repository_name stringlengths 5 67 | func_path_in_repository stringlengths 4 234 | func_name stringlengths 0 314 | whole_func_string stringlengths 52 3.87M | language stringclasses 6
values | func_code_string stringlengths 52 3.87M | func_code_tokens listlengths 15 672k | func_documentation_string stringlengths 1 47.2k | func_documentation_tokens listlengths 1 3.92k | split_name stringclasses 1
value | func_code_url stringlengths 85 339 |
|---|---|---|---|---|---|---|---|---|---|---|
PmagPy/PmagPy | pmagpy/pmag.py | vspec | def vspec(data):
"""
Takes the vector mean of replicate measurements at a given step
"""
vdata, Dirdata, step_meth = [], [], []
tr0 = data[0][0] # set beginning treatment
data.append("Stop")
k, R = 1, 0
for i in range(k, len(data)):
Dirdata = []
if data[i][0] != tr0:
... | python | def vspec(data):
"""
Takes the vector mean of replicate measurements at a given step
"""
vdata, Dirdata, step_meth = [], [], []
tr0 = data[0][0] # set beginning treatment
data.append("Stop")
k, R = 1, 0
for i in range(k, len(data)):
Dirdata = []
if data[i][0] != tr0:
... | [
"def",
"vspec",
"(",
"data",
")",
":",
"vdata",
",",
"Dirdata",
",",
"step_meth",
"=",
"[",
"]",
",",
"[",
"]",
",",
"[",
"]",
"tr0",
"=",
"data",
"[",
"0",
"]",
"[",
"0",
"]",
"# set beginning treatment",
"data",
".",
"append",
"(",
"\"Stop\"",
... | Takes the vector mean of replicate measurements at a given step | [
"Takes",
"the",
"vector",
"mean",
"of",
"replicate",
"measurements",
"at",
"a",
"given",
"step"
] | train | https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/pmag.py#L2372-L2398 |
PmagPy/PmagPy | pmagpy/pmag.py | Vdiff | def Vdiff(D1, D2):
"""
finds the vector difference between two directions D1,D2
"""
A = dir2cart([D1[0], D1[1], 1.])
B = dir2cart([D2[0], D2[1], 1.])
C = []
for i in range(3):
C.append(A[i] - B[i])
return cart2dir(C) | python | def Vdiff(D1, D2):
"""
finds the vector difference between two directions D1,D2
"""
A = dir2cart([D1[0], D1[1], 1.])
B = dir2cart([D2[0], D2[1], 1.])
C = []
for i in range(3):
C.append(A[i] - B[i])
return cart2dir(C) | [
"def",
"Vdiff",
"(",
"D1",
",",
"D2",
")",
":",
"A",
"=",
"dir2cart",
"(",
"[",
"D1",
"[",
"0",
"]",
",",
"D1",
"[",
"1",
"]",
",",
"1.",
"]",
")",
"B",
"=",
"dir2cart",
"(",
"[",
"D2",
"[",
"0",
"]",
",",
"D2",
"[",
"1",
"]",
",",
"1... | finds the vector difference between two directions D1,D2 | [
"finds",
"the",
"vector",
"difference",
"between",
"two",
"directions",
"D1",
"D2"
] | train | https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/pmag.py#L2401-L2410 |
PmagPy/PmagPy | pmagpy/pmag.py | cart2dir | def cart2dir(cart):
"""
Converts a direction in cartesian coordinates into declination, inclinations
Parameters
----------
cart : input list of [x,y,z] or list of lists [[x1,y1,z1],[x2,y2,z2]...]
Returns
-------
direction_array : returns an array of [declination, inclination, intensity... | python | def cart2dir(cart):
"""
Converts a direction in cartesian coordinates into declination, inclinations
Parameters
----------
cart : input list of [x,y,z] or list of lists [[x1,y1,z1],[x2,y2,z2]...]
Returns
-------
direction_array : returns an array of [declination, inclination, intensity... | [
"def",
"cart2dir",
"(",
"cart",
")",
":",
"cart",
"=",
"np",
".",
"array",
"(",
"cart",
")",
"rad",
"=",
"old_div",
"(",
"np",
".",
"pi",
",",
"180.",
")",
"# constant to convert degrees to radians",
"if",
"len",
"(",
"cart",
".",
"shape",
")",
">",
... | Converts a direction in cartesian coordinates into declination, inclinations
Parameters
----------
cart : input list of [x,y,z] or list of lists [[x1,y1,z1],[x2,y2,z2]...]
Returns
-------
direction_array : returns an array of [declination, inclination, intensity]
Examples
--------
... | [
"Converts",
"a",
"direction",
"in",
"cartesian",
"coordinates",
"into",
"declination",
"inclinations"
] | train | https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/pmag.py#L2452-L2492 |
PmagPy/PmagPy | pmagpy/pmag.py | Tmatrix | def Tmatrix(X):
"""
gets the orientation matrix (T) from data in X
"""
T = [[0., 0., 0.], [0., 0., 0.], [0., 0., 0.]]
for row in X:
for k in range(3):
for l in range(3):
T[k][l] += row[k] * row[l]
return T | python | def Tmatrix(X):
"""
gets the orientation matrix (T) from data in X
"""
T = [[0., 0., 0.], [0., 0., 0.], [0., 0., 0.]]
for row in X:
for k in range(3):
for l in range(3):
T[k][l] += row[k] * row[l]
return T | [
"def",
"Tmatrix",
"(",
"X",
")",
":",
"T",
"=",
"[",
"[",
"0.",
",",
"0.",
",",
"0.",
"]",
",",
"[",
"0.",
",",
"0.",
",",
"0.",
"]",
",",
"[",
"0.",
",",
"0.",
",",
"0.",
"]",
"]",
"for",
"row",
"in",
"X",
":",
"for",
"k",
"in",
"ran... | gets the orientation matrix (T) from data in X | [
"gets",
"the",
"orientation",
"matrix",
"(",
"T",
")",
"from",
"data",
"in",
"X"
] | train | https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/pmag.py#L2530-L2539 |
PmagPy/PmagPy | pmagpy/pmag.py | dir2cart | def dir2cart(d):
"""
Converts a list or array of vector directions in degrees (declination,
inclination) to an array of the direction in cartesian coordinates (x,y,z)
Parameters
----------
d : list or array of [dec,inc] or [dec,inc,intensity]
Returns
-------
cart : array of [x,y,z]... | python | def dir2cart(d):
"""
Converts a list or array of vector directions in degrees (declination,
inclination) to an array of the direction in cartesian coordinates (x,y,z)
Parameters
----------
d : list or array of [dec,inc] or [dec,inc,intensity]
Returns
-------
cart : array of [x,y,z]... | [
"def",
"dir2cart",
"(",
"d",
")",
":",
"ints",
"=",
"np",
".",
"ones",
"(",
"len",
"(",
"d",
")",
")",
".",
"transpose",
"(",
")",
"# get an array of ones to plug into dec,inc pairs",
"d",
"=",
"np",
".",
"array",
"(",
"d",
")",
"rad",
"=",
"np",
"."... | Converts a list or array of vector directions in degrees (declination,
inclination) to an array of the direction in cartesian coordinates (x,y,z)
Parameters
----------
d : list or array of [dec,inc] or [dec,inc,intensity]
Returns
-------
cart : array of [x,y,z]
Examples
--------
... | [
"Converts",
"a",
"list",
"or",
"array",
"of",
"vector",
"directions",
"in",
"degrees",
"(",
"declination",
"inclination",
")",
"to",
"an",
"array",
"of",
"the",
"direction",
"in",
"cartesian",
"coordinates",
"(",
"x",
"y",
"z",
")"
] | train | https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/pmag.py#L2542-L2576 |
PmagPy/PmagPy | pmagpy/pmag.py | findrec | def findrec(s, data):
"""
finds all the records belonging to s in data
"""
datablock = []
for rec in data:
if s == rec[0]:
datablock.append([rec[1], rec[2], rec[3], rec[4]])
return datablock | python | def findrec(s, data):
"""
finds all the records belonging to s in data
"""
datablock = []
for rec in data:
if s == rec[0]:
datablock.append([rec[1], rec[2], rec[3], rec[4]])
return datablock | [
"def",
"findrec",
"(",
"s",
",",
"data",
")",
":",
"datablock",
"=",
"[",
"]",
"for",
"rec",
"in",
"data",
":",
"if",
"s",
"==",
"rec",
"[",
"0",
"]",
":",
"datablock",
".",
"append",
"(",
"[",
"rec",
"[",
"1",
"]",
",",
"rec",
"[",
"2",
"]... | finds all the records belonging to s in data | [
"finds",
"all",
"the",
"records",
"belonging",
"to",
"s",
"in",
"data"
] | train | https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/pmag.py#L2593-L2601 |
PmagPy/PmagPy | pmagpy/pmag.py | domean | def domean(data, start, end, calculation_type):
"""
Gets average direction using Fisher or principal component analysis (line
or plane) methods
Parameters
----------
data : nest list of data: [[treatment,dec,inc,int,quality],...]
start : step being used as start of fit (often temperature mi... | python | def domean(data, start, end, calculation_type):
"""
Gets average direction using Fisher or principal component analysis (line
or plane) methods
Parameters
----------
data : nest list of data: [[treatment,dec,inc,int,quality],...]
start : step being used as start of fit (often temperature mi... | [
"def",
"domean",
"(",
"data",
",",
"start",
",",
"end",
",",
"calculation_type",
")",
":",
"mpars",
"=",
"{",
"}",
"datablock",
"=",
"[",
"]",
"start0",
",",
"end0",
"=",
"start",
",",
"end",
"# indata = [rec.append('g') if len(rec)<6 else rec for rec in indata]... | Gets average direction using Fisher or principal component analysis (line
or plane) methods
Parameters
----------
data : nest list of data: [[treatment,dec,inc,int,quality],...]
start : step being used as start of fit (often temperature minimum)
end : step being used as end of fit (often temper... | [
"Gets",
"average",
"direction",
"using",
"Fisher",
"or",
"principal",
"component",
"analysis",
"(",
"line",
"or",
"plane",
")",
"methods"
] | train | https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/pmag.py#L2604-L2786 |
PmagPy/PmagPy | pmagpy/pmag.py | circ | def circ(dec, dip, alpha):
"""
function to calculate points on an circle about dec,dip with angle alpha
"""
rad = old_div(np.pi, 180.)
D_out, I_out = [], []
dec, dip, alpha = dec * rad, dip * rad, alpha * rad
dec1 = dec + old_div(np.pi, 2.)
isign = 1
if dip != 0:
isign = (old... | python | def circ(dec, dip, alpha):
"""
function to calculate points on an circle about dec,dip with angle alpha
"""
rad = old_div(np.pi, 180.)
D_out, I_out = [], []
dec, dip, alpha = dec * rad, dip * rad, alpha * rad
dec1 = dec + old_div(np.pi, 2.)
isign = 1
if dip != 0:
isign = (old... | [
"def",
"circ",
"(",
"dec",
",",
"dip",
",",
"alpha",
")",
":",
"rad",
"=",
"old_div",
"(",
"np",
".",
"pi",
",",
"180.",
")",
"D_out",
",",
"I_out",
"=",
"[",
"]",
",",
"[",
"]",
"dec",
",",
"dip",
",",
"alpha",
"=",
"dec",
"*",
"rad",
",",... | function to calculate points on an circle about dec,dip with angle alpha | [
"function",
"to",
"calculate",
"points",
"on",
"an",
"circle",
"about",
"dec",
"dip",
"with",
"angle",
"alpha"
] | train | https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/pmag.py#L2789-L2824 |
PmagPy/PmagPy | pmagpy/pmag.py | PintPars | def PintPars(datablock, araiblock, zijdblock, start, end, accept, **kwargs):
"""
calculate the paleointensity magic parameters make some definitions
"""
if 'version' in list(kwargs.keys()) and kwargs['version'] == 3:
meth_key = 'method_codes'
beta_key = 'int_b_beta'
temp_key, m... | python | def PintPars(datablock, araiblock, zijdblock, start, end, accept, **kwargs):
"""
calculate the paleointensity magic parameters make some definitions
"""
if 'version' in list(kwargs.keys()) and kwargs['version'] == 3:
meth_key = 'method_codes'
beta_key = 'int_b_beta'
temp_key, m... | [
"def",
"PintPars",
"(",
"datablock",
",",
"araiblock",
",",
"zijdblock",
",",
"start",
",",
"end",
",",
"accept",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"'version'",
"in",
"list",
"(",
"kwargs",
".",
"keys",
"(",
")",
")",
"and",
"kwargs",
"[",
"... | calculate the paleointensity magic parameters make some definitions | [
"calculate",
"the",
"paleointensity",
"magic",
"parameters",
"make",
"some",
"definitions"
] | train | https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/pmag.py#L2827-L3374 |
PmagPy/PmagPy | pmagpy/pmag.py | getkeys | def getkeys(table):
"""
customize by commenting out unwanted keys
"""
keys = []
if table == "ER_expedition":
pass
if table == "ER_citations":
keys.append("er_citation_name")
keys.append("long_authors")
keys.append("year")
keys.append("title")
keys.... | python | def getkeys(table):
"""
customize by commenting out unwanted keys
"""
keys = []
if table == "ER_expedition":
pass
if table == "ER_citations":
keys.append("er_citation_name")
keys.append("long_authors")
keys.append("year")
keys.append("title")
keys.... | [
"def",
"getkeys",
"(",
"table",
")",
":",
"keys",
"=",
"[",
"]",
"if",
"table",
"==",
"\"ER_expedition\"",
":",
"pass",
"if",
"table",
"==",
"\"ER_citations\"",
":",
"keys",
".",
"append",
"(",
"\"er_citation_name\"",
")",
"keys",
".",
"append",
"(",
"\"... | customize by commenting out unwanted keys | [
"customize",
"by",
"commenting",
"out",
"unwanted",
"keys"
] | train | https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/pmag.py#L3377-L3534 |
PmagPy/PmagPy | pmagpy/pmag.py | getnames | def getnames():
"""
get mail names
"""
namestring = ""
addmore = 1
while addmore:
scientist = input("Enter name - <Return> when done ")
if scientist != "":
namestring = namestring + ":" + scientist
else:
namestring = namestring[1:]
ad... | python | def getnames():
"""
get mail names
"""
namestring = ""
addmore = 1
while addmore:
scientist = input("Enter name - <Return> when done ")
if scientist != "":
namestring = namestring + ":" + scientist
else:
namestring = namestring[1:]
ad... | [
"def",
"getnames",
"(",
")",
":",
"namestring",
"=",
"\"\"",
"addmore",
"=",
"1",
"while",
"addmore",
":",
"scientist",
"=",
"input",
"(",
"\"Enter name - <Return> when done \"",
")",
"if",
"scientist",
"!=",
"\"\"",
":",
"namestring",
"=",
"namestring",
"+"... | get mail names | [
"get",
"mail",
"names"
] | train | https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/pmag.py#L3537-L3550 |
PmagPy/PmagPy | pmagpy/pmag.py | magic_help | def magic_help(keyhelp):
"""
returns a help message for a give magic key
"""
helpme = {}
helpme["er_location_name"] = "Name for location or drill site"
helpme["er_location_alternatives"] = "Colon-delimited list of alternative names and abbreviations"
helpme["location_type"] = "Location type"... | python | def magic_help(keyhelp):
"""
returns a help message for a give magic key
"""
helpme = {}
helpme["er_location_name"] = "Name for location or drill site"
helpme["er_location_alternatives"] = "Colon-delimited list of alternative names and abbreviations"
helpme["location_type"] = "Location type"... | [
"def",
"magic_help",
"(",
"keyhelp",
")",
":",
"helpme",
"=",
"{",
"}",
"helpme",
"[",
"\"er_location_name\"",
"]",
"=",
"\"Name for location or drill site\"",
"helpme",
"[",
"\"er_location_alternatives\"",
"]",
"=",
"\"Colon-delimited list of alternative names and abbrevia... | returns a help message for a give magic key | [
"returns",
"a",
"help",
"message",
"for",
"a",
"give",
"magic",
"key"
] | train | https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/pmag.py#L3553-L3856 |
PmagPy/PmagPy | pmagpy/pmag.py | dosundec | def dosundec(sundata):
"""
returns the declination for a given set of suncompass data
Parameters
__________
sundata : dictionary with these keys:
date: time string with the format 'yyyy:mm:dd:hr:min'
delta_u: time to SUBTRACT from local time for Universal time
lat: la... | python | def dosundec(sundata):
"""
returns the declination for a given set of suncompass data
Parameters
__________
sundata : dictionary with these keys:
date: time string with the format 'yyyy:mm:dd:hr:min'
delta_u: time to SUBTRACT from local time for Universal time
lat: la... | [
"def",
"dosundec",
"(",
"sundata",
")",
":",
"iday",
"=",
"0",
"timedate",
"=",
"sundata",
"[",
"\"date\"",
"]",
"timedate",
"=",
"timedate",
".",
"split",
"(",
"\":\"",
")",
"year",
"=",
"int",
"(",
"timedate",
"[",
"0",
"]",
")",
"mon",
"=",
"int... | returns the declination for a given set of suncompass data
Parameters
__________
sundata : dictionary with these keys:
date: time string with the format 'yyyy:mm:dd:hr:min'
delta_u: time to SUBTRACT from local time for Universal time
lat: latitude of location (negative for so... | [
"returns",
"the",
"declination",
"for",
"a",
"given",
"set",
"of",
"suncompass",
"data",
"Parameters",
"__________",
"sundata",
":",
"dictionary",
"with",
"these",
"keys",
":",
"date",
":",
"time",
"string",
"with",
"the",
"format",
"yyyy",
":",
"mm",
":",
... | train | https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/pmag.py#L3859-L3915 |
PmagPy/PmagPy | pmagpy/pmag.py | gha | def gha(julian_day, f):
"""
returns greenwich hour angle
"""
rad = old_div(np.pi, 180.)
d = julian_day - 2451545.0 + f
L = 280.460 + 0.9856474 * d
g = 357.528 + 0.9856003 * d
L = L % 360.
g = g % 360.
# ecliptic longitude
lamb = L + 1.915 * np.sin(g * rad) + .02 * np.sin(2 * g * ... | python | def gha(julian_day, f):
"""
returns greenwich hour angle
"""
rad = old_div(np.pi, 180.)
d = julian_day - 2451545.0 + f
L = 280.460 + 0.9856474 * d
g = 357.528 + 0.9856003 * d
L = L % 360.
g = g % 360.
# ecliptic longitude
lamb = L + 1.915 * np.sin(g * rad) + .02 * np.sin(2 * g * ... | [
"def",
"gha",
"(",
"julian_day",
",",
"f",
")",
":",
"rad",
"=",
"old_div",
"(",
"np",
".",
"pi",
",",
"180.",
")",
"d",
"=",
"julian_day",
"-",
"2451545.0",
"+",
"f",
"L",
"=",
"280.460",
"+",
"0.9856474",
"*",
"d",
"g",
"=",
"357.528",
"+",
"... | returns greenwich hour angle | [
"returns",
"greenwich",
"hour",
"angle"
] | train | https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/pmag.py#L3918-L3948 |
PmagPy/PmagPy | pmagpy/pmag.py | julian | def julian(mon, day, year):
"""
returns julian day
"""
ig = 15 + 31 * (10 + 12 * 1582)
if year == 0:
print("Julian no can do")
return
if year < 0:
year = year + 1
if mon > 2:
julian_year = year
julian_month = mon + 1
else:
julian_year = yea... | python | def julian(mon, day, year):
"""
returns julian day
"""
ig = 15 + 31 * (10 + 12 * 1582)
if year == 0:
print("Julian no can do")
return
if year < 0:
year = year + 1
if mon > 2:
julian_year = year
julian_month = mon + 1
else:
julian_year = yea... | [
"def",
"julian",
"(",
"mon",
",",
"day",
",",
"year",
")",
":",
"ig",
"=",
"15",
"+",
"31",
"*",
"(",
"10",
"+",
"12",
"*",
"1582",
")",
"if",
"year",
"==",
"0",
":",
"print",
"(",
"\"Julian no can do\"",
")",
"return",
"if",
"year",
"<",
"0",
... | returns julian day | [
"returns",
"julian",
"day"
] | train | https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/pmag.py#L3951-L3974 |
PmagPy/PmagPy | pmagpy/pmag.py | fillkeys | def fillkeys(Recs):
"""
reconciles keys of dictionaries within Recs.
"""
keylist, OutRecs = [], []
for rec in Recs:
for key in list(rec.keys()):
if key not in keylist:
keylist.append(key)
for rec in Recs:
for key in keylist:
if key not in l... | python | def fillkeys(Recs):
"""
reconciles keys of dictionaries within Recs.
"""
keylist, OutRecs = [], []
for rec in Recs:
for key in list(rec.keys()):
if key not in keylist:
keylist.append(key)
for rec in Recs:
for key in keylist:
if key not in l... | [
"def",
"fillkeys",
"(",
"Recs",
")",
":",
"keylist",
",",
"OutRecs",
"=",
"[",
"]",
",",
"[",
"]",
"for",
"rec",
"in",
"Recs",
":",
"for",
"key",
"in",
"list",
"(",
"rec",
".",
"keys",
"(",
")",
")",
":",
"if",
"key",
"not",
"in",
"keylist",
... | reconciles keys of dictionaries within Recs. | [
"reconciles",
"keys",
"of",
"dictionaries",
"within",
"Recs",
"."
] | train | https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/pmag.py#L3977-L3991 |
PmagPy/PmagPy | pmagpy/pmag.py | fisher_mean | def fisher_mean(data):
"""
Calculates the Fisher mean and associated parameter from a di_block
Parameters
----------
di_block : a nested list of [dec,inc] or [dec,inc,intensity]
Returns
-------
fpars : dictionary containing the Fisher mean and statistics
dec : mean declination
... | python | def fisher_mean(data):
"""
Calculates the Fisher mean and associated parameter from a di_block
Parameters
----------
di_block : a nested list of [dec,inc] or [dec,inc,intensity]
Returns
-------
fpars : dictionary containing the Fisher mean and statistics
dec : mean declination
... | [
"def",
"fisher_mean",
"(",
"data",
")",
":",
"R",
",",
"Xbar",
",",
"X",
",",
"fpars",
"=",
"0",
",",
"[",
"0",
",",
"0",
",",
"0",
"]",
",",
"[",
"]",
",",
"{",
"}",
"N",
"=",
"len",
"(",
"data",
")",
"if",
"N",
"<",
"2",
":",
"return"... | Calculates the Fisher mean and associated parameter from a di_block
Parameters
----------
di_block : a nested list of [dec,inc] or [dec,inc,intensity]
Returns
-------
fpars : dictionary containing the Fisher mean and statistics
dec : mean declination
inc : mean inclination
... | [
"Calculates",
"the",
"Fisher",
"mean",
"and",
"associated",
"parameter",
"from",
"a",
"di_block"
] | train | https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/pmag.py#L3994-L4047 |
PmagPy/PmagPy | pmagpy/pmag.py | gausspars | def gausspars(data):
"""
calculates gaussian statistics for data
"""
N, mean, d = len(data), 0., 0.
if N < 1:
return "", ""
if N == 1:
return data[0], 0
for j in range(N):
mean += old_div(data[j], float(N))
for j in range(N):
d += (data[j] - mean)**2
s... | python | def gausspars(data):
"""
calculates gaussian statistics for data
"""
N, mean, d = len(data), 0., 0.
if N < 1:
return "", ""
if N == 1:
return data[0], 0
for j in range(N):
mean += old_div(data[j], float(N))
for j in range(N):
d += (data[j] - mean)**2
s... | [
"def",
"gausspars",
"(",
"data",
")",
":",
"N",
",",
"mean",
",",
"d",
"=",
"len",
"(",
"data",
")",
",",
"0.",
",",
"0.",
"if",
"N",
"<",
"1",
":",
"return",
"\"\"",
",",
"\"\"",
"if",
"N",
"==",
"1",
":",
"return",
"data",
"[",
"0",
"]",
... | calculates gaussian statistics for data | [
"calculates",
"gaussian",
"statistics",
"for",
"data"
] | train | https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/pmag.py#L4050-L4064 |
PmagPy/PmagPy | pmagpy/pmag.py | weighted_mean | def weighted_mean(data):
"""
calculates weighted mean of data
"""
W, N, mean, d = 0, len(data), 0, 0
if N < 1:
return "", ""
if N == 1:
return data[0][0], 0
for x in data:
W += x[1] # sum of the weights
for x in data:
mean += old_div((float(x[1]) * float(... | python | def weighted_mean(data):
"""
calculates weighted mean of data
"""
W, N, mean, d = 0, len(data), 0, 0
if N < 1:
return "", ""
if N == 1:
return data[0][0], 0
for x in data:
W += x[1] # sum of the weights
for x in data:
mean += old_div((float(x[1]) * float(... | [
"def",
"weighted_mean",
"(",
"data",
")",
":",
"W",
",",
"N",
",",
"mean",
",",
"d",
"=",
"0",
",",
"len",
"(",
"data",
")",
",",
"0",
",",
"0",
"if",
"N",
"<",
"1",
":",
"return",
"\"\"",
",",
"\"\"",
"if",
"N",
"==",
"1",
":",
"return",
... | calculates weighted mean of data | [
"calculates",
"weighted",
"mean",
"of",
"data"
] | train | https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/pmag.py#L4067-L4083 |
PmagPy/PmagPy | pmagpy/pmag.py | fisher_by_pol | def fisher_by_pol(data):
"""
input: as in dolnp (list of dictionaries with 'dec' and 'inc')
description: do fisher mean after splitting data into two polarity domains.
output: three dictionaries:
'A'= polarity 'A'
'B = polarity 'B'
'ALL'= switching polarity of 'B' directions, ... | python | def fisher_by_pol(data):
"""
input: as in dolnp (list of dictionaries with 'dec' and 'inc')
description: do fisher mean after splitting data into two polarity domains.
output: three dictionaries:
'A'= polarity 'A'
'B = polarity 'B'
'ALL'= switching polarity of 'B' directions, ... | [
"def",
"fisher_by_pol",
"(",
"data",
")",
":",
"FisherByPoles",
"=",
"{",
"}",
"DIblock",
",",
"nameblock",
",",
"locblock",
"=",
"[",
"]",
",",
"[",
"]",
",",
"[",
"]",
"for",
"rec",
"in",
"data",
":",
"if",
"'dec'",
"in",
"list",
"(",
"rec",
".... | input: as in dolnp (list of dictionaries with 'dec' and 'inc')
description: do fisher mean after splitting data into two polarity domains.
output: three dictionaries:
'A'= polarity 'A'
'B = polarity 'B'
'ALL'= switching polarity of 'B' directions, and calculate fisher mean of all data... | [
"input",
":",
"as",
"in",
"dolnp",
"(",
"list",
"of",
"dictionaries",
"with",
"dec",
"and",
"inc",
")",
"description",
":",
"do",
"fisher",
"mean",
"after",
"splitting",
"data",
"into",
"two",
"polarity",
"domains",
".",
"output",
":",
"three",
"dictionari... | train | https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/pmag.py#L4122-L4195 |
PmagPy/PmagPy | pmagpy/pmag.py | dolnp3_0 | def dolnp3_0(Data):
"""
DEPRECATED!! USE dolnp()
Desciption: takes a list of dicts with the controlled vocabulary of 3_0 and calls dolnp on them after reformating for compatibility.
Parameters
__________
Data : nested list of dictionarys with keys
dir_dec
dir_inc
dir_til... | python | def dolnp3_0(Data):
"""
DEPRECATED!! USE dolnp()
Desciption: takes a list of dicts with the controlled vocabulary of 3_0 and calls dolnp on them after reformating for compatibility.
Parameters
__________
Data : nested list of dictionarys with keys
dir_dec
dir_inc
dir_til... | [
"def",
"dolnp3_0",
"(",
"Data",
")",
":",
"if",
"len",
"(",
"Data",
")",
"==",
"0",
":",
"print",
"(",
"\"This function requires input Data have at least 1 entry\"",
")",
"return",
"{",
"}",
"if",
"len",
"(",
"Data",
")",
"==",
"1",
":",
"ReturnData",
"=",... | DEPRECATED!! USE dolnp()
Desciption: takes a list of dicts with the controlled vocabulary of 3_0 and calls dolnp on them after reformating for compatibility.
Parameters
__________
Data : nested list of dictionarys with keys
dir_dec
dir_inc
dir_tilt_correction
method_code... | [
"DEPRECATED!!",
"USE",
"dolnp",
"()",
"Desciption",
":",
"takes",
"a",
"list",
"of",
"dicts",
"with",
"the",
"controlled",
"vocabulary",
"of",
"3_0",
"and",
"calls",
"dolnp",
"on",
"them",
"after",
"reformating",
"for",
"compatibility",
".",
"Parameters",
"___... | train | https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/pmag.py#L4198-L4255 |
PmagPy/PmagPy | pmagpy/pmag.py | dolnp | def dolnp(data, direction_type_key):
"""
Returns fisher mean, a95 for data using method of Mcfadden and Mcelhinny '88 for lines and planes
Parameters
__________
Data : nested list of dictionaries with keys
Data model 3.0:
dir_dec
dir_inc
dir_tilt_correct... | python | def dolnp(data, direction_type_key):
"""
Returns fisher mean, a95 for data using method of Mcfadden and Mcelhinny '88 for lines and planes
Parameters
__________
Data : nested list of dictionaries with keys
Data model 3.0:
dir_dec
dir_inc
dir_tilt_correct... | [
"def",
"dolnp",
"(",
"data",
",",
"direction_type_key",
")",
":",
"if",
"'dir_dec'",
"in",
"data",
"[",
"0",
"]",
".",
"keys",
"(",
")",
":",
"tilt_key",
"=",
"'dir_tilt_correction'",
"# this is data model 3.0",
"else",
":",
"tilt_key",
"=",
"'tilt_correction'... | Returns fisher mean, a95 for data using method of Mcfadden and Mcelhinny '88 for lines and planes
Parameters
__________
Data : nested list of dictionaries with keys
Data model 3.0:
dir_dec
dir_inc
dir_tilt_correction
method_codes
Data model 2... | [
"Returns",
"fisher",
"mean",
"a95",
"for",
"data",
"using",
"method",
"of",
"Mcfadden",
"and",
"Mcelhinny",
"88",
"for",
"lines",
"and",
"planes"
] | train | https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/pmag.py#L4258-L4361 |
PmagPy/PmagPy | pmagpy/pmag.py | vclose | def vclose(L, V):
"""
gets the closest vector
"""
lam, X = 0, []
for k in range(3):
lam = lam + V[k] * L[k]
beta = np.sqrt(1. - lam**2)
for k in range(3):
X.append((old_div((V[k] - lam * L[k]), beta)))
return X | python | def vclose(L, V):
"""
gets the closest vector
"""
lam, X = 0, []
for k in range(3):
lam = lam + V[k] * L[k]
beta = np.sqrt(1. - lam**2)
for k in range(3):
X.append((old_div((V[k] - lam * L[k]), beta)))
return X | [
"def",
"vclose",
"(",
"L",
",",
"V",
")",
":",
"lam",
",",
"X",
"=",
"0",
",",
"[",
"]",
"for",
"k",
"in",
"range",
"(",
"3",
")",
":",
"lam",
"=",
"lam",
"+",
"V",
"[",
"k",
"]",
"*",
"L",
"[",
"k",
"]",
"beta",
"=",
"np",
".",
"sqrt... | gets the closest vector | [
"gets",
"the",
"closest",
"vector"
] | train | https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/pmag.py#L4364-L4374 |
PmagPy/PmagPy | pmagpy/pmag.py | calculate_best_fit_vectors | def calculate_best_fit_vectors(L, E, V, n_planes):
"""
Calculates the best fit vectors for a set of plane interpretations used in fisher mean calculations
@param: L - a list of the "EL, EM, EN" array of MM88 or the cartisian form of dec and inc of the plane interpretation
@param: E - the sum of the cart... | python | def calculate_best_fit_vectors(L, E, V, n_planes):
"""
Calculates the best fit vectors for a set of plane interpretations used in fisher mean calculations
@param: L - a list of the "EL, EM, EN" array of MM88 or the cartisian form of dec and inc of the plane interpretation
@param: E - the sum of the cart... | [
"def",
"calculate_best_fit_vectors",
"(",
"L",
",",
"E",
",",
"V",
",",
"n_planes",
")",
":",
"U",
",",
"XV",
"=",
"E",
"[",
":",
"]",
",",
"[",
"]",
"# make a copy of E to prevent mutation",
"for",
"pole",
"in",
"L",
":",
"XV",
".",
"append",
"(",
"... | Calculates the best fit vectors for a set of plane interpretations used in fisher mean calculations
@param: L - a list of the "EL, EM, EN" array of MM88 or the cartisian form of dec and inc of the plane interpretation
@param: E - the sum of the cartisian coordinates of all the line fits to be used in the mean
... | [
"Calculates",
"the",
"best",
"fit",
"vectors",
"for",
"a",
"set",
"of",
"plane",
"interpretations",
"used",
"in",
"fisher",
"mean",
"calculations"
] | train | https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/pmag.py#L4377-L4413 |
PmagPy/PmagPy | pmagpy/pmag.py | process_data_for_mean | def process_data_for_mean(data, direction_type_key):
"""
takes list of dicts with dec and inc as well as direction_type if possible or method_codes and sorts the data into lines and planes and process it for fisher means
@param: data - list of dicts with dec inc and some manner of PCA type info
@param:... | python | def process_data_for_mean(data, direction_type_key):
"""
takes list of dicts with dec and inc as well as direction_type if possible or method_codes and sorts the data into lines and planes and process it for fisher means
@param: data - list of dicts with dec inc and some manner of PCA type info
@param:... | [
"def",
"process_data_for_mean",
"(",
"data",
",",
"direction_type_key",
")",
":",
"dec_key",
",",
"inc_key",
",",
"meth_key",
"=",
"'dec'",
",",
"'inc'",
",",
"'magic_method_codes'",
"# data model 2.5",
"if",
"'dir_dec'",
"in",
"data",
"[",
"0",
"]",
".",
"key... | takes list of dicts with dec and inc as well as direction_type if possible or method_codes and sorts the data into lines and planes and process it for fisher means
@param: data - list of dicts with dec inc and some manner of PCA type info
@param: direction_type_key - key that indicates the direction type varia... | [
"takes",
"list",
"of",
"dicts",
"with",
"dec",
"and",
"inc",
"as",
"well",
"as",
"direction_type",
"if",
"possible",
"or",
"method_codes",
"and",
"sorts",
"the",
"data",
"into",
"lines",
"and",
"planes",
"and",
"process",
"it",
"for",
"fisher",
"means"
] | train | https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/pmag.py#L4416-L4483 |
PmagPy/PmagPy | pmagpy/pmag.py | scoreit | def scoreit(pars, PmagSpecRec, accept, text, verbose):
"""
gets a grade for a given set of data, spits out stuff
"""
s = PmagSpecRec["er_specimen_name"]
PmagSpecRec["measurement_step_min"] = '%8.3e' % (
pars["measurement_step_min"])
PmagSpecRec["measurement_step_max"] = '%8.3e' % (
... | python | def scoreit(pars, PmagSpecRec, accept, text, verbose):
"""
gets a grade for a given set of data, spits out stuff
"""
s = PmagSpecRec["er_specimen_name"]
PmagSpecRec["measurement_step_min"] = '%8.3e' % (
pars["measurement_step_min"])
PmagSpecRec["measurement_step_max"] = '%8.3e' % (
... | [
"def",
"scoreit",
"(",
"pars",
",",
"PmagSpecRec",
",",
"accept",
",",
"text",
",",
"verbose",
")",
":",
"s",
"=",
"PmagSpecRec",
"[",
"\"er_specimen_name\"",
"]",
"PmagSpecRec",
"[",
"\"measurement_step_min\"",
"]",
"=",
"'%8.3e'",
"%",
"(",
"pars",
"[",
... | gets a grade for a given set of data, spits out stuff | [
"gets",
"a",
"grade",
"for",
"a",
"given",
"set",
"of",
"data",
"spits",
"out",
"stuff"
] | train | https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/pmag.py#L4486-L4551 |
PmagPy/PmagPy | pmagpy/pmag.py | b_vdm | def b_vdm(B, lat):
"""
Converts a magnetic field value (input in units of tesla) to a virtual
dipole moment (VDM) or a virtual axial dipole moment (VADM); output
in units of Am^2)
Parameters
----------
B: local magnetic field strength in tesla
lat: latitude of site in degrees
Retur... | python | def b_vdm(B, lat):
"""
Converts a magnetic field value (input in units of tesla) to a virtual
dipole moment (VDM) or a virtual axial dipole moment (VADM); output
in units of Am^2)
Parameters
----------
B: local magnetic field strength in tesla
lat: latitude of site in degrees
Retur... | [
"def",
"b_vdm",
"(",
"B",
",",
"lat",
")",
":",
"# changed radius of the earth from 3.367e6 3/12/2010",
"fact",
"=",
"(",
"(",
"6.371e6",
")",
"**",
"3",
")",
"*",
"1e7",
"colat",
"=",
"np",
".",
"radians",
"(",
"90.",
"-",
"lat",
")",
"return",
"fact",
... | Converts a magnetic field value (input in units of tesla) to a virtual
dipole moment (VDM) or a virtual axial dipole moment (VADM); output
in units of Am^2)
Parameters
----------
B: local magnetic field strength in tesla
lat: latitude of site in degrees
Returns
----------
V(A)DM in... | [
"Converts",
"a",
"magnetic",
"field",
"value",
"(",
"input",
"in",
"units",
"of",
"tesla",
")",
"to",
"a",
"virtual",
"dipole",
"moment",
"(",
"VDM",
")",
"or",
"a",
"virtual",
"axial",
"dipole",
"moment",
"(",
"VADM",
")",
";",
"output",
"in",
"units"... | train | https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/pmag.py#L4554-L4578 |
PmagPy/PmagPy | pmagpy/pmag.py | vdm_b | def vdm_b(vdm, lat):
"""
Converts a virtual dipole moment (VDM) or a virtual axial dipole moment
(VADM; input in units of Am^2) to a local magnetic field value (output in
units of tesla)
Parameters
----------
vdm : V(A)DM in units of Am^2
lat: latitude of site in degrees
Returns
... | python | def vdm_b(vdm, lat):
"""
Converts a virtual dipole moment (VDM) or a virtual axial dipole moment
(VADM; input in units of Am^2) to a local magnetic field value (output in
units of tesla)
Parameters
----------
vdm : V(A)DM in units of Am^2
lat: latitude of site in degrees
Returns
... | [
"def",
"vdm_b",
"(",
"vdm",
",",
"lat",
")",
":",
"rad",
"=",
"old_div",
"(",
"np",
".",
"pi",
",",
"180.",
")",
"# changed radius of the earth from 3.367e6 3/12/2010",
"fact",
"=",
"(",
"(",
"6.371e6",
")",
"**",
"3",
")",
"*",
"1e7",
"colat",
"=",
"(... | Converts a virtual dipole moment (VDM) or a virtual axial dipole moment
(VADM; input in units of Am^2) to a local magnetic field value (output in
units of tesla)
Parameters
----------
vdm : V(A)DM in units of Am^2
lat: latitude of site in degrees
Returns
-------
B: local magnetic f... | [
"Converts",
"a",
"virtual",
"dipole",
"moment",
"(",
"VDM",
")",
"or",
"a",
"virtual",
"axial",
"dipole",
"moment",
"(",
"VADM",
";",
"input",
"in",
"units",
"of",
"Am^2",
")",
"to",
"a",
"local",
"magnetic",
"field",
"value",
"(",
"output",
"in",
"uni... | train | https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/pmag.py#L4581-L4600 |
PmagPy/PmagPy | pmagpy/pmag.py | binglookup | def binglookup(w1i, w2i):
"""
Bingham statistics lookup table.
"""
K = {'0.06': {'0.02': ['-25.58', '-8.996'], '0.06': ['-9.043', '-9.043'], '0.04': ['-13.14', '-9.019']}, '0.22': {'0.08': ['-6.944', '-2.644'], '0.02': ['-25.63', '-2.712'], '0.20': ['-2.649', '-2.354'], '0.06': ['-9.027', '-2.673'], '0.... | python | def binglookup(w1i, w2i):
"""
Bingham statistics lookup table.
"""
K = {'0.06': {'0.02': ['-25.58', '-8.996'], '0.06': ['-9.043', '-9.043'], '0.04': ['-13.14', '-9.019']}, '0.22': {'0.08': ['-6.944', '-2.644'], '0.02': ['-25.63', '-2.712'], '0.20': ['-2.649', '-2.354'], '0.06': ['-9.027', '-2.673'], '0.... | [
"def",
"binglookup",
"(",
"w1i",
",",
"w2i",
")",
":",
"K",
"=",
"{",
"'0.06'",
":",
"{",
"'0.02'",
":",
"[",
"'-25.58'",
",",
"'-8.996'",
"]",
",",
"'0.06'",
":",
"[",
"'-9.043'",
",",
"'-9.043'",
"]",
",",
"'0.04'",
":",
"[",
"'-13.14'",
",",
"... | Bingham statistics lookup table. | [
"Bingham",
"statistics",
"lookup",
"table",
"."
] | train | https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/pmag.py#L4603-L4624 |
PmagPy/PmagPy | pmagpy/pmag.py | cdfout | def cdfout(data, file):
"""
spits out the cdf for data to file
"""
f = open(file, "w")
data.sort()
for j in range(len(data)):
y = old_div(float(j), float(len(data)))
out = str(data[j]) + ' ' + str(y) + '\n'
f.write(out)
f.close() | python | def cdfout(data, file):
"""
spits out the cdf for data to file
"""
f = open(file, "w")
data.sort()
for j in range(len(data)):
y = old_div(float(j), float(len(data)))
out = str(data[j]) + ' ' + str(y) + '\n'
f.write(out)
f.close() | [
"def",
"cdfout",
"(",
"data",
",",
"file",
")",
":",
"f",
"=",
"open",
"(",
"file",
",",
"\"w\"",
")",
"data",
".",
"sort",
"(",
")",
"for",
"j",
"in",
"range",
"(",
"len",
"(",
"data",
")",
")",
":",
"y",
"=",
"old_div",
"(",
"float",
"(",
... | spits out the cdf for data to file | [
"spits",
"out",
"the",
"cdf",
"for",
"data",
"to",
"file"
] | train | https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/pmag.py#L4627-L4637 |
PmagPy/PmagPy | pmagpy/pmag.py | dobingham | def dobingham(di_block):
"""
Calculates the Bingham mean and associated statistical parameters from
directions that are input as a di_block
Parameters
----------
di_block : a nested list of [dec,inc] or [dec,inc,intensity]
Returns
-------
bpars : dictionary containing the Bingham m... | python | def dobingham(di_block):
"""
Calculates the Bingham mean and associated statistical parameters from
directions that are input as a di_block
Parameters
----------
di_block : a nested list of [dec,inc] or [dec,inc,intensity]
Returns
-------
bpars : dictionary containing the Bingham m... | [
"def",
"dobingham",
"(",
"di_block",
")",
":",
"control",
",",
"X",
",",
"bpars",
"=",
"[",
"]",
",",
"[",
"]",
",",
"{",
"}",
"N",
"=",
"len",
"(",
"di_block",
")",
"if",
"N",
"<",
"2",
":",
"return",
"bpars",
"#",
"# get cartesian coordinates",
... | Calculates the Bingham mean and associated statistical parameters from
directions that are input as a di_block
Parameters
----------
di_block : a nested list of [dec,inc] or [dec,inc,intensity]
Returns
-------
bpars : dictionary containing the Bingham mean and associated statistics
dic... | [
"Calculates",
"the",
"Bingham",
"mean",
"and",
"associated",
"statistical",
"parameters",
"from",
"directions",
"that",
"are",
"input",
"as",
"a",
"di_block"
] | train | https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/pmag.py#L4640-L4701 |
PmagPy/PmagPy | pmagpy/pmag.py | doflip | def doflip(dec, inc):
"""
flips lower hemisphere data to upper hemisphere
"""
if inc < 0:
inc = -inc
dec = (dec + 180.) % 360.
return dec, inc | python | def doflip(dec, inc):
"""
flips lower hemisphere data to upper hemisphere
"""
if inc < 0:
inc = -inc
dec = (dec + 180.) % 360.
return dec, inc | [
"def",
"doflip",
"(",
"dec",
",",
"inc",
")",
":",
"if",
"inc",
"<",
"0",
":",
"inc",
"=",
"-",
"inc",
"dec",
"=",
"(",
"dec",
"+",
"180.",
")",
"%",
"360.",
"return",
"dec",
",",
"inc"
] | flips lower hemisphere data to upper hemisphere | [
"flips",
"lower",
"hemisphere",
"data",
"to",
"upper",
"hemisphere"
] | train | https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/pmag.py#L4704-L4711 |
PmagPy/PmagPy | pmagpy/pmag.py | doincfish | def doincfish(inc):
"""
gets fisher mean inc from inc only data
input: list of inclination values
output: dictionary of
'n' : number of inclination values supplied
'ginc' : gaussian mean of inclinations
'inc' : estimated Fisher mean
'r' : estimated Fisher R value
... | python | def doincfish(inc):
"""
gets fisher mean inc from inc only data
input: list of inclination values
output: dictionary of
'n' : number of inclination values supplied
'ginc' : gaussian mean of inclinations
'inc' : estimated Fisher mean
'r' : estimated Fisher R value
... | [
"def",
"doincfish",
"(",
"inc",
")",
":",
"rad",
",",
"SCOi",
",",
"SSOi",
"=",
"old_div",
"(",
"np",
".",
"pi",
",",
"180.",
")",
",",
"0.",
",",
"0.",
"# some definitions",
"abinc",
"=",
"[",
"]",
"for",
"i",
"in",
"inc",
":",
"abinc",
".",
"... | gets fisher mean inc from inc only data
input: list of inclination values
output: dictionary of
'n' : number of inclination values supplied
'ginc' : gaussian mean of inclinations
'inc' : estimated Fisher mean
'r' : estimated Fisher R value
'k' : estimated Fisher kappa
... | [
"gets",
"fisher",
"mean",
"inc",
"from",
"inc",
"only",
"data",
"input",
":",
"list",
"of",
"inclination",
"values",
"output",
":",
"dictionary",
"of",
"n",
":",
"number",
"of",
"inclination",
"values",
"supplied",
"ginc",
":",
"gaussian",
"mean",
"of",
"i... | train | https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/pmag.py#L4714-L4784 |
PmagPy/PmagPy | pmagpy/pmag.py | dokent | def dokent(data, NN):
"""
gets Kent parameters for data
Parameters
___________________
data : nested pairs of [Dec,Inc]
NN : normalization
NN is the number of data for Kent ellipse
NN is 1 for Kent ellipses of bootstrapped mean directions
Return
kpars dictionary keys
... | python | def dokent(data, NN):
"""
gets Kent parameters for data
Parameters
___________________
data : nested pairs of [Dec,Inc]
NN : normalization
NN is the number of data for Kent ellipse
NN is 1 for Kent ellipses of bootstrapped mean directions
Return
kpars dictionary keys
... | [
"def",
"dokent",
"(",
"data",
",",
"NN",
")",
":",
"X",
",",
"kpars",
"=",
"[",
"]",
",",
"{",
"}",
"N",
"=",
"len",
"(",
"data",
")",
"if",
"N",
"<",
"2",
":",
"return",
"kpars",
"#",
"# get fisher mean and convert to co-inclination (theta)/dec (phi) i... | gets Kent parameters for data
Parameters
___________________
data : nested pairs of [Dec,Inc]
NN : normalization
NN is the number of data for Kent ellipse
NN is 1 for Kent ellipses of bootstrapped mean directions
Return
kpars dictionary keys
dec : mean declination
... | [
"gets",
"Kent",
"parameters",
"for",
"data",
"Parameters",
"___________________",
"data",
":",
"nested",
"pairs",
"of",
"[",
"Dec",
"Inc",
"]",
"NN",
":",
"normalization",
"NN",
"is",
"the",
"number",
"of",
"data",
"for",
"Kent",
"ellipse",
"NN",
"is",
"1"... | train | https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/pmag.py#L4787-L4913 |
PmagPy/PmagPy | pmagpy/pmag.py | doprinc | def doprinc(data):
"""
Gets principal components from data in form of a list of [dec,inc] data.
Parameters
----------
data : nested list of dec, inc directions
Returns
-------
ppars : dictionary with the principal components
dec : principal directiion declination
inc : ... | python | def doprinc(data):
"""
Gets principal components from data in form of a list of [dec,inc] data.
Parameters
----------
data : nested list of dec, inc directions
Returns
-------
ppars : dictionary with the principal components
dec : principal directiion declination
inc : ... | [
"def",
"doprinc",
"(",
"data",
")",
":",
"ppars",
"=",
"{",
"}",
"rad",
"=",
"old_div",
"(",
"np",
".",
"pi",
",",
"180.",
")",
"X",
"=",
"dir2cart",
"(",
"data",
")",
"# for rec in data:",
"# dir=[]",
"# for c in rec: dir.append(c)",
"# cart= (dir2... | Gets principal components from data in form of a list of [dec,inc] data.
Parameters
----------
data : nested list of dec, inc directions
Returns
-------
ppars : dictionary with the principal components
dec : principal directiion declination
inc : principal direction inclination... | [
"Gets",
"principal",
"components",
"from",
"data",
"in",
"form",
"of",
"a",
"list",
"of",
"[",
"dec",
"inc",
"]",
"data",
"."
] | train | https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/pmag.py#L4916-L4971 |
PmagPy/PmagPy | pmagpy/pmag.py | pt_rot | def pt_rot(EP, Lats, Lons):
"""
Rotates points on a globe by an Euler pole rotation using method of
Cox and Hart 1986, box 7-3.
Parameters
----------
EP : Euler pole list [lat,lon,angle]
Lats : list of latitudes of points to be rotated
Lons : list of longitudes of points to be rotated
... | python | def pt_rot(EP, Lats, Lons):
"""
Rotates points on a globe by an Euler pole rotation using method of
Cox and Hart 1986, box 7-3.
Parameters
----------
EP : Euler pole list [lat,lon,angle]
Lats : list of latitudes of points to be rotated
Lons : list of longitudes of points to be rotated
... | [
"def",
"pt_rot",
"(",
"EP",
",",
"Lats",
",",
"Lons",
")",
":",
"# gets user input of Rotation pole lat,long, omega for plate and converts",
"# to radians",
"E",
"=",
"dir2cart",
"(",
"[",
"EP",
"[",
"1",
"]",
",",
"EP",
"[",
"0",
"]",
",",
"1.",
"]",
")",
... | Rotates points on a globe by an Euler pole rotation using method of
Cox and Hart 1986, box 7-3.
Parameters
----------
EP : Euler pole list [lat,lon,angle]
Lats : list of latitudes of points to be rotated
Lons : list of longitudes of points to be rotated
Returns
_________
RLats : ro... | [
"Rotates",
"points",
"on",
"a",
"globe",
"by",
"an",
"Euler",
"pole",
"rotation",
"using",
"method",
"of",
"Cox",
"and",
"Hart",
"1986",
"box",
"7",
"-",
"3",
"."
] | train | https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/pmag.py#L4974-L5022 |
PmagPy/PmagPy | pmagpy/pmag.py | dread | def dread(infile, cols):
"""
reads in specimen, tr, dec, inc int into data[]. position of
tr, dec, inc, int determined by cols[]
"""
data = []
f = open(infile, "r")
for line in f.readlines():
tmp = line.split()
rec = (tmp[0], float(tmp[cols[0]]), float(tmp[cols[1]]), float... | python | def dread(infile, cols):
"""
reads in specimen, tr, dec, inc int into data[]. position of
tr, dec, inc, int determined by cols[]
"""
data = []
f = open(infile, "r")
for line in f.readlines():
tmp = line.split()
rec = (tmp[0], float(tmp[cols[0]]), float(tmp[cols[1]]), float... | [
"def",
"dread",
"(",
"infile",
",",
"cols",
")",
":",
"data",
"=",
"[",
"]",
"f",
"=",
"open",
"(",
"infile",
",",
"\"r\"",
")",
"for",
"line",
"in",
"f",
".",
"readlines",
"(",
")",
":",
"tmp",
"=",
"line",
".",
"split",
"(",
")",
"rec",
"="... | reads in specimen, tr, dec, inc int into data[]. position of
tr, dec, inc, int determined by cols[] | [
"reads",
"in",
"specimen",
"tr",
"dec",
"inc",
"int",
"into",
"data",
"[]",
".",
"position",
"of",
"tr",
"dec",
"inc",
"int",
"determined",
"by",
"cols",
"[]"
] | train | https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/pmag.py#L5025-L5038 |
PmagPy/PmagPy | pmagpy/pmag.py | fshdev | def fshdev(k):
"""
Generate a random draw from a Fisher distribution with mean declination
of 0 and inclination of 90 with a specified kappa.
Parameters
----------
k : kappa (precision parameter) of the distribution
k can be a single number or an array of values
Returns
-------... | python | def fshdev(k):
"""
Generate a random draw from a Fisher distribution with mean declination
of 0 and inclination of 90 with a specified kappa.
Parameters
----------
k : kappa (precision parameter) of the distribution
k can be a single number or an array of values
Returns
-------... | [
"def",
"fshdev",
"(",
"k",
")",
":",
"k",
"=",
"np",
".",
"array",
"(",
"k",
")",
"if",
"len",
"(",
"k",
".",
"shape",
")",
"!=",
"0",
":",
"n",
"=",
"k",
".",
"shape",
"[",
"0",
"]",
"else",
":",
"n",
"=",
"1",
"R1",
"=",
"random",
"."... | Generate a random draw from a Fisher distribution with mean declination
of 0 and inclination of 90 with a specified kappa.
Parameters
----------
k : kappa (precision parameter) of the distribution
k can be a single number or an array of values
Returns
----------
dec, inc : declinat... | [
"Generate",
"a",
"random",
"draw",
"from",
"a",
"Fisher",
"distribution",
"with",
"mean",
"declination",
"of",
"0",
"and",
"inclination",
"of",
"90",
"with",
"a",
"specified",
"kappa",
"."
] | train | https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/pmag.py#L5041-L5071 |
PmagPy/PmagPy | pmagpy/pmag.py | lowes | def lowes(data):
"""
gets Lowe's power spectrum from gauss coefficients
Parameters
_________
data : nested list of [[l,m,g,h],...] as from pmag.unpack()
Returns
_______
Ls : list of degrees (l)
Rs : power at degree l
"""
lmax = data[-1][0]
Ls = list(range(1, lmax+1))... | python | def lowes(data):
"""
gets Lowe's power spectrum from gauss coefficients
Parameters
_________
data : nested list of [[l,m,g,h],...] as from pmag.unpack()
Returns
_______
Ls : list of degrees (l)
Rs : power at degree l
"""
lmax = data[-1][0]
Ls = list(range(1, lmax+1))... | [
"def",
"lowes",
"(",
"data",
")",
":",
"lmax",
"=",
"data",
"[",
"-",
"1",
"]",
"[",
"0",
"]",
"Ls",
"=",
"list",
"(",
"range",
"(",
"1",
",",
"lmax",
"+",
"1",
")",
")",
"Rs",
"=",
"[",
"]",
"recno",
"=",
"0",
"for",
"l",
"in",
"Ls",
"... | gets Lowe's power spectrum from gauss coefficients
Parameters
_________
data : nested list of [[l,m,g,h],...] as from pmag.unpack()
Returns
_______
Ls : list of degrees (l)
Rs : power at degree l | [
"gets",
"Lowe",
"s",
"power",
"spectrum",
"from",
"gauss",
"coefficients"
] | train | https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/pmag.py#L5074-L5099 |
PmagPy/PmagPy | pmagpy/pmag.py | magnetic_lat | def magnetic_lat(inc):
"""
returns magnetic latitude from inclination
"""
rad = old_div(np.pi, 180.)
paleo_lat = old_div(np.arctan(0.5 * np.tan(inc * rad)), rad)
return paleo_lat | python | def magnetic_lat(inc):
"""
returns magnetic latitude from inclination
"""
rad = old_div(np.pi, 180.)
paleo_lat = old_div(np.arctan(0.5 * np.tan(inc * rad)), rad)
return paleo_lat | [
"def",
"magnetic_lat",
"(",
"inc",
")",
":",
"rad",
"=",
"old_div",
"(",
"np",
".",
"pi",
",",
"180.",
")",
"paleo_lat",
"=",
"old_div",
"(",
"np",
".",
"arctan",
"(",
"0.5",
"*",
"np",
".",
"tan",
"(",
"inc",
"*",
"rad",
")",
")",
",",
"rad",
... | returns magnetic latitude from inclination | [
"returns",
"magnetic",
"latitude",
"from",
"inclination"
] | train | https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/pmag.py#L5102-L5108 |
PmagPy/PmagPy | pmagpy/pmag.py | Dir_anis_corr | def Dir_anis_corr(InDir, AniSpec):
"""
takes the 6 element 's' vector and the Dec,Inc 'InDir' data,
performs simple anisotropy correction. returns corrected Dec, Inc
"""
Dir = np.zeros((3), 'f')
Dir[0] = InDir[0]
Dir[1] = InDir[1]
Dir[2] = 1.
chi, chi_inv = check_F(AniSpec)
if ch... | python | def Dir_anis_corr(InDir, AniSpec):
"""
takes the 6 element 's' vector and the Dec,Inc 'InDir' data,
performs simple anisotropy correction. returns corrected Dec, Inc
"""
Dir = np.zeros((3), 'f')
Dir[0] = InDir[0]
Dir[1] = InDir[1]
Dir[2] = 1.
chi, chi_inv = check_F(AniSpec)
if ch... | [
"def",
"Dir_anis_corr",
"(",
"InDir",
",",
"AniSpec",
")",
":",
"Dir",
"=",
"np",
".",
"zeros",
"(",
"(",
"3",
")",
",",
"'f'",
")",
"Dir",
"[",
"0",
"]",
"=",
"InDir",
"[",
"0",
"]",
"Dir",
"[",
"1",
"]",
"=",
"InDir",
"[",
"1",
"]",
"Dir"... | takes the 6 element 's' vector and the Dec,Inc 'InDir' data,
performs simple anisotropy correction. returns corrected Dec, Inc | [
"takes",
"the",
"6",
"element",
"s",
"vector",
"and",
"the",
"Dec",
"Inc",
"InDir",
"data",
"performs",
"simple",
"anisotropy",
"correction",
".",
"returns",
"corrected",
"Dec",
"Inc"
] | train | https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/pmag.py#L5150-L5165 |
PmagPy/PmagPy | pmagpy/pmag.py | doaniscorr | def doaniscorr(PmagSpecRec, AniSpec):
"""
takes the 6 element 's' vector and the Dec,Inc, Int 'Dir' data,
performs simple anisotropy correction. returns corrected Dec, Inc, Int
"""
AniSpecRec = {}
for key in list(PmagSpecRec.keys()):
AniSpecRec[key] = PmagSpecRec[key]
Dir = np.zeros(... | python | def doaniscorr(PmagSpecRec, AniSpec):
"""
takes the 6 element 's' vector and the Dec,Inc, Int 'Dir' data,
performs simple anisotropy correction. returns corrected Dec, Inc, Int
"""
AniSpecRec = {}
for key in list(PmagSpecRec.keys()):
AniSpecRec[key] = PmagSpecRec[key]
Dir = np.zeros(... | [
"def",
"doaniscorr",
"(",
"PmagSpecRec",
",",
"AniSpec",
")",
":",
"AniSpecRec",
"=",
"{",
"}",
"for",
"key",
"in",
"list",
"(",
"PmagSpecRec",
".",
"keys",
"(",
")",
")",
":",
"AniSpecRec",
"[",
"key",
"]",
"=",
"PmagSpecRec",
"[",
"key",
"]",
"Dir"... | takes the 6 element 's' vector and the Dec,Inc, Int 'Dir' data,
performs simple anisotropy correction. returns corrected Dec, Inc, Int | [
"takes",
"the",
"6",
"element",
"s",
"vector",
"and",
"the",
"Dec",
"Inc",
"Int",
"Dir",
"data",
"performs",
"simple",
"anisotropy",
"correction",
".",
"returns",
"corrected",
"Dec",
"Inc",
"Int"
] | train | https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/pmag.py#L5168-L5219 |
PmagPy/PmagPy | pmagpy/pmag.py | vfunc | def vfunc(pars_1, pars_2):
"""
Calculate the Watson Vw test statistic. Calculated as 2*(Sw-Rw)
Parameters
----------
pars_1 : dictionary of Fisher statistics from population 1
pars_2 : dictionary of Fisher statistics from population 2
Returns
-------
Vw : Watson's Vw statistic
... | python | def vfunc(pars_1, pars_2):
"""
Calculate the Watson Vw test statistic. Calculated as 2*(Sw-Rw)
Parameters
----------
pars_1 : dictionary of Fisher statistics from population 1
pars_2 : dictionary of Fisher statistics from population 2
Returns
-------
Vw : Watson's Vw statistic
... | [
"def",
"vfunc",
"(",
"pars_1",
",",
"pars_2",
")",
":",
"cart_1",
"=",
"dir2cart",
"(",
"[",
"pars_1",
"[",
"\"dec\"",
"]",
",",
"pars_1",
"[",
"\"inc\"",
"]",
",",
"pars_1",
"[",
"\"r\"",
"]",
"]",
")",
"cart_2",
"=",
"dir2cart",
"(",
"[",
"pars_2... | Calculate the Watson Vw test statistic. Calculated as 2*(Sw-Rw)
Parameters
----------
pars_1 : dictionary of Fisher statistics from population 1
pars_2 : dictionary of Fisher statistics from population 2
Returns
-------
Vw : Watson's Vw statistic | [
"Calculate",
"the",
"Watson",
"Vw",
"test",
"statistic",
".",
"Calculated",
"as",
"2",
"*",
"(",
"Sw",
"-",
"Rw",
")"
] | train | https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/pmag.py#L5222-L5242 |
PmagPy/PmagPy | pmagpy/pmag.py | vgp_di | def vgp_di(plat, plong, slat, slong):
"""
Converts a pole position (pole latitude, pole longitude) to a direction
(declination, inclination) at a given location (slat, slong) assuming a
dipolar field.
Parameters
----------
plat : latitude of pole (vgp latitude)
plong : longitude of pole... | python | def vgp_di(plat, plong, slat, slong):
"""
Converts a pole position (pole latitude, pole longitude) to a direction
(declination, inclination) at a given location (slat, slong) assuming a
dipolar field.
Parameters
----------
plat : latitude of pole (vgp latitude)
plong : longitude of pole... | [
"def",
"vgp_di",
"(",
"plat",
",",
"plong",
",",
"slat",
",",
"slong",
")",
":",
"plong",
"=",
"plong",
"%",
"360",
"slong",
"=",
"slong",
"%",
"360",
"signdec",
"=",
"1.",
"delphi",
"=",
"abs",
"(",
"plong",
"-",
"slong",
")",
"if",
"delphi",
"!... | Converts a pole position (pole latitude, pole longitude) to a direction
(declination, inclination) at a given location (slat, slong) assuming a
dipolar field.
Parameters
----------
plat : latitude of pole (vgp latitude)
plong : longitude of pole (vgp longitude)
slat : latitude of site
s... | [
"Converts",
"a",
"pole",
"position",
"(",
"pole",
"latitude",
"pole",
"longitude",
")",
"to",
"a",
"direction",
"(",
"declination",
"inclination",
")",
"at",
"a",
"given",
"location",
"(",
"slat",
"slong",
")",
"assuming",
"a",
"dipolar",
"field",
"."
] | train | https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/pmag.py#L5245-L5289 |
PmagPy/PmagPy | pmagpy/pmag.py | watsonsV | def watsonsV(Dir1, Dir2):
"""
calculates Watson's V statistic for two sets of directions
"""
counter, NumSims = 0, 500
#
# first calculate the fisher means and cartesian coordinates of each set of Directions
#
pars_1 = fisher_mean(Dir1)
pars_2 = fisher_mean(Dir2)
#
# get V statistic for these
#
... | python | def watsonsV(Dir1, Dir2):
"""
calculates Watson's V statistic for two sets of directions
"""
counter, NumSims = 0, 500
#
# first calculate the fisher means and cartesian coordinates of each set of Directions
#
pars_1 = fisher_mean(Dir1)
pars_2 = fisher_mean(Dir2)
#
# get V statistic for these
#
... | [
"def",
"watsonsV",
"(",
"Dir1",
",",
"Dir2",
")",
":",
"counter",
",",
"NumSims",
"=",
"0",
",",
"500",
"#",
"# first calculate the fisher means and cartesian coordinates of each set of Directions",
"#",
"pars_1",
"=",
"fisher_mean",
"(",
"Dir1",
")",
"pars_2",
"=",... | calculates Watson's V statistic for two sets of directions | [
"calculates",
"Watson",
"s",
"V",
"statistic",
"for",
"two",
"sets",
"of",
"directions"
] | train | https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/pmag.py#L5292-L5334 |
PmagPy/PmagPy | pmagpy/pmag.py | dimap | def dimap(D, I):
"""
Function to map directions to x,y pairs in equal area projection
Parameters
----------
D : list or array of declinations (as float)
I : list or array or inclinations (as float)
Returns
-------
XY : x, y values of directions for equal area projection [x,y]
... | python | def dimap(D, I):
"""
Function to map directions to x,y pairs in equal area projection
Parameters
----------
D : list or array of declinations (as float)
I : list or array or inclinations (as float)
Returns
-------
XY : x, y values of directions for equal area projection [x,y]
... | [
"def",
"dimap",
"(",
"D",
",",
"I",
")",
":",
"try",
":",
"D",
"=",
"float",
"(",
"D",
")",
"I",
"=",
"float",
"(",
"I",
")",
"except",
"TypeError",
":",
"# is an array",
"return",
"dimap_V",
"(",
"D",
",",
"I",
")",
"# DEFINE FUNCTION VARIABLES",
... | Function to map directions to x,y pairs in equal area projection
Parameters
----------
D : list or array of declinations (as float)
I : list or array or inclinations (as float)
Returns
-------
XY : x, y values of directions for equal area projection [x,y] | [
"Function",
"to",
"map",
"directions",
"to",
"x",
"y",
"pairs",
"in",
"equal",
"area",
"projection"
] | train | https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/pmag.py#L5337-L5377 |
PmagPy/PmagPy | pmagpy/pmag.py | dimap_V | def dimap_V(D, I):
"""
FUNCTION TO MAP DECLINATION, INCLINATIONS INTO EQUAL AREA PROJECTION, X,Y
Usage: dimap_V(D, I)
D and I are both numpy arrays
"""
# GET CARTESIAN COMPONENTS OF INPUT DIRECTION
DI = np.array([D, I]).transpose()
X = dir2cart(DI).transpose()
# CALCULATE THE X,Y C... | python | def dimap_V(D, I):
"""
FUNCTION TO MAP DECLINATION, INCLINATIONS INTO EQUAL AREA PROJECTION, X,Y
Usage: dimap_V(D, I)
D and I are both numpy arrays
"""
# GET CARTESIAN COMPONENTS OF INPUT DIRECTION
DI = np.array([D, I]).transpose()
X = dir2cart(DI).transpose()
# CALCULATE THE X,Y C... | [
"def",
"dimap_V",
"(",
"D",
",",
"I",
")",
":",
"# GET CARTESIAN COMPONENTS OF INPUT DIRECTION",
"DI",
"=",
"np",
".",
"array",
"(",
"[",
"D",
",",
"I",
"]",
")",
".",
"transpose",
"(",
")",
"X",
"=",
"dir2cart",
"(",
"DI",
")",
".",
"transpose",
"("... | FUNCTION TO MAP DECLINATION, INCLINATIONS INTO EQUAL AREA PROJECTION, X,Y
Usage: dimap_V(D, I)
D and I are both numpy arrays | [
"FUNCTION",
"TO",
"MAP",
"DECLINATION",
"INCLINATIONS",
"INTO",
"EQUAL",
"AREA",
"PROJECTION",
"X",
"Y"
] | train | https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/pmag.py#L5380-L5397 |
PmagPy/PmagPy | pmagpy/pmag.py | getmeths | def getmeths(method_type):
"""
returns MagIC method codes available for a given type
"""
meths = []
if method_type == 'GM':
meths.append('GM-PMAG-APWP')
meths.append('GM-ARAR')
meths.append('GM-ARAR-AP')
meths.append('GM-ARAR-II')
meths.append('GM-ARAR-NI')
... | python | def getmeths(method_type):
"""
returns MagIC method codes available for a given type
"""
meths = []
if method_type == 'GM':
meths.append('GM-PMAG-APWP')
meths.append('GM-ARAR')
meths.append('GM-ARAR-AP')
meths.append('GM-ARAR-II')
meths.append('GM-ARAR-NI')
... | [
"def",
"getmeths",
"(",
"method_type",
")",
":",
"meths",
"=",
"[",
"]",
"if",
"method_type",
"==",
"'GM'",
":",
"meths",
".",
"append",
"(",
"'GM-PMAG-APWP'",
")",
"meths",
".",
"append",
"(",
"'GM-ARAR'",
")",
"meths",
".",
"append",
"(",
"'GM-ARAR-AP'... | returns MagIC method codes available for a given type | [
"returns",
"MagIC",
"method",
"codes",
"available",
"for",
"a",
"given",
"type"
] | train | https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/pmag.py#L5400-L5439 |
PmagPy/PmagPy | pmagpy/pmag.py | first_up | def first_up(ofile, Rec, file_type):
"""
writes the header for a MagIC template file
"""
keylist = []
pmag_out = open(ofile, 'a')
outstring = "tab \t" + file_type + "\n"
pmag_out.write(outstring)
keystring = ""
for key in list(Rec.keys()):
keystring = keystring + '\t' + key
... | python | def first_up(ofile, Rec, file_type):
"""
writes the header for a MagIC template file
"""
keylist = []
pmag_out = open(ofile, 'a')
outstring = "tab \t" + file_type + "\n"
pmag_out.write(outstring)
keystring = ""
for key in list(Rec.keys()):
keystring = keystring + '\t' + key
... | [
"def",
"first_up",
"(",
"ofile",
",",
"Rec",
",",
"file_type",
")",
":",
"keylist",
"=",
"[",
"]",
"pmag_out",
"=",
"open",
"(",
"ofile",
",",
"'a'",
")",
"outstring",
"=",
"\"tab \\t\"",
"+",
"file_type",
"+",
"\"\\n\"",
"pmag_out",
".",
"write",
"(",... | writes the header for a MagIC template file | [
"writes",
"the",
"header",
"for",
"a",
"MagIC",
"template",
"file"
] | train | https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/pmag.py#L5442-L5457 |
PmagPy/PmagPy | pmagpy/pmag.py | get_age | def get_age(Rec, sitekey, keybase, Ages, DefaultAge):
"""
finds the age record for a given site
"""
site = Rec[sitekey]
gotone = 0
if len(Ages) > 0:
for agerec in Ages:
if agerec["er_site_name"] == site:
if "age" in list(agerec.keys()) and agerec["age"] != "":... | python | def get_age(Rec, sitekey, keybase, Ages, DefaultAge):
"""
finds the age record for a given site
"""
site = Rec[sitekey]
gotone = 0
if len(Ages) > 0:
for agerec in Ages:
if agerec["er_site_name"] == site:
if "age" in list(agerec.keys()) and agerec["age"] != "":... | [
"def",
"get_age",
"(",
"Rec",
",",
"sitekey",
",",
"keybase",
",",
"Ages",
",",
"DefaultAge",
")",
":",
"site",
"=",
"Rec",
"[",
"sitekey",
"]",
"gotone",
"=",
"0",
"if",
"len",
"(",
"Ages",
")",
">",
"0",
":",
"for",
"agerec",
"in",
"Ages",
":",... | finds the age record for a given site | [
"finds",
"the",
"age",
"record",
"for",
"a",
"given",
"site"
] | train | https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/pmag.py#L5480-L5502 |
PmagPy/PmagPy | pmagpy/pmag.py | adjust_ages | def adjust_ages(AgesIn):
"""
Function to adjust ages to a common age_unit
"""
# get a list of age_units first
age_units, AgesOut, factors, factor, maxunit, age_unit = [], [], [], 1, 1, "Ma"
for agerec in AgesIn:
if agerec[1] not in age_units:
age_units.append(agerec[1])
... | python | def adjust_ages(AgesIn):
"""
Function to adjust ages to a common age_unit
"""
# get a list of age_units first
age_units, AgesOut, factors, factor, maxunit, age_unit = [], [], [], 1, 1, "Ma"
for agerec in AgesIn:
if agerec[1] not in age_units:
age_units.append(agerec[1])
... | [
"def",
"adjust_ages",
"(",
"AgesIn",
")",
":",
"# get a list of age_units first",
"age_units",
",",
"AgesOut",
",",
"factors",
",",
"factor",
",",
"maxunit",
",",
"age_unit",
"=",
"[",
"]",
",",
"[",
"]",
",",
"[",
"]",
",",
"1",
",",
"1",
",",
"\"Ma\"... | Function to adjust ages to a common age_unit | [
"Function",
"to",
"adjust",
"ages",
"to",
"a",
"common",
"age_unit"
] | train | https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/pmag.py#L5506-L5549 |
PmagPy/PmagPy | pmagpy/pmag.py | get_unf | def get_unf(N=100):
"""
Generates N uniformly distributed directions
using the way described in Fisher et al. (1987).
Parameters
__________
N : number of directions, default is 100
Returns
______
array of nested dec,inc pairs
"""
#
# get uniform directions [dec,inc]
z = ran... | python | def get_unf(N=100):
"""
Generates N uniformly distributed directions
using the way described in Fisher et al. (1987).
Parameters
__________
N : number of directions, default is 100
Returns
______
array of nested dec,inc pairs
"""
#
# get uniform directions [dec,inc]
z = ran... | [
"def",
"get_unf",
"(",
"N",
"=",
"100",
")",
":",
"#",
"# get uniform directions [dec,inc]",
"z",
"=",
"random",
".",
"uniform",
"(",
"-",
"1.",
",",
"1.",
",",
"size",
"=",
"N",
")",
"t",
"=",
"random",
".",
"uniform",
"(",
"0.",
",",
"360.",
","... | Generates N uniformly distributed directions
using the way described in Fisher et al. (1987).
Parameters
__________
N : number of directions, default is 100
Returns
______
array of nested dec,inc pairs | [
"Generates",
"N",
"uniformly",
"distributed",
"directions",
"using",
"the",
"way",
"described",
"in",
"Fisher",
"et",
"al",
".",
"(",
"1987",
")",
".",
"Parameters",
"__________",
"N",
":",
"number",
"of",
"directions",
"default",
"is",
"100"
] | train | https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/pmag.py#L5572-L5594 |
PmagPy/PmagPy | pmagpy/pmag.py | s2a | def s2a(s):
"""
convert 6 element "s" list to 3,3 a matrix (see Tauxe 1998)
"""
a = np.zeros((3, 3,), 'f') # make the a matrix
for i in range(3):
a[i][i] = s[i]
a[0][1], a[1][0] = s[3], s[3]
a[1][2], a[2][1] = s[4], s[4]
a[0][2], a[2][0] = s[5], s[5]
return a | python | def s2a(s):
"""
convert 6 element "s" list to 3,3 a matrix (see Tauxe 1998)
"""
a = np.zeros((3, 3,), 'f') # make the a matrix
for i in range(3):
a[i][i] = s[i]
a[0][1], a[1][0] = s[3], s[3]
a[1][2], a[2][1] = s[4], s[4]
a[0][2], a[2][0] = s[5], s[5]
return a | [
"def",
"s2a",
"(",
"s",
")",
":",
"a",
"=",
"np",
".",
"zeros",
"(",
"(",
"3",
",",
"3",
",",
")",
",",
"'f'",
")",
"# make the a matrix",
"for",
"i",
"in",
"range",
"(",
"3",
")",
":",
"a",
"[",
"i",
"]",
"[",
"i",
"]",
"=",
"s",
"[",
... | convert 6 element "s" list to 3,3 a matrix (see Tauxe 1998) | [
"convert",
"6",
"element",
"s",
"list",
"to",
"3",
"3",
"a",
"matrix",
"(",
"see",
"Tauxe",
"1998",
")"
] | train | https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/pmag.py#L5620-L5630 |
PmagPy/PmagPy | pmagpy/pmag.py | a2s | def a2s(a):
"""
convert 3,3 a matrix to 6 element "s" list (see Tauxe 1998)
"""
s = np.zeros((6,), 'f') # make the a matrix
for i in range(3):
s[i] = a[i][i]
s[3] = a[0][1]
s[4] = a[1][2]
s[5] = a[0][2]
return s | python | def a2s(a):
"""
convert 3,3 a matrix to 6 element "s" list (see Tauxe 1998)
"""
s = np.zeros((6,), 'f') # make the a matrix
for i in range(3):
s[i] = a[i][i]
s[3] = a[0][1]
s[4] = a[1][2]
s[5] = a[0][2]
return s | [
"def",
"a2s",
"(",
"a",
")",
":",
"s",
"=",
"np",
".",
"zeros",
"(",
"(",
"6",
",",
")",
",",
"'f'",
")",
"# make the a matrix",
"for",
"i",
"in",
"range",
"(",
"3",
")",
":",
"s",
"[",
"i",
"]",
"=",
"a",
"[",
"i",
"]",
"[",
"i",
"]",
... | convert 3,3 a matrix to 6 element "s" list (see Tauxe 1998) | [
"convert",
"3",
"3",
"a",
"matrix",
"to",
"6",
"element",
"s",
"list",
"(",
"see",
"Tauxe",
"1998",
")"
] | train | https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/pmag.py#L5634-L5644 |
PmagPy/PmagPy | pmagpy/pmag.py | doseigs | def doseigs(s):
"""
convert s format for eigenvalues and eigenvectors
Parameters
__________
s=[x11,x22,x33,x12,x23,x13] : the six tensor elements
Return
__________
tau : [t1,t2,t3]
tau is an list of eigenvalues in decreasing order:
V : [[V1_dec,V1_inc],[V2_dec,V2... | python | def doseigs(s):
"""
convert s format for eigenvalues and eigenvectors
Parameters
__________
s=[x11,x22,x33,x12,x23,x13] : the six tensor elements
Return
__________
tau : [t1,t2,t3]
tau is an list of eigenvalues in decreasing order:
V : [[V1_dec,V1_inc],[V2_dec,V2... | [
"def",
"doseigs",
"(",
"s",
")",
":",
"#",
"A",
"=",
"s2a",
"(",
"s",
")",
"# convert s to a (see Tauxe 1998)",
"tau",
",",
"V",
"=",
"tauV",
"(",
"A",
")",
"# convert to eigenvalues (t), eigenvectors (V)",
"Vdirs",
"=",
"[",
"]",
"for",
"v",
"in",
"V",
... | convert s format for eigenvalues and eigenvectors
Parameters
__________
s=[x11,x22,x33,x12,x23,x13] : the six tensor elements
Return
__________
tau : [t1,t2,t3]
tau is an list of eigenvalues in decreasing order:
V : [[V1_dec,V1_inc],[V2_dec,V2_inc],[V3_dec,V3_inc]]
... | [
"convert",
"s",
"format",
"for",
"eigenvalues",
"and",
"eigenvectors"
] | train | https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/pmag.py#L5647-L5672 |
PmagPy/PmagPy | pmagpy/pmag.py | doeigs_s | def doeigs_s(tau, Vdirs):
"""
get elements of s from eigenvaulues - note that this is very unstable
Input:
tau,V:
tau is an list of eigenvalues in decreasing order:
[t1,t2,t3]
V is an list of the eigenvector directions
[[V1_dec,V1_inc],[V2_dec,V2_... | python | def doeigs_s(tau, Vdirs):
"""
get elements of s from eigenvaulues - note that this is very unstable
Input:
tau,V:
tau is an list of eigenvalues in decreasing order:
[t1,t2,t3]
V is an list of the eigenvector directions
[[V1_dec,V1_inc],[V2_dec,V2_... | [
"def",
"doeigs_s",
"(",
"tau",
",",
"Vdirs",
")",
":",
"t",
"=",
"np",
".",
"zeros",
"(",
"(",
"3",
",",
"3",
",",
")",
",",
"'f'",
")",
"# initialize the tau diagonal matrix",
"V",
"=",
"[",
"]",
"for",
"j",
"in",
"range",
"(",
"3",
")",
":",
... | get elements of s from eigenvaulues - note that this is very unstable
Input:
tau,V:
tau is an list of eigenvalues in decreasing order:
[t1,t2,t3]
V is an list of the eigenvector directions
[[V1_dec,V1_inc],[V2_dec,V2_inc],[V3_dec,V3_inc]]
Output:
... | [
"get",
"elements",
"of",
"s",
"from",
"eigenvaulues",
"-",
"note",
"that",
"this",
"is",
"very",
"unstable",
"Input",
":",
"tau",
"V",
":",
"tau",
"is",
"an",
"list",
"of",
"eigenvalues",
"in",
"decreasing",
"order",
":",
"[",
"t1",
"t2",
"t3",
"]",
... | train | https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/pmag.py#L5677-L5700 |
PmagPy/PmagPy | pmagpy/pmag.py | fcalc | def fcalc(col, row):
"""
looks up an F-test stastic from F tables F(col,row), where row is number of degrees of freedom - this is 95% confidence (p=0.05).
Parameters
_________
col : degrees of freedom column
row : degrees of freedom row
Returns
F : value for 95% confidence fr... | python | def fcalc(col, row):
"""
looks up an F-test stastic from F tables F(col,row), where row is number of degrees of freedom - this is 95% confidence (p=0.05).
Parameters
_________
col : degrees of freedom column
row : degrees of freedom row
Returns
F : value for 95% confidence fr... | [
"def",
"fcalc",
"(",
"col",
",",
"row",
")",
":",
"#",
"if",
"row",
">",
"200",
":",
"row",
"=",
"200",
"if",
"col",
">",
"20",
":",
"col",
"=",
"20",
"ftest",
"=",
"np",
".",
"array",
"(",
"[",
"[",
"0",
",",
"1",
",",
"2",
",",
"3",
"... | looks up an F-test stastic from F tables F(col,row), where row is number of degrees of freedom - this is 95% confidence (p=0.05).
Parameters
_________
col : degrees of freedom column
row : degrees of freedom row
Returns
F : value for 95% confidence from the F-table | [
"looks",
"up",
"an",
"F",
"-",
"test",
"stastic",
"from",
"F",
"tables",
"F",
"(",
"col",
"row",
")",
"where",
"row",
"is",
"number",
"of",
"degrees",
"of",
"freedom",
"-",
"this",
"is",
"95%",
"confidence",
"(",
"p",
"=",
"0",
".",
"05",
")",
".... | train | https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/pmag.py#L5706-L6123 |
PmagPy/PmagPy | pmagpy/pmag.py | tcalc | def tcalc(nf, p):
"""
t-table for nf degrees of freedom (95% confidence)
"""
#
if p == .05:
if nf > 2:
t = 4.3027
if nf > 3:
t = 3.1824
if nf > 4:
t = 2.7765
if nf > 5:
t = 2.5706
if nf > 6:
t = 2.4469
... | python | def tcalc(nf, p):
"""
t-table for nf degrees of freedom (95% confidence)
"""
#
if p == .05:
if nf > 2:
t = 4.3027
if nf > 3:
t = 3.1824
if nf > 4:
t = 2.7765
if nf > 5:
t = 2.5706
if nf > 6:
t = 2.4469
... | [
"def",
"tcalc",
"(",
"nf",
",",
"p",
")",
":",
"#",
"if",
"p",
"==",
".05",
":",
"if",
"nf",
">",
"2",
":",
"t",
"=",
"4.3027",
"if",
"nf",
">",
"3",
":",
"t",
"=",
"3.1824",
"if",
"nf",
">",
"4",
":",
"t",
"=",
"2.7765",
"if",
"nf",
">... | t-table for nf degrees of freedom (95% confidence) | [
"t",
"-",
"table",
"for",
"nf",
"degrees",
"of",
"freedom",
"(",
"95%",
"confidence",
")"
] | train | https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/pmag.py#L6126-L6534 |
PmagPy/PmagPy | pmagpy/pmag.py | sbar | def sbar(Ss):
"""
calculate average s,sigma from list of "s"s.
"""
if type(Ss) == list:
Ss = np.array(Ss)
npts = Ss.shape[0]
Ss = Ss.transpose()
avd, avs = [], []
# D=np.array([Ss[0],Ss[1],Ss[2],Ss[3]+0.5*(Ss[0]+Ss[1]),Ss[4]+0.5*(Ss[1]+Ss[2]),Ss[5]+0.5*(Ss[0]+Ss[2])]).transpose(... | python | def sbar(Ss):
"""
calculate average s,sigma from list of "s"s.
"""
if type(Ss) == list:
Ss = np.array(Ss)
npts = Ss.shape[0]
Ss = Ss.transpose()
avd, avs = [], []
# D=np.array([Ss[0],Ss[1],Ss[2],Ss[3]+0.5*(Ss[0]+Ss[1]),Ss[4]+0.5*(Ss[1]+Ss[2]),Ss[5]+0.5*(Ss[0]+Ss[2])]).transpose(... | [
"def",
"sbar",
"(",
"Ss",
")",
":",
"if",
"type",
"(",
"Ss",
")",
"==",
"list",
":",
"Ss",
"=",
"np",
".",
"array",
"(",
"Ss",
")",
"npts",
"=",
"Ss",
".",
"shape",
"[",
"0",
"]",
"Ss",
"=",
"Ss",
".",
"transpose",
"(",
")",
"avd",
",",
"... | calculate average s,sigma from list of "s"s. | [
"calculate",
"average",
"s",
"sigma",
"from",
"list",
"of",
"s",
"s",
"."
] | train | https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/pmag.py#L6538-L6570 |
PmagPy/PmagPy | pmagpy/pmag.py | dohext | def dohext(nf, sigma, s):
"""
calculates hext parameters for nf, sigma and s
Parameters
__________
nf : number of degrees of freedom (measurements - 6)
sigma : the sigma of the measurements
s : [x11,x22,x33,x12,x23,x13] - the six tensor elements
Return
hpars : dictionary of Hext s... | python | def dohext(nf, sigma, s):
"""
calculates hext parameters for nf, sigma and s
Parameters
__________
nf : number of degrees of freedom (measurements - 6)
sigma : the sigma of the measurements
s : [x11,x22,x33,x12,x23,x13] - the six tensor elements
Return
hpars : dictionary of Hext s... | [
"def",
"dohext",
"(",
"nf",
",",
"sigma",
",",
"s",
")",
":",
"#",
"hpars",
"=",
"{",
"}",
"hpars",
"[",
"'F_crit'",
"]",
"=",
"'0'",
"hpars",
"[",
"'F12_crit'",
"]",
"=",
"'0'",
"hpars",
"[",
"\"F\"",
"]",
"=",
"0",
"hpars",
"[",
"\"F12\"",
"]... | calculates hext parameters for nf, sigma and s
Parameters
__________
nf : number of degrees of freedom (measurements - 6)
sigma : the sigma of the measurements
s : [x11,x22,x33,x12,x23,x13] - the six tensor elements
Return
hpars : dictionary of Hext statistics with keys:
'F_crit' ... | [
"calculates",
"hext",
"parameters",
"for",
"nf",
"sigma",
"and",
"s"
] | train | https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/pmag.py#L6573-L6654 |
PmagPy/PmagPy | pmagpy/pmag.py | design | def design(npos):
"""
make a design matrix for an anisotropy experiment
"""
if npos == 15:
#
# rotatable design of Jelinek for kappabridge (see Tauxe, 1998)
#
A = np.array([[.5, .5, 0, -1., 0, 0], [.5, .5, 0, 1., 0, 0], [1, .0, 0, 0, 0, 0], [.5, .5, 0, -1., 0, 0], [.5, .... | python | def design(npos):
"""
make a design matrix for an anisotropy experiment
"""
if npos == 15:
#
# rotatable design of Jelinek for kappabridge (see Tauxe, 1998)
#
A = np.array([[.5, .5, 0, -1., 0, 0], [.5, .5, 0, 1., 0, 0], [1, .0, 0, 0, 0, 0], [.5, .5, 0, -1., 0, 0], [.5, .... | [
"def",
"design",
"(",
"npos",
")",
":",
"if",
"npos",
"==",
"15",
":",
"#",
"# rotatable design of Jelinek for kappabridge (see Tauxe, 1998)",
"#",
"A",
"=",
"np",
".",
"array",
"(",
"[",
"[",
".5",
",",
".5",
",",
"0",
",",
"-",
"1.",
",",
"0",
",",
... | make a design matrix for an anisotropy experiment | [
"make",
"a",
"design",
"matrix",
"for",
"an",
"anisotropy",
"experiment"
] | train | https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/pmag.py#L6659-L6679 |
PmagPy/PmagPy | pmagpy/pmag.py | dok15_s | def dok15_s(k15):
"""
calculates least-squares matrix for 15 measurements from Jelinek [1976]
"""
#
A, B = design(15) # get design matrix for 15 measurements
sbar = np.dot(B, k15) # get mean s
t = (sbar[0] + sbar[1] + sbar[2]) # trace
bulk = old_div(t, 3.) # bulk susceptibility
Kbar ... | python | def dok15_s(k15):
"""
calculates least-squares matrix for 15 measurements from Jelinek [1976]
"""
#
A, B = design(15) # get design matrix for 15 measurements
sbar = np.dot(B, k15) # get mean s
t = (sbar[0] + sbar[1] + sbar[2]) # trace
bulk = old_div(t, 3.) # bulk susceptibility
Kbar ... | [
"def",
"dok15_s",
"(",
"k15",
")",
":",
"#",
"A",
",",
"B",
"=",
"design",
"(",
"15",
")",
"# get design matrix for 15 measurements",
"sbar",
"=",
"np",
".",
"dot",
"(",
"B",
",",
"k15",
")",
"# get mean s",
"t",
"=",
"(",
"sbar",
"[",
"0",
"]",
"+... | calculates least-squares matrix for 15 measurements from Jelinek [1976] | [
"calculates",
"least",
"-",
"squares",
"matrix",
"for",
"15",
"measurements",
"from",
"Jelinek",
"[",
"1976",
"]"
] | train | https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/pmag.py#L6684-L6698 |
PmagPy/PmagPy | pmagpy/pmag.py | cross | def cross(v, w):
"""
cross product of two vectors
"""
x = v[1] * w[2] - v[2] * w[1]
y = v[2] * w[0] - v[0] * w[2]
z = v[0] * w[1] - v[1] * w[0]
return [x, y, z] | python | def cross(v, w):
"""
cross product of two vectors
"""
x = v[1] * w[2] - v[2] * w[1]
y = v[2] * w[0] - v[0] * w[2]
z = v[0] * w[1] - v[1] * w[0]
return [x, y, z] | [
"def",
"cross",
"(",
"v",
",",
"w",
")",
":",
"x",
"=",
"v",
"[",
"1",
"]",
"*",
"w",
"[",
"2",
"]",
"-",
"v",
"[",
"2",
"]",
"*",
"w",
"[",
"1",
"]",
"y",
"=",
"v",
"[",
"2",
"]",
"*",
"w",
"[",
"0",
"]",
"-",
"v",
"[",
"0",
"]... | cross product of two vectors | [
"cross",
"product",
"of",
"two",
"vectors"
] | train | https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/pmag.py#L6702-L6709 |
PmagPy/PmagPy | pmagpy/pmag.py | dosgeo | def dosgeo(s, az, pl):
"""
rotates matrix a to az,pl returns s
Parameters
__________
s : [x11,x22,x33,x12,x23,x13] - the six tensor elements
az : the azimuth of the specimen X direction
pl : the plunge (inclination) of the specimen X direction
Return
s_rot : [x11,x22,x33,x12,x23,x... | python | def dosgeo(s, az, pl):
"""
rotates matrix a to az,pl returns s
Parameters
__________
s : [x11,x22,x33,x12,x23,x13] - the six tensor elements
az : the azimuth of the specimen X direction
pl : the plunge (inclination) of the specimen X direction
Return
s_rot : [x11,x22,x33,x12,x23,x... | [
"def",
"dosgeo",
"(",
"s",
",",
"az",
",",
"pl",
")",
":",
"#",
"a",
"=",
"s2a",
"(",
"s",
")",
"# convert to 3,3 matrix",
"# first get three orthogonal axes",
"X1",
"=",
"dir2cart",
"(",
"(",
"az",
",",
"pl",
",",
"1.",
")",
")",
"X2",
"=",
"dir2ca... | rotates matrix a to az,pl returns s
Parameters
__________
s : [x11,x22,x33,x12,x23,x13] - the six tensor elements
az : the azimuth of the specimen X direction
pl : the plunge (inclination) of the specimen X direction
Return
s_rot : [x11,x22,x33,x12,x23,x13] - after rotation | [
"rotates",
"matrix",
"a",
"to",
"az",
"pl",
"returns",
"s",
"Parameters",
"__________",
"s",
":",
"[",
"x11",
"x22",
"x33",
"x12",
"x23",
"x13",
"]",
"-",
"the",
"six",
"tensor",
"elements",
"az",
":",
"the",
"azimuth",
"of",
"the",
"specimen",
"X",
... | train | https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/pmag.py#L6713-L6741 |
PmagPy/PmagPy | pmagpy/pmag.py | dostilt | def dostilt(s, bed_az, bed_dip):
"""
Rotates "s" tensor to stratigraphic coordinates
Parameters
__________
s : [x11,x22,x33,x12,x23,x13] - the six tensor elements
bed_az : bedding dip direction
bed_dip : bedding dip
Return
s_rot : [x11,x22,x33,x12,x23,x13] - after rotation
""... | python | def dostilt(s, bed_az, bed_dip):
"""
Rotates "s" tensor to stratigraphic coordinates
Parameters
__________
s : [x11,x22,x33,x12,x23,x13] - the six tensor elements
bed_az : bedding dip direction
bed_dip : bedding dip
Return
s_rot : [x11,x22,x33,x12,x23,x13] - after rotation
""... | [
"def",
"dostilt",
"(",
"s",
",",
"bed_az",
",",
"bed_dip",
")",
":",
"tau",
",",
"Vdirs",
"=",
"doseigs",
"(",
"s",
")",
"Vrot",
"=",
"[",
"]",
"for",
"evec",
"in",
"Vdirs",
":",
"d",
",",
"i",
"=",
"dotilt",
"(",
"evec",
"[",
"0",
"]",
",",
... | Rotates "s" tensor to stratigraphic coordinates
Parameters
__________
s : [x11,x22,x33,x12,x23,x13] - the six tensor elements
bed_az : bedding dip direction
bed_dip : bedding dip
Return
s_rot : [x11,x22,x33,x12,x23,x13] - after rotation | [
"Rotates",
"s",
"tensor",
"to",
"stratigraphic",
"coordinates"
] | train | https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/pmag.py#L6746-L6766 |
PmagPy/PmagPy | pmagpy/pmag.py | apseudo | def apseudo(Ss, ipar, sigma):
"""
draw a bootstrap sample of Ss
"""
#
Is = random.randint(0, len(Ss) - 1, size=len(Ss)) # draw N random integers
#Ss = np.array(Ss)
if not ipar: # ipar == 0:
BSs = Ss[Is]
else: # need to recreate measurement - then do the parametric stuffr
A... | python | def apseudo(Ss, ipar, sigma):
"""
draw a bootstrap sample of Ss
"""
#
Is = random.randint(0, len(Ss) - 1, size=len(Ss)) # draw N random integers
#Ss = np.array(Ss)
if not ipar: # ipar == 0:
BSs = Ss[Is]
else: # need to recreate measurement - then do the parametric stuffr
A... | [
"def",
"apseudo",
"(",
"Ss",
",",
"ipar",
",",
"sigma",
")",
":",
"#",
"Is",
"=",
"random",
".",
"randint",
"(",
"0",
",",
"len",
"(",
"Ss",
")",
"-",
"1",
",",
"size",
"=",
"len",
"(",
"Ss",
")",
")",
"# draw N random integers",
"#Ss = np.array(Ss... | draw a bootstrap sample of Ss | [
"draw",
"a",
"bootstrap",
"sample",
"of",
"Ss"
] | train | https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/pmag.py#L6771-L6788 |
PmagPy/PmagPy | pmagpy/pmag.py | sbootpars | def sbootpars(Taus, Vs):
"""
get bootstrap parameters for s data
"""
#
Tau1s, Tau2s, Tau3s = [], [], []
V1s, V2s, V3s = [], [], []
nb = len(Taus)
bpars = {}
for k in range(nb):
Tau1s.append(Taus[k][0])
Tau2s.append(Taus[k][1])
Tau3s.append(Taus[k][2])
V1s... | python | def sbootpars(Taus, Vs):
"""
get bootstrap parameters for s data
"""
#
Tau1s, Tau2s, Tau3s = [], [], []
V1s, V2s, V3s = [], [], []
nb = len(Taus)
bpars = {}
for k in range(nb):
Tau1s.append(Taus[k][0])
Tau2s.append(Taus[k][1])
Tau3s.append(Taus[k][2])
V1s... | [
"def",
"sbootpars",
"(",
"Taus",
",",
"Vs",
")",
":",
"#",
"Tau1s",
",",
"Tau2s",
",",
"Tau3s",
"=",
"[",
"]",
",",
"[",
"]",
",",
"[",
"]",
"V1s",
",",
"V2s",
",",
"V3s",
"=",
"[",
"]",
",",
"[",
"]",
",",
"[",
"]",
"nb",
"=",
"len",
"... | get bootstrap parameters for s data | [
"get",
"bootstrap",
"parameters",
"for",
"s",
"data"
] | train | https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/pmag.py#L6792-L6844 |
PmagPy/PmagPy | pmagpy/pmag.py | s_boot | def s_boot(Ss, ipar=0, nb=1000):
"""
Returns bootstrap parameters for S data
Parameters
__________
Ss : nested array of [[x11 x22 x33 x12 x23 x13],....] data
ipar : if True, do a parametric bootstrap
nb : number of bootstraps
Returns
________
Tmean : average eigenvalues
Vme... | python | def s_boot(Ss, ipar=0, nb=1000):
"""
Returns bootstrap parameters for S data
Parameters
__________
Ss : nested array of [[x11 x22 x33 x12 x23 x13],....] data
ipar : if True, do a parametric bootstrap
nb : number of bootstraps
Returns
________
Tmean : average eigenvalues
Vme... | [
"def",
"s_boot",
"(",
"Ss",
",",
"ipar",
"=",
"0",
",",
"nb",
"=",
"1000",
")",
":",
"#npts = len(Ss)",
"Ss",
"=",
"np",
".",
"array",
"(",
"Ss",
")",
"npts",
"=",
"Ss",
".",
"shape",
"[",
"0",
"]",
"# get average s for whole dataset",
"nf",
",",
"... | Returns bootstrap parameters for S data
Parameters
__________
Ss : nested array of [[x11 x22 x33 x12 x23 x13],....] data
ipar : if True, do a parametric bootstrap
nb : number of bootstraps
Returns
________
Tmean : average eigenvalues
Vmean : average eigvectors
Taus : bootstrapp... | [
"Returns",
"bootstrap",
"parameters",
"for",
"S",
"data"
] | train | https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/pmag.py#L6849-L6886 |
PmagPy/PmagPy | pmagpy/pmag.py | designAARM | def designAARM(npos):
#
"""
calculates B matrix for AARM calculations.
"""
if npos != 9:
print('Sorry - only 9 positions available')
return
Dec = [315., 225., 180., 135., 45., 90., 270.,
270., 270., 90., 0., 0., 0., 180., 180.]
Dip = [0., 0., 0., 0., 0., -45., -45.... | python | def designAARM(npos):
#
"""
calculates B matrix for AARM calculations.
"""
if npos != 9:
print('Sorry - only 9 positions available')
return
Dec = [315., 225., 180., 135., 45., 90., 270.,
270., 270., 90., 0., 0., 0., 180., 180.]
Dip = [0., 0., 0., 0., 0., -45., -45.... | [
"def",
"designAARM",
"(",
"npos",
")",
":",
"#",
"if",
"npos",
"!=",
"9",
":",
"print",
"(",
"'Sorry - only 9 positions available'",
")",
"return",
"Dec",
"=",
"[",
"315.",
",",
"225.",
",",
"180.",
",",
"135.",
",",
"45.",
",",
"90.",
",",
"270.",
"... | calculates B matrix for AARM calculations. | [
"calculates",
"B",
"matrix",
"for",
"AARM",
"calculations",
"."
] | train | https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/pmag.py#L6891-L6937 |
PmagPy/PmagPy | pmagpy/pmag.py | domagicmag | def domagicmag(file, Recs):
"""
converts a magic record back into the SIO mag format
"""
for rec in Recs:
type = ".0"
meths = []
tmp = rec["magic_method_codes"].split(':')
for meth in tmp:
meths.append(meth.strip())
if 'LT-T-I' in meths:
ty... | python | def domagicmag(file, Recs):
"""
converts a magic record back into the SIO mag format
"""
for rec in Recs:
type = ".0"
meths = []
tmp = rec["magic_method_codes"].split(':')
for meth in tmp:
meths.append(meth.strip())
if 'LT-T-I' in meths:
ty... | [
"def",
"domagicmag",
"(",
"file",
",",
"Recs",
")",
":",
"for",
"rec",
"in",
"Recs",
":",
"type",
"=",
"\".0\"",
"meths",
"=",
"[",
"]",
"tmp",
"=",
"rec",
"[",
"\"magic_method_codes\"",
"]",
".",
"split",
"(",
"':'",
")",
"for",
"meth",
"in",
"tmp... | converts a magic record back into the SIO mag format | [
"converts",
"a",
"magic",
"record",
"back",
"into",
"the",
"SIO",
"mag",
"format"
] | train | https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/pmag.py#L6989-L7011 |
PmagPy/PmagPy | pmagpy/pmag.py | cleanup | def cleanup(first_I, first_Z):
"""
cleans up unbalanced steps
failure can be from unbalanced final step, or from missing steps,
this takes care of missing steps
"""
cont = 0
Nmin = len(first_I)
if len(first_Z) < Nmin:
Nmin = len(first_Z)
for kk in range(Nmin):
if ... | python | def cleanup(first_I, first_Z):
"""
cleans up unbalanced steps
failure can be from unbalanced final step, or from missing steps,
this takes care of missing steps
"""
cont = 0
Nmin = len(first_I)
if len(first_Z) < Nmin:
Nmin = len(first_Z)
for kk in range(Nmin):
if ... | [
"def",
"cleanup",
"(",
"first_I",
",",
"first_Z",
")",
":",
"cont",
"=",
"0",
"Nmin",
"=",
"len",
"(",
"first_I",
")",
"if",
"len",
"(",
"first_Z",
")",
"<",
"Nmin",
":",
"Nmin",
"=",
"len",
"(",
"first_Z",
")",
"for",
"kk",
"in",
"range",
"(",
... | cleans up unbalanced steps
failure can be from unbalanced final step, or from missing steps,
this takes care of missing steps | [
"cleans",
"up",
"unbalanced",
"steps",
"failure",
"can",
"be",
"from",
"unbalanced",
"final",
"step",
"or",
"from",
"missing",
"steps",
"this",
"takes",
"care",
"of",
"missing",
"steps"
] | train | https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/pmag.py#L7016-L7037 |
PmagPy/PmagPy | pmagpy/pmag.py | sortarai | def sortarai(datablock, s, Zdiff, **kwargs):
"""
sorts data block in to first_Z, first_I, etc.
Parameters
_________
datablock : Pandas DataFrame with Thellier-Tellier type data
s : specimen name
Zdiff : if True, take difference in Z values instead of vector difference
NB: this... | python | def sortarai(datablock, s, Zdiff, **kwargs):
"""
sorts data block in to first_Z, first_I, etc.
Parameters
_________
datablock : Pandas DataFrame with Thellier-Tellier type data
s : specimen name
Zdiff : if True, take difference in Z values instead of vector difference
NB: this... | [
"def",
"sortarai",
"(",
"datablock",
",",
"s",
",",
"Zdiff",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"'version'",
"in",
"list",
"(",
"kwargs",
".",
"keys",
"(",
")",
")",
"and",
"kwargs",
"[",
"'version'",
"]",
"==",
"3",
":",
"dec_key",
",",
"i... | sorts data block in to first_Z, first_I, etc.
Parameters
_________
datablock : Pandas DataFrame with Thellier-Tellier type data
s : specimen name
Zdiff : if True, take difference in Z values instead of vector difference
NB: this should always be False
**kwargs :
version : d... | [
"sorts",
"data",
"block",
"in",
"to",
"first_Z",
"first_I",
"etc",
"."
] | train | https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/pmag.py#L7042-L7240 |
PmagPy/PmagPy | pmagpy/pmag.py | sortmwarai | def sortmwarai(datablock, exp_type):
"""
sorts microwave double heating data block in to first_Z, first_I, etc.
"""
first_Z, first_I, ptrm_check, ptrm_tail, zptrm_check = [], [], [], [], []
field, phi, theta = "", "", ""
POWT_I, POWT_Z, POWT_PZ, POWT_PI, POWT_M = [], [], [], [], []
ISteps, ... | python | def sortmwarai(datablock, exp_type):
"""
sorts microwave double heating data block in to first_Z, first_I, etc.
"""
first_Z, first_I, ptrm_check, ptrm_tail, zptrm_check = [], [], [], [], []
field, phi, theta = "", "", ""
POWT_I, POWT_Z, POWT_PZ, POWT_PI, POWT_M = [], [], [], [], []
ISteps, ... | [
"def",
"sortmwarai",
"(",
"datablock",
",",
"exp_type",
")",
":",
"first_Z",
",",
"first_I",
",",
"ptrm_check",
",",
"ptrm_tail",
",",
"zptrm_check",
"=",
"[",
"]",
",",
"[",
"]",
",",
"[",
"]",
",",
"[",
"]",
",",
"[",
"]",
"field",
",",
"phi",
... | sorts microwave double heating data block in to first_Z, first_I, etc. | [
"sorts",
"microwave",
"double",
"heating",
"data",
"block",
"in",
"to",
"first_Z",
"first_I",
"etc",
"."
] | train | https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/pmag.py#L7243-L7424 |
PmagPy/PmagPy | pmagpy/pmag.py | docustom | def docustom(lon, lat, alt, gh):
"""
Passes the coefficients to the Malin and Barraclough
routine (function pmag.magsyn) to calculate the field from the coefficients.
Parameters:
-----------
lon = east longitude in degrees (0 to 360 or -180 to 180)
lat = latitude in degrees (-90 to 90)
... | python | def docustom(lon, lat, alt, gh):
"""
Passes the coefficients to the Malin and Barraclough
routine (function pmag.magsyn) to calculate the field from the coefficients.
Parameters:
-----------
lon = east longitude in degrees (0 to 360 or -180 to 180)
lat = latitude in degrees (-90 to 90)
... | [
"def",
"docustom",
"(",
"lon",
",",
"lat",
",",
"alt",
",",
"gh",
")",
":",
"model",
",",
"date",
",",
"itype",
"=",
"0",
",",
"0",
",",
"1",
"sv",
"=",
"np",
".",
"zeros",
"(",
"len",
"(",
"gh",
")",
")",
"colat",
"=",
"90.",
"-",
"lat",
... | Passes the coefficients to the Malin and Barraclough
routine (function pmag.magsyn) to calculate the field from the coefficients.
Parameters:
-----------
lon = east longitude in degrees (0 to 360 or -180 to 180)
lat = latitude in degrees (-90 to 90)
alt = height above mean sea level in km ... | [
"Passes",
"the",
"coefficients",
"to",
"the",
"Malin",
"and",
"Barraclough",
"routine",
"(",
"function",
"pmag",
".",
"magsyn",
")",
"to",
"calculate",
"the",
"field",
"from",
"the",
"coefficients",
"."
] | train | https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/pmag.py#L7429-L7444 |
PmagPy/PmagPy | pmagpy/pmag.py | doigrf | def doigrf(lon, lat, alt, date, **kwargs):
"""
Calculates the interpolated (<2015) or extrapolated (>2015) main field and
secular variation coefficients and passes them to the Malin and Barraclough
routine (function pmag.magsyn) to calculate the field from the coefficients.
Parameters:
--------... | python | def doigrf(lon, lat, alt, date, **kwargs):
"""
Calculates the interpolated (<2015) or extrapolated (>2015) main field and
secular variation coefficients and passes them to the Malin and Barraclough
routine (function pmag.magsyn) to calculate the field from the coefficients.
Parameters:
--------... | [
"def",
"doigrf",
"(",
"lon",
",",
"lat",
",",
"alt",
",",
"date",
",",
"*",
"*",
"kwargs",
")",
":",
"from",
".",
"import",
"coefficients",
"as",
"cf",
"gh",
",",
"sv",
"=",
"[",
"]",
",",
"[",
"]",
"colat",
"=",
"90.",
"-",
"lat",
"#! convert ... | Calculates the interpolated (<2015) or extrapolated (>2015) main field and
secular variation coefficients and passes them to the Malin and Barraclough
routine (function pmag.magsyn) to calculate the field from the coefficients.
Parameters:
-----------
lon : east longitude in degrees (0 to 360 or -... | [
"Calculates",
"the",
"interpolated",
"(",
"<2015",
")",
"or",
"extrapolated",
"(",
">",
"2015",
")",
"main",
"field",
"and",
"secular",
"variation",
"coefficients",
"and",
"passes",
"them",
"to",
"the",
"Malin",
"and",
"Barraclough",
"routine",
"(",
"function"... | train | https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/pmag.py#L7447-L7573 |
PmagPy/PmagPy | pmagpy/pmag.py | unpack | def unpack(gh):
"""
unpacks gh list into l m g h type list
Parameters
_________
gh : list of gauss coefficients (as returned by, e.g., doigrf)
Returns
data : nested list of [[l,m,g,h],...]
"""
data = []
k, l = 0, 1
while k + 1 < len(gh):
for m in range(l + 1):
... | python | def unpack(gh):
"""
unpacks gh list into l m g h type list
Parameters
_________
gh : list of gauss coefficients (as returned by, e.g., doigrf)
Returns
data : nested list of [[l,m,g,h],...]
"""
data = []
k, l = 0, 1
while k + 1 < len(gh):
for m in range(l + 1):
... | [
"def",
"unpack",
"(",
"gh",
")",
":",
"data",
"=",
"[",
"]",
"k",
",",
"l",
"=",
"0",
",",
"1",
"while",
"k",
"+",
"1",
"<",
"len",
"(",
"gh",
")",
":",
"for",
"m",
"in",
"range",
"(",
"l",
"+",
"1",
")",
":",
"if",
"m",
"==",
"0",
":... | unpacks gh list into l m g h type list
Parameters
_________
gh : list of gauss coefficients (as returned by, e.g., doigrf)
Returns
data : nested list of [[l,m,g,h],...] | [
"unpacks",
"gh",
"list",
"into",
"l",
"m",
"g",
"h",
"type",
"list"
] | train | https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/pmag.py#L7577-L7600 |
PmagPy/PmagPy | pmagpy/pmag.py | magsyn | def magsyn(gh, sv, b, date, itype, alt, colat, elong):
"""
# Computes x, y, z, and f for a given date and position, from the
# spherical harmonic coefficients of the International Geomagnetic
# Reference Field (IGRF).
# From Malin and Barraclough (1981), Computers and Geosciences, V.7, 401-405.
#
# Input:
# d... | python | def magsyn(gh, sv, b, date, itype, alt, colat, elong):
"""
# Computes x, y, z, and f for a given date and position, from the
# spherical harmonic coefficients of the International Geomagnetic
# Reference Field (IGRF).
# From Malin and Barraclough (1981), Computers and Geosciences, V.7, 401-405.
#
# Input:
# d... | [
"def",
"magsyn",
"(",
"gh",
",",
"sv",
",",
"b",
",",
"date",
",",
"itype",
",",
"alt",
",",
"colat",
",",
"elong",
")",
":",
"#",
"# real gh(120),sv(120),p(66),q(66),cl(10),sl(10)",
"# real begin,dateq",
"p",
"=",
"np",
".",
"zeros",
"(",
... | # Computes x, y, z, and f for a given date and position, from the
# spherical harmonic coefficients of the International Geomagnetic
# Reference Field (IGRF).
# From Malin and Barraclough (1981), Computers and Geosciences, V.7, 401-405.
#
# Input:
# date = Required date in years and decimals of a year (A.D.)
# ... | [
"#",
"Computes",
"x",
"y",
"z",
"and",
"f",
"for",
"a",
"given",
"date",
"and",
"position",
"from",
"the",
"#",
"spherical",
"harmonic",
"coefficients",
"of",
"the",
"International",
"Geomagnetic",
"#",
"Reference",
"Field",
"(",
"IGRF",
")",
".",
"#",
"... | train | https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/pmag.py#L7603-L7740 |
PmagPy/PmagPy | pmagpy/pmag.py | measurements_methods | def measurements_methods(meas_data, noave):
"""
get list of unique specs
"""
#
version_num = get_version()
sids = get_specs(meas_data)
# list of measurement records for this specimen
#
# step through spec by spec
#
SpecTmps, SpecOuts = [], []
for spec in sids:
TRM, IRM3D, ATRM, CR =... | python | def measurements_methods(meas_data, noave):
"""
get list of unique specs
"""
#
version_num = get_version()
sids = get_specs(meas_data)
# list of measurement records for this specimen
#
# step through spec by spec
#
SpecTmps, SpecOuts = [], []
for spec in sids:
TRM, IRM3D, ATRM, CR =... | [
"def",
"measurements_methods",
"(",
"meas_data",
",",
"noave",
")",
":",
"#",
"version_num",
"=",
"get_version",
"(",
")",
"sids",
"=",
"get_specs",
"(",
"meas_data",
")",
"# list of measurement records for this specimen",
"#",
"# step through spec by spec",
"#",
"Sp... | get list of unique specs | [
"get",
"list",
"of",
"unique",
"specs"
] | train | https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/pmag.py#L7745-L8254 |
PmagPy/PmagPy | pmagpy/pmag.py | parse_site | def parse_site(sample, convention, Z):
"""
parse the site name from the sample name using the specified convention
"""
convention = str(convention)
site = sample # default is that site = sample
#
#
# Sample is final letter on site designation eg: TG001a (used by SIO lab
# in San Diego)
if conv... | python | def parse_site(sample, convention, Z):
"""
parse the site name from the sample name using the specified convention
"""
convention = str(convention)
site = sample # default is that site = sample
#
#
# Sample is final letter on site designation eg: TG001a (used by SIO lab
# in San Diego)
if conv... | [
"def",
"parse_site",
"(",
"sample",
",",
"convention",
",",
"Z",
")",
":",
"convention",
"=",
"str",
"(",
"convention",
")",
"site",
"=",
"sample",
"# default is that site = sample",
"#",
"#",
"# Sample is final letter on site designation eg: TG001a (used by SIO lab",
... | parse the site name from the sample name using the specified convention | [
"parse",
"the",
"site",
"name",
"from",
"the",
"sample",
"name",
"using",
"the",
"specified",
"convention"
] | train | https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/pmag.py#L8933-L8981 |
PmagPy/PmagPy | pmagpy/pmag.py | get_samp_con | def get_samp_con():
"""
get sample naming convention
"""
#
samp_con, Z = "", ""
while samp_con == "":
samp_con = input("""
Sample naming convention:
[1] XXXXY: where XXXX is an arbitrary length site designation and Y
is the single character sample design... | python | def get_samp_con():
"""
get sample naming convention
"""
#
samp_con, Z = "", ""
while samp_con == "":
samp_con = input("""
Sample naming convention:
[1] XXXXY: where XXXX is an arbitrary length site designation and Y
is the single character sample design... | [
"def",
"get_samp_con",
"(",
")",
":",
"#",
"samp_con",
",",
"Z",
"=",
"\"\"",
",",
"\"\"",
"while",
"samp_con",
"==",
"\"\"",
":",
"samp_con",
"=",
"input",
"(",
"\"\"\"\n Sample naming convention:\n [1] XXXXY: where XXXX is an arbitrary length site desi... | get sample naming convention | [
"get",
"sample",
"naming",
"convention"
] | train | https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/pmag.py#L8984-L9026 |
PmagPy/PmagPy | pmagpy/pmag.py | get_tilt | def get_tilt(dec_geo, inc_geo, dec_tilt, inc_tilt):
"""
Function to return the dip direction and dip that would yield the tilt
corrected direction if applied to the uncorrected direction (geographic
coordinates)
Parameters
----------
dec_geo : declination in geographic coordinates
inc_g... | python | def get_tilt(dec_geo, inc_geo, dec_tilt, inc_tilt):
"""
Function to return the dip direction and dip that would yield the tilt
corrected direction if applied to the uncorrected direction (geographic
coordinates)
Parameters
----------
dec_geo : declination in geographic coordinates
inc_g... | [
"def",
"get_tilt",
"(",
"dec_geo",
",",
"inc_geo",
",",
"dec_tilt",
",",
"inc_tilt",
")",
":",
"# strike is horizontal line equidistant from two input directions",
"SCart",
"=",
"[",
"0",
",",
"0",
",",
"0",
"]",
"# cartesian coordites of Strike",
"SCart",
"[",
"2",... | Function to return the dip direction and dip that would yield the tilt
corrected direction if applied to the uncorrected direction (geographic
coordinates)
Parameters
----------
dec_geo : declination in geographic coordinates
inc_geo : inclination in geographic coordinates
dec_tilt : declin... | [
"Function",
"to",
"return",
"the",
"dip",
"direction",
"and",
"dip",
"that",
"would",
"yield",
"the",
"tilt",
"corrected",
"direction",
"if",
"applied",
"to",
"the",
"uncorrected",
"direction",
"(",
"geographic",
"coordinates",
")"
] | train | https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/pmag.py#L9029-L9069 |
PmagPy/PmagPy | pmagpy/pmag.py | get_azpl | def get_azpl(cdec, cinc, gdec, ginc):
"""
gets azimuth and pl from specimen dec inc (cdec,cinc) and gdec,ginc (geographic) coordinates
"""
TOL = 1e-4
rad = old_div(np.pi, 180.)
Xp = dir2cart([gdec, ginc, 1.])
X = dir2cart([cdec, cinc, 1.])
# find plunge first
az, pl, zdif, ang = 0.... | python | def get_azpl(cdec, cinc, gdec, ginc):
"""
gets azimuth and pl from specimen dec inc (cdec,cinc) and gdec,ginc (geographic) coordinates
"""
TOL = 1e-4
rad = old_div(np.pi, 180.)
Xp = dir2cart([gdec, ginc, 1.])
X = dir2cart([cdec, cinc, 1.])
# find plunge first
az, pl, zdif, ang = 0.... | [
"def",
"get_azpl",
"(",
"cdec",
",",
"cinc",
",",
"gdec",
",",
"ginc",
")",
":",
"TOL",
"=",
"1e-4",
"rad",
"=",
"old_div",
"(",
"np",
".",
"pi",
",",
"180.",
")",
"Xp",
"=",
"dir2cart",
"(",
"[",
"gdec",
",",
"ginc",
",",
"1.",
"]",
")",
"X"... | gets azimuth and pl from specimen dec inc (cdec,cinc) and gdec,ginc (geographic) coordinates | [
"gets",
"azimuth",
"and",
"pl",
"from",
"specimen",
"dec",
"inc",
"(",
"cdec",
"cinc",
")",
"and",
"gdec",
"ginc",
"(",
"geographic",
")",
"coordinates"
] | train | https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/pmag.py#L9073-L9092 |
PmagPy/PmagPy | pmagpy/pmag.py | set_priorities | def set_priorities(SO_methods, ask):
"""
figure out which sample_azimuth to use, if multiple orientation methods
"""
# if ask set to 1, then can change priorities
SO_methods = [meth.strip() for meth in SO_methods]
SO_defaults = ['SO-SUN', 'SO-GPS-DIFF', 'SO-SUN-SIGHT', 'SO-SIGHT', 'SO-SIGHT-BS'... | python | def set_priorities(SO_methods, ask):
"""
figure out which sample_azimuth to use, if multiple orientation methods
"""
# if ask set to 1, then can change priorities
SO_methods = [meth.strip() for meth in SO_methods]
SO_defaults = ['SO-SUN', 'SO-GPS-DIFF', 'SO-SUN-SIGHT', 'SO-SIGHT', 'SO-SIGHT-BS'... | [
"def",
"set_priorities",
"(",
"SO_methods",
",",
"ask",
")",
":",
"# if ask set to 1, then can change priorities",
"SO_methods",
"=",
"[",
"meth",
".",
"strip",
"(",
")",
"for",
"meth",
"in",
"SO_methods",
"]",
"SO_defaults",
"=",
"[",
"'SO-SUN'",
",",
"'SO-GPS-... | figure out which sample_azimuth to use, if multiple orientation methods | [
"figure",
"out",
"which",
"sample_azimuth",
"to",
"use",
"if",
"multiple",
"orientation",
"methods"
] | train | https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/pmag.py#L9095-L9130 |
PmagPy/PmagPy | pmagpy/pmag.py | get_EOL | def get_EOL(file):
"""
find EOL of input file (whether mac,PC or unix format)
"""
f = open(file, 'r')
firstline = f.read(350)
EOL = ""
for k in range(350):
if firstline[k:k + 2] == "\r\n":
print(file, ' appears to be a dos file')
EOL = '\r\n'
brea... | python | def get_EOL(file):
"""
find EOL of input file (whether mac,PC or unix format)
"""
f = open(file, 'r')
firstline = f.read(350)
EOL = ""
for k in range(350):
if firstline[k:k + 2] == "\r\n":
print(file, ' appears to be a dos file')
EOL = '\r\n'
brea... | [
"def",
"get_EOL",
"(",
"file",
")",
":",
"f",
"=",
"open",
"(",
"file",
",",
"'r'",
")",
"firstline",
"=",
"f",
".",
"read",
"(",
"350",
")",
"EOL",
"=",
"\"\"",
"for",
"k",
"in",
"range",
"(",
"350",
")",
":",
"if",
"firstline",
"[",
"k",
":... | find EOL of input file (whether mac,PC or unix format) | [
"find",
"EOL",
"of",
"input",
"file",
"(",
"whether",
"mac",
"PC",
"or",
"unix",
"format",
")"
] | train | https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/pmag.py#L9135-L9156 |
PmagPy/PmagPy | pmagpy/pmag.py | sortshaw | def sortshaw(s, datablock):
"""
sorts data block in to ARM1,ARM2 NRM,TRM,ARM1,ARM2=[],[],[],[]
stick first zero field stuff into first_Z
"""
for rec in datablock:
methcodes = rec["magic_method_codes"].split(":")
step = float(rec["treatment_ac_field"])
str = float(rec["meas... | python | def sortshaw(s, datablock):
"""
sorts data block in to ARM1,ARM2 NRM,TRM,ARM1,ARM2=[],[],[],[]
stick first zero field stuff into first_Z
"""
for rec in datablock:
methcodes = rec["magic_method_codes"].split(":")
step = float(rec["treatment_ac_field"])
str = float(rec["meas... | [
"def",
"sortshaw",
"(",
"s",
",",
"datablock",
")",
":",
"for",
"rec",
"in",
"datablock",
":",
"methcodes",
"=",
"rec",
"[",
"\"magic_method_codes\"",
"]",
".",
"split",
"(",
"\":\"",
")",
"step",
"=",
"float",
"(",
"rec",
"[",
"\"treatment_ac_field\"",
... | sorts data block in to ARM1,ARM2 NRM,TRM,ARM1,ARM2=[],[],[],[]
stick first zero field stuff into first_Z | [
"sorts",
"data",
"block",
"in",
"to",
"ARM1",
"ARM2",
"NRM",
"TRM",
"ARM1",
"ARM2",
"=",
"[]",
"[]",
"[]",
"[]",
"stick",
"first",
"zero",
"field",
"stuff",
"into",
"first_Z"
] | train | https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/pmag.py#L9160-L9218 |
PmagPy/PmagPy | pmagpy/pmag.py | getvec | def getvec(gh, lat, lon):
"""
Evaluates the vector at a given latitude and longitude for a specified
set of coefficients
Parameters
----------
gh : a list of gauss coefficients
lat : latitude of location
long : longitude of location
Returns
-------
vec : direction in [dec, ... | python | def getvec(gh, lat, lon):
"""
Evaluates the vector at a given latitude and longitude for a specified
set of coefficients
Parameters
----------
gh : a list of gauss coefficients
lat : latitude of location
long : longitude of location
Returns
-------
vec : direction in [dec, ... | [
"def",
"getvec",
"(",
"gh",
",",
"lat",
",",
"lon",
")",
":",
"sv",
"=",
"[",
"]",
"pad",
"=",
"120",
"-",
"len",
"(",
"gh",
")",
"for",
"x",
"in",
"range",
"(",
"pad",
")",
":",
"gh",
".",
"append",
"(",
"0.",
")",
"for",
"x",
"in",
"ran... | Evaluates the vector at a given latitude and longitude for a specified
set of coefficients
Parameters
----------
gh : a list of gauss coefficients
lat : latitude of location
long : longitude of location
Returns
-------
vec : direction in [dec, inc, intensity] | [
"Evaluates",
"the",
"vector",
"at",
"a",
"given",
"latitude",
"and",
"longitude",
"for",
"a",
"specified",
"set",
"of",
"coefficients"
] | train | https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/pmag.py#L9233-L9261 |
PmagPy/PmagPy | pmagpy/pmag.py | s_l | def s_l(l, alpha):
"""
get sigma as a function of degree l from Constable and Parker (1988)
"""
a2 = alpha**2
c_a = 0.547
s_l = np.sqrt(old_div(((c_a**(2. * l)) * a2), ((l + 1.) * (2. * l + 1.))))
return s_l | python | def s_l(l, alpha):
"""
get sigma as a function of degree l from Constable and Parker (1988)
"""
a2 = alpha**2
c_a = 0.547
s_l = np.sqrt(old_div(((c_a**(2. * l)) * a2), ((l + 1.) * (2. * l + 1.))))
return s_l | [
"def",
"s_l",
"(",
"l",
",",
"alpha",
")",
":",
"a2",
"=",
"alpha",
"**",
"2",
"c_a",
"=",
"0.547",
"s_l",
"=",
"np",
".",
"sqrt",
"(",
"old_div",
"(",
"(",
"(",
"c_a",
"**",
"(",
"2.",
"*",
"l",
")",
")",
"*",
"a2",
")",
",",
"(",
"(",
... | get sigma as a function of degree l from Constable and Parker (1988) | [
"get",
"sigma",
"as",
"a",
"function",
"of",
"degree",
"l",
"from",
"Constable",
"and",
"Parker",
"(",
"1988",
")"
] | train | https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/pmag.py#L9264-L9271 |
PmagPy/PmagPy | pmagpy/pmag.py | mktk03 | def mktk03(terms, seed, G2, G3):
"""
generates a list of gauss coefficients drawn from the TK03 distribution
"""
# random.seed(n)
p = 0
n = seed
gh = []
g10, sfact, afact = -18e3, 3.8, 2.4
g20 = G2 * g10
g30 = G3 * g10
alpha = g10/afact
s1 = s_l(1, alpha)
s10 = sfact * s1... | python | def mktk03(terms, seed, G2, G3):
"""
generates a list of gauss coefficients drawn from the TK03 distribution
"""
# random.seed(n)
p = 0
n = seed
gh = []
g10, sfact, afact = -18e3, 3.8, 2.4
g20 = G2 * g10
g30 = G3 * g10
alpha = g10/afact
s1 = s_l(1, alpha)
s10 = sfact * s1... | [
"def",
"mktk03",
"(",
"terms",
",",
"seed",
",",
"G2",
",",
"G3",
")",
":",
"# random.seed(n)",
"p",
"=",
"0",
"n",
"=",
"seed",
"gh",
"=",
"[",
"]",
"g10",
",",
"sfact",
",",
"afact",
"=",
"-",
"18e3",
",",
"3.8",
",",
"2.4",
"g20",
"=",
"G2... | generates a list of gauss coefficients drawn from the TK03 distribution | [
"generates",
"a",
"list",
"of",
"gauss",
"coefficients",
"drawn",
"from",
"the",
"TK03",
"distribution"
] | train | https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/pmag.py#L9275-L9319 |
PmagPy/PmagPy | pmagpy/pmag.py | pinc | def pinc(lat):
"""
calculate paleoinclination from latitude using dipole formula: tan(I) = 2tan(lat)
Parameters
________________
lat : either a single value or an array of latitudes
Returns
-------
array of inclinations
"""
tanl = np.tan(np.radians(lat))
inc = np.arctan(2.... | python | def pinc(lat):
"""
calculate paleoinclination from latitude using dipole formula: tan(I) = 2tan(lat)
Parameters
________________
lat : either a single value or an array of latitudes
Returns
-------
array of inclinations
"""
tanl = np.tan(np.radians(lat))
inc = np.arctan(2.... | [
"def",
"pinc",
"(",
"lat",
")",
":",
"tanl",
"=",
"np",
".",
"tan",
"(",
"np",
".",
"radians",
"(",
"lat",
")",
")",
"inc",
"=",
"np",
".",
"arctan",
"(",
"2.",
"*",
"tanl",
")",
"return",
"np",
".",
"degrees",
"(",
"inc",
")"
] | calculate paleoinclination from latitude using dipole formula: tan(I) = 2tan(lat)
Parameters
________________
lat : either a single value or an array of latitudes
Returns
-------
array of inclinations | [
"calculate",
"paleoinclination",
"from",
"latitude",
"using",
"dipole",
"formula",
":",
"tan",
"(",
"I",
")",
"=",
"2tan",
"(",
"lat",
")",
"Parameters",
"________________"
] | train | https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/pmag.py#L9324-L9339 |
PmagPy/PmagPy | pmagpy/pmag.py | plat | def plat(inc):
"""
calculate paleolatitude from inclination using dipole formula: tan(I) = 2tan(lat)
Parameters
________________
inc : either a single value or an array of inclinations
Returns
-------
array of latitudes
"""
tani = np.tan(np.radians(inc))
lat = np.arctan(ta... | python | def plat(inc):
"""
calculate paleolatitude from inclination using dipole formula: tan(I) = 2tan(lat)
Parameters
________________
inc : either a single value or an array of inclinations
Returns
-------
array of latitudes
"""
tani = np.tan(np.radians(inc))
lat = np.arctan(ta... | [
"def",
"plat",
"(",
"inc",
")",
":",
"tani",
"=",
"np",
".",
"tan",
"(",
"np",
".",
"radians",
"(",
"inc",
")",
")",
"lat",
"=",
"np",
".",
"arctan",
"(",
"tani",
"/",
"2.",
")",
"return",
"np",
".",
"degrees",
"(",
"lat",
")"
] | calculate paleolatitude from inclination using dipole formula: tan(I) = 2tan(lat)
Parameters
________________
inc : either a single value or an array of inclinations
Returns
-------
array of latitudes | [
"calculate",
"paleolatitude",
"from",
"inclination",
"using",
"dipole",
"formula",
":",
"tan",
"(",
"I",
")",
"=",
"2tan",
"(",
"lat",
")",
"Parameters",
"________________"
] | train | https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/pmag.py#L9343-L9358 |
PmagPy/PmagPy | pmagpy/pmag.py | pseudo | def pseudo(DIs, random_seed=None):
"""
Draw a bootstrap sample of directions returning as many bootstrapped samples
as in the input directions
Parameters
----------
DIs : nested list of dec, inc lists (known as a di_block)
random_seed : set random seed for reproducible number generation (de... | python | def pseudo(DIs, random_seed=None):
"""
Draw a bootstrap sample of directions returning as many bootstrapped samples
as in the input directions
Parameters
----------
DIs : nested list of dec, inc lists (known as a di_block)
random_seed : set random seed for reproducible number generation (de... | [
"def",
"pseudo",
"(",
"DIs",
",",
"random_seed",
"=",
"None",
")",
":",
"if",
"random_seed",
"!=",
"None",
":",
"np",
".",
"random",
".",
"seed",
"(",
"random_seed",
")",
"Inds",
"=",
"np",
".",
"random",
".",
"randint",
"(",
"len",
"(",
"DIs",
")"... | Draw a bootstrap sample of directions returning as many bootstrapped samples
as in the input directions
Parameters
----------
DIs : nested list of dec, inc lists (known as a di_block)
random_seed : set random seed for reproducible number generation (default is None)
Returns
-------
Boo... | [
"Draw",
"a",
"bootstrap",
"sample",
"of",
"directions",
"returning",
"as",
"many",
"bootstrapped",
"samples",
"as",
"in",
"the",
"input",
"directions"
] | train | https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/pmag.py#L9363-L9382 |
PmagPy/PmagPy | pmagpy/pmag.py | di_boot | def di_boot(DIs, nb=5000):
"""
returns bootstrap means for Directional data
Parameters
_________________
DIs : nested list of Dec,Inc pairs
nb : number of bootstrap pseudosamples
Returns
-------
BDIs: nested list of bootstrapped mean Dec,Inc pairs
"""
#
# now do bootst... | python | def di_boot(DIs, nb=5000):
"""
returns bootstrap means for Directional data
Parameters
_________________
DIs : nested list of Dec,Inc pairs
nb : number of bootstrap pseudosamples
Returns
-------
BDIs: nested list of bootstrapped mean Dec,Inc pairs
"""
#
# now do bootst... | [
"def",
"di_boot",
"(",
"DIs",
",",
"nb",
"=",
"5000",
")",
":",
"#",
"# now do bootstrap to collect BDIs bootstrap means",
"#",
"BDIs",
"=",
"[",
"]",
"# number of bootstraps, list of bootstrap directions",
"#",
"for",
"k",
"in",
"range",
"(",
"nb",
")",
":",
"... | returns bootstrap means for Directional data
Parameters
_________________
DIs : nested list of Dec,Inc pairs
nb : number of bootstrap pseudosamples
Returns
-------
BDIs: nested list of bootstrapped mean Dec,Inc pairs | [
"returns",
"bootstrap",
"means",
"for",
"Directional",
"data",
"Parameters",
"_________________",
"DIs",
":",
"nested",
"list",
"of",
"Dec",
"Inc",
"pairs",
"nb",
":",
"number",
"of",
"bootstrap",
"pseudosamples"
] | train | https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/pmag.py#L9385-L9408 |
PmagPy/PmagPy | pmagpy/pmag.py | dir_df_boot | def dir_df_boot(dir_df, nb=5000, par=False):
"""
Performs a bootstrap for direction DataFrame with optional parametric bootstrap
Parameters
_________
dir_df : Pandas DataFrame with columns:
dir_dec : mean declination
dir_inc : mean inclination
Required for parametric bootstrap... | python | def dir_df_boot(dir_df, nb=5000, par=False):
"""
Performs a bootstrap for direction DataFrame with optional parametric bootstrap
Parameters
_________
dir_df : Pandas DataFrame with columns:
dir_dec : mean declination
dir_inc : mean inclination
Required for parametric bootstrap... | [
"def",
"dir_df_boot",
"(",
"dir_df",
",",
"nb",
"=",
"5000",
",",
"par",
"=",
"False",
")",
":",
"N",
"=",
"dir_df",
".",
"dir_dec",
".",
"values",
".",
"shape",
"[",
"0",
"]",
"# number of data points",
"BDIs",
"=",
"[",
"]",
"for",
"k",
"in",
"ra... | Performs a bootstrap for direction DataFrame with optional parametric bootstrap
Parameters
_________
dir_df : Pandas DataFrame with columns:
dir_dec : mean declination
dir_inc : mean inclination
Required for parametric bootstrap
dir_n : number of data points in mean
di... | [
"Performs",
"a",
"bootstrap",
"for",
"direction",
"DataFrame",
"with",
"optional",
"parametric",
"bootstrap"
] | train | https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/pmag.py#L9411-L9454 |
PmagPy/PmagPy | pmagpy/pmag.py | dir_df_fisher_mean | def dir_df_fisher_mean(dir_df):
"""
calculates fisher mean for Pandas data frame
Parameters
__________
dir_df: pandas data frame with columns:
dir_dec : declination
dir_inc : inclination
Returns
-------
fpars : dictionary containing the Fisher mean and statistics
... | python | def dir_df_fisher_mean(dir_df):
"""
calculates fisher mean for Pandas data frame
Parameters
__________
dir_df: pandas data frame with columns:
dir_dec : declination
dir_inc : inclination
Returns
-------
fpars : dictionary containing the Fisher mean and statistics
... | [
"def",
"dir_df_fisher_mean",
"(",
"dir_df",
")",
":",
"N",
"=",
"dir_df",
".",
"dir_dec",
".",
"values",
".",
"shape",
"[",
"0",
"]",
"# number of data points",
"fpars",
"=",
"{",
"}",
"if",
"N",
"<",
"2",
":",
"return",
"fpars",
"dirs",
"=",
"dir_df",... | calculates fisher mean for Pandas data frame
Parameters
__________
dir_df: pandas data frame with columns:
dir_dec : declination
dir_inc : inclination
Returns
-------
fpars : dictionary containing the Fisher mean and statistics
dec : mean declination
inc : mean i... | [
"calculates",
"fisher",
"mean",
"for",
"Pandas",
"data",
"frame"
] | train | https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/pmag.py#L9457-L9507 |
PmagPy/PmagPy | pmagpy/pmag.py | pseudosample | def pseudosample(x):
"""
draw a bootstrap sample of x
"""
#
BXs = []
for k in range(len(x)):
ind = random.randint(0, len(x) - 1)
BXs.append(x[ind])
return BXs | python | def pseudosample(x):
"""
draw a bootstrap sample of x
"""
#
BXs = []
for k in range(len(x)):
ind = random.randint(0, len(x) - 1)
BXs.append(x[ind])
return BXs | [
"def",
"pseudosample",
"(",
"x",
")",
":",
"#",
"BXs",
"=",
"[",
"]",
"for",
"k",
"in",
"range",
"(",
"len",
"(",
"x",
")",
")",
":",
"ind",
"=",
"random",
".",
"randint",
"(",
"0",
",",
"len",
"(",
"x",
")",
"-",
"1",
")",
"BXs",
".",
"a... | draw a bootstrap sample of x | [
"draw",
"a",
"bootstrap",
"sample",
"of",
"x"
] | train | https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/pmag.py#L9510-L9519 |
PmagPy/PmagPy | pmagpy/pmag.py | bc02 | def bc02(data):
"""
get APWP from Besse and Courtillot 2002 paper
Parameters
----------
Takes input as [plate, site_lat, site_lon, age]
plate : string (options: AF, ANT, AU, EU, GL, IN, NA, SA)
site_lat : float
site_lon : float
age : float in Myr
Returns
----------
"""... | python | def bc02(data):
"""
get APWP from Besse and Courtillot 2002 paper
Parameters
----------
Takes input as [plate, site_lat, site_lon, age]
plate : string (options: AF, ANT, AU, EU, GL, IN, NA, SA)
site_lat : float
site_lon : float
age : float in Myr
Returns
----------
"""... | [
"def",
"bc02",
"(",
"data",
")",
":",
"plate",
",",
"site_lat",
",",
"site_lon",
",",
"age",
"=",
"data",
"[",
"0",
"]",
",",
"data",
"[",
"1",
"]",
",",
"data",
"[",
"2",
"]",
",",
"data",
"[",
"3",
"]",
"apwp",
"=",
"get_plate_data",
"(",
"... | get APWP from Besse and Courtillot 2002 paper
Parameters
----------
Takes input as [plate, site_lat, site_lon, age]
plate : string (options: AF, ANT, AU, EU, GL, IN, NA, SA)
site_lat : float
site_lon : float
age : float in Myr
Returns
---------- | [
"get",
"APWP",
"from",
"Besse",
"and",
"Courtillot",
"2002",
"paper"
] | train | https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/pmag.py#L9545-L9586 |
PmagPy/PmagPy | pmagpy/pmag.py | linreg | def linreg(x, y):
"""
does a linear regression
"""
if len(x) != len(y):
print('x and y must be same length')
return
xx, yy, xsum, ysum, xy, n, sum = 0, 0, 0, 0, 0, len(x), 0
linpars = {}
for i in range(n):
xx += x[i] * x[i]
yy += y[i] * y[i]
xy += x[i]... | python | def linreg(x, y):
"""
does a linear regression
"""
if len(x) != len(y):
print('x and y must be same length')
return
xx, yy, xsum, ysum, xy, n, sum = 0, 0, 0, 0, 0, len(x), 0
linpars = {}
for i in range(n):
xx += x[i] * x[i]
yy += y[i] * y[i]
xy += x[i]... | [
"def",
"linreg",
"(",
"x",
",",
"y",
")",
":",
"if",
"len",
"(",
"x",
")",
"!=",
"len",
"(",
"y",
")",
":",
"print",
"(",
"'x and y must be same length'",
")",
"return",
"xx",
",",
"yy",
",",
"xsum",
",",
"ysum",
",",
"xy",
",",
"n",
",",
"sum"... | does a linear regression | [
"does",
"a",
"linear",
"regression"
] | train | https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/pmag.py#L9589-L9615 |
PmagPy/PmagPy | pmagpy/pmag.py | squish | def squish(incs, f):
"""
returns 'flattened' inclination, assuming factor, f and King (1955) formula:
tan (I_o) = f tan (I_f)
Parameters
__________
incs : array of inclination (I_f) data to flatten
f : flattening factor
Returns
_______
I_o : inclinations after flattening
... | python | def squish(incs, f):
"""
returns 'flattened' inclination, assuming factor, f and King (1955) formula:
tan (I_o) = f tan (I_f)
Parameters
__________
incs : array of inclination (I_f) data to flatten
f : flattening factor
Returns
_______
I_o : inclinations after flattening
... | [
"def",
"squish",
"(",
"incs",
",",
"f",
")",
":",
"incs",
"=",
"np",
".",
"radians",
"(",
"incs",
")",
"I_o",
"=",
"f",
"*",
"np",
".",
"tan",
"(",
"incs",
")",
"# multiply tangent by flattening factor",
"return",
"np",
".",
"degrees",
"(",
"np",
"."... | returns 'flattened' inclination, assuming factor, f and King (1955) formula:
tan (I_o) = f tan (I_f)
Parameters
__________
incs : array of inclination (I_f) data to flatten
f : flattening factor
Returns
_______
I_o : inclinations after flattening | [
"returns",
"flattened",
"inclination",
"assuming",
"factor",
"f",
"and",
"King",
"(",
"1955",
")",
"formula",
":",
"tan",
"(",
"I_o",
")",
"=",
"f",
"tan",
"(",
"I_f",
")"
] | train | https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/pmag.py#L9618-L9634 |
PmagPy/PmagPy | pmagpy/pmag.py | get_ts | def get_ts(ts):
"""
returns GPTS timescales.
options are: ck95, gts04, and gts12
returns timescales and Chron labels
"""
if ts == 'ck95':
TS = [0, 0.780, 0.990, 1.070, 1.770, 1.950, 2.140, 2.150, 2.581, 3.040, 3.110, 3.220, 3.330, 3.580, 4.180, 4.290, 4.480, 4.620, 4.800, 4.890, 4.980, ... | python | def get_ts(ts):
"""
returns GPTS timescales.
options are: ck95, gts04, and gts12
returns timescales and Chron labels
"""
if ts == 'ck95':
TS = [0, 0.780, 0.990, 1.070, 1.770, 1.950, 2.140, 2.150, 2.581, 3.040, 3.110, 3.220, 3.330, 3.580, 4.180, 4.290, 4.480, 4.620, 4.800, 4.890, 4.980, ... | [
"def",
"get_ts",
"(",
"ts",
")",
":",
"if",
"ts",
"==",
"'ck95'",
":",
"TS",
"=",
"[",
"0",
",",
"0.780",
",",
"0.990",
",",
"1.070",
",",
"1.770",
",",
"1.950",
",",
"2.140",
",",
"2.150",
",",
"2.581",
",",
"3.040",
",",
"3.110",
",",
"3.220"... | returns GPTS timescales.
options are: ck95, gts04, and gts12
returns timescales and Chron labels | [
"returns",
"GPTS",
"timescales",
".",
"options",
"are",
":",
"ck95",
"gts04",
"and",
"gts12",
"returns",
"timescales",
"and",
"Chron",
"labels"
] | train | https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/pmag.py#L9656-L9681 |
PmagPy/PmagPy | pmagpy/pmag.py | execute | def execute(st, **kwargs):
"""
Work around for Python3 exec function which doesn't allow changes to the local namespace because of scope.
This breaks a lot of the old functionality in the code which was origionally in Python2. So this function
runs just like exec except that it returns the output of the... | python | def execute(st, **kwargs):
"""
Work around for Python3 exec function which doesn't allow changes to the local namespace because of scope.
This breaks a lot of the old functionality in the code which was origionally in Python2. So this function
runs just like exec except that it returns the output of the... | [
"def",
"execute",
"(",
"st",
",",
"*",
"*",
"kwargs",
")",
":",
"namespace",
"=",
"kwargs",
"exec",
"(",
"\"b = {}\"",
".",
"format",
"(",
"st",
")",
",",
"namespace",
")",
"return",
"namespace",
"[",
"'b'",
"]"
] | Work around for Python3 exec function which doesn't allow changes to the local namespace because of scope.
This breaks a lot of the old functionality in the code which was origionally in Python2. So this function
runs just like exec except that it returns the output of the input statement to the local namespace... | [
"Work",
"around",
"for",
"Python3",
"exec",
"function",
"which",
"doesn",
"t",
"allow",
"changes",
"to",
"the",
"local",
"namespace",
"because",
"of",
"scope",
".",
"This",
"breaks",
"a",
"lot",
"of",
"the",
"old",
"functionality",
"in",
"the",
"code",
"wh... | train | https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/pmag.py#L9684-L9703 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.