MTgeophysics / mtpy

Python toolbox for standard Magnetotelluric (MT) data analysis
GNU General Public License v3.0
145 stars 66 forks source link

Ploting phase tensor pseudosection #103

Closed charlesweijun closed 4 years ago

charlesweijun commented 4 years ago

Expected Behavior

Current Behavior

Possible Solution

Steps to Reproduce (for bugs)

1. 2. 3. 4.

# Paste your code here
#
#

Context

Your Environment

Installed Python Packages: use pip freeze or conda list [-n ENVIRONMENT_NAME] to list all the installed libraries.

On ploting phase tensor pseudosection for a AMT profile, I failed to do it. I do not know how to set xstretch and ystretch, and how to set fig_size? Could you hel me how to tweak these parameters?

charlesweijun commented 4 years ago

I set the figure size to be 8 by 6 inches: fig_size=(8,6)

charlesweijun commented 4 years ago

n ploting phase tensor pseudosection for a AMT profile, I failed to do it. I do not know how to set xstretch and ystretch, and how to set fig_size? Could you hel me how to tweak these parameters?

charlesweijun commented 4 years ago

one AMT profles contain 42 stations. normal station spacing is 80 m, while it is 40 m in special segment about 10 stations.

kashkoulimohammad commented 4 years ago

Hi @charlesweijun There are two points: 1- Be careful about your profile direction and set 'ew' (if a profile direction is closer to east-west) or 'sn'(if a profile direction is closer to south-north). 2- you should adjust the stretch according to your station spacing. I put my script that I plotted the 41 stations. Change the directory of data and path of save as well as the parameter(phimin, skew and so on) that you like to plot. ` from mtpy.imaging.phase_tensor_pseudosection import PlotPhaseTensorPseudoSection import os.path as op import os

path to edis

edi_path = r'/home/mkash/Desktop/Dimensionality/L5'

save path

savepath = r'/home/mkash/Desktop/Dimensionality/'

edi list

elst=[op.join(edi_path,edi) for edi in os.listdir(edi_path) if ((edi.endswith('.edi')))]# and edi.startswith('GB')

create a plot object

plotObj = PlotPhaseTensorPseudoSection(fn_list = elst, linedir='ew', # 'ns' if the line is closer to north-south, 'ew' if line is closer to east-west stretch=(600,12), # determines (x,y) aspect ratio of plot

station_id=(0,6), # indices for showing station names

                             stationlist=[], 
                             #plot_tipper = 'yr', # plot tipper ('y') + 'ri' means real+imag
                             arrow_size = 60,
                             arrow_head_length= 0.3,
                             arrow_direction = -1,
                             font_size=3.5,
                             #cb_dict= {'orientation':'horizontal',
                              #        'position':[0.4,0.1,0.25,0.025]},
                             lw=0.5,
                             ellipse_dict = {'ellipse_colorby':'skew_seg',# option to colour by phimin, phimax, skew, skew_seg
                                             'ellipse_range':[-10,10,2.5]} # set color limits - default 0,90 for phimin or max,
                                                                     # [-12,12] for skew. If plotting skew_seg need to provide
                                                                     # 3 numbers, the 3rd indicates interval, e.g. [-12,12,3]
                             )

update ellipse size (tweak for your dataset)

plotObj.ellipse_size = 2

self.cb_orientation = cb_dict['horizontal']

plotObj.plot() plotObj.save_figure(save_fn = os.path.join(savepath,'skew_n2.png'), fig_dpi=1000)

plotObj.save_figure(save_fn = op.join(savepath,'PhaseTensorSection.png'),

fig_dpi=400) # change to your preferred file resolution

`

charlesweijun commented 4 years ago

from mtpy.imaging.phase_tensor_pseudosection import PlotPhaseTensorPseudoSection import os

edi_path="C:/mtpywin/mtpy/examples/data/edi_files_2/"

savepath="C:/tmp"

edi_path='D:/HeiheAMT2015/MM' savepath='D:/HeiheAMT2015/MM/processed' edi_list=[os.path.join(edi_path,ff) for ff in os.listdir(edi_path)\ if ((ff.endswith('.edi')))]

ellipse_dict={'ellipse_colorby':'skew', 'ellipse_range':[-10,10,2]}

create a plot object

ptsection=PlotPhaseTensorPseudoSection(fn_list=edi_list, ellipse_dict=ellipse_dict, linedir='ew', fig_size=(8,6), strech=(17,8), station_id=(0,4), plot_tipper='n', font_size=6, ellipse_size=3, lw=0.6, cb_dict={'orientation':'vertical', 'position':[1.0,0.1,0.25,0.005]} ) ptsection.plot()
ptsection.save_figure(save_fn=os.path.join(savepath, 'PhaseTensorPseoudoSection1.png'), fig_dpi=350)

The code above was run several time, it faild to produce desired figure. Thank kashkoulimohammad for you showing code and give soem information.

  1. the AMT profile is close to east-west trending.
  2. the stretchs for X- and Y- axis were tweaked a couple of times. For example , first fix the y-stretch, adjust x stretch, the figure remain the same. second, fixe the x-stretch, adjust y stretch, the figure stilll remain unchanged.
  3. Is there any proglem with the figure size (8,6)?
  4. I do not know where the fault lies
kashkoulimohammad commented 4 years ago

Hi @charlesweijun The attribute for figure size is figsize. You can see all of the attributes in the phase_tensor_pseudosection.py in this path: C:\mtpywin\mtpy\mtpy\imaging

charlesweijun commented 4 years ago

Hi @kashkoulimohammad yes, i have looked at them, it is fig_size .

kashkoulimohammad commented 4 years ago

Hi @charlesweijun In the phase_tensor_pseudosection.py that is : -figsize size of figure in inches

charlesweijun commented 4 years ago

Hi, @kashkoulimohammad in the Attributes: I can see -fig_size size of figure in inches. Possibly, I downloaded MTpy package 2 months ago.