Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug reading ModEM .log files #150

Open
DGD042 opened this issue Aug 17, 2021 · 0 comments
Open

Bug reading ModEM .log files #150

DGD042 opened this issue Aug 17, 2021 · 0 comments

Comments

@DGD042
Copy link

DGD042 commented Aug 17, 2021

Hello,

When reading the .log files, there is a bug when getting the metrics from ModEM inversion results. When the rms values are higher than 10, I get back the following error in the plot_rms_iterations.read(logfile) function

File "mtpy\mtpy\utils\plot_rms_iterations.py", line 77, in read
    metric, value = word.split('=')
ValueError: not enough values to unpack (expected 2, got 1)

Possible Solution

A possible solution is to account for a broader possibilities of rms values by changing line 72 in plot_rms_iterations.py from,

value_lines = [l.strip().replace('   ', '').split() for l in value_lines]

to

value_lines = [
        line.strip().replace('   ', '').replace('  ', '').replace(
            '= ', '=').split()
        for line in value_lines
    ]

Steps to Reproduce (for bugs)

Here is a file (Modular_NLCG.log) that has a series of rms values higher than 10. Download the file and create a python script to run the following code,

wd = 'path_to_log_file_directory'
logfile = plot_rms_iterations.concatenate_log_files(wd)
metrics = plot_rms_iterations.read(logfile)

This should reproduce the error I got.

Your Environment

  • Operating system: Windows 10
  • MtPy version: 1.1.5
  • Python version: 3.7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant