code
string
signature
string
docstring
string
loss_without_docstring
float64
loss_with_docstring
float64
factor
float64
pole_lat, pole_lon = bc02(data) # get the pole for these parameters # get the declination and inclination for that pole ExpDec, ExpInc = vgp_di(pole_lat, pole_lon, data[1], data[2]) # convert the inclination to paleo latitude paleo_lat = magnetic_lat(ExpInc) if print_results: # pri...
def apwp(data, print_results=False)
calculates expected pole positions and directions for given plate, location and age Parameters _________ data : [plate,lat,lon,age] plate : [NA, SA, AF, IN, EU, AU, ANT, GL] NA : North America SA : South America AF : Africa IN :...
4.767505
3.811745
1.250741
low, k, iz = start, 0, 0 Tzero = [] f = open('chart.txt', 'w') vline = '\t%s\n' % ( ' | | | | | | | |') hline = '______________________________________________________________________________\n' f.write('file:_________________ field:__...
def chart_maker(Int, Top, start=100, outfile='chart.txt')
Makes a chart for performing IZZI experiments. Print out the file and tape it to the oven. This chart will help keep track of the different steps. Z : performed in zero field - enter the temperature XXX.0 in the sio formatted measurement file created by the LabView program I : performed in the ...
3.932478
3.295902
1.193142
Basemap = None has_basemap = True has_cartopy = import_cartopy()[0] try: from mpl_toolkits.basemap import Basemap WARNINGS['has_basemap'] = True except ImportError: has_basemap = False # if they have installed cartopy, no warning is needed if has_cartopy...
def import_basemap()
Try to import Basemap and print out a useful help message if Basemap is either not installed or is missing required environment variables. Returns --------- has_basemap : bool Basemap : Basemap package if possible else None
4.196239
4.089678
1.026056
cartopy = None has_cartopy = True try: import cartopy WARNINGS['has_cartopy'] = True except ImportError: has_cartopy = False if not WARNINGS['cartopy']: print('-W- cartopy is not installed') print(' If you want to make maps, install using c...
def import_cartopy()
Try to import cartopy and print out a help message if it is not installed Returns --------- has_cartopy : bool cartopy : cartopy package if available else None
3.678018
3.751373
0.980446
ageBP = -1e9 if age_unit == "Years AD (+/-)" or age_unit == "Years Cal AD (+/-)": if age < 0: age = age+1 # to correct for there being no 0 AD ageBP = 1950-age elif age_unit == "Years BP" or age_unit == "Years Cal BP": ageBP = age elif age_unit == "ka": ...
def age_to_BP(age, age_unit)
Convert an age value into the equivalent in time Before Present(BP) where Present is 1950 Returns --------- ageBP : number
3.962179
3.92771
1.008776
if not input_dir_path: input_dir_path = output_dir_path input_dir_path = os.path.realpath(input_dir_path) output_dir_path = os.path.realpath(output_dir_path) return input_dir_path, output_dir_path
def fix_directories(input_dir_path, output_dir_path)
Take arguments input/output directories and fixes them. If no input_directory, default to output_dir_path for both. Then return realpath for both values. Parameters ---------- input_dir_path : str output_dir_path : str Returns --------- input_dir_path, output_dir_path
1.726475
1.559562
1.107026
#get parameters from kwargs.get(parameter_name, default_value) user = kwargs.get('user', '') magfile = kwargs.get('magfile') #do any extra formating you need to variables here #open magfile to start reading data try: infile=open(magfile,'r') except Exception as ex: pr...
def convert(**kwargs)
EXAMPLE DOCSTRING for function (you would usually put the discription here) Parameters ----------- user : colon delimited list of analysts (default : "") magfile : input magnetometer file (required) Returns ----------- type - Tuple : (True or False indicating if conversion was sucessful, m...
3.45007
3.299906
1.045506
inp,out="","" if '-h' in sys.argv: print(main.__doc__) sys.exit() if '-f' in sys.argv: ind=sys.argv.index('-f') file=sys.argv[ind+1] f=open(file,'r') inp=f.readlines() if '-F' in sys.argv: ind=sys.argv.index('-F') o=sys.argv[ind+1] ...
def main()
NAME b_vdm.py DESCRIPTION converts B (in microT) and (magnetic) latitude to V(A)DM INPUT (COMMAND LINE ENTRY) B (microtesla), latitude (positive north) OUTPUT V[A]DM SYNTAX b_vdm.py [command line options] [< filename] OPTIONS ...
3.722272
2.901158
1.28303
data_files = {} def cond(File, prefix): file_path = path.join(prefix, 'data_files', File) return (not File.startswith('!') and not File.endswith('~') and not File.endswith('#') and not File.endswith('.pyc') and not Fil...
def do_walk(data_path)
Walk through data_files and list all in dict format
3.503617
3.32664
1.0532
dir_path="./" change='l' if '-WD' in sys.argv: ind=sys.argv.index('-WD') dir_path=sys.argv[ind+1] if '-h' in sys.argv: print(main.__doc__) sys.exit() if '-f' in sys.argv: ind=sys.argv.index('-f') magic_file=dir_path+'/'+sys.argv[ind+1] else: ...
def main()
NAME change_case_magic.py DESCRIPTION picks out key and converts to upper or lower case SYNTAX change_case_magic.py [command line options] OPTIONS -h prints help message and quits -f FILE: specify input magic format file -F FILE: specify output magic form...
2.67217
2.314279
1.154644
if '-h' in sys.argv: print(main.__doc__) sys.exit() if '-WD' in sys.argv: ind=sys.argv.index('-WD') dir_path=sys.argv[ind+1] # interactive entry if '-i' in sys.argv: infile=input("Magic txt file for unpacking? ") dir_path = '.' input_dir_path ...
def main()
NAME download_magic.py DESCRIPTION unpacks a magic formatted smartbook .txt file from the MagIC database into the tab delimited MagIC format txt files for use with the MagIC-Py programs. SYNTAX download_magic.py command line options] INPUT takes either the upload.tx...
3.023526
2.577524
1.173035
args = sys.argv if "-h" in args: print(main.__doc__) sys.exit() pltspec = "" verbose = pmagplotlib.verbose dir_path = pmag.get_named_arg('-WD', '.') dir_path = os.path.realpath(dir_path) meas_file = pmag.get_named_arg('-f', 'measurements.txt') fmt = pmag.get_named_ar...
def main()
NAME quick_hyst.py DESCRIPTION makes plots of hysteresis data SYNTAX quick_hyst.py [command line options] OPTIONS -h prints help message and quits -f: specify input file, default is measurements.txt -spc SPEC: specify specimen name to plot and quit ...
3.136668
2.504101
1.252612
if x.ndim != 1: raise ValueError("smooth only accepts 1 dimension arrays.") if x.size < window_len: raise ValueError("Input vector needs to be bigger than window size.") if window_len<3: return x # numpy available windows if not window in ['flat', 'hanning', 'hamming...
def smooth(x,window_len,window='bartlett')
smooth the data using a sliding window with requested size. This method is based on the convolution of a scaled window with the signal. The signal is prepared by padding the beginning and the end of the signal with average of the first (last) ten values of the signal, to evoid jumps at the beggining/en...
2.301434
2.156344
1.067285
m_,x_,y_,xy_,x_2=0.,0.,0.,0.,0. for ix in range(i,i+n,1): x_=x_+x[ix] y_=y_+y[ix] xy_=xy_+x[ix]*y[ix] x_2=x_2+x[ix]**2 m= old_div(( (n*xy_) - (x_*y_) ), ( n*x_2-(x_)**2)) return(m)
def deriv1(x,y,i,n)
alternative way to smooth the derivative of a noisy signal using least square fit. x=array of x axis y=array of y axis n=smoothing factor i= position in this method the slope in position i is calculated by least square fit of n points before and after position.
3.273846
3.480453
0.940638
citation='This study' args=sys.argv outfile='magic_methods.txt' infile='magic_measurements.txt' # # get command line arguments # dir_path='.' if '-WD' in args: ind=args.index("-WD") dir_path=args[ind+1] if "-h" in args: print(main.__doc__) sys.exit() ...
def main()
NAME extract_methods.py DESCRIPTION reads in a magic table and creates a file with method codes SYNTAX extract_methods.py [command line options] OPTIONS -h: prints the help message and quits. -f FILE: specify magic format input file, default is magic_measurements....
2.970755
2.4803
1.19774
if '-h' in sys.argv: # check if help is needed print(main.__doc__) sys.exit() # graceful quit if '-i' in sys.argv: # ask for filename file=input("Enter file name with dec, inc data: ") f=open(file,'r') data=f.readlines() elif '-f' in sys.argv: dat=[] ...
def main()
NAME gofish.py DESCRIPTION calculates fisher parameters from dec inc data INPUT FORMAT takes dec/inc as first two columns in space delimited file SYNTAX gofish.py [options] [< filename] OPTIONS -h prints help message and quits -i for interactive filename ...
3.690727
2.900126
1.272609
args = sys.argv if "-h" in args: print(main.__doc__) sys.exit() # # initialize variables Z = 1 # get arguments from the command line orient_file = pmag.get_named_arg("-f", reqd=True) data_model_num = int(float(pmag.get_named_arg("-DM", 3))) if data_model_num == 2...
def main()
NAME huji_sample_magic.py DESCRIPTION takes tab delimited Hebrew University sample file and converts to MagIC formatted tables SYNTAX huji_sample_magic.py [command line options] OPTIONS -f FILE: specify input file -Fsa FILE: specify sample output file, default is: ...
4.003347
2.645711
1.513146
if '-h' in sys.argv: # check if help is needed print(main.__doc__) sys.exit() # graceful quit if '-f' in sys.argv: dat=[] ind=sys.argv.index('-f') file=sys.argv[ind+1] else: file = sys.stdin # read from standard input ofile="" if '-F' in sys.argv...
def main()
NAME vector_mean.py DESCRIPTION calculates vector mean of vector data INPUT FORMAT takes dec, inc, int from an input file SYNTAX vector_mean.py [command line options] [< filename] OPTIONS -h prints help message and quits -f FILE, specify input file ...
4.288796
3.56875
1.201764
kappa, cutoff = 0, 180 rev, anti, boot = 0, 0, 0 spin,n,v,mm97 = 0,0,0,0 if '-h' in sys.argv: print(main.__doc__) sys.exit() if '-f' in sys.argv: ind = sys.argv.index("-f") in_file = sys.argv[ind + 1] vgp_df=pd.read_csv(in_file,delim_whitespace=True,heade...
def main()
NAME scalc.py DESCRIPTION calculates Sb from VGP Long,VGP Lat,Directional kappa,Site latitude data SYNTAX scalc -h [command line options] [< standard input] INPUT takes space delimited files with PLong, PLat,[kappa, N_site, slat] OPTIONS -h prints help message and q...
2.61408
2.164549
1.207679
the_slice = () for j in range(num_axes): if j == axis: the_slice = the_slice + (i,) else: the_slice = the_slice + (slice(None),) return the_slice
def all_but_axis(i, axis, num_axes)
Return a slice covering all combinations with coordinate i along axis. (Effectively the hyperplane perpendicular to axis at i.)
2.340682
2.361133
0.991338
"Apply an ordinary function to all values in an array." flat_ar = ravel(ar) out = zeros(len(flat_ar), flat_ar.typecode()) for i in range(len(flat_ar)): out[i] = f(flat_ar[i]) out.shape = ar.shape return out
def array_map(f, ar)
Apply an ordinary function to all values in an array.
3.115911
2.55021
1.221825
if not self.xdata or not self.ydata: return pos=event.GetPosition() width, height = self.canvas.get_width_height() pos[1] = height - pos[1] xpick_data,ypick_data = pos xdata_org = self.xdata ydata_org = self.ydata data_corrected = self.map.transDa...
def on_plot_select(self,event)
Select data point if cursor is in range of a data point @param: event -> the wx Mouseevent for that click
3.403823
3.445381
0.987938
if not self.xdata or not self.ydata: return pos=event.GetPosition() width, height = self.canvas.get_width_height() pos[1] = height - pos[1] xpick_data,ypick_data = pos xdata_org = self.xdata ydata_org = self.ydata data_corrected = self.map.transDa...
def on_change_plot_cursor(self,event)
If mouse is over data point making it selectable change the shape of the cursor @param: event -> the wx Mouseevent for that click
3.035939
3.014339
1.007166
return_dict = {} for i,ctrl in enumerate(self.list_ctrls): if hasattr(self.parse_funcs,'__getitem__') and len(self.parse_funcs)>i and hasattr(self.parse_funcs[i],'__call__'): try: return_dict[self.inputs[i]] = self.parse_funcs[i](ctrl.GetValue()) exce...
def get_values(self)
Applies parsing functions to each input as specified in init before returning a tuple with first entry being a boolean which specifies if the user entered all values and a second entry which is a dictionary of input names to parsed values.
2.985225
2.415845
1.235686
if '-h' in sys.argv: print(main.__doc__) sys.exit() else: data_model_num = pmag.get_named_arg("-DM", 3) dataframe = extractor.command_line_dataframe([['cat', False, 0], ['F', False, ''], ['f', False, '']]) checked_args = extractor.extract_and_check_args(sys.argv, dat...
def main()
NAME upload_magic.py DESCRIPTION This program will prepare your MagIC text files for uploading to the MagIC database it will check for all the MagIC text files and skip the missing ones SYNTAX upload_magic.py INPUT MagIC txt files OPTIONS -h prints he...
5.731437
4.934551
1.161491
''' #================================================= /poly fit for every SF grid data #================================================= ''' X, Y = np.meshgrid(x, y, copy=False) X = X.flatten() Y = Y.flatten() A = np.array([np.ones(len(X)), X, X**2, Y, Y**2, X*Y]).T Z = np.arra...
def d2_func(x, y, z)
#================================================= /poly fit for every SF grid data #=================================================
4.330457
2.670203
1.621771
''' #================================================= /process the grid data /convert to list data for poly fitting #================================================= ''' a = [] b = [] M = [] for i in data: a.append(i[0]) # np.array([i[1] for i in data], dtype=np.float6...
def grid_list(data)
#================================================= /process the grid data /convert to list data for poly fitting #=================================================
2.453381
1.780646
1.377804
#print("-I- getting data model, please be patient!!!!") url = 'http://earthref.org/services/MagIC-data-model.txt' offline = True # always get cached data model, as 2.5 is now static #try: # data = urllib2.urlopen(url) #except urllib2.URLError: # print '-W- Unable to fetch data mod...
def get_data_model()
try to grab the up to date data model document from the EarthRef site. if that fails, try to get the data model document from the PmagPy directory on the user's computer. if that fails, return False. data_model is a set of nested dictionaries that looks like this: {'magic_contributions': {'group...
4.552768
4.20574
1.082513
container = [] new_list = [] for line in lines: if '>>>' in line: container.append(new_list) new_list = [] else: new_list.append(line) container.append(new_list) return container
def split_lines(lines)
split a MagIC upload format file into lists. the lists are split by the '>>>' lines between file_types.
2.35145
2.099506
1.120002
data_dictionaries = [] for chunk in data[:-1]: if not chunk: continue data1 = data[0] file_type = chunk[0].split('\t')[1].strip('\n').strip('\r') keys = chunk[1].split('\t') clean_keys = [] # remove new-line characters, and any empty string keys ...
def get_dicts(data)
data must be a list of lists, from a tab delimited file. in each list: the first list item will be the type of data. the second list item will be a tab delimited list of headers. the remaining items will be a tab delimited list following the list of headers.
2.606145
2.521809
1.033443
if ghfile != "": lmgh = np.loadtxt(ghfile) gh = [] lmgh = np.loadtxt(ghfile).transpose() gh.append(lmgh[2][0]) for i in range(1, lmgh.shape[1]): gh.append(lmgh[2][i]) gh.append(lmgh[3][i]) if len(gh) == 0: print('no valid gh fi...
def igrf(input_list, mod='', ghfile="")
Determine Declination, Inclination and Intensity from the IGRF model. (http://www.ngdc.noaa.gov/IAGA/vmod/igrf.html) Parameters ---------- input_list : list with format [Date, Altitude, Latitude, Longitude] date must be in decimal year format XXXX.XXXX (Common Era) mod : desired model ...
2.731758
2.865263
0.953406
dd = float(degrees) + old_div(float(minutes), 60) + \ old_div(float(seconds), (60 * 60)) return dd
def dms2dd(degrees, minutes, seconds)
Convert latitude/longitude of a location that is in degrees, minutes, seconds to decimal degrees Parameters ---------- degrees : degrees of latitude/longitude minutes : minutes of latitude/longitude seconds : seconds of latitude/longitude Returns ------- degrees : decimal degrees of lo...
2.925851
4.758879
0.614819
if di_block is None: di_block = make_di_block(dec, inc) return pmag.fisher_mean(di_block) else: return pmag.fisher_mean(di_block)
def fisher_mean(dec=None, inc=None, di_block=None)
Calculates the Fisher mean and associated parameters from either a list of declination values and a separate list of inclination values or from a di_block (a nested list a nested list of [dec,inc,1.0]). Returns a dictionary with the Fisher mean and statistical parameters. Parameters ---------- ...
2.752281
3.368235
0.817129
''' The angle from the true mean within which a chosen percentage of directions lie can be calculated from the Fisher distribution. This function uses the calculated Fisher concentration parameter to estimate this angle from directional data. The 63 percent confidence interval is often called the ...
def fisher_angular_deviation(dec=None, inc=None, di_block=None, confidence=95)
The angle from the true mean within which a chosen percentage of directions lie can be calculated from the Fisher distribution. This function uses the calculated Fisher concentration parameter to estimate this angle from directional data. The 63 percent confidence interval is often called the angular st...
5.229063
1.550914
3.371602
if di_block is None: di_block = make_di_block(dec, inc) return pmag.dobingham(di_block) else: return pmag.dobingham(di_block)
def bingham_mean(dec=None, inc=None, di_block=None)
Calculates the Bingham mean and associated statistical parameters from either a list of declination values and a separate list of inclination values or from a di_block (a nested list a nested list of [dec,inc,1.0]). Returns a dictionary with the Bingham mean and statistical parameters. Parameters -...
3.767063
4.51536
0.834277
if di_block is None: di_block = make_di_block(dec, inc) return pmag.dokent(di_block, len(di_block)) else: return pmag.dokent(di_block, len(di_block))
def kent_mean(dec=None, inc=None, di_block=None)
Calculates the Kent mean and associated statistical parameters from either a list of declination values and a separate list of inclination values or from a di_block (a nested list a nested list of [dec,inc,1.0]). Returns a dictionary with the Kent mean and statistical parameters. Parameters -------...
3.453635
4.722939
0.731247
print('Dec: ' + str(round(mean_dictionary['dec'], 1)) + ' Inc: ' + str(round(mean_dictionary['inc'], 1))) print('Number of directions in mean (n): ' + str(mean_dictionary['n'])) print('Angular radius of 95% confidence (a_95): ' + str(round(mean_dictionary['alpha95'], 1))) print...
def print_direction_mean(mean_dictionary)
Does a pretty job printing a Fisher mean and associated statistics for directional data. Parameters ---------- mean_dictionary: output dictionary of pmag.fisher_mean Examples -------- Generate a Fisher mean using ``ipmag.fisher_mean`` and then print it nicely using ``ipmag.print_direct...
3.868104
1.673053
2.312004
print('Plon: ' + str(round(mean_dictionary['dec'], 1)) + ' Plat: ' + str(round(mean_dictionary['inc'], 1))) print('Number of directions in mean (n): ' + str(mean_dictionary['n'])) print('Angular radius of 95% confidence (A_95): ' + str(round(mean_dictionary['alpha95'], 1))) pri...
def print_pole_mean(mean_dictionary)
Does a pretty job printing a Fisher mean and associated statistics for mean paleomagnetic poles. Parameters ---------- mean_dictionary: output dictionary of pmag.fisher_mean Examples -------- Generate a Fisher mean using ``ipmag.fisher_mean`` and then print it nicely using ``ipmag.prin...
4.533714
1.800779
2.517641
directions = [] declinations = [] inclinations = [] if di_block == True: for data in range(n): d, i = pmag.fshdev(k) drot, irot = pmag.dodirot(d, i, dec, inc) directions.append([drot, irot, 1.]) return directions else: for data in rang...
def fishrot(k=20, n=100, dec=0, inc=90, di_block=True)
Generates Fisher distributed unit vectors from a specified distribution using the pmag.py fshdev and dodirot functions. Parameters ---------- k : kappa precision parameter (default is 20) n : number of vectors to determine (default is 100) dec : mean declination of distribution (default is 0) ...
2.839666
2.108287
1.346907
tk_03_output = [] for k in range(n): gh = pmag.mktk03(8, k, G2, G3) # terms and random seed # get a random longitude, between 0 and 359 lon = random.randint(0, 360) vec = pmag.getvec(gh, lat, lon) # send field model and lat to getvec vec[0] += dec if vec[0]...
def tk03(n=100, dec=0, lat=0, rev='no', G2=0, G3=0)
Generates vectors drawn from the TK03.gad model of secular variation (Tauxe and Kent, 2004) at given latitude and rotated about a vertical axis by the given declination. Return a nested list of of [dec,inc,intensity]. Parameters ---------- n : number of vectors to determine (default is 100) ...
4.65096
4.308976
1.079366
try: length = len(incs) incs_unsquished = [] for n in range(0, length): inc_rad = np.deg2rad(incs[n]) # convert to radians inc_new_rad = (old_div(1., f)) * np.tan(inc_rad) # convert back to degrees inc_new = np.rad2deg(np.arctan(inc_new_r...
def unsquish(incs, f)
This function applies uses a flattening factor (f) to unflatten inclination data (incs) and returns 'unsquished' values. Parameters ---------- incs : list of inclination values or a single value f : unflattening factor (between 0.0 and 1.0) Returns ---------- incs_unsquished : List of ...
2.099882
2.081587
1.008789
try: length = len(incs) incs_squished = [] for n in range(0, length): inc_rad = incs[n] * np.pi / 180. # convert to radians inc_new_rad = f * np.tan(inc_rad) inc_new = np.arctan(inc_new_rad) * 180. / \ np.pi # convert back to degrees...
def squish(incs, f)
This function applies an flattening factor (f) to inclination data (incs) and returns 'squished' values. Parameters ---------- incs : list of inclination values or a single value f : flattening factor (between 0.0 and 1.0) Returns --------- incs_squished : List of flattened directions ...
1.872402
1.878303
0.996859
if di_block is None: dec_flip = [] inc_flip = [] for n in range(0, len(dec)): dec_flip.append((dec[n] - 180.) % 360.0) inc_flip.append(-inc[n]) return dec_flip, inc_flip else: dflip = [] for rec in di_block: d, i = (rec[0] ...
def do_flip(dec=None, inc=None, di_block=None)
This function returns the antipode (i.e. it flips) of directions. The function can take dec and inc as seperate lists if they are of equal length and explicitly specified or are the first two arguments. It will then return a list of flipped decs and a list of flipped incs. If a di_block (a nested list ...
2.636766
2.198636
1.199274
rad = old_div(np.pi, 180.) paleo_lat = old_div(np.arctan(0.5 * np.tan(inc * rad)), rad) if a95 is not None: paleo_lat_max = old_div( np.arctan(0.5 * np.tan((inc + a95) * rad)), rad) paleo_lat_min = old_div( np.arctan(0.5 * np.tan((inc - a95) * rad)), rad) ...
def lat_from_inc(inc, a95=None)
Calculate paleolatitude from inclination using the dipole equation Required Parameter ---------- inc: (paleo)magnetic inclination in degrees Optional Parameter ---------- a95: 95% confidence interval from Fisher mean Returns ---------- if a95 is provided paleo_lat, paleo_lat_max, ...
1.879106
1.636391
1.148323
ref_loc = (ref_loc_lon, ref_loc_lat) pole = (pole_plon, pole_plat) paleo_lat = 90 - pmag.angle(pole, ref_loc) return float(paleo_lat)
def lat_from_pole(ref_loc_lon, ref_loc_lat, pole_plon, pole_plat)
Calculate paleolatitude for a reference location based on a paleomagnetic pole Required Parameters ---------- ref_loc_lon: longitude of reference location in degrees ref_loc_lat: latitude of reference location pole_plon: paleopole longitude in degrees pole_plat: paleopole latitude in degrees
3.13369
3.3403
0.938146
rad = old_div(np.pi, 180.) inc = old_div(np.arctan(2 * np.tan(lat * rad)), rad) return inc
def inc_from_lat(lat)
Calculate inclination predicted from latitude using the dipole equation Parameter ---------- lat : latitude in degrees Returns ------- inc : inclination calculated using the dipole equation
4.318492
4.507553
0.958057
# make the perimeter plt.figure(num=fignum,) plt.clf() plt.axis("off") Dcirc = np.arange(0, 361.) Icirc = np.zeros(361, 'f') Xcirc, Ycirc = [], [] for k in range(361): XY = pmag.dimap(Dcirc[k], Icirc[k]) Xcirc.append(XY[0]) Ycirc.append(XY[1]) plt.plot(Xcirc...
def plot_net(fignum)
Draws circle and tick marks for equal area projection.
1.767205
1.734628
1.01878
X_down = [] X_up = [] Y_down = [] Y_up = [] color_down = [] color_up = [] if di_block is not None: di_lists = unpack_di_block(di_block) if len(di_lists) == 3: dec, inc, intensity = di_lists if len(di_lists) == 2: dec, inc = di_lists t...
def plot_di(dec=None, inc=None, di_block=None, color='k', marker='o', markersize=20, legend='no', label='', title='', edge='',alpha=1)
Plot declination, inclination data on an equal area plot. Before this function is called a plot needs to be initialized with code that looks something like: >fignum = 1 >plt.figure(num=fignum,figsize=(10,10),dpi=160) >ipmag.plot_net(fignum) Required Parameters ----------- dec : declina...
1.663607
1.720863
0.966728
DI_dimap = pmag.dimap(dec, inc) if inc < 0: plt.scatter(DI_dimap[0], DI_dimap[1], edgecolors=color, facecolors='white', marker=marker, s=markersize, label=label) if inc >= 0: plt.scatter(DI_dimap[0], DI_dimap[1], edgecolors=col...
def plot_di_mean(dec, inc, a95, color='k', marker='o', markersize=20, label='', legend='no')
Plot a mean direction (declination, inclination) with alpha_95 ellipse on an equal area plot. Before this function is called, a plot needs to be initialized with code that looks something like: >fignum = 1 >plt.figure(num=fignum,figsize=(10,10),dpi=160) >ipmag.plot_net(fignum) Required Par...
2.512662
2.695646
0.932119
plot_di_mean_ellipse(bingham_dictionary, fignum=fignum, color=color, marker=marker, markersize=markersize, label=label, legend=legend)
def plot_di_mean_bingham(bingham_dictionary, fignum=1, color='k', marker='o', markersize=20, label='', legend='no')
see plot_di_mean_ellipse
2.285513
1.891534
1.208285
pars = [] pars.append(dictionary['dec']) pars.append(dictionary['inc']) pars.append(dictionary['Zeta']) pars.append(dictionary['Zdec']) pars.append(dictionary['Zinc']) pars.append(dictionary['Eta']) pars.append(dictionary['Edec']) pars.append(dictionary['Einc']) DI_dimap = ...
def plot_di_mean_ellipse(dictionary, fignum=1, color='k', marker='o', markersize=20, label='', legend='no')
Plot a mean direction (declination, inclination) confidence ellipse. Parameters ----------- dictionary : a dictionary generated by the pmag.dobingham or pmag.dokent funcitons
2.4948
2.462049
1.013303
''' Function creates and returns an orthographic map projection using cartopy Example ------- >>> map_axis = make_orthographic_map(central_longitude=200,central_latitude=30) Optional Parameters ----------- central_longitude : central longitude of projection (default is 0) central_l...
def make_orthographic_map(central_longitude=0, central_latitude=0, figsize=(8, 8), add_land=True, land_color='tan', add_ocean=False, ocean_color='lightblue', grid_lines=True, lat_grid=[-80., -60., -30., 0., 30., 60., 80.], ...
Function creates and returns an orthographic map projection using cartopy Example ------- >>> map_axis = make_orthographic_map(central_longitude=200,central_latitude=30) Optional Parameters ----------- central_longitude : central longitude of projection (default is 0) central_latitude : ce...
2.286147
1.491369
1.532918
if not has_cartopy: print('-W- cartopy must be installed to run ipmag.plot_pole') return A95_km = A95 * 111.32 map_axis.scatter(plon, plat, marker=marker, color=color, edgecolors=edgecolor, s=markersize, label=label, zorder=101, transform=ccrs.G...
def plot_pole(map_axis, plon, plat, A95, label='', color='k', edgecolor='k', marker='o', markersize=20, legend='no')
This function plots a paleomagnetic pole and A95 error ellipse on a cartopy map axis. Before this function is called, a plot needs to be initialized with code such as that in the make_orthographic_map function. Example ------- >>> plon = 200 >>> plat = 60 >>> A95 = 6 >>> map_axis = ipm...
3.35161
3.575413
0.937405
map_axis.scatter(plon, plat, marker=marker, color=color, edgecolors=edgecolor, s=markersize, label=label, zorder=101, transform=ccrs.Geodetic()) if isinstance(color,str)==True: for n in range(0,len(A95)): A95_km = A95[n] * 111.32 eq...
def plot_poles(map_axis, plon, plat, A95, label='', color='k', edgecolor='k', marker='o', markersize=20, legend='no')
This function plots paleomagnetic poles and A95 error ellipses on a cartopy map axis. Before this function is called, a plot needs to be initialized with code such as that in the make_orthographic_map function. Examples ------- >>> plons = [200, 180, 210] >>> plats = [60, 40, 35] >>> A95 =...
1.992684
2.232263
0.892674
centerlon, centerlat = mapname(plon, plat) A95_km = A95 * 111.32 mapname.scatter(centerlon, centerlat, marker=marker, color=color, edgecolors=edgecolor, s=markersize, label=label, zorder=101) equi_basemap(mapname, plon, plat, A95_km, color) if legend == 'yes': plt.le...
def plot_pole_basemap(mapname, plon, plat, A95, label='', color='k', edgecolor='k', marker='o', markersize=20, legend='no')
This function plots a paleomagnetic pole and A95 error ellipse on whatever current map projection has been set using the basemap plotting library. Before this function is called, a plot needs to be initialized with code that looks something like: >from mpl_toolkits.basemap import Basemap >mapname = ...
2.809866
3.305369
0.850092
if not has_cartopy: print('-W- cartopy must be installed to run ipmag.plot_poles_colorbar') return color_mapping = plt.cm.ScalarMappable(cmap=colormap, norm=plt.Normalize(vmin=vmin, vmax=vmax)) colors = color_mapping.to_rgba(colorvalues).tolist() plot_poles(map_axis, plons, plats...
def plot_poles_colorbar(map_axis, plons, plats, A95s, colorvalues, vmin, vmax, colormap='viridis', edgecolor='k', marker='o', markersize='20', alpha=1.0, colorbar=True, colorbar_label='pole age (Ma)')
This function plots multiple paleomagnetic pole and A95 error ellipse on a cartopy map axis. The poles are colored by the defined colormap. Before this function is called, a plot needs to be initialized with code such as that in the make_orthographic_map function. Example ------- >>> plons = [...
2.648572
2.720922
0.97341
if not has_cartopy: print('-W- cartopy must be installed to run ipmag.plot_vgp') return if di_block != None: di_lists = unpack_di_block(di_block) if len(di_lists) == 3: vgp_lon, vgp_lat, intensity = di_lists if len(di_lists) == 2: vgp_lon, vgp...
def plot_vgp(map_axis, vgp_lon=None, vgp_lat=None, di_block=None, label='', color='k', marker='o', edge='black', markersize=20, legend=False)
This function plots a paleomagnetic pole position on a cartopy map axis. Before this function is called, a plot needs to be initialized with code such as that in the make_orthographic_map function. Example ------- >>> vgps = ipmag.fishrot(dec=200,inc=30) >>> vgp_lon_list,vgp_lat_list,intensiti...
2.828435
2.627627
1.076422
if di_block != None: di_lists = unpack_di_block(di_block) if len(di_lists) == 3: vgp_lon, vgp_lat, intensity = di_lists if len(di_lists) == 2: vgp_lon, vgp_lat = di_lists centerlon, centerlat = mapname(vgp_lon, vgp_lat) mapname.scatter(centerlon, centerla...
def plot_vgp_basemap(mapname, vgp_lon=None, vgp_lat=None, di_block=None, label='', color='k', marker='o', markersize=20, legend='no')
This function plots a paleomagnetic pole on whatever current map projection has been set using the basemap plotting library. Before this function is called, a plot needs to be initialized with code that looks something like: >from mpl_toolkits.basemap import Basemap >mapname = Basemap(projection='or...
2.354486
2.442127
0.964113
# calculate the mean from the directional data dataframe_dirs = [] for n in range(0, len(dataframe)): dataframe_dirs.append([dataframe[dec_tc][n], dataframe[inc_tc][n], 1.]) dataframe_dir_mean = pmag.fisher_mean(dataframe_dirs) # calculate the mean from ...
def sb_vgp_calc(dataframe, site_correction='yes', dec_tc='dec_tc', inc_tc='inc_tc')
This function calculates the angular dispersion of VGPs and corrects for within site dispersion (unless site_correction = 'no') to return a value S_b. The input data needs to be within a pandas Dataframe. Parameters ----------- dataframe : the name of the pandas.DataFrame containing the data t...
2.888916
2.793502
1.034156
di_block = [] for n in range(0, len(dec)): di_block.append([dec[n], inc[n], 1.0]) return di_block
def make_di_block(dec, inc)
Some pmag.py and ipmag.py functions require or will take a list of unit vectors [dec,inc,1.] as input. This function takes declination and inclination data and make it into such a nest list of lists. Parameters ----------- dec : list of declinations inc : list of inclinations Returns -...
2.79303
3.40094
0.821252
dec_list = [] inc_list = [] moment_list = [] for n in range(0, len(di_block)): dec = di_block[n][0] inc = di_block[n][1] dec_list.append(dec) inc_list.append(inc) if len(di_block[n]) > 2: moment = di_block[n][2] moment_list.append(mom...
def unpack_di_block(di_block)
This function unpacks a nested list of [dec,inc,mag_moment] into a list of declination values, a list of inclination values and a list of magnetic moment values. Mag_moment values are optional, while dec and inc values are required. Parameters ----------- di_block : nested list of declination, ...
1.998897
1.717899
1.163571
diddd_block = [] for n in range(0, len(dec)): diddd_block.append([dec[n], inc[n], dip_direction[n], dip[n]]) diddd_array = np.array(diddd_block) return diddd_array
def make_diddd_array(dec, inc, dip_direction, dip)
Some pmag.py functions such as the bootstrap fold test require a numpy array of dec, inc, dip direction, dip [dec, inc, dd, dip] as input. This function makes such an array. Parameters ----------- dec : paleomagnetic declination in degrees inc : paleomagnetic inclination in degrees dip_di...
2.040063
2.843683
0.717401
if not has_cartopy: print('-W- cartopy must be installed to run ipmag.equi') return glon1 = centerlon glat1 = centerlat X = [] Y = [] for azimuth in range(0, 360): glon2, glat2, baz = shoot(glon1, glat1, azimuth, radius) X.append(glon2) Y.append(glat2...
def equi(map_axis, centerlon, centerlat, radius, color, alpha=1.0)
This function enables A95 error ellipses to be drawn in cartopy around paleomagnetic poles in conjunction with shoot (modified from: http://www.geophysique.be/2011/02/20/matplotlib-basemap-tutorial-09-drawing-circles/).
3.082409
2.8738
1.07259
glon1 = centerlon glat1 = centerlat X = [] Y = [] for azimuth in range(0, 360): glon2, glat2, baz = shoot(glon1, glat1, azimuth, radius) X.append(glon2) Y.append(glat2) X.append(X[0]) Y.append(Y[0]) X, Y = m(X, Y) plt.plot(X, Y, color)
def equi_basemap(m, centerlon, centerlat, radius, color)
This function enables A95 error ellipses to be drawn in basemap around paleomagnetic poles in conjunction with shoot (from: http://www.geophysique.be/2011/02/20/matplotlib-basemap-tutorial-09-drawing-circles/).
2.496239
2.298755
1.085909
if not has_cartopy: print('-W- cartopy must be installed to run ipmag.ellipse') return False angle = angle*(np.pi/180) glon1 = centerlon glat1 = centerlat X = [] Y = [] for azimuth in np.linspace(0, 360, n): az_rad = azimuth*(np.pi/180) radius = ((major_a...
def ellipse(map_axis, centerlon, centerlat, major_axis, minor_axis, angle, n=360, filled=False, **kwargs)
This function enables general error ellipses to be drawn on the cartopy projection of the input map axis using a center and a set of major and minor axes and a rotation angle east of north. (Adapted from equi). Parameters ----------- map_axis : cartopy axis centerlon : longitude of the center o...
2.796456
2.874417
0.972877
plt.figure(num=fignum, figsize=(5, 5)) if intensity: int_key=intensity else: intlist = ['magn_moment', 'magn_volume', 'magn_mass'] # get which key we have IntMeths = [col_name for col_name in data.columns if col_name in intlist] int_key = IntMeths[0] data = data[...
def plot_dmag(data="", title="", fignum=1, norm=1,dmag_key='treat_ac_field',intensity='', quality=False)
plots demagenetization data versus step for all specimens in pandas dataframe datablock Parameters ______________ data : Pandas dataframe with MagIC data model 3 columns: fignum : figure number specimen : specimen name dmag_key : one of these: ['treat_temp','treat_ac_field','treat_m...
4.051779
3.482318
1.163529
file = os.path.join(dir_path, infile) eigs_data = np.loadtxt(file) Ss = [] for ind in range(eigs_data.shape[0]): tau, Vdirs = [], [] for k in range(0, 9, 3): tau.append(eigs_data[ind][k]) Vdirs.append([eigs_data[ind][k+1], eigs_data[ind][k+2]]) s = li...
def eigs_s(infile="", dir_path='.')
Converts eigenparamters format data to s format Parameters ___________________ Input: file : input file name with eigenvalues (tau) and eigenvectors (V) with format: tau_1 V1_dec V1_inc tau_2 V2_dec V2_inc tau_3 V3_dec V3_inc Output the six tensor elements as a nested arra...
3.091789
2.925421
1.05687
for pole in poles: pmagplotlib.plot_circ(fignum, pole, 90., color)
def plot_gc(poles, color='g', fignum=1)
plots a great circle on an equal area projection Parameters ____________________ Input fignum : number of matplotlib object poles : nested list of [Dec,Inc] pairs of poles color : color of lower hemisphere dots for great circle - must be in form: 'g','r','y','k',etc. uppe...
7.822077
10.464476
0.747489
# we could return the type of coordinates ACTUALLY used # transform geographic decs = this_spec_meas_df['dir_dec'].values.tolist() incs = this_spec_meas_df['dir_inc'].values.tolist() or_info, az_type = pmag.get_orient(samp_df,samp,data_model=3) if 'azimuth' in or_info.keys() and cb.not_null...
def transform_to_geographic(this_spec_meas_df, samp_df, samp, coord="0")
Transform decs/incs to geographic coordinates. Calls pmag.dogeo_V for the heavy lifting Parameters ---------- this_spec_meas_df : pandas dataframe of measurements for a single specimen samp_df : pandas dataframe of samples samp : samp name Returns --------- this_spec_meas_df : meas...
3.75687
3.396364
1.106145
input_dir_path, output_dir_path = pmag.fix_directories(input_dir_path, output_dir_path) try: fname = pmag.resolve_file_name(spec_file, input_dir_path) except IOError: print("bad specimen file name") return False, "bad specimen file name" spec_df = pd.read_csv(fname, sep='\t'...
def specimens_extract(spec_file='specimens.txt', output_file='specimens.xls', landscape=False, longtable=False, output_dir_path='.', input_dir_path='', latex=False)
Extracts specimen results from a MagIC 3.0 format specimens.txt file. Default output format is an Excel file. typeset with latex on your own computer. Parameters ___________ spec_file : str, default "specimens.txt" input file name output_file : str, default "specimens.xls" ou...
2.365232
2.389146
0.98999
input_dir_path, output_dir_path = pmag.fix_directories(input_dir_path, output_dir_path) try: fname = pmag.resolve_file_name(crit_file, input_dir_path) except IOError: print("bad criteria file name") return False, "bad criteria file name" crit_df = pd.read_csv(fname, sep='\t'...
def criteria_extract(crit_file='criteria.txt', output_file='criteria.xls', output_dir_path='.', input_dir_path='', latex=False)
Extracts criteria from a MagIC 3.0 format criteria.txt file. Default output format is an Excel file. typeset with latex on your own computer. Parameters ___________ crit_file : str, default "criteria.txt" input file name output_file : str, default "criteria.xls" output file n...
2.702687
2.742865
0.985352
# set outfile name if outfile: fmt = "" else: outfile = 'hist.'+fmt # read in data from infile or use data argument if os.path.exists(infile): D = np.loadtxt(infile) else: D = np.array(data) try: if not len(D): print('-W- No data found...
def histplot(infile="", data=(), outfile="", xlab='x', binsize=False, norm=1, fmt='svg', save_plots=True, interactive=False)
makes histograms for data Parameters ---------- infile : str, default "" input file name format: single variable data : list-like, default () list/array of values to plot if infile is not provided outfile : str, default "" name for plot, if not provided defaults to h...
2.714673
2.676642
1.014209
'''USE PARSE_ALL_FITS unless otherwise necessary Isolate fits by the name of the fit; we also set 'specimen_tilt_correction' to zero in order to only include data in geographic coordinates - THIS NEEDS TO BE GENERALIZED ''' fits = self.fits.loc[self.fits.specimen_comp_name == ...
def parse_fits(self, fit_name)
USE PARSE_ALL_FITS unless otherwise necessary Isolate fits by the name of the fit; we also set 'specimen_tilt_correction' to zero in order to only include data in geographic coordinates - THIS NEEDS TO BE GENERALIZED
5.701769
2.214956
2.574214
# # initialize variables # # # dir_path='.' if "-WD" in sys.argv: ind=sys.argv.index("-WD") dir_path=sys.argv[ind+1] meas_file,spec_file= dir_path+"/magic_measurements.txt",dir_path+"/er_specimens.txt" out_file=meas_file MeasRecs,SpecRecs=[],[] OutRecs=[]...
def main()
NAME measurements_normalize.py DESCRIPTION takes magic_measurements file and normalized moment by sample_weight and sample_volume in the er_specimens table SYNTAX measurements_normalize.py [command line options] OPTIONS -f FILE: specify input file, default is: magic_me...
2.083657
1.803532
1.155321
if wind: wind.Destroy() if not self.parent.IsShown(): self.on_show_mainframe(None) # re-do the quit binding self.parent.Bind(wx.EVT_MENU, self.on_quit, self.file_quit) else: self.parent.Close()
def on_quit(self, event, wind=None)
shut down application if in the main frame. otherwise, destroy the top window (wind) and restore the main frame.
4.124154
3.836335
1.075024
self.parent.Enable() self.parent.Show() self.parent.Raise()
def on_show_mainframe(self, event)
Show mainframe window
4.691349
3.766137
1.245666
dia = pmag_menu_dialogs.ClearWD(self.parent, self.parent.WD) clear = dia.do_clear() if clear: # clear directory, but use previously acquired data_model if self.data_model_num == 2.5: self.parent.er_magic = builder.ErMagicBuilder(self.parent.WD, se...
def on_clear(self, event)
initialize window to allow user to empty the working directory
7.577708
7.065486
1.072496
infile,outfile,data,indata="","",[],[] if '-h' in sys.argv: print(main.__doc__) sys.exit() if '-F' in sys.argv: ind=sys.argv.index('-F') outfile=sys.argv[ind+1] out=open(outfile,'w') if '-i' in sys.argv: print("Welcome to paleolatitude calculator\n") ...
def main()
NAME apwp.py DESCRIPTION returns predicted paleolatitudes, directions and pole latitude/longitude from apparent polar wander paths of Besse and Courtillot (2002). SYNTAX apwp.py [command line options][< filename] OPTIONS -h prints help message and quits -i ...
2.737417
2.088104
1.310958
t,V,tr=[],[],0. ind1,ind2,ind3=0,1,2 evalues,evectmps=numpy.linalg.eig(T) evectors=numpy.transpose(evectmps) # to make compatible with Numeric convention for tau in evalues: tr += tau # tr totals tau values if tr != 0: for i in range(3): evalues[i]=old_div(eval...
def tauV(T)
gets the eigenvalues (tau) and eigenvectors (V) from matrix T
3.83989
3.516238
1.092045
n = len(X1_prime) - 1 X1 = X1_prime[0] - X1_prime[n] X2 = X2_prime[0] - X2_prime[n] X3 = X3_prime[0] - X3_prime[n] R= numpy.array([X1, X2, X3]) #print 'R (reference vector for PD direction)', R dot = numpy.dot(PD, R) # dot product of reference vector and the principal axis of the V matr...
def get_PD_direction(X1_prime, X2_prime, X3_prime, PD)
takes arrays of X1_prime, X2_prime, X3_prime, and the PD. checks that the PD vector direction is correct
2.984182
2.873551
1.0385
# tau is ordered so that tau[0] > tau[1] > tau[2] for t in tau: if isinstance(t, complex): return -999 MAD = math.degrees(numpy.arctan(numpy.sqrt(old_div((tau[1] + tau[2]), tau[0]))) ) return MAD
def get_MAD(tau)
input: eigenvalues of PCA matrix output: Maximum Angular Deviation
5.854747
5.872925
0.996905
ints = numpy.array(d[2]) else: ints = numpy.array([1.]) cart = numpy.array([ints * numpy.cos(decs) * numpy.cos(incs), ints * numpy.sin(decs) * numpy.cos(incs), ints * numpy.sin(incs) ]).transpose() return cart
def dir2cart(d): # from pmag.py ints = numpy.ones(len(d)).transpose() # get an array of ones to plug into dec,inc pairs d = numpy.array(d) rad = old_div(numpy.pi, 180.) if len(d.shape) > 1: # array of vectors decs, incs =...
converts list or array of vector directions, in degrees, to array of cartesian coordinates, in x,y,z form
2.361444
2.045129
1.154667
D1 = D1[:,0:2] # strip off intensity else: D1 = D1[:2] D2 = numpy.array(D2) if len(D2.shape) > 1: D2 = D2[:,0:2] # strip off intensity else: D2 = D2[:2] X1 = dir2cart(D1) # convert to cartesian from polar X2 = dir2cart(D2) angles = [] # set up a list for angles for k in r...
def pmag_angle(D1,D2): # use this D1 = numpy.array(D1) if len(D1.shape) > 1
finds the angle between lists of two directions D1,D2
2.712826
2.641089
1.027162
v1 = numpy.array(v1) v2 = numpy.array(v2) angle = numpy.arctan2(numpy.linalg.norm(numpy.cross(v1, v2)), numpy.dot(v1, v2)) return math.degrees(angle)
def new_get_angle_diff(v1,v2)
returns angular difference in degrees between two vectors. may be more precise in certain cases. see SPD
1.719638
1.724552
0.99715
v1 = numpy.array(v1) v2 = numpy.array(v2) angle=numpy.arccos(old_div((numpy.dot(v1, v2) ), (numpy.sqrt(math.fsum(v1**2)) * numpy.sqrt(math.fsum(v2**2))))) return math.degrees(angle)
def get_angle_difference(v1, v2)
returns angular difference in degrees between two vectors. takes in cartesian coordinates.
2.82206
2.620251
1.077019
ptrms_angle = math.degrees(math.acos(old_div(numpy.dot(ptrms_best_fit_vector,B_lab_vector),(numpy.sqrt(sum(ptrms_best_fit_vector**2)) * numpy.sqrt(sum(B_lab_vector**2)))))) # from old thellier_gui.py code return ptrms_angle
def get_ptrms_angle(ptrms_best_fit_vector, B_lab_vector)
gives angle between principal direction of the ptrm data and the b_lab vector. this is NOT in SPD, but taken from Ron Shaar's old thellier_gui.py code. see PmagPy on github
3.539646
2.399297
1.475285
filename = pmag.get_named_arg('-f') if not filename: return with open(filename, 'rb+') as f: content = f.read() f.seek(0) f.write(content.replace(b'\r', b'')) f.truncate()
def main()
Take out dos problem characters from any file
3.538533
3.086608
1.146415
'''criteria used only in thellier gui these criteria are not written to pmag_criteria.txt ''' category="thellier_gui" for crit in ['sample_int_n_outlier_check','site_int_n_outlier_check']: acceptance_criteria[crit]={} acceptance_criteria[crit]['category']=category acceptance_...
def add_thellier_gui_criteria(acceptance_criteria)
criteria used only in thellier gui these criteria are not written to pmag_criteria.txt
2.468762
2.286611
1.07966
dir_path='.' inspec="pmag_specimens.txt" if '-WD' in sys.argv: ind=sys.argv.index('-WD') dir_path=sys.argv[ind+1] if '-h' in sys.argv: print(main.__doc__) sys.exit() if '-f' in sys.argv: ind=sys.argv.index('-f') inspec=sys.argv[ind+1] basename...
def main()
NAME sort_specimens.py DESCRIPTION Reads in a pmag_specimen formatted file and separates it into different components (A,B...etc.) SYNTAX sort_specimens.py [-h] [command line options] INPUT takes pmag_specimens.txt formatted input file OPTIONS -h: prints help...
2.62103
2.485601
1.054485
self.menubar = wx.MenuBar() menu_about = wx.Menu() menu_help = menu_about.Append(-1, "&Some notes", "") self.Bind(wx.EVT_MENU, self.on_menu_help, menu_help) self.menubar.Append(menu_about, "& Instructions") self.SetMenuBar(self.menubar)
def create_menu(self)
Create menu
2.914411
2.781118
1.047928
#wait = wx.BusyInfo("Please wait, working...") #wx.SafeYield() self.contribution.propagate_lithology_cols() spec_df = self.contribution.tables['specimens'].df self.panel = wx.Panel(self, style=wx.SIMPLE_BORDER) self.grid_frame = grid_frame3.GridFrame(self.contrib...
def InitSpecCheck(self)
make an interactive grid in which users can edit specimen names as well as which sample a specimen belongs to
5.495868
5.269896
1.04288
# propagate average lat/lon info from samples table if # available in samples and missing in sites self.contribution.propagate_average_up(cols=['lat', 'lon', 'height'], target_df_name='sites', source_df_name='...
def InitSiteCheck(self)
make an interactive grid in which users can edit site names as well as which location a site belongs to
5.57248
5.409788
1.030074
# if there is a location without a name, name it 'unknown' self.contribution.rename_item('locations', 'nan', 'unknown') # propagate lat/lon values from sites table self.contribution.get_min_max_lat_lon() # propagate lithologies & geologic classes from sites table ...
def InitLocCheck(self)
make an interactive grid in which users can edit locations
5.106756
5.015839
1.018126
age_df = self.contribution.tables['ages'].df self.panel = wx.Panel(self, style=wx.SIMPLE_BORDER) self.grid_frame = grid_frame3.GridFrame(self.contribution, self.WD, 'ages', 'ages', self.panel, ...
def InitAgeCheck(self)
make an interactive grid in which users can edit ages
4.548309
4.335291
1.049136
# deselect column, including remove 'EDIT ALL' label if self.grid_frame.drop_down_menu: self.grid_frame.drop_down_menu.clean_up() # remove '**' and '^^' from col names #self.remove_starred_labels(grid) grid.remove_starred_labels() grid.SaveEditContr...
def onContinue(self, event, grid, next_dia=None):#, age_data_type='site')
Save grid data in the data object
6.716593
6.704659
1.00178
grid_name = str(grid.GetName()) dmodel = self.contribution.dmodel reqd_headers = dmodel.get_reqd_headers(grid_name) df = self.contribution.tables[grid_name].df df = df.replace('', np.nan) # python does not view empty strings as null if df.empty: retur...
def validate(self, grid)
Using the MagIC data model, generate validation errors on a MagicGrid. Parameters ---------- grid : dialogs.magic_grid3.MagicGrid The MagicGrid to be validated Returns --------- warnings: dict Empty dict if no warnings, otherwise a dict ...
3.688267
3.394063
1.086682
wait = wx.BusyInfo("Please wait, working...") wx.SafeYield() if self.grid_frame.drop_down_menu: # unhighlight selected columns, etc. self.grid_frame.drop_down_menu.clean_up() # remove '**' and '^^' from col labels starred_cols, hatted_cols = grid.remove_st...
def on_saveButton(self, event, grid)
saves any editing of the grid but does not continue to the next window
5.912751
5.643551
1.0477
x, y = grid.CalcUnscrolledPosition(event.GetX(), event.GetY()) coords = grid.XYToCell(x, y) col = coords[1] row = coords[0] # creates tooltip message for cells with long values # note: this works with EPD for windows, and modern wxPython, but not with Canopy Pyt...
def onMouseOver(self, event, grid)
Displays a tooltip over any cell in a certain column
5.170862
4.712387
1.097292
# for use on the command line: path = find_pmag_dir.get_pmag_dir() # for use with pyinstaller #path = self.main_frame.resource_dir help_page = os.path.join(path, 'dialogs', 'help_files', page) # if using with py2app, the directory structure is flat, # so ...
def on_helpButton(self, event, page=None)
shows html help page
6.747508
6.572702
1.026596
#wait = wx.BusyInfo("Please wait, working...") # unhighlight selected columns, etc. if self.drop_down_menu: self.drop_down_menu.clean_up() # remove '**' from col names #self.remove_starred_labels(grid) grid.remove_starred_labels() grid.SaveE...
def on_continueButton(self, event, grid, next_dia=None)
pulls up next dialog, if there is one. gets any updated information from the current grid and runs ErMagicBuilder
6.780525
6.641616
1.020915