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

Unable to generate Phase Tensor Plot #139

Closed
roshanmanjitsingh opened this issue Mar 16, 2021 · 24 comments
Closed

Unable to generate Phase Tensor Plot #139

roshanmanjitsingh opened this issue Mar 16, 2021 · 24 comments

Comments

@roshanmanjitsingh
Copy link

I have an MT data file where the entries are in column format.
I have converted it into EDI format.
For some frequencies, I do have only the tipper data and not the impedance data
and vice versa.
In the EDI file, I am adding "0.000000E+0" for the component whose value is missing.
For example, corresponding to the frequency "2.441406E-05" I don't have the Z information so in the EDI file, I am adding "0.000000E+0" for all the Z components whereas for tipper I am giving the measured value.

In such cases, I am unable to generate the phase tensor plots for the respective sites.

@zhang01GA
Copy link
Contributor

Hi Roshan, @roshanmanjitsingh

Thank you for your enquiry. I will pass the issue to @alkirkby to have a look.

@alkirkby
Copy link
Contributor

Hi @roshanmanjitsingh, I can't seem to reproduce your error. Are you adding 0.000000E+0 to all of the Z fields?
You could try using a no-data-value of 1.000000e+32 and setting EMPTY=1.0e+32 in the header. Alternatively, if you could provide your code and edi files I can look into it for you.

@roshanmanjitsingh
Copy link
Author

roshanmanjitsingh commented Mar 23, 2021 via email

@alkirkby
Copy link
Contributor

I can't see the files. Can you zip them up and email them to me?

@roshanmanjitsingh
Copy link
Author

roshanmanjitsingh commented Mar 24, 2021 via email

@alkirkby
Copy link
Contributor

alkirkby commented Mar 24, 2021

OK it's not a problem with the edi files it's the script. If you run:

from mtpy.core import mt

edi_file = 'path/to/edifile'

mt_obj = mt.MT(edi_file)
pt_obj = mt_obj.plot_mt_response()

It should work. I get a plot like this:
image

@roshanmanjitsingh
Copy link
Author

roshanmanjitsingh commented Mar 24, 2021 via email

@roshanmanjitsingh
Copy link
Author

roshanmanjitsingh commented Mar 25, 2021 via email

@alkirkby
Copy link
Contributor

quite possibly, it is definitely worth pulling the latest version, let me know how you go.

@roshanmanjitsingh
Copy link
Author

roshanmanjitsingh commented Mar 25, 2021 via email

@alkirkby
Copy link
Contributor

Following those instructions should get you the latest version. If you navigate to the path where mtpy is installed (e.g. /c/mtpywin/mtpy), make sure the develop branch is checked out, and run git pull, you should have the latest version.
If you used pip install mtpy that version is out of date.

@roshanmanjitsingh
Copy link
Author

roshanmanjitsingh commented Mar 25, 2021 via email

@alkirkby
Copy link
Contributor

Hmm
It's really hard to debug as I can't reproduce the error, it works fine for me. How are you running the script (e.g. jupyter notebook, spyder, or commandline)? and what version of matplotlib are you using?
I have matplotlib=3.2.1 (you can get a list of installed packages and versions by running pip freeze)
and I am running it in spyder

@roshanmanjitsingh
Copy link
Author

roshanmanjitsingh commented Mar 26, 2021 via email

@alkirkby
Copy link
Contributor

I'm running out of suggestions I'm sorry, @zhang01GA do you have any ideas?
The only other things I can suggest are:

  • make sure you have the mtpy environment active in Anaconda
  • if that doesn't help try running it as a script directly in a command prompt (ensuring the mtpy environment is active)

@roshanmanjitsingh
Copy link
Author

roshanmanjitsingh commented Mar 26, 2021 via email

@zhang01GA
Copy link
Contributor

@alkirkby @roshanmanjitsingh , we have a new developer @snazzybloke (Ante Bilic) who can start looking into this problem. I will provide assistance as required

@roshanmanjitsingh
Copy link
Author

roshanmanjitsingh commented Mar 30, 2021 via email

@snazzybloke
Copy link
Collaborator

Hi @roshanmanjitsingh,
I would need to know your whole environment to reproduce and investigate the issue.
Would you be able share your package versions?
(try perhaps pip freeze > requriements.txt)

@roshanmanjitsingh
Copy link
Author

roshanmanjitsingh commented Mar 30, 2021 via email

@snazzybloke
Copy link
Collaborator

snazzybloke commented Apr 4, 2021

Hi @roshanmanjitsingh,

I've run into the same errors as you by running Alison's script shown above.
The issue was matplotlib. My version was 3.4.1 and after replacing it with 3.2.1:
pip install matplotlib==3.2.1
the script reproduces Alison's plots without a hiccup.

So, as a quick fix I suggest that you set up the virtual environment for mtpy to use the 3.2.1 matplotlib ver.
Clearly, a better solution is needed that does not crash with newer versions.

Ante

@snazzybloke
Copy link
Collaborator

@roshanmanjitsingh, further to my comment above, even with the newer matplotlib version you should still be able to produce the plots simply by running your script from the command line, e.g.:
> python script_name.py

The error I see is between IPython and new matplotlib, which makes it impossible for either spyder or jupyter to render the plot object (since they both rely on IPython directly and/or via ipykernel).

@roshanmanjitsingh
Copy link
Author

roshanmanjitsingh commented Apr 4, 2021 via email

@roshanmanjitsingh
Copy link
Author

roshanmanjitsingh commented Apr 5, 2021 via email

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

4 participants