Created on Tue Aug 23 11:54:38 2011
@author: a1185872
make2DdataFile will make a data file for occam2D.
edipath = path to edifiles mmode = modes to invert for. Can be:
‘both’ -> will model both TE and TM modes ‘TM’ -> will model just TM mode ‘TE’ -> will model just TE mode
title = title input into the data file thetar = rotation angle (deg) of the edifiles if you want to align the
components with the profile. Angle is on the unit circle with an orientation that north is 0 degree, east -90.
ss = is the spacing parameter for the data file fmt = format of the numbers for the data file, see string formats for
a full description
plotyn = y or n to plot the stations on the profile line. lineori = predominant line orientation with respect to geographic north
- ew for east-west line-> will orientate so first station is
- farthest to the west
- ns for north-south line-> will orientate so first station is
- farthest to the south
maskPoints will take in points found from plotMaskPoints and rewrite the data file to nameRW.dat. Be sure to run plotMaskPoints first
plotResponse will plot the responses modeled from winglink against the observed data.
respfn = full path to response file datafn = full path to data file wlfn = full path to a winglink data file used for a similar
inversion. This will be plotted on the response plots for comparison of fits.
maxcol = maximum number of columns for the plot plottype = ‘all’ to plot all on the same plot
‘1’ to plot each respones in a different figure station to plot a single station or enter as a list of stations to plot a few stations [station1,station2]. Does not have to be verbatim but should have similar unique characters input pb01 for pb01cs in outputfile
ms = marker size phaselimits = limits of phase in degrees (min,max) colormode = ‘color’ for color plots
‘bw’ for black and white plots
Plot all the responses of occam inversion from data file. This assumes the response curves are in the same folder as the datafile.
An interactive plotting tool to mask points an add errorbars
plots a pseudo section of the data
datafn = full path to data file respfn = full path to response file
read2DRespFile will read in a response file and combine the data with info from the data file.
‘station’ = station name ‘offset’ = relative offset, ‘resxy’ = TE resistivity ‘resyx’= TM resistivity ‘phasexy’= TE phase ‘phaseyx’= TM phase a ‘realtip’= Real Tipper ‘imagtip’= Imaginary Tipper
Note: that the resistivity will be in log10 space. Also, there are 2 extra rows in the data arrays, this is to put the response from the inversion.
freq = list of frequencies used in the inversion title = title, could be useful for plotting.
‘station’ = station name ‘offset’ = relative offset, ‘resxy’ = TE resistivity and error as row 0 and 1 ressectively, ‘resyx’= TM resistivity and error as row 0 and 1 respectively, ‘phasexy’= TE phase and error as row 0 and 1 respectively, ‘phaseyx’= Tm phase and error as row 0 and 1 respectively, ‘realtip’= Real Tipper and error as row 0 and 1 respectively, ‘imagtip’= Imaginary Tipper and error as row 0 and 1 respectively
Note: that the resistivity will be in log10 space. Also, there are 2 extra rows in the data arrays, this is to put the response from the inversion.
freq = list of frequencies used in the inversion title = title, could be useful for plotting.
rewrite2DDataFile will rewrite an existing data file so you can redefine some of the parameters, such as rotation angle, or errors for the different components or only invert for one mode or add one or add tipper or remove tipper.
datafn = full path to data file to rewrite
rotz = rotation angle with positive clockwise
removestation = list of stations to remove if desired
Bases: MTpy.core.OCCAMTools.Occam2DData
This class deals with the model side of Occam inversions, including plotting the model, the L-curve, depth profiles. It will also be able to build a mesh and regularization grid at some point.
It inherits Occam2DData and the data can be extracted from the method get2DData(). After this call you can use all the methods of Occam2DData, such as plotting the model responses and pseudo sections.
get2DModel will create an array based on the FE mesh and fill the values found from the regularization grid. This way the array can be manipulated as a 2D object and plotted as an image or a mesh.
plotModel will plot the model output by occam in the iteration file.
Inputs:
- datafn = full path to data file. If none is input it will use the
- data file found in the iteration file.
xpad = padding in the horizontal direction of model
- ypad = padding the in the vertical direction of the top of the model
- to fit the station names and markers
- mpad = marker pad to fit right at the surface, haven’t found a better
- way of doing this automatically yet
- spad = padding of station names away from the top of the model, this
- is kind of awkward at the moment especially if you zoom into the model, it usually looks retarded and doesn’t fit
ms = marker size in ambiguous points
- stationid = index of station names to plot -> ex. pb01sdr would be
- stationid=(0,4) to plot pb01
- fdict = font dictionary for the station names, can have keys:
- ‘size’ = font size ‘rotation’ = angle of rotation (deg) of font ‘weight’ = weight of font ‘color’ = color of font ‘style’ = style of font ex. ‘italics’
plotdimensions = x-y dimensions of the figure (10,10) in inches
dpi = dot per inch of figure, should be 300 for publications
ylimits = limits of depth scale (km). ex, ylimits=(0,30)
xminorticks = location of minor tick marks for the horizontal axis
yminorticks = location of minor tick marks for vertical axis
climits = limits of log10(resistivity). ex. climits=(0,4)
cmap = color map to plot the model image
fs = font size of axis labels
femesh = ‘on’ to plot finite element forward modeling mesh (black)
regmesh = ‘on’ to plot regularization mesh (blue)
- aspect = aspect ratio of the figure, depends on your line length and
- the depth you want to investigate
- title = ‘on’ to put the RMS and Roughness as the title, or input a
- string that will be added to the RMS and roughness, or put None to not put a title on the plot and print out RMS and roughness
meshnum = ‘on’ to plot FE mesh block numbers
fignum = figure number to plot to
blocknum = ‘on’ to plot numbers on the regularization blocks
blkfdict = font dictionary for the numbering of regularization blocks
- grid = major for major ticks grid
- minor for a grid of the minor ticks both for a grid with major and minor ticks
yscale = ‘km’ for depth in km or ‘m’ for depth in meters
will plot a depth section profile for a given set of stations.
Inputs:
- plotnum = 1 to plot in different figures, ‘all’ to plot in all into
- one figure.
dpi = dpi of figure
depth = max depth to estimate the profile
- stationnames = list of station names corresponding to the starting
- block numbers
yscale = ‘log’ for logarithmic or ‘linear’ for linear
PlotL2Curve will plot the RMS vs iteration number for the given inversion folder and roughness vs iteration number
fignum = figure number dpi = dpi of the figure
read an INMODEL file for occam 2D
read2DIter will read an iteration file and combine that info from the datafn and return a dictionary of variables.
Bases: object
This class will help the user interactively pick points to mask and add error bars.
To mask just a single point right click over the point and a gray point will appear indicating it has been masked
To mask both the apparent resistivity and phase left click over the point. Gray points will appear over both the apparent resistivity and phase. Sometimes the points don’t exactly matchup, haven’t quite worked that bug out yet, but not to worry it picks out the correct points
To add error bars to a point click the middle or scroll bar button. This only adds error bars to the point and does not reduce them so start out with reasonable errorbars. You can change the increment that the error bars are increased with reserrinc and phaseerrinc.
linelst = list of lines used to plot the responses, not the error bars
reserrinc = percent increment to increase the errorbars
phaseerrinc = percent increment to increase the errorbars
When the function is called the mouse events will be recorder for picking points to mask or change error bars.
Left mouse button will mask both resistivity and phase point
Right mouse button will mask just the point selected
middle mouse button will increase the error bars
q will close the figure.
list of weak references to the object (if defined)
compareIter will take the difference between two iteration and make a difference iter file
iterfn1 = full path to iteration file 1 iterfn2 = full path to iteration file 2 savepath = path to save the difference iteration file, can be full or
just a directory
Make a 1D input file for occam
roughtype = roughness type maxiter = maximum number of iterations targetrms = target rms value rhostart = starting resistivity value on linear scale paramcount =
Makes a 1D model file
savepath =path to save file to, if just path saved as savepathmodel.mod nlayers = number of layers bottomlayer = depth of bottom layer in meters basestep = numerical base of logarithmic depth step 10 or 2 or 1 for
linear
z1layer = depth of first layer in meters airlayerheight = height of air layers in meters
make1Ddatafile will write a data file for Occam1D
station = the station name and path if edipath=None edipath = path to the edi files to be written into a data file,
useful for multile data files
savepath = path to save the file thetar = rotation angle to rotate Z
#=============================================================================== # Input parameters #===============================================================================
edipath=r”C:PeacockMy DropboxParalanaEDIFilesBaseSurveySS” #path to edi’s station=’pb01’ #station to create data file for savepath=r”C:PeacockPHDOCCAMDInversionBase” #path to save the data file polarization=’both’ #choose component either xy or yx or both reserr=’data’ #either data or set as a percentage phaseerr=’data’ #either data or set as percentage -> 10 for 10 percent error ss=’ ‘ fmt=’%.6e’ #=============================================================================== # open up edi file and write data file #===============================================================================
make2DdataFile will make a data file for occam2D.
edipath = path to edifiles mmode = modes to invert for. Can be:
‘both’ -> will model both TE and TM modes ‘TM’ -> will model just TM mode ‘TE’ -> will model just TE mode
title = title input into the data file thetar = rotation angle (deg) of the edifiles if you want to align the
components with the profile. Angle is on the unit circle with an orientation that north is 0 degree, east -90.
ss = is the spacing parameter for the data file fmt = format of the numbers for the data file, see string formats for
a full description
plotyn = y or n to plot the stations on the profile line. lineori = predominant line orientation with respect to geographic north
- ew for east-west line-> will orientate so first station is
- farthest to the west
- ns for north-south line-> will orientate so first station is
- farthest to the south
makeModel will make an the input files for occam using Steve Constable’s MakeModel2DMT.f code.
meshfn = mesh file for finite element grid saved ats MESH inmodelfn = input model, starting model with rhostart as starting value
saved as INMODEL
startupfn = start up filepath, saved as startup
plotModel will plot the model output by occam in the iteration file.
iterfile = full path to the iteration file that you want to plot
xpad = padding in the horizontal direction of model
ms = marker size in ambiguous points
plotdimensions = x-y dimensions of the figure (10,10) in inches
dpi = dot per inch of figure, should be 300 for publications
ylimits = limits of depth scale (km). ex, ylimits=(0,30)
xminorticks = location of minor tick marks for the horizontal axis
yminorticks = location of minor tick marks for vertical axis
climits = limits of log10(resistivity). ex. climits=(0,4)
cmap = color map to plot the model image
fs = font size of axis labels
femesh = ‘on’ to plot finite element forward modeling mesh (black)
regmesh = ‘on’ to plot regularization mesh (blue)
meshnum = ‘on’ to plot FE mesh block numbers
fignum = figure number to plot to
blocknum = ‘on’ to plot numbers on the regularization blocks
blkfdict = font dictionary for the numbering of regularization blocks
yscale = ‘km’ for depth in km or ‘m’ for depth in meters
plotResponse will plot the responses modeled from winglink against the observed data.
respfn = full path to response file datafn = full path to data file wlfn = full path to a winglink data file used for a similar
inversion. This will be plotted on the response plots for comparison of fits.
maxcol = maximum number of columns for the plot plottype = ‘all’ to plot all on the same plot
‘1’ to plot each respones in a different figure station to plot a single station or enter as a list of stations to plot a few stations [station1,station2]. Does not have to be verbatim but should have similar unique characters input pb01 for pb01cs in outputfile
Plot all the responses of occam inversion from data file. This assumes the response curves are in the same folder as the datafile.
will plot a depth section as a line for the block numbers given by slst and the layer multiplier lm
PlotL2Curve will plot the RMS vs iteration number for the given inversion folder and roughness vs iteration number
invpath = full path to the inversion folder where .iter files are fnstem = filename stem to look for in case multiple inversions were
run in the same folder. If none then searches for anything ending in .iter
plots a pseudo section of the data
datafn = full path to data file respfn = full path to response file
read an iteration file
depth = depth of model in m modelres = resistivity of model, any fixed parameters will be put in
correct place.
will read in model file
read response file
freq = frequency array resxy,resyx,phasexy,phaseyx = array for corresponding component with
- index as:
- 0 = input data 1 = input error 2 = model data 3 = model error
reads a 1D data file
read an INMODEL file for occam 2D
read2DIterFile will read an iteration file and combine that info from the datafn and return a dictionary of variables.
read2DRespFile will read in a response file and combine the data with info from the data file.
‘station’ = station name ‘offset’ = relative offset, ‘resxy’ = TE resistivity ‘resyx’= TM resistivity ‘phasexy’= TE phase ‘phaseyx’= TM phase a ‘realtip’= Real Tipper ‘imagtip’= Imaginary Tipper
Note: that the resistivity will be in log10 space. Also, there are 2 extra rows in the data arrays, this is to put the response from the inversion.
freq = list of frequencies used in the inversion title = title, could be useful for plotting.
read2DdataFile will read in data from a 2D occam data file. Only supports the first 6 data types of occam2D
‘station’ = station name ‘offset’ = relative offset, ‘resxy’ = TE resistivity and error as row 0 and 1 ressectively, ‘resyx’= TM resistivity and error as row 0 and 1 respectively, ‘phasexy’= TE phase and error as row 0 and 1 respectively, ‘phaseyx’= Tm phase and error as row 0 and 1 respectively, ‘realtip’= Real Tipper and error as row 0 and 1 respectively, ‘imagtip’= Imaginary Tipper and error as row 0 and 1 respectively
Note: that the resistivity will be in log10 space. Also, there are 2 extra rows in the data arrays, this is to put the response from the inversion.
freq = list of frequencies used in the inversion title = title, could be useful for plotting.
read a 2D meshfn
rewrite2DDataFile will rewrite an existing data file so you can redefine some of the parameters, such as rotation angle, or errors for the different components or only invert for one mode or add one or add tipper or remove tipper.
datafn = full path to data file to rewrite
rotz = rotation angle with positive clockwise
removestation = list of stations to remove if desired
checkMesh will check to see if the number of lines are correct and the length of the line is correct