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

plot pseudo-section of phasetensor with tipper #14

Open
kashkoulimohammad opened this issue Feb 6, 2024 · 3 comments · Fixed by #28
Open

plot pseudo-section of phasetensor with tipper #14

kashkoulimohammad opened this issue Feb 6, 2024 · 3 comments · Fixed by #28

Comments

@kashkoulimohammad
Copy link

kashkoulimohammad commented Feb 6, 2024

Hi,
I am tiring to plot pseudo-section of phasetensor with tipper but I faced with this error:

C:\Users\Mohammad\.conda\envs\MTpy-v2\Lib\site-packages\scipy\stats\_stats_mstats_common.py:182: RuntimeWarning: invalid value encountered in scalar divide
  slope = ssxym / ssxm
C:\Users\Mohammad\.conda\envs\MTpy-v2\Lib\site-packages\scipy\stats\_stats_mstats_common.py:196: RuntimeWarning: invalid value encountered in sqrt
  t = r * np.sqrt(df / ((1.0 - r + TINY)*(1.0 + r + TINY)))
C:\Users\Mohammad\.conda\envs\MTpy-v2\Lib\site-packages\scipy\stats\_stats_mstats_common.py:199: RuntimeWarning: invalid value encountered in scalar divide
  slope_stderr = np.sqrt((1 - r**2) * ssym / ssxm / df)
Traceback (most recent call last):
  File "C:\Users\Mohammad\Desktop\MTpy_V2\2.py", line 11, in <module>
    plot_pt_pseudosection = dgh_mt_data.plot_phase_tensor_pseudosection(
                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Mohammad\.conda\envs\MTpy-v2\Lib\site-packages\mtpy\core\mt_data.py", line 1116, in plot_phase_tensor_pseudosection
    return PlotPhaseTensorPseudoSection(mt_data=self, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Mohammad\.conda\envs\MTpy-v2\Lib\site-packages\mtpy\imaging\plot_phase_tensor_pseudosection.py", line 101, in __init__
    self.plot()
  File "C:\Users\Mohammad\.conda\envs\MTpy-v2\Lib\site-packages\mtpy\imaging\plot_phase_tensor_pseudosection.py", line 340, in plot
    self._get_profile_line()
  File "C:\Users\Mohammad\.conda\envs\MTpy-v2\Lib\site-packages\mtpy\imaging\mtplot_tools\base.py", line 655, in _get_profile_line
    mt_obj.project_onto_profile_line(
  File "C:\Users\Mohammad\.conda\envs\MTpy-v2\Lib\site-packages\mtpy\core\mt_location.py", line 452, in project_onto_profile_line
    raise ValueError(
ValueError: utm_crs is None, cannot project onto profile line.

my script is:

from mtpy import MTCollection
mc = MTCollection()
mc.open_collection(r'C:\Users\Mohammad\Desktop\work\nasrabad_data\nasrabad_data\15\15.h5')
#plot_strike_all = mc.plot_strike()
mc.utm_crs = 32640
mc.working_dataframe = mc.master_dataframe[mc.master_dataframe.station.str.startswith("15_010-0000")]
dgh_mt_data = mc.to_mt_data()
plot_pt_pseudosection = dgh_mt_data.plot_phase_tensor_pseudosection( 
    plot_tipper="yri", 
    profile_reverse=False,
    y_limits=(10**2, 1)
)
@kujaku11
Copy link
Contributor

kujaku11 commented Feb 9, 2024

@kashkoulimohammad

Looks like you found a bug.

I added key word arguments to to_mt_data in PR #17

Your code is close, just need to set the utm_crs in the MTData object instead of the MTCollection object:

from mtpy import MTCollection
mc = MTCollection()
mc.open_collection(r'C:\Users\Mohammad\Desktop\work\nasrabad_data\nasrabad_data\15\15.h5')

mc.working_dataframe = mc.master_dataframe[mc.master_dataframe.station.str.startswith("15_010-0000")]

# here is the new change. You can set the `utm_crs` through `to_mt_data` now.
dgh_mt_data = mc.to_mt_data(utm_crs=32640)
plot_pt_pseudosection = dgh_mt_data.plot_phase_tensor_pseudosection( 
    plot_tipper="yri", 
    profile_reverse=False,
    y_limits=(10**2, 1)
)

@kashkoulimohammad
Copy link
Author

Thanks @kujaku11
It does not work.

Traceback (most recent call last):
  File "C:\Users\Mohammad\Desktop\MTpy_V2\2_1.py", line 8, in <module>
    dgh_mt_data = mc.to_mt_data(utm_crs=32640)
TypeError: to_mt_data() got an unexpected keyword argument 'utm_crs'

@kujaku11
Copy link
Contributor

@kashkoulimohammad Try to reinstall mtpy-v2 from git.

@kujaku11 kujaku11 linked a pull request Apr 24, 2024 that will close this issue
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

Successfully merging a pull request may close this issue.

2 participants