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
programs/magic_gui.py
MainFrame.reset_highlights
def reset_highlights(self): """ Remove red outlines from all buttons """ for dtype in ["specimens", "samples", "sites", "locations", "ages"]: wind = self.FindWindowByName(dtype + '_btn') wind.Unbind(wx.EVT_PAINT, handler=self.highlight_button) self.Refresh...
python
def reset_highlights(self): """ Remove red outlines from all buttons """ for dtype in ["specimens", "samples", "sites", "locations", "ages"]: wind = self.FindWindowByName(dtype + '_btn') wind.Unbind(wx.EVT_PAINT, handler=self.highlight_button) self.Refresh...
[ "def", "reset_highlights", "(", "self", ")", ":", "for", "dtype", "in", "[", "\"specimens\"", ",", "\"samples\"", ",", "\"sites\"", ",", "\"locations\"", ",", "\"ages\"", "]", ":", "wind", "=", "self", ".", "FindWindowByName", "(", "dtype", "+", "'_btn'", ...
Remove red outlines from all buttons
[ "Remove", "red", "outlines", "from", "all", "buttons" ]
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/programs/magic_gui.py#L433-L443
PmagPy/PmagPy
programs/magic_gui.py
MainFrame.highlight_button
def highlight_button(self, event): """ Draw a red highlight line around the event object """ wind = event.GetEventObject() pos = wind.GetPosition() size = wind.GetSize() try: dc = wx.PaintDC(self) except wx._core.PyAssertionError: #...
python
def highlight_button(self, event): """ Draw a red highlight line around the event object """ wind = event.GetEventObject() pos = wind.GetPosition() size = wind.GetSize() try: dc = wx.PaintDC(self) except wx._core.PyAssertionError: #...
[ "def", "highlight_button", "(", "self", ",", "event", ")", ":", "wind", "=", "event", ".", "GetEventObject", "(", ")", "pos", "=", "wind", ".", "GetPosition", "(", ")", "size", "=", "wind", ".", "GetSize", "(", ")", "try", ":", "dc", "=", "wx", "."...
Draw a red highlight line around the event object
[ "Draw", "a", "red", "highlight", "line", "around", "the", "event", "object" ]
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/programs/magic_gui.py#L446-L460
PmagPy/PmagPy
programs/magic_gui.py
MagICMenu.on_clear
def on_clear(self, event): """ initialize window to allow user to empty the working directory """ dia = pmag_menu_dialogs.ClearWD(self.parent, self.parent.WD) clear = dia.do_clear() if clear: print('-I- Clear data object') self.contribution = cb.Co...
python
def on_clear(self, event): """ initialize window to allow user to empty the working directory """ dia = pmag_menu_dialogs.ClearWD(self.parent, self.parent.WD) clear = dia.do_clear() if clear: print('-I- Clear data object') self.contribution = cb.Co...
[ "def", "on_clear", "(", "self", ",", "event", ")", ":", "dia", "=", "pmag_menu_dialogs", ".", "ClearWD", "(", "self", ".", "parent", ",", "self", ".", "parent", ".", "WD", ")", "clear", "=", "dia", ".", "do_clear", "(", ")", "if", "clear", ":", "pr...
initialize window to allow user to empty the working directory
[ "initialize", "window", "to", "allow", "user", "to", "empty", "the", "working", "directory" ]
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/programs/magic_gui.py#L523-L532
PmagPy/PmagPy
programs/magic_gui.py
MagICMenu.on_close_grid
def on_close_grid(self, event): """ If there is an open grid, save its data and close it. """ if self.parent.grid_frame: self.parent.grid_frame.onSave(None) self.parent.grid_frame.Destroy()
python
def on_close_grid(self, event): """ If there is an open grid, save its data and close it. """ if self.parent.grid_frame: self.parent.grid_frame.onSave(None) self.parent.grid_frame.Destroy()
[ "def", "on_close_grid", "(", "self", ",", "event", ")", ":", "if", "self", ".", "parent", ".", "grid_frame", ":", "self", ".", "parent", ".", "grid_frame", ".", "onSave", "(", "None", ")", "self", ".", "parent", ".", "grid_frame", ".", "Destroy", "(", ...
If there is an open grid, save its data and close it.
[ "If", "there", "is", "an", "open", "grid", "save", "its", "data", "and", "close", "it", "." ]
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/programs/magic_gui.py#L557-L563
PmagPy/PmagPy
programs/k15_s.py
main
def main(): """ NAME k15_s.py DESCRIPTION converts .k15 format data to .s format. assumes Jelinek Kappabridge measurement scheme SYNTAX k15_s.py [-h][-i][command line options][<filename] OPTIONS -h prints help message and quits -i allows inte...
python
def main(): """ NAME k15_s.py DESCRIPTION converts .k15 format data to .s format. assumes Jelinek Kappabridge measurement scheme SYNTAX k15_s.py [-h][-i][command line options][<filename] OPTIONS -h prints help message and quits -i allows inte...
[ "def", "main", "(", ")", ":", "firstline", ",", "itilt", ",", "igeo", ",", "linecnt", ",", "key", "=", "1", ",", "0", ",", "0", ",", "0", ",", "\"\"", "out", "=", "\"\"", "data", ",", "k15", "=", "[", "]", ",", "[", "]", "dir", "=", "'./'",...
NAME k15_s.py DESCRIPTION converts .k15 format data to .s format. assumes Jelinek Kappabridge measurement scheme SYNTAX k15_s.py [-h][-i][command line options][<filename] OPTIONS -h prints help message and quits -i allows interactive entry of options...
[ "NAME", "k15_s", ".", "py", "DESCRIPTION", "converts", ".", "k15", "format", "data", "to", ".", "s", "format", ".", "assumes", "Jelinek", "Kappabridge", "measurement", "scheme" ]
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/programs/k15_s.py#L8-L103
PmagPy/PmagPy
programs/deprecated/zeq_magic_redo.py
main
def main(): """ NAME zeq_magic_redo.py DESCRIPTION Calculate principal components through demagnetization data using bounds and calculation type stored in "redo" file SYNTAX zeq_magic_redo.py [command line options] OPTIONS -h prints help message -usr U...
python
def main(): """ NAME zeq_magic_redo.py DESCRIPTION Calculate principal components through demagnetization data using bounds and calculation type stored in "redo" file SYNTAX zeq_magic_redo.py [command line options] OPTIONS -h prints help message -usr U...
[ "def", "main", "(", ")", ":", "dir_path", "=", "'.'", "INCL", "=", "[", "\"LT-NO\"", ",", "\"LT-AF-Z\"", ",", "\"LT-T-Z\"", ",", "\"LT-M-Z\"", "]", "# looking for demag data", "beg", ",", "end", ",", "pole", ",", "geo", ",", "tilt", ",", "askave", ",", ...
NAME zeq_magic_redo.py DESCRIPTION Calculate principal components through demagnetization data using bounds and calculation type stored in "redo" file SYNTAX zeq_magic_redo.py [command line options] OPTIONS -h prints help message -usr USER: identify user, de...
[ "NAME", "zeq_magic_redo", ".", "py", "DESCRIPTION", "Calculate", "principal", "components", "through", "demagnetization", "data", "using", "bounds", "and", "calculation", "type", "stored", "in", "redo", "file", "SYNTAX", "zeq_magic_redo", ".", "py", "[", "command", ...
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/programs/deprecated/zeq_magic_redo.py#L8-L278
PmagPy/PmagPy
programs/dipole_plat.py
main
def main(): """ NAME dipole_plat.py DESCRIPTION gives paleolatitude from given inclination, assuming GAD field SYNTAX dipole_plat.py [command line options]<filename OPTIONS -h prints help message and quits -i allows interactive entry of latitude -...
python
def main(): """ NAME dipole_plat.py DESCRIPTION gives paleolatitude from given inclination, assuming GAD field SYNTAX dipole_plat.py [command line options]<filename OPTIONS -h prints help message and quits -i allows interactive entry of latitude -...
[ "def", "main", "(", ")", ":", "if", "'-h'", "in", "sys", ".", "argv", ":", "print", "(", "main", ".", "__doc__", ")", "sys", ".", "exit", "(", ")", "elif", "'-f'", "in", "sys", ".", "argv", ":", "ind", "=", "sys", ".", "argv", ".", "index", "...
NAME dipole_plat.py DESCRIPTION gives paleolatitude from given inclination, assuming GAD field SYNTAX dipole_plat.py [command line options]<filename OPTIONS -h prints help message and quits -i allows interactive entry of latitude -f file, specifies file n...
[ "NAME", "dipole_plat", ".", "py" ]
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/programs/dipole_plat.py#L7-L44
PmagPy/PmagPy
programs/zeq_magic.py
main
def main(): """ NAME zeq_magic.py DESCRIPTION reads in a MagIC measurements formatted file, makes plots of remanence decay during demagnetization experiments. Reads in prior interpretations saved in a specimens formatted file interpretations in a specimens file. inte...
python
def main(): """ NAME zeq_magic.py DESCRIPTION reads in a MagIC measurements formatted file, makes plots of remanence decay during demagnetization experiments. Reads in prior interpretations saved in a specimens formatted file interpretations in a specimens file. inte...
[ "def", "main", "(", ")", ":", "if", "'-h'", "in", "sys", ".", "argv", ":", "print", "(", "main", ".", "__doc__", ")", "return", "dir_path", "=", "pmag", ".", "get_named_arg", "(", "\"-WD\"", ",", "default_val", "=", "os", ".", "getcwd", "(", ")", "...
NAME zeq_magic.py DESCRIPTION reads in a MagIC measurements formatted file, makes plots of remanence decay during demagnetization experiments. Reads in prior interpretations saved in a specimens formatted file interpretations in a specimens file. interpretations are saved in...
[ "NAME", "zeq_magic", ".", "py", "DESCRIPTION", "reads", "in", "a", "MagIC", "measurements", "formatted", "file", "makes", "plots", "of", "remanence", "decay", "during", "demagnetization", "experiments", ".", "Reads", "in", "prior", "interpretations", "saved", "in"...
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/programs/zeq_magic.py#L19-L71
PmagPy/PmagPy
programs/conversion_scripts2/iodp_dscr_magic2.py
main
def main(command_line=True, **kwargs): """ NAME iodp_dscr_magic.py DESCRIPTION converts ODP LIMS discrete sample format files to magic_measurements format files SYNTAX iodp_descr_magic.py [command line options] OPTIONS -h: prints the help message and quits. ...
python
def main(command_line=True, **kwargs): """ NAME iodp_dscr_magic.py DESCRIPTION converts ODP LIMS discrete sample format files to magic_measurements format files SYNTAX iodp_descr_magic.py [command line options] OPTIONS -h: prints the help message and quits. ...
[ "def", "main", "(", "command_line", "=", "True", ",", "*", "*", "kwargs", ")", ":", "#", "# initialize defaults", "version_num", "=", "pmag", ".", "get_version", "(", ")", "meas_file", "=", "'magic_measurements.txt'", "csv_file", "=", "''", "MagRecs", ",", "...
NAME iodp_dscr_magic.py DESCRIPTION converts ODP LIMS discrete sample format files to magic_measurements format files SYNTAX iodp_descr_magic.py [command line options] OPTIONS -h: prints the help message and quits. -f FILE: specify input .csv file, default is all ...
[ "NAME", "iodp_dscr_magic", ".", "py" ]
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/programs/conversion_scripts2/iodp_dscr_magic2.py#L9-L197
PmagPy/PmagPy
programs/conversion_scripts2/sio_magic2.py
main
def main(command_line=True, **kwargs): """ NAME sio_magic.py DESCRIPTION converts SIO .mag format files to magic_measurements format files SYNTAX sio_magic.py [command line options] OPTIONS -h: prints the help message and quits. -usr USER: identify user, ...
python
def main(command_line=True, **kwargs): """ NAME sio_magic.py DESCRIPTION converts SIO .mag format files to magic_measurements format files SYNTAX sio_magic.py [command line options] OPTIONS -h: prints the help message and quits. -usr USER: identify user, ...
[ "def", "main", "(", "command_line", "=", "True", ",", "*", "*", "kwargs", ")", ":", "# initialize some stuff", "mag_file", "=", "None", "codelist", "=", "None", "infile_type", "=", "\"mag\"", "noave", "=", "0", "methcode", ",", "inst", "=", "\"LP-NO\"", ",...
NAME sio_magic.py DESCRIPTION converts SIO .mag format files to magic_measurements format files SYNTAX sio_magic.py [command line options] OPTIONS -h: prints the help message and quits. -usr USER: identify user, default is "" -f FILE: specify .mag format ...
[ "NAME", "sio_magic", ".", "py" ]
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/programs/conversion_scripts2/sio_magic2.py#L8-L693
PmagPy/PmagPy
SPD/lib/new_lib_curvature.py
fitcircle
def fitcircle(n, x, y): # n points, x points, y points """c Fit circle to arbitrary number of x,y pairs, based on the c modified least squares method of Umback and Jones (2000), c IEEE Transactions on Instrumentation and Measurement.""" # adding in normalize vectors step #x = numpy.array(x) / max(x) #y...
python
def fitcircle(n, x, y): # n points, x points, y points """c Fit circle to arbitrary number of x,y pairs, based on the c modified least squares method of Umback and Jones (2000), c IEEE Transactions on Instrumentation and Measurement.""" # adding in normalize vectors step #x = numpy.array(x) / max(x) #y...
[ "def", "fitcircle", "(", "n", ",", "x", ",", "y", ")", ":", "# n points, x points, y points", "# adding in normalize vectors step", "#x = numpy.array(x) / max(x)", "#y = numpy.array(y) / max(y)", "#", "sx", ",", "sx2", ",", "sx3", ",", "sy", ",", "sy2", ",", "sy3", ...
c Fit circle to arbitrary number of x,y pairs, based on the c modified least squares method of Umback and Jones (2000), c IEEE Transactions on Instrumentation and Measurement.
[ "c", "Fit", "circle", "to", "arbitrary", "number", "of", "x", "y", "pairs", "based", "on", "the", "c", "modified", "least", "squares", "method", "of", "Umback", "and", "Jones", "(", "2000", ")", "c", "IEEE", "Transactions", "on", "Instrumentation", "and", ...
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/SPD/lib/new_lib_curvature.py#L29-L75
PmagPy/PmagPy
programs/vgp_di.py
main
def main(): """ NAME vgp_di.py DESCRIPTION converts site latitude, longitude and pole latitude, longitude to declination, inclination SYNTAX vgp_di.py [-h] [-i] [-f FILE] [< filename] OPTIONS -h prints help message and quits -i interactive data entry ...
python
def main(): """ NAME vgp_di.py DESCRIPTION converts site latitude, longitude and pole latitude, longitude to declination, inclination SYNTAX vgp_di.py [-h] [-i] [-f FILE] [< filename] OPTIONS -h prints help message and quits -i interactive data entry ...
[ "def", "main", "(", ")", ":", "if", "'-h'", "in", "sys", ".", "argv", ":", "print", "(", "main", ".", "__doc__", ")", "sys", ".", "exit", "(", ")", "if", "'-i'", "in", "sys", ".", "argv", ":", "# if one is -i", "while", "1", ":", "try", ":", "a...
NAME vgp_di.py DESCRIPTION converts site latitude, longitude and pole latitude, longitude to declination, inclination SYNTAX vgp_di.py [-h] [-i] [-f FILE] [< filename] OPTIONS -h prints help message and quits -i interactive data entry -f FILE to specif...
[ "NAME", "vgp_di", ".", "py", "DESCRIPTION", "converts", "site", "latitude", "longitude", "and", "pole", "latitude", "longitude", "to", "declination", "inclination", "SYNTAX", "vgp_di", ".", "py", "[", "-", "h", "]", "[", "-", "i", "]", "[", "-", "f", "FI...
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/programs/vgp_di.py#L17-L77
PmagPy/PmagPy
dev_setup.py
unix_install
def unix_install(): """ Edits or creates .bashrc, .bash_profile, and .profile files in the users HOME directory in order to add your current directory (hopefully your PmagPy directory) and assorted lower directories in the PmagPy/programs directory to your PATH environment variable. It also adds the...
python
def unix_install(): """ Edits or creates .bashrc, .bash_profile, and .profile files in the users HOME directory in order to add your current directory (hopefully your PmagPy directory) and assorted lower directories in the PmagPy/programs directory to your PATH environment variable. It also adds the...
[ "def", "unix_install", "(", ")", ":", "PmagPyDir", "=", "os", ".", "path", ".", "abspath", "(", "\".\"", ")", "COMMAND", "=", "\"\"\"\\n\nfor d in %s/programs/*/ \"%s/programs/\"; do\n case \":$PATH:\" in\n *\":$d:\"*) :;; # already there\n *) PMAGPATHS=\"$PMAGPATHS:$d\";; #...
Edits or creates .bashrc, .bash_profile, and .profile files in the users HOME directory in order to add your current directory (hopefully your PmagPy directory) and assorted lower directories in the PmagPy/programs directory to your PATH environment variable. It also adds the PmagPy and the PmagPy/progr...
[ "Edits", "or", "creates", ".", "bashrc", ".", "bash_profile", "and", ".", "profile", "files", "in", "the", "users", "HOME", "directory", "in", "order", "to", "add", "your", "current", "directory", "(", "hopefully", "your", "PmagPy", "directory", ")", "and", ...
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/dev_setup.py#L56-L96
PmagPy/PmagPy
dev_setup.py
windows_install
def windows_install(path_to_python=""): """ Sets the .py extension to be associated with the ftype Python which is then set to the python.exe you provide in the path_to_python variable or after the -p flag if run as a script. Once the python environment is set up the function proceeds to set PATH an...
python
def windows_install(path_to_python=""): """ Sets the .py extension to be associated with the ftype Python which is then set to the python.exe you provide in the path_to_python variable or after the -p flag if run as a script. Once the python environment is set up the function proceeds to set PATH an...
[ "def", "windows_install", "(", "path_to_python", "=", "\"\"", ")", ":", "if", "not", "path_to_python", ":", "print", "(", "\"Please enter the path to your python.exe you wish Windows to use to run python files. If you do not, this script will not be able to set up a full python environme...
Sets the .py extension to be associated with the ftype Python which is then set to the python.exe you provide in the path_to_python variable or after the -p flag if run as a script. Once the python environment is set up the function proceeds to set PATH and PYTHONPATH using setx. Parameters -------...
[ "Sets", "the", ".", "py", "extension", "to", "be", "associated", "with", "the", "ftype", "Python", "which", "is", "then", "set", "to", "the", "python", ".", "exe", "you", "provide", "in", "the", "path_to_python", "variable", "or", "after", "the", "-", "p...
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/dev_setup.py#L127-L193
PmagPy/PmagPy
programs/pmag_results_extract.py
main
def main(): """ NAME pmag_results_extract.py DESCRIPTION make a tab delimited output file from pmag_results table SYNTAX pmag_results_extract.py [command line options] OPTIONS -h prints help message and quits -f RFILE, specify pmag_results table; default ...
python
def main(): """ NAME pmag_results_extract.py DESCRIPTION make a tab delimited output file from pmag_results table SYNTAX pmag_results_extract.py [command line options] OPTIONS -h prints help message and quits -f RFILE, specify pmag_results table; default ...
[ "def", "main", "(", ")", ":", "do_help", "=", "pmag", ".", "get_flag_arg_from_sys", "(", "'-h'", ")", "if", "do_help", ":", "print", "(", "main", ".", "__doc__", ")", "return", "False", "res_file", "=", "pmag", ".", "get_named_arg", "(", "'-f'", ",", "...
NAME pmag_results_extract.py DESCRIPTION make a tab delimited output file from pmag_results table SYNTAX pmag_results_extract.py [command line options] OPTIONS -h prints help message and quits -f RFILE, specify pmag_results table; default is pmag_results.txt ...
[ "NAME", "pmag_results_extract", ".", "py" ]
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/programs/pmag_results_extract.py#L8-L39
PmagPy/PmagPy
programs/replace_ac_specimens.py
main
def main(): """ NAME replace_AC_specimens.py DESCRIPTION finds anisotropy corrected data and replaces that specimen with it. puts in pmag_specimen format file SYNTAX replace_AC_specimens.py [command line options] OPTIONS -h prints help mes...
python
def main(): """ NAME replace_AC_specimens.py DESCRIPTION finds anisotropy corrected data and replaces that specimen with it. puts in pmag_specimen format file SYNTAX replace_AC_specimens.py [command line options] OPTIONS -h prints help mes...
[ "def", "main", "(", ")", ":", "dir_path", "=", "'.'", "tspec", "=", "\"thellier_specimens.txt\"", "aspec", "=", "\"AC_specimens.txt\"", "ofile", "=", "\"TorAC_specimens.txt\"", "critfile", "=", "\"pmag_criteria.txt\"", "ACSamplist", ",", "Samplist", ",", "sigmin", "...
NAME replace_AC_specimens.py DESCRIPTION finds anisotropy corrected data and replaces that specimen with it. puts in pmag_specimen format file SYNTAX replace_AC_specimens.py [command line options] OPTIONS -h prints help message and quits -...
[ "NAME", "replace_AC_specimens", ".", "py", "DESCRIPTION", "finds", "anisotropy", "corrected", "data", "and", "replaces", "that", "specimen", "with", "it", ".", "puts", "in", "pmag_specimen", "format", "file", "SYNTAX", "replace_AC_specimens", ".", "py", "[", "comm...
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/programs/replace_ac_specimens.py#L6-L96
PmagPy/PmagPy
dialogs/thellier_gui_lib.py
check_specimen_PI_criteria
def check_specimen_PI_criteria(pars,acceptance_criteria): ''' # Check if specimen pass Acceptance criteria ''' #if 'pars' not in self.Data[specimen].kes(): # return pars['specimen_fail_criteria']=[] for crit in list(acceptance_criteria.keys()): if crit not in list(pars.keys()): ...
python
def check_specimen_PI_criteria(pars,acceptance_criteria): ''' # Check if specimen pass Acceptance criteria ''' #if 'pars' not in self.Data[specimen].kes(): # return pars['specimen_fail_criteria']=[] for crit in list(acceptance_criteria.keys()): if crit not in list(pars.keys()): ...
[ "def", "check_specimen_PI_criteria", "(", "pars", ",", "acceptance_criteria", ")", ":", "#if 'pars' not in self.Data[specimen].kes():", "# return", "pars", "[", "'specimen_fail_criteria'", "]", "=", "[", "]", "for", "crit", "in", "list", "(", "acceptance_criteria", "...
# Check if specimen pass Acceptance criteria
[ "#", "Check", "if", "specimen", "pass", "Acceptance", "criteria" ]
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/dialogs/thellier_gui_lib.py#L295-L324
PmagPy/PmagPy
programs/grab_magic_key.py
main
def main(): """ NAME grab_magic_key.py DESCRIPTION picks out key and saves to file SYNTAX grab_magic_key.py [command line optins] OPTIONS -h prints help message and quits -f FILE: specify input magic format file -key KEY: specify key to print to sta...
python
def main(): """ NAME grab_magic_key.py DESCRIPTION picks out key and saves to file SYNTAX grab_magic_key.py [command line optins] OPTIONS -h prints help message and quits -f FILE: specify input magic format file -key KEY: specify key to print to sta...
[ "def", "main", "(", ")", ":", "dir_path", "=", "\"./\"", "if", "'-WD'", "in", "sys", ".", "argv", ":", "ind", "=", "sys", ".", "argv", ".", "index", "(", "'-WD'", ")", "dir_path", "=", "sys", ".", "argv", "[", "ind", "+", "1", "]", "if", "'-h'"...
NAME grab_magic_key.py DESCRIPTION picks out key and saves to file SYNTAX grab_magic_key.py [command line optins] OPTIONS -h prints help message and quits -f FILE: specify input magic format file -key KEY: specify key to print to standard output
[ "NAME", "grab_magic_key", ".", "py" ]
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/programs/grab_magic_key.py#L6-L50
PmagPy/PmagPy
programs/dia_vgp.py
main
def main(): """ NAME dia_vgp.py DESCRIPTION converts declination inclination alpha95 to virtual geomagnetic pole, dp and dm SYNTAX dia_vgp.py [-h] [-i] [-f FILE] [< filename] OPTIONS -h prints help message and quits -i interactive data entry -f...
python
def main(): """ NAME dia_vgp.py DESCRIPTION converts declination inclination alpha95 to virtual geomagnetic pole, dp and dm SYNTAX dia_vgp.py [-h] [-i] [-f FILE] [< filename] OPTIONS -h prints help message and quits -i interactive data entry -f...
[ "def", "main", "(", ")", ":", "if", "'-h'", "in", "sys", ".", "argv", ":", "print", "(", "main", ".", "__doc__", ")", "sys", ".", "exit", "(", ")", "if", "'-i'", "in", "sys", ".", "argv", ":", "# if one is -i", "while", "1", ":", "try", ":", "a...
NAME dia_vgp.py DESCRIPTION converts declination inclination alpha95 to virtual geomagnetic pole, dp and dm SYNTAX dia_vgp.py [-h] [-i] [-f FILE] [< filename] OPTIONS -h prints help message and quits -i interactive data entry -f FILE to specify file na...
[ "NAME", "dia_vgp", ".", "py", "DESCRIPTION", "converts", "declination", "inclination", "alpha95", "to", "virtual", "geomagnetic", "pole", "dp", "and", "dm", "SYNTAX", "dia_vgp", ".", "py", "[", "-", "h", "]", "[", "-", "i", "]", "[", "-", "f", "FILE", ...
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/programs/dia_vgp.py#L27-L102
PmagPy/PmagPy
programs/plot_2cdfs.py
main
def main(): """ NAME plot_2cdfs.py DESCRIPTION makes plots of cdfs of data in input file SYNTAX plot_2cdfs.py [-h][command line options] OPTIONS -h prints help message and quits -f FILE1 FILE2 -t TITLE -fmt [svg,eps,png,pdf,jpg..] specify f...
python
def main(): """ NAME plot_2cdfs.py DESCRIPTION makes plots of cdfs of data in input file SYNTAX plot_2cdfs.py [-h][command line options] OPTIONS -h prints help message and quits -f FILE1 FILE2 -t TITLE -fmt [svg,eps,png,pdf,jpg..] specify f...
[ "def", "main", "(", ")", ":", "fmt", "=", "'svg'", "title", "=", "\"\"", "if", "'-h'", "in", "sys", ".", "argv", ":", "print", "(", "main", ".", "__doc__", ")", "sys", ".", "exit", "(", ")", "if", "'-f'", "in", "sys", ".", "argv", ":", "ind", ...
NAME plot_2cdfs.py DESCRIPTION makes plots of cdfs of data in input file SYNTAX plot_2cdfs.py [-h][command line options] OPTIONS -h prints help message and quits -f FILE1 FILE2 -t TITLE -fmt [svg,eps,png,pdf,jpg..] specify format of output figure, ...
[ "NAME", "plot_2cdfs", ".", "py" ]
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/programs/plot_2cdfs.py#L11-L65
PmagPy/PmagPy
programs/lowrie_magic.py
main
def main(): """ NAME lowrie_magic.py DESCRIPTION plots intensity decay curves for Lowrie experiments SYNTAX lowrie_magic.py -h [command line options] INPUT takes measurements formatted input files OPTIONS -h prints help message and quits -f FILE:...
python
def main(): """ NAME lowrie_magic.py DESCRIPTION plots intensity decay curves for Lowrie experiments SYNTAX lowrie_magic.py -h [command line options] INPUT takes measurements formatted input files OPTIONS -h prints help message and quits -f FILE:...
[ "def", "main", "(", ")", ":", "if", "'-h'", "in", "sys", ".", "argv", ":", "print", "(", "main", ".", "__doc__", ")", "sys", ".", "exit", "(", ")", "if", "len", "(", "sys", ".", "argv", ")", "<=", "1", ":", "print", "(", "main", ".", "__doc__...
NAME lowrie_magic.py DESCRIPTION plots intensity decay curves for Lowrie experiments SYNTAX lowrie_magic.py -h [command line options] INPUT takes measurements formatted input files OPTIONS -h prints help message and quits -f FILE: specify input file, def...
[ "NAME", "lowrie_magic", ".", "py" ]
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/programs/lowrie_magic.py#L11-L127
PmagPy/PmagPy
programs/deprecated/reorder_samples.py
main
def main(): """ NAME reorder_samples.py DESCRIPTION takes specimen file and reorders sample file with selected orientation methods placed first SYNTAX reorder_samples.py [command line options] OPTIONS -h prints help message and quits -fsp: specimen input pm...
python
def main(): """ NAME reorder_samples.py DESCRIPTION takes specimen file and reorders sample file with selected orientation methods placed first SYNTAX reorder_samples.py [command line options] OPTIONS -h prints help message and quits -fsp: specimen input pm...
[ "def", "main", "(", ")", ":", "infile", "=", "'pmag_specimens.txt'", "sampfile", "=", "\"er_samples.txt\"", "outfile", "=", "\"er_samples.txt\"", "# get command line stuff", "if", "\"-h\"", "in", "sys", ".", "argv", ":", "print", "(", "main", ".", "__doc__", ")"...
NAME reorder_samples.py DESCRIPTION takes specimen file and reorders sample file with selected orientation methods placed first SYNTAX reorder_samples.py [command line options] OPTIONS -h prints help message and quits -fsp: specimen input pmag_specimens format file...
[ "NAME", "reorder_samples", ".", "py" ]
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/programs/deprecated/reorder_samples.py#L7-L50
PmagPy/PmagPy
pmagpy/contribution_builder.py
not_null
def not_null(val, zero_as_null=True): """ Comprehensive check to see if a value is null or not. Returns True for: non-empty iterables, True, non-zero floats and ints, non-emtpy strings. Returns False for: empty iterables, False, zero, empty strings. Parameters ---------- val : any Pytho...
python
def not_null(val, zero_as_null=True): """ Comprehensive check to see if a value is null or not. Returns True for: non-empty iterables, True, non-zero floats and ints, non-emtpy strings. Returns False for: empty iterables, False, zero, empty strings. Parameters ---------- val : any Pytho...
[ "def", "not_null", "(", "val", ",", "zero_as_null", "=", "True", ")", ":", "def", "can_iter", "(", "x", ")", ":", "\"\"\"\n Returns True for a non-empty iterable\n \"\"\"", "try", ":", "any", "(", "x", ")", "return", "True", "except", "TypeError", ...
Comprehensive check to see if a value is null or not. Returns True for: non-empty iterables, True, non-zero floats and ints, non-emtpy strings. Returns False for: empty iterables, False, zero, empty strings. Parameters ---------- val : any Python object zero_as_null: bool treat zero...
[ "Comprehensive", "check", "to", "see", "if", "a", "value", "is", "null", "or", "not", ".", "Returns", "True", "for", ":", "non", "-", "empty", "iterables", "True", "non", "-", "zero", "floats", "and", "ints", "non", "-", "emtpy", "strings", ".", "Retur...
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/contribution_builder.py#L2251-L2319
PmagPy/PmagPy
pmagpy/contribution_builder.py
get_intensity_col
def get_intensity_col(data): """ Check measurement dataframe for intensity columns 'magn_moment', 'magn_volume', 'magn_mass','magn_uncal'. Return the first intensity column that is in the dataframe AND has data. Parameters ---------- data : pandas DataFrame Returns --------- str ...
python
def get_intensity_col(data): """ Check measurement dataframe for intensity columns 'magn_moment', 'magn_volume', 'magn_mass','magn_uncal'. Return the first intensity column that is in the dataframe AND has data. Parameters ---------- data : pandas DataFrame Returns --------- str ...
[ "def", "get_intensity_col", "(", "data", ")", ":", "# possible intensity columns", "intlist", "=", "[", "'magn_moment'", ",", "'magn_volume'", ",", "'magn_mass'", ",", "'magn_uncal'", "]", "# intensity columns that are in the data", "int_meths", "=", "[", "col_name", "f...
Check measurement dataframe for intensity columns 'magn_moment', 'magn_volume', 'magn_mass','magn_uncal'. Return the first intensity column that is in the dataframe AND has data. Parameters ---------- data : pandas DataFrame Returns --------- str intensity method column or ""
[ "Check", "measurement", "dataframe", "for", "intensity", "columns", "magn_moment", "magn_volume", "magn_mass", "magn_uncal", ".", "Return", "the", "first", "intensity", "column", "that", "is", "in", "the", "dataframe", "AND", "has", "data", "." ]
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/contribution_builder.py#L2328-L2356
PmagPy/PmagPy
pmagpy/contribution_builder.py
add_sites_to_meas_table
def add_sites_to_meas_table(dir_path): """ Add site columns to measurements table (e.g., to plot intensity data), or generate an informative error message. Parameters ---------- dir_path : str directory with data files Returns ---------- status : bool True if succe...
python
def add_sites_to_meas_table(dir_path): """ Add site columns to measurements table (e.g., to plot intensity data), or generate an informative error message. Parameters ---------- dir_path : str directory with data files Returns ---------- status : bool True if succe...
[ "def", "add_sites_to_meas_table", "(", "dir_path", ")", ":", "reqd_tables", "=", "[", "'measurements'", ",", "'specimens'", ",", "'samples'", ",", "'sites'", "]", "con", "=", "Contribution", "(", "dir_path", ",", "read_tables", "=", "reqd_tables", ")", "# check ...
Add site columns to measurements table (e.g., to plot intensity data), or generate an informative error message. Parameters ---------- dir_path : str directory with data files Returns ---------- status : bool True if successful, else False data : pandas DataFrame ...
[ "Add", "site", "columns", "to", "measurements", "table", "(", "e", ".", "g", ".", "to", "plot", "intensity", "data", ")", "or", "generate", "an", "informative", "error", "message", "." ]
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/contribution_builder.py#L2359-L2394
PmagPy/PmagPy
pmagpy/contribution_builder.py
prep_for_intensity_plot
def prep_for_intensity_plot(data, meth_code, dropna=(), reqd_cols=()): """ Strip down measurement data to what is needed for an intensity plot. Find the column with intensity data. Drop empty columns, and make sure required columns are present. Keep only records with the specified method code. ...
python
def prep_for_intensity_plot(data, meth_code, dropna=(), reqd_cols=()): """ Strip down measurement data to what is needed for an intensity plot. Find the column with intensity data. Drop empty columns, and make sure required columns are present. Keep only records with the specified method code. ...
[ "def", "prep_for_intensity_plot", "(", "data", ",", "meth_code", ",", "dropna", "=", "(", ")", ",", "reqd_cols", "=", "(", ")", ")", ":", "# initialize", "dropna", "=", "list", "(", "dropna", ")", "reqd_cols", "=", "list", "(", "reqd_cols", ")", "# get i...
Strip down measurement data to what is needed for an intensity plot. Find the column with intensity data. Drop empty columns, and make sure required columns are present. Keep only records with the specified method code. Parameters ---------- data : pandas DataFrame measurement dataframe...
[ "Strip", "down", "measurement", "data", "to", "what", "is", "needed", "for", "an", "intensity", "plot", ".", "Find", "the", "column", "with", "intensity", "data", ".", "Drop", "empty", "columns", "and", "make", "sure", "required", "columns", "are", "present"...
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/contribution_builder.py#L2433-L2484
PmagPy/PmagPy
pmagpy/contribution_builder.py
stringify_col
def stringify_col(df, col_name): """ Take a dataframe and string-i-fy a column of values. Turn nan/None into "" and all other values into strings. Parameters ---------- df : dataframe col_name : string """ df = df.copy() df[col_name] = df[col_name].fillna("") df[col_name] = ...
python
def stringify_col(df, col_name): """ Take a dataframe and string-i-fy a column of values. Turn nan/None into "" and all other values into strings. Parameters ---------- df : dataframe col_name : string """ df = df.copy() df[col_name] = df[col_name].fillna("") df[col_name] = ...
[ "def", "stringify_col", "(", "df", ",", "col_name", ")", ":", "df", "=", "df", ".", "copy", "(", ")", "df", "[", "col_name", "]", "=", "df", "[", "col_name", "]", ".", "fillna", "(", "\"\"", ")", "df", "[", "col_name", "]", "=", "df", "[", "col...
Take a dataframe and string-i-fy a column of values. Turn nan/None into "" and all other values into strings. Parameters ---------- df : dataframe col_name : string
[ "Take", "a", "dataframe", "and", "string", "-", "i", "-", "fy", "a", "column", "of", "values", ".", "Turn", "nan", "/", "None", "into", "and", "all", "other", "values", "into", "strings", "." ]
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/contribution_builder.py#L2486-L2499
PmagPy/PmagPy
pmagpy/contribution_builder.py
Contribution.add_empty_magic_table
def add_empty_magic_table(self, dtype, col_names=None, groups=None): """ Add a blank MagicDataFrame to the contribution. You can provide either a list of column names, or a list of column group names. If provided, col_names takes precedence. """ if dtype not in se...
python
def add_empty_magic_table(self, dtype, col_names=None, groups=None): """ Add a blank MagicDataFrame to the contribution. You can provide either a list of column names, or a list of column group names. If provided, col_names takes precedence. """ if dtype not in se...
[ "def", "add_empty_magic_table", "(", "self", ",", "dtype", ",", "col_names", "=", "None", ",", "groups", "=", "None", ")", ":", "if", "dtype", "not", "in", "self", ".", "table_names", ":", "print", "(", "\"-W- {} is not a valid MagIC table name\"", ".", "forma...
Add a blank MagicDataFrame to the contribution. You can provide either a list of column names, or a list of column group names. If provided, col_names takes precedence.
[ "Add", "a", "blank", "MagicDataFrame", "to", "the", "contribution", ".", "You", "can", "provide", "either", "a", "list", "of", "column", "names", "or", "a", "list", "of", "column", "group", "names", ".", "If", "provided", "col_names", "takes", "precedence", ...
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/contribution_builder.py#L87-L99
PmagPy/PmagPy
pmagpy/contribution_builder.py
Contribution.add_magic_table_from_data
def add_magic_table_from_data(self, dtype, data): """ Add a MagIC table to the contribution from a data list Parameters ---------- dtype : str MagIC table type, i.e. 'specimens' data : list of dicts data list with format [{'key1': 'val1', ...}, {'...
python
def add_magic_table_from_data(self, dtype, data): """ Add a MagIC table to the contribution from a data list Parameters ---------- dtype : str MagIC table type, i.e. 'specimens' data : list of dicts data list with format [{'key1': 'val1', ...}, {'...
[ "def", "add_magic_table_from_data", "(", "self", ",", "dtype", ",", "data", ")", ":", "self", ".", "tables", "[", "dtype", "]", "=", "MagicDataFrame", "(", "dtype", "=", "dtype", ",", "data", "=", "data", ")", "if", "dtype", "==", "'measurements'", ":", ...
Add a MagIC table to the contribution from a data list Parameters ---------- dtype : str MagIC table type, i.e. 'specimens' data : list of dicts data list with format [{'key1': 'val1', ...}, {'key1': 'val2', ...}, ... }]
[ "Add", "a", "MagIC", "table", "to", "the", "contribution", "from", "a", "data", "list" ]
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/contribution_builder.py#L101-L115
PmagPy/PmagPy
pmagpy/contribution_builder.py
Contribution.add_magic_table
def add_magic_table(self, dtype, fname=None, df=None): """ Read in a new file to add a table to self.tables. Requires dtype argument and EITHER filename or df. Parameters ---------- dtype : str MagIC table name (plural, i.e. 'specimens') fname : str ...
python
def add_magic_table(self, dtype, fname=None, df=None): """ Read in a new file to add a table to self.tables. Requires dtype argument and EITHER filename or df. Parameters ---------- dtype : str MagIC table name (plural, i.e. 'specimens') fname : str ...
[ "def", "add_magic_table", "(", "self", ",", "dtype", ",", "fname", "=", "None", ",", "df", "=", "None", ")", ":", "if", "df", "is", "None", ":", "# if providing a filename but no data type", "if", "dtype", "==", "\"unknown\"", ":", "filename", "=", "os", "...
Read in a new file to add a table to self.tables. Requires dtype argument and EITHER filename or df. Parameters ---------- dtype : str MagIC table name (plural, i.e. 'specimens') fname : str filename of MagIC format file (short path, directory...
[ "Read", "in", "a", "new", "file", "to", "add", "a", "table", "to", "self", ".", "tables", ".", "Requires", "dtype", "argument", "and", "EITHER", "filename", "or", "df", "." ]
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/contribution_builder.py#L118-L174
PmagPy/PmagPy
pmagpy/contribution_builder.py
Contribution.propagate_measurement_info
def propagate_measurement_info(self): """ Take a contribution with a measurement table. Create specimen, sample, site, and location tables using the unique names in the measurement table to fill in the index. """ meas_df = self.tables['measurements'].df na...
python
def propagate_measurement_info(self): """ Take a contribution with a measurement table. Create specimen, sample, site, and location tables using the unique names in the measurement table to fill in the index. """ meas_df = self.tables['measurements'].df na...
[ "def", "propagate_measurement_info", "(", "self", ")", ":", "meas_df", "=", "self", ".", "tables", "[", "'measurements'", "]", ".", "df", "names_list", "=", "[", "'specimen'", ",", "'sample'", ",", "'site'", ",", "'location'", "]", "# add in any tables that you ...
Take a contribution with a measurement table. Create specimen, sample, site, and location tables using the unique names in the measurement table to fill in the index.
[ "Take", "a", "contribution", "with", "a", "measurement", "table", ".", "Create", "specimen", "sample", "site", "and", "location", "tables", "using", "the", "unique", "names", "in", "the", "measurement", "table", "to", "fill", "in", "the", "index", "." ]
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/contribution_builder.py#L177-L206
PmagPy/PmagPy
pmagpy/contribution_builder.py
Contribution.propagate_all_tables_info
def propagate_all_tables_info(self, write=True): """ Find any items (specimens, samples, sites, or locations) from tables other than measurements and make sure they each have a row in their own table. For example, if a site name is in the samples table but not in the sites table...
python
def propagate_all_tables_info(self, write=True): """ Find any items (specimens, samples, sites, or locations) from tables other than measurements and make sure they each have a row in their own table. For example, if a site name is in the samples table but not in the sites table...
[ "def", "propagate_all_tables_info", "(", "self", ",", "write", "=", "True", ")", ":", "for", "table_name", "in", "[", "\"specimens\"", ",", "\"samples\"", ",", "\"sites\"", ",", "\"locations\"", "]", ":", "if", "not", "table_name", "in", "self", ".", "tables...
Find any items (specimens, samples, sites, or locations) from tables other than measurements and make sure they each have a row in their own table. For example, if a site name is in the samples table but not in the sites table, create a row for it in the sites table.
[ "Find", "any", "items", "(", "specimens", "samples", "sites", "or", "locations", ")", "from", "tables", "other", "than", "measurements", "and", "make", "sure", "they", "each", "have", "a", "row", "in", "their", "own", "table", ".", "For", "example", "if", ...
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/contribution_builder.py#L209-L302
PmagPy/PmagPy
pmagpy/contribution_builder.py
Contribution.get_parent_and_child
def get_parent_and_child(self, table_name): """ Get the name of the parent table and the child table for a given MagIC table name. Parameters ---------- table_name : string of MagIC table name ['specimens', 'samples', 'sites', 'locations'] Returns ------...
python
def get_parent_and_child(self, table_name): """ Get the name of the parent table and the child table for a given MagIC table name. Parameters ---------- table_name : string of MagIC table name ['specimens', 'samples', 'sites', 'locations'] Returns ------...
[ "def", "get_parent_and_child", "(", "self", ",", "table_name", ")", ":", "if", "table_name", "not", "in", "self", ".", "ancestry", ":", "return", "None", ",", "None", "parent_ind", "=", "self", ".", "ancestry", ".", "index", "(", "table_name", ")", "+", ...
Get the name of the parent table and the child table for a given MagIC table name. Parameters ---------- table_name : string of MagIC table name ['specimens', 'samples', 'sites', 'locations'] Returns ------- parent_name : string of parent table name chil...
[ "Get", "the", "name", "of", "the", "parent", "table", "and", "the", "child", "table", "for", "a", "given", "MagIC", "table", "name", "." ]
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/contribution_builder.py#L305-L331
PmagPy/PmagPy
pmagpy/contribution_builder.py
Contribution.get_min_max_lat_lon
def get_min_max_lat_lon(self): """ Find latitude/longitude information from sites table and group it by location. Returns --------- """ if 'sites' not in self.tables: return # get min/max lat/lon from sites table site_container = self....
python
def get_min_max_lat_lon(self): """ Find latitude/longitude information from sites table and group it by location. Returns --------- """ if 'sites' not in self.tables: return # get min/max lat/lon from sites table site_container = self....
[ "def", "get_min_max_lat_lon", "(", "self", ")", ":", "if", "'sites'", "not", "in", "self", ".", "tables", ":", "return", "# get min/max lat/lon from sites table", "site_container", "=", "self", ".", "tables", "[", "'sites'", "]", "if", "not", "(", "'lat'", "in...
Find latitude/longitude information from sites table and group it by location. Returns ---------
[ "Find", "latitude", "/", "longitude", "information", "from", "sites", "table", "and", "group", "it", "by", "location", "." ]
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/contribution_builder.py#L333-L420
PmagPy/PmagPy
pmagpy/contribution_builder.py
Contribution.propagate_lithology_cols
def propagate_lithology_cols(self): """ Propagate any data from lithologies, geologic_types, or geologic_classes from the sites table to the samples and specimens table. In the samples/specimens tables, null or "Not Specified" values will be overwritten based on the data from the...
python
def propagate_lithology_cols(self): """ Propagate any data from lithologies, geologic_types, or geologic_classes from the sites table to the samples and specimens table. In the samples/specimens tables, null or "Not Specified" values will be overwritten based on the data from the...
[ "def", "propagate_lithology_cols", "(", "self", ")", ":", "cols", "=", "[", "'lithologies'", ",", "'geologic_types'", ",", "'geologic_classes'", "]", "#for table in ['specimens', 'samples']:", "# convert \"Not Specified\" to blank", "#self.tables[table].df.replace(\"^[Nn]ot [Ss]pec...
Propagate any data from lithologies, geologic_types, or geologic_classes from the sites table to the samples and specimens table. In the samples/specimens tables, null or "Not Specified" values will be overwritten based on the data from their parent site.
[ "Propagate", "any", "data", "from", "lithologies", "geologic_types", "or", "geologic_classes", "from", "the", "sites", "table", "to", "the", "samples", "and", "specimens", "table", ".", "In", "the", "samples", "/", "specimens", "tables", "null", "or", "Not", "...
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/contribution_builder.py#L422-L446
PmagPy/PmagPy
pmagpy/contribution_builder.py
Contribution.rename_item
def rename_item(self, table_name, item_old_name, item_new_name): """ Rename item (such as a site) everywhere that it occurs. This change often spans multiple tables. For example, a site name will occur in the sites table, the samples table, and possibly in the locations/ages tabl...
python
def rename_item(self, table_name, item_old_name, item_new_name): """ Rename item (such as a site) everywhere that it occurs. This change often spans multiple tables. For example, a site name will occur in the sites table, the samples table, and possibly in the locations/ages tabl...
[ "def", "rename_item", "(", "self", ",", "table_name", ",", "item_old_name", ",", "item_new_name", ")", ":", "# define some helper methods:", "def", "put_together_if_list", "(", "item", ")", ":", "\"\"\"\n String joining function\n that doesn't break with N...
Rename item (such as a site) everywhere that it occurs. This change often spans multiple tables. For example, a site name will occur in the sites table, the samples table, and possibly in the locations/ages tables.
[ "Rename", "item", "(", "such", "as", "a", "site", ")", "everywhere", "that", "it", "occurs", ".", "This", "change", "often", "spans", "multiple", "tables", ".", "For", "example", "a", "site", "name", "will", "occur", "in", "the", "sites", "table", "the",...
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/contribution_builder.py#L454-L519
PmagPy/PmagPy
pmagpy/contribution_builder.py
Contribution.get_table_name
def get_table_name(self, ind): """ Return both the table_name (i.e., 'specimens') and the col_name (i.e., 'specimen') for a given index in self.ancestry. """ if ind >= len(self.ancestry): return "", "" if ind > -1: table_name = self.ancestr...
python
def get_table_name(self, ind): """ Return both the table_name (i.e., 'specimens') and the col_name (i.e., 'specimen') for a given index in self.ancestry. """ if ind >= len(self.ancestry): return "", "" if ind > -1: table_name = self.ancestr...
[ "def", "get_table_name", "(", "self", ",", "ind", ")", ":", "if", "ind", ">=", "len", "(", "self", ".", "ancestry", ")", ":", "return", "\"\"", ",", "\"\"", "if", "ind", ">", "-", "1", ":", "table_name", "=", "self", ".", "ancestry", "[", "ind", ...
Return both the table_name (i.e., 'specimens') and the col_name (i.e., 'specimen') for a given index in self.ancestry.
[ "Return", "both", "the", "table_name", "(", "i", ".", "e", ".", "specimens", ")", "and", "the", "col_name", "(", "i", ".", "e", ".", "specimen", ")", "for", "a", "given", "index", "in", "self", ".", "ancestry", "." ]
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/contribution_builder.py#L522-L535
PmagPy/PmagPy
pmagpy/contribution_builder.py
Contribution.propagate_name_down
def propagate_name_down(self, col_name, df_name, verbose=False): """ Put the data for "col_name" into dataframe with df_name Used to add 'site_name' to specimen table, for example. """ if df_name not in self.tables: table = self.add_magic_table(df_name)[1] ...
python
def propagate_name_down(self, col_name, df_name, verbose=False): """ Put the data for "col_name" into dataframe with df_name Used to add 'site_name' to specimen table, for example. """ if df_name not in self.tables: table = self.add_magic_table(df_name)[1] ...
[ "def", "propagate_name_down", "(", "self", ",", "col_name", ",", "df_name", ",", "verbose", "=", "False", ")", ":", "if", "df_name", "not", "in", "self", ".", "tables", ":", "table", "=", "self", ".", "add_magic_table", "(", "df_name", ")", "[", "1", "...
Put the data for "col_name" into dataframe with df_name Used to add 'site_name' to specimen table, for example.
[ "Put", "the", "data", "for", "col_name", "into", "dataframe", "with", "df_name", "Used", "to", "add", "site_name", "to", "specimen", "table", "for", "example", "." ]
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/contribution_builder.py#L560-L666
PmagPy/PmagPy
pmagpy/contribution_builder.py
Contribution.propagate_cols
def propagate_cols(self, col_names, target_df_name, source_df_name, down=True): """ Put the data for "col_name" from source_df into target_df Used to get "azimuth" from sample table into measurements table (for example). Note: if getting data from the sampl...
python
def propagate_cols(self, col_names, target_df_name, source_df_name, down=True): """ Put the data for "col_name" from source_df into target_df Used to get "azimuth" from sample table into measurements table (for example). Note: if getting data from the sampl...
[ "def", "propagate_cols", "(", "self", ",", "col_names", ",", "target_df_name", ",", "source_df_name", ",", "down", "=", "True", ")", ":", "# make sure target table is read in", "if", "target_df_name", "not", "in", "self", ".", "tables", ":", "self", ".", "add_ma...
Put the data for "col_name" from source_df into target_df Used to get "azimuth" from sample table into measurements table (for example). Note: if getting data from the sample table, don't include "sample" in the col_names list. It is included automatically.
[ "Put", "the", "data", "for", "col_name", "from", "source_df", "into", "target_df", "Used", "to", "get", "azimuth", "from", "sample", "table", "into", "measurements", "table", "(", "for", "example", ")", ".", "Note", ":", "if", "getting", "data", "from", "t...
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/contribution_builder.py#L668-L773
PmagPy/PmagPy
pmagpy/contribution_builder.py
Contribution.propagate_cols_up
def propagate_cols_up(self, cols, target_df_name, source_df_name): """ Take values from source table, compile them into a colon-delimited list, and apply them to the target table. This method won't overwrite values in the target table, it will only supply values where they are mi...
python
def propagate_cols_up(self, cols, target_df_name, source_df_name): """ Take values from source table, compile them into a colon-delimited list, and apply them to the target table. This method won't overwrite values in the target table, it will only supply values where they are mi...
[ "def", "propagate_cols_up", "(", "self", ",", "cols", ",", "target_df_name", ",", "source_df_name", ")", ":", "print", "(", "\"-I- Trying to propagate {} columns from {} table into {} table\"", ".", "format", "(", "cols", ",", "source_df_name", ",", "target_df_name", ")...
Take values from source table, compile them into a colon-delimited list, and apply them to the target table. This method won't overwrite values in the target table, it will only supply values where they are missing. Parameters ---------- cols : list-like list...
[ "Take", "values", "from", "source", "table", "compile", "them", "into", "a", "colon", "-", "delimited", "list", "and", "apply", "them", "to", "the", "target", "table", ".", "This", "method", "won", "t", "overwrite", "values", "in", "the", "target", "table"...
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/contribution_builder.py#L775-L847
PmagPy/PmagPy
pmagpy/contribution_builder.py
Contribution.propagate_average_up
def propagate_average_up(self, cols=['lat', 'lon'], target_df_name='sites', source_df_name='samples'): """ Propagate average values from a lower table to a higher one. For example, propagate average lats/lons from samples to sites. Pre-existing values will no...
python
def propagate_average_up(self, cols=['lat', 'lon'], target_df_name='sites', source_df_name='samples'): """ Propagate average values from a lower table to a higher one. For example, propagate average lats/lons from samples to sites. Pre-existing values will no...
[ "def", "propagate_average_up", "(", "self", ",", "cols", "=", "[", "'lat'", ",", "'lon'", "]", ",", "target_df_name", "=", "'sites'", ",", "source_df_name", "=", "'samples'", ")", ":", "# make sure target/source table are appropriate", "target_ind", "=", "self", "...
Propagate average values from a lower table to a higher one. For example, propagate average lats/lons from samples to sites. Pre-existing values will not be overwritten. Parameters ---------- cols : list-like list of columns to propagate target_df_name : str ...
[ "Propagate", "average", "values", "from", "a", "lower", "table", "to", "a", "higher", "one", ".", "For", "example", "propagate", "average", "lats", "/", "lons", "from", "samples", "to", "sites", ".", "Pre", "-", "existing", "values", "will", "not", "be", ...
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/contribution_builder.py#L849-L940
PmagPy/PmagPy
pmagpy/contribution_builder.py
Contribution.propagate_min_max_up
def propagate_min_max_up(self, cols=['age'], target_df_name='locations', source_df_name='sites', min_suffix='low', max_suffix='high'): """ Take minimum/maximum values for a set of columns ...
python
def propagate_min_max_up(self, cols=['age'], target_df_name='locations', source_df_name='sites', min_suffix='low', max_suffix='high'): """ Take minimum/maximum values for a set of columns ...
[ "def", "propagate_min_max_up", "(", "self", ",", "cols", "=", "[", "'age'", "]", ",", "target_df_name", "=", "'locations'", ",", "source_df_name", "=", "'sites'", ",", "min_suffix", "=", "'low'", ",", "max_suffix", "=", "'high'", ")", ":", "# make sure target/...
Take minimum/maximum values for a set of columns in source_df, and apply them to the target table. This method won't overwrite values in the target table, it will only supply values where they are missing. Parameters ---------- cols : list-like list of column...
[ "Take", "minimum", "/", "maximum", "values", "for", "a", "set", "of", "columns", "in", "source_df", "and", "apply", "them", "to", "the", "target", "table", ".", "This", "method", "won", "t", "overwrite", "values", "in", "the", "target", "table", "it", "w...
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/contribution_builder.py#L942-L1032
PmagPy/PmagPy
pmagpy/contribution_builder.py
Contribution.get_age_levels
def get_age_levels(self): """ Method to add a "level" column to the ages table. Finds the lowest filled in level (i.e., specimen, sample, etc.) for that particular row. I.e., a row with both site and sample name filled in is considered a sample-level age. Returns...
python
def get_age_levels(self): """ Method to add a "level" column to the ages table. Finds the lowest filled in level (i.e., specimen, sample, etc.) for that particular row. I.e., a row with both site and sample name filled in is considered a sample-level age. Returns...
[ "def", "get_age_levels", "(", "self", ")", ":", "def", "get_level", "(", "ser", ",", "levels", "=", "(", "'specimen'", ",", "'sample'", ",", "'site'", ",", "'location'", ")", ")", ":", "for", "level", "in", "levels", ":", "if", "pd", ".", "notnull", ...
Method to add a "level" column to the ages table. Finds the lowest filled in level (i.e., specimen, sample, etc.) for that particular row. I.e., a row with both site and sample name filled in is considered a sample-level age. Returns --------- self.tables['ages']...
[ "Method", "to", "add", "a", "level", "column", "to", "the", "ages", "table", ".", "Finds", "the", "lowest", "filled", "in", "level", "(", "i", ".", "e", ".", "specimen", "sample", "etc", ".", ")", "for", "that", "particular", "row", ".", "I", ".", ...
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/contribution_builder.py#L1034-L1060
PmagPy/PmagPy
pmagpy/contribution_builder.py
Contribution.propagate_ages
def propagate_ages(self): """ Mine ages table for any age data, and write it into specimens, samples, sites, locations tables. Do not overwrite existing age data. """ # if there is no age table, skip if 'ages' not in self.tables: return # if ag...
python
def propagate_ages(self): """ Mine ages table for any age data, and write it into specimens, samples, sites, locations tables. Do not overwrite existing age data. """ # if there is no age table, skip if 'ages' not in self.tables: return # if ag...
[ "def", "propagate_ages", "(", "self", ")", ":", "# if there is no age table, skip", "if", "'ages'", "not", "in", "self", ".", "tables", ":", "return", "# if age table has no data, skip", "if", "not", "len", "(", "self", ".", "tables", "[", "'ages'", "]", ".", ...
Mine ages table for any age data, and write it into specimens, samples, sites, locations tables. Do not overwrite existing age data.
[ "Mine", "ages", "table", "for", "any", "age", "data", "and", "write", "it", "into", "specimens", "samples", "sites", "locations", "tables", ".", "Do", "not", "overwrite", "existing", "age", "data", "." ]
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/contribution_builder.py#L1062-L1119
PmagPy/PmagPy
pmagpy/contribution_builder.py
Contribution.remove_non_magic_cols
def remove_non_magic_cols(self): """ Remove all non-MagIC columns from all tables. """ for table_name in self.tables: table = self.tables[table_name] table.remove_non_magic_cols_from_table()
python
def remove_non_magic_cols(self): """ Remove all non-MagIC columns from all tables. """ for table_name in self.tables: table = self.tables[table_name] table.remove_non_magic_cols_from_table()
[ "def", "remove_non_magic_cols", "(", "self", ")", ":", "for", "table_name", "in", "self", ".", "tables", ":", "table", "=", "self", ".", "tables", "[", "table_name", "]", "table", ".", "remove_non_magic_cols_from_table", "(", ")" ]
Remove all non-MagIC columns from all tables.
[ "Remove", "all", "non", "-", "MagIC", "columns", "from", "all", "tables", "." ]
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/contribution_builder.py#L1123-L1129
PmagPy/PmagPy
pmagpy/contribution_builder.py
Contribution.write_table_to_file
def write_table_to_file(self, dtype, custom_name=None, append=False, dir_path=None): """ Write out a MagIC table to file, using custom filename as specified in self.filenames. Parameters ---------- dtype : str magic table name """ if custom_na...
python
def write_table_to_file(self, dtype, custom_name=None, append=False, dir_path=None): """ Write out a MagIC table to file, using custom filename as specified in self.filenames. Parameters ---------- dtype : str magic table name """ if custom_na...
[ "def", "write_table_to_file", "(", "self", ",", "dtype", ",", "custom_name", "=", "None", ",", "append", "=", "False", ",", "dir_path", "=", "None", ")", ":", "if", "custom_name", ":", "fname", "=", "custom_name", "else", ":", "fname", "=", "self", ".", ...
Write out a MagIC table to file, using custom filename as specified in self.filenames. Parameters ---------- dtype : str magic table name
[ "Write", "out", "a", "MagIC", "table", "to", "file", "using", "custom", "filename", "as", "specified", "in", "self", ".", "filenames", "." ]
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/contribution_builder.py#L1131-L1152
PmagPy/PmagPy
pmagpy/contribution_builder.py
Contribution.remove_names
def remove_names(self, dtype): """ Remove unneeded name columns ('specimen'/'sample'/etc) from the specified table. Parameters ---------- dtype : str Returns --------- pandas DataFrame without the unneeded columns Example -------...
python
def remove_names(self, dtype): """ Remove unneeded name columns ('specimen'/'sample'/etc) from the specified table. Parameters ---------- dtype : str Returns --------- pandas DataFrame without the unneeded columns Example -------...
[ "def", "remove_names", "(", "self", ",", "dtype", ")", ":", "if", "dtype", "not", "in", "self", ".", "ancestry", ":", "return", "if", "dtype", "in", "self", ".", "tables", ":", "# remove extra columns here", "self_ind", "=", "self", ".", "ancestry", ".", ...
Remove unneeded name columns ('specimen'/'sample'/etc) from the specified table. Parameters ---------- dtype : str Returns --------- pandas DataFrame without the unneeded columns Example --------- Contribution.tables['specimens'].df = Co...
[ "Remove", "unneeded", "name", "columns", "(", "specimen", "/", "sample", "/", "etc", ")", "from", "the", "specified", "table", "." ]
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/contribution_builder.py#L1154-L1182
PmagPy/PmagPy
pmagpy/contribution_builder.py
Contribution.find_missing_items
def find_missing_items(self, dtype): """ Find any items that are referenced in a child table but are missing in their own table. For example, a site that is listed in the samples table, but has no entry in the sites table. Parameters ---------- dtype : st...
python
def find_missing_items(self, dtype): """ Find any items that are referenced in a child table but are missing in their own table. For example, a site that is listed in the samples table, but has no entry in the sites table. Parameters ---------- dtype : st...
[ "def", "find_missing_items", "(", "self", ",", "dtype", ")", ":", "parent_dtype", ",", "child_dtype", "=", "self", ".", "get_parent_and_child", "(", "dtype", ")", "if", "not", "child_dtype", "in", "self", ".", "tables", ":", "return", "set", "(", ")", "ite...
Find any items that are referenced in a child table but are missing in their own table. For example, a site that is listed in the samples table, but has no entry in the sites table. Parameters ---------- dtype : str table name, e.g. 'specimens' Retur...
[ "Find", "any", "items", "that", "are", "referenced", "in", "a", "child", "table", "but", "are", "missing", "in", "their", "own", "table", ".", "For", "example", "a", "site", "that", "is", "listed", "in", "the", "samples", "table", "but", "has", "no", "...
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/contribution_builder.py#L1187-L1208
PmagPy/PmagPy
pmagpy/contribution_builder.py
Contribution.get_con_id
def get_con_id(self): """ Return contribution id if available """ con_id = "" if "contribution" in self.tables: if "id" in self.tables["contribution"].df.columns: con_id = str(self.tables["contribution"].df["id"].values[0]) return con_id
python
def get_con_id(self): """ Return contribution id if available """ con_id = "" if "contribution" in self.tables: if "id" in self.tables["contribution"].df.columns: con_id = str(self.tables["contribution"].df["id"].values[0]) return con_id
[ "def", "get_con_id", "(", "self", ")", ":", "con_id", "=", "\"\"", "if", "\"contribution\"", "in", "self", ".", "tables", ":", "if", "\"id\"", "in", "self", ".", "tables", "[", "\"contribution\"", "]", ".", "df", ".", "columns", ":", "con_id", "=", "st...
Return contribution id if available
[ "Return", "contribution", "id", "if", "available" ]
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/contribution_builder.py#L1211-L1219
PmagPy/PmagPy
pmagpy/contribution_builder.py
MagicDataFrame.all_to_str
def all_to_str(self): """ In all columns, turn all floats/ints into strings. If a float ends with .0, strip off '.0' from the resulting string. """ def stringify(x): # float --> string, # truncating floats like 3.0 --> 3 if isinstance(x, float)...
python
def all_to_str(self): """ In all columns, turn all floats/ints into strings. If a float ends with .0, strip off '.0' from the resulting string. """ def stringify(x): # float --> string, # truncating floats like 3.0 --> 3 if isinstance(x, float)...
[ "def", "all_to_str", "(", "self", ")", ":", "def", "stringify", "(", "x", ")", ":", "# float --> string,", "# truncating floats like 3.0 --> 3", "if", "isinstance", "(", "x", ",", "float", ")", ":", "if", "x", ".", "is_integer", "(", ")", ":", "#print('{} --...
In all columns, turn all floats/ints into strings. If a float ends with .0, strip off '.0' from the resulting string.
[ "In", "all", "columns", "turn", "all", "floats", "/", "ints", "into", "strings", ".", "If", "a", "float", "ends", "with", ".", "0", "strip", "off", ".", "0", "from", "the", "resulting", "string", "." ]
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/contribution_builder.py#L1430-L1495
PmagPy/PmagPy
pmagpy/contribution_builder.py
MagicDataFrame.remove_non_magic_cols_from_table
def remove_non_magic_cols_from_table(self, ignore_cols=()): """ Remove all non-magic columns from self.df. Changes in place. Parameters ---------- ignore_cols : list-like columns not to remove, whether they are proper MagIC columns or not ...
python
def remove_non_magic_cols_from_table(self, ignore_cols=()): """ Remove all non-magic columns from self.df. Changes in place. Parameters ---------- ignore_cols : list-like columns not to remove, whether they are proper MagIC columns or not ...
[ "def", "remove_non_magic_cols_from_table", "(", "self", ",", "ignore_cols", "=", "(", ")", ")", ":", "unrecognized_cols", "=", "self", ".", "get_non_magic_cols", "(", ")", "for", "col", "in", "ignore_cols", ":", "if", "col", "in", "unrecognized_cols", ":", "un...
Remove all non-magic columns from self.df. Changes in place. Parameters ---------- ignore_cols : list-like columns not to remove, whether they are proper MagIC columns or not Returns --------- unrecognized_cols : list any colu...
[ "Remove", "all", "non", "-", "magic", "columns", "from", "self", ".", "df", ".", "Changes", "in", "place", "." ]
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/contribution_builder.py#L1498-L1524
PmagPy/PmagPy
pmagpy/contribution_builder.py
MagicDataFrame.update_row
def update_row(self, ind, row_data): """ Update a row with data. Must provide the specific numeric index (not row label). If any new keys are present in row_data dictionary, that column will be added to the dataframe. This is done inplace. """ if sorted(ro...
python
def update_row(self, ind, row_data): """ Update a row with data. Must provide the specific numeric index (not row label). If any new keys are present in row_data dictionary, that column will be added to the dataframe. This is done inplace. """ if sorted(ro...
[ "def", "update_row", "(", "self", ",", "ind", ",", "row_data", ")", ":", "if", "sorted", "(", "row_data", ".", "keys", "(", ")", ")", "!=", "sorted", "(", "self", ".", "df", ".", "columns", ")", ":", "# add any new column names", "for", "key", "in", ...
Update a row with data. Must provide the specific numeric index (not row label). If any new keys are present in row_data dictionary, that column will be added to the dataframe. This is done inplace.
[ "Update", "a", "row", "with", "data", ".", "Must", "provide", "the", "specific", "numeric", "index", "(", "not", "row", "label", ")", ".", "If", "any", "new", "keys", "are", "present", "in", "row_data", "dictionary", "that", "column", "will", "be", "adde...
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/contribution_builder.py#L1551-L1572
PmagPy/PmagPy
pmagpy/contribution_builder.py
MagicDataFrame.add_row
def add_row(self, label, row_data, columns=""): """ Add a row with data. If any new keys are present in row_data dictionary, that column will be added to the dataframe. This is done inplace """ # use provided column order, making sure you don't lose any values ...
python
def add_row(self, label, row_data, columns=""): """ Add a row with data. If any new keys are present in row_data dictionary, that column will be added to the dataframe. This is done inplace """ # use provided column order, making sure you don't lose any values ...
[ "def", "add_row", "(", "self", ",", "label", ",", "row_data", ",", "columns", "=", "\"\"", ")", ":", "# use provided column order, making sure you don't lose any values", "# from self.df.columns", "if", "len", "(", "columns", ")", ":", "if", "sorted", "(", "self", ...
Add a row with data. If any new keys are present in row_data dictionary, that column will be added to the dataframe. This is done inplace
[ "Add", "a", "row", "with", "data", ".", "If", "any", "new", "keys", "are", "present", "in", "row_data", "dictionary", "that", "column", "will", "be", "added", "to", "the", "dataframe", ".", "This", "is", "done", "inplace" ]
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/contribution_builder.py#L1574-L1615
PmagPy/PmagPy
pmagpy/contribution_builder.py
MagicDataFrame.add_data
def add_data(self, data): # add append option later """ Add df to a MagicDataFrame using a data list. Parameters ---------- data : list of dicts data list with format [{'key1': 'val1', ...}, {'key1': 'val2', ...}, ... }] dtype : str MagIC table t...
python
def add_data(self, data): # add append option later """ Add df to a MagicDataFrame using a data list. Parameters ---------- data : list of dicts data list with format [{'key1': 'val1', ...}, {'key1': 'val2', ...}, ... }] dtype : str MagIC table t...
[ "def", "add_data", "(", "self", ",", "data", ")", ":", "# add append option later", "df", "=", "pd", ".", "DataFrame", "(", "data", ")", "name", ",", "dtype", "=", "self", ".", "get_singular_and_plural_dtype", "(", "self", ".", "dtype", ")", "if", "name", ...
Add df to a MagicDataFrame using a data list. Parameters ---------- data : list of dicts data list with format [{'key1': 'val1', ...}, {'key1': 'val2', ...}, ... }] dtype : str MagIC table type
[ "Add", "df", "to", "a", "MagicDataFrame", "using", "a", "data", "list", "." ]
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/contribution_builder.py#L1617-L1633
PmagPy/PmagPy
pmagpy/contribution_builder.py
MagicDataFrame.add_blank_row
def add_blank_row(self, label): """ Add a blank row with only an index value to self.df. This is done inplace. """ col_labels = self.df.columns blank_item = pd.Series({}, index=col_labels, name=label) # use .loc to add in place (append won't do that) self....
python
def add_blank_row(self, label): """ Add a blank row with only an index value to self.df. This is done inplace. """ col_labels = self.df.columns blank_item = pd.Series({}, index=col_labels, name=label) # use .loc to add in place (append won't do that) self....
[ "def", "add_blank_row", "(", "self", ",", "label", ")", ":", "col_labels", "=", "self", ".", "df", ".", "columns", "blank_item", "=", "pd", ".", "Series", "(", "{", "}", ",", "index", "=", "col_labels", ",", "name", "=", "label", ")", "# use .loc to ad...
Add a blank row with only an index value to self.df. This is done inplace.
[ "Add", "a", "blank", "row", "with", "only", "an", "index", "value", "to", "self", ".", "df", ".", "This", "is", "done", "inplace", "." ]
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/contribution_builder.py#L1635-L1644
PmagPy/PmagPy
pmagpy/contribution_builder.py
MagicDataFrame.delete_row
def delete_row(self, ind): """ remove self.df row at ind inplace """ self.df = pd.concat([self.df[:ind], self.df[ind+1:]], sort=True) return self.df
python
def delete_row(self, ind): """ remove self.df row at ind inplace """ self.df = pd.concat([self.df[:ind], self.df[ind+1:]], sort=True) return self.df
[ "def", "delete_row", "(", "self", ",", "ind", ")", ":", "self", ".", "df", "=", "pd", ".", "concat", "(", "[", "self", ".", "df", "[", ":", "ind", "]", ",", "self", ".", "df", "[", "ind", "+", "1", ":", "]", "]", ",", "sort", "=", "True", ...
remove self.df row at ind inplace
[ "remove", "self", ".", "df", "row", "at", "ind", "inplace" ]
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/contribution_builder.py#L1646-L1652
PmagPy/PmagPy
pmagpy/contribution_builder.py
MagicDataFrame.delete_rows
def delete_rows(self, condition, info_str=None): """ delete all rows with condition==True inplace Parameters ---------- condition : pandas DataFrame indexer all self.df rows that meet this condition will be deleted info_str : str descript...
python
def delete_rows(self, condition, info_str=None): """ delete all rows with condition==True inplace Parameters ---------- condition : pandas DataFrame indexer all self.df rows that meet this condition will be deleted info_str : str descript...
[ "def", "delete_rows", "(", "self", ",", "condition", ",", "info_str", "=", "None", ")", ":", "self", ".", "df", "[", "'num'", "]", "=", "list", "(", "range", "(", "len", "(", "self", ".", "df", ")", ")", ")", "df_data", "=", "self", ".", "df", ...
delete all rows with condition==True inplace Parameters ---------- condition : pandas DataFrame indexer all self.df rows that meet this condition will be deleted info_str : str description of the kind of rows to be deleted, e.g "specimen rows...
[ "delete", "all", "rows", "with", "condition", "==", "True", "inplace" ]
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/contribution_builder.py#L1654-L1687
PmagPy/PmagPy
pmagpy/contribution_builder.py
MagicDataFrame.drop_stub_rows
def drop_stub_rows(self, ignore_cols=('specimen', 'sample', 'software_packages', 'num')): """ Drop self.df rows that have only null values, ignoring certain columns. ...
python
def drop_stub_rows(self, ignore_cols=('specimen', 'sample', 'software_packages', 'num')): """ Drop self.df rows that have only null values, ignoring certain columns. ...
[ "def", "drop_stub_rows", "(", "self", ",", "ignore_cols", "=", "(", "'specimen'", ",", "'sample'", ",", "'software_packages'", ",", "'num'", ")", ")", ":", "# ignore citations if they just say 'This study'", "if", "'citations'", "in", "self", ".", "df", ".", "colu...
Drop self.df rows that have only null values, ignoring certain columns. Parameters ---------- ignore_cols : list-like list of column names to ignore for Returns --------- self.df : pandas DataFrame
[ "Drop", "self", ".", "df", "rows", "that", "have", "only", "null", "values", "ignoring", "certain", "columns", "." ]
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/contribution_builder.py#L1689-L1712
PmagPy/PmagPy
pmagpy/contribution_builder.py
MagicDataFrame.drop_duplicate_rows
def drop_duplicate_rows(self, ignore_cols=['specimen', 'sample']): """ Drop self.df rows that have only null values, ignoring certain columns BUT only if those rows do not have a unique index. Different from drop_stub_rows because it only drops empty rows if there is ano...
python
def drop_duplicate_rows(self, ignore_cols=['specimen', 'sample']): """ Drop self.df rows that have only null values, ignoring certain columns BUT only if those rows do not have a unique index. Different from drop_stub_rows because it only drops empty rows if there is ano...
[ "def", "drop_duplicate_rows", "(", "self", ",", "ignore_cols", "=", "[", "'specimen'", ",", "'sample'", "]", ")", ":", "# keep any row with a unique index", "unique_index", "=", "self", ".", "df", ".", "index", ".", "unique", "(", ")", "cond1", "=", "~", "se...
Drop self.df rows that have only null values, ignoring certain columns BUT only if those rows do not have a unique index. Different from drop_stub_rows because it only drops empty rows if there is another row with that index. Parameters ---------- ignore_cols : ...
[ "Drop", "self", ".", "df", "rows", "that", "have", "only", "null", "values", "ignoring", "certain", "columns", "BUT", "only", "if", "those", "rows", "do", "not", "have", "a", "unique", "index", "." ]
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/contribution_builder.py#L1714-L1749
PmagPy/PmagPy
pmagpy/contribution_builder.py
MagicDataFrame.update_record
def update_record(self, name, new_data, condition, update_only=False, debug=False): """ Find the first row in self.df with index == name and condition == True. Update that record with new_data, then delete any additional records where index == name and condi...
python
def update_record(self, name, new_data, condition, update_only=False, debug=False): """ Find the first row in self.df with index == name and condition == True. Update that record with new_data, then delete any additional records where index == name and condi...
[ "def", "update_record", "(", "self", ",", "name", ",", "new_data", ",", "condition", ",", "update_only", "=", "False", ",", "debug", "=", "False", ")", ":", "# add numeric index column temporarily", "self", ".", "df", "[", "'num'", "]", "=", "list", "(", "...
Find the first row in self.df with index == name and condition == True. Update that record with new_data, then delete any additional records where index == name and condition == True. Change is inplace
[ "Find", "the", "first", "row", "in", "self", ".", "df", "with", "index", "==", "name", "and", "condition", "==", "True", ".", "Update", "that", "record", "with", "new_data", "then", "delete", "any", "additional", "records", "where", "index", "==", "name", ...
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/contribution_builder.py#L1752-L1791
PmagPy/PmagPy
pmagpy/contribution_builder.py
MagicDataFrame.front_and_backfill
def front_and_backfill(self, cols, inplace=True): """ Groups dataframe by index name then replaces null values in selected columns with front/backfilled values if available. Changes self.df inplace. Parameters ---------- self : MagicDataFrame cols : array...
python
def front_and_backfill(self, cols, inplace=True): """ Groups dataframe by index name then replaces null values in selected columns with front/backfilled values if available. Changes self.df inplace. Parameters ---------- self : MagicDataFrame cols : array...
[ "def", "front_and_backfill", "(", "self", ",", "cols", ",", "inplace", "=", "True", ")", ":", "cols", "=", "list", "(", "cols", ")", "for", "col", "in", "cols", ":", "if", "col", "not", "in", "self", ".", "df", ".", "columns", ":", "self", ".", "...
Groups dataframe by index name then replaces null values in selected columns with front/backfilled values if available. Changes self.df inplace. Parameters ---------- self : MagicDataFrame cols : array-like list of column names Returns ------...
[ "Groups", "dataframe", "by", "index", "name", "then", "replaces", "null", "values", "in", "selected", "columns", "with", "front", "/", "backfilled", "values", "if", "available", ".", "Changes", "self", ".", "df", "inplace", "." ]
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/contribution_builder.py#L1793-L1822
PmagPy/PmagPy
pmagpy/contribution_builder.py
MagicDataFrame.sort_dataframe_cols
def sort_dataframe_cols(self): """ Sort self.df so that self.name is the first column, and the rest of the columns are sorted by group. """ # get the group for each column cols = self.df.columns groups = list(map(lambda x: self.data_model.get_group_for_col(self.dt...
python
def sort_dataframe_cols(self): """ Sort self.df so that self.name is the first column, and the rest of the columns are sorted by group. """ # get the group for each column cols = self.df.columns groups = list(map(lambda x: self.data_model.get_group_for_col(self.dt...
[ "def", "sort_dataframe_cols", "(", "self", ")", ":", "# get the group for each column", "cols", "=", "self", ".", "df", ".", "columns", "groups", "=", "list", "(", "map", "(", "lambda", "x", ":", "self", ".", "data_model", ".", "get_group_for_col", "(", "sel...
Sort self.df so that self.name is the first column, and the rest of the columns are sorted by group.
[ "Sort", "self", ".", "df", "so", "that", "self", ".", "name", "is", "the", "first", "column", "and", "the", "rest", "of", "the", "columns", "are", "sorted", "by", "group", "." ]
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/contribution_builder.py#L1825-L1859
PmagPy/PmagPy
pmagpy/contribution_builder.py
MagicDataFrame.find_filled_col
def find_filled_col(self, col_list): """ return the first col_name from the list that is both a. present in self.df.columns and b. self.df[col_name] has at least one non-null value Parameters ---------- self: MagicDataFrame col_list : iterable ...
python
def find_filled_col(self, col_list): """ return the first col_name from the list that is both a. present in self.df.columns and b. self.df[col_name] has at least one non-null value Parameters ---------- self: MagicDataFrame col_list : iterable ...
[ "def", "find_filled_col", "(", "self", ",", "col_list", ")", ":", "for", "col", "in", "col_list", ":", "if", "col", "in", "self", ".", "df", ".", "columns", ":", "if", "not", "all", "(", "[", "is_null", "(", "val", ",", "False", ")", "for", "val", ...
return the first col_name from the list that is both a. present in self.df.columns and b. self.df[col_name] has at least one non-null value Parameters ---------- self: MagicDataFrame col_list : iterable list of columns to check Returns -------...
[ "return", "the", "first", "col_name", "from", "the", "list", "that", "is", "both", "a", ".", "present", "in", "self", ".", "df", ".", "columns", "and", "b", ".", "self", ".", "df", "[", "col_name", "]", "has", "at", "least", "one", "non", "-", "nul...
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/contribution_builder.py#L1867-L1886
PmagPy/PmagPy
pmagpy/contribution_builder.py
MagicDataFrame.convert_to_pmag_data_list
def convert_to_pmag_data_list(self, lst_or_dict="lst", df=None): """ Take MagicDataFrame and turn it into a list of dictionaries. This will have the same format as reading in a 2.5 file with pmag.magic_read(), i.e.: if "lst": [{"sample": "samp_name", "azimuth": 12, ......
python
def convert_to_pmag_data_list(self, lst_or_dict="lst", df=None): """ Take MagicDataFrame and turn it into a list of dictionaries. This will have the same format as reading in a 2.5 file with pmag.magic_read(), i.e.: if "lst": [{"sample": "samp_name", "azimuth": 12, ......
[ "def", "convert_to_pmag_data_list", "(", "self", ",", "lst_or_dict", "=", "\"lst\"", ",", "df", "=", "None", ")", ":", "if", "isinstance", "(", "df", ",", "type", "(", "None", ")", ")", ":", "df", "=", "self", ".", "df", "# replace np.nan / None with \"\""...
Take MagicDataFrame and turn it into a list of dictionaries. This will have the same format as reading in a 2.5 file with pmag.magic_read(), i.e.: if "lst": [{"sample": "samp_name", "azimuth": 12, ...}, {...}] if "dict": {"samp_name": {"azimuth": 12, ...}, "samp_name2...
[ "Take", "MagicDataFrame", "and", "turn", "it", "into", "a", "list", "of", "dictionaries", ".", "This", "will", "have", "the", "same", "format", "as", "reading", "in", "a", "2", ".", "5", "file", "with", "pmag", ".", "magic_read", "()", "i", ".", "e", ...
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/contribution_builder.py#L1888-L1911
PmagPy/PmagPy
pmagpy/contribution_builder.py
MagicDataFrame.get_name
def get_name(self, col_name, df_slice="", index_names=""): """ Takes in a column name, and either a DataFrame slice or a list of index_names to slice self.df using fancy indexing. Then return the value for that column in the relevant slice. (Assumes that all values for column wil...
python
def get_name(self, col_name, df_slice="", index_names=""): """ Takes in a column name, and either a DataFrame slice or a list of index_names to slice self.df using fancy indexing. Then return the value for that column in the relevant slice. (Assumes that all values for column wil...
[ "def", "get_name", "(", "self", ",", "col_name", ",", "df_slice", "=", "\"\"", ",", "index_names", "=", "\"\"", ")", ":", "# if slice is provided, use it", "if", "any", "(", "df_slice", ")", ":", "df_slice", "=", "df_slice", "# if given index_names, grab a slice u...
Takes in a column name, and either a DataFrame slice or a list of index_names to slice self.df using fancy indexing. Then return the value for that column in the relevant slice. (Assumes that all values for column will be the same in the chosen slice, so return the first one.)
[ "Takes", "in", "a", "column", "name", "and", "either", "a", "DataFrame", "slice", "or", "a", "list", "of", "index_names", "to", "slice", "self", ".", "df", "using", "fancy", "indexing", ".", "Then", "return", "the", "value", "for", "that", "column", "in"...
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/contribution_builder.py#L1913-L1941
PmagPy/PmagPy
pmagpy/contribution_builder.py
MagicDataFrame.get_di_block
def get_di_block(self, df_slice=None, do_index=False, item_names=None, tilt_corr='100', excl=None, ignore_tilt=False): """ Input either a DataFrame slice or do_index=True and a list of index_names. Optional arguments: Provide tilt...
python
def get_di_block(self, df_slice=None, do_index=False, item_names=None, tilt_corr='100', excl=None, ignore_tilt=False): """ Input either a DataFrame slice or do_index=True and a list of index_names. Optional arguments: Provide tilt...
[ "def", "get_di_block", "(", "self", ",", "df_slice", "=", "None", ",", "do_index", "=", "False", ",", "item_names", "=", "None", ",", "tilt_corr", "=", "'100'", ",", "excl", "=", "None", ",", "ignore_tilt", "=", "False", ")", ":", "tilt_corr", "=", "in...
Input either a DataFrame slice or do_index=True and a list of index_names. Optional arguments: Provide tilt_corr (default 100). Excl is a list of method codes to exclude. Output dec/inc from the slice in this format: [[dec1, inc1], [dec2, inc2], ...]. Not ...
[ "Input", "either", "a", "DataFrame", "slice", "or", "do_index", "=", "True", "and", "a", "list", "of", "index_names", ".", "Optional", "arguments", ":", "Provide", "tilt_corr", "(", "default", "100", ")", ".", "Excl", "is", "a", "list", "of", "method", "...
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/contribution_builder.py#L1945-L1998
PmagPy/PmagPy
pmagpy/contribution_builder.py
MagicDataFrame.get_records_for_code
def get_records_for_code(self, meth_code, incl=True, use_slice=False, sli=None, strict_match=True): """ Use regex to see if meth_code is in the method_codes ":" delimited list. If incl == True, return all records WITH meth_code. If incl == False, return all r...
python
def get_records_for_code(self, meth_code, incl=True, use_slice=False, sli=None, strict_match=True): """ Use regex to see if meth_code is in the method_codes ":" delimited list. If incl == True, return all records WITH meth_code. If incl == False, return all r...
[ "def", "get_records_for_code", "(", "self", ",", "meth_code", ",", "incl", "=", "True", ",", "use_slice", "=", "False", ",", "sli", "=", "None", ",", "strict_match", "=", "True", ")", ":", "# (must use fillna to replace np.nan with False for indexing)", "if", "use...
Use regex to see if meth_code is in the method_codes ":" delimited list. If incl == True, return all records WITH meth_code. If incl == False, return all records WITHOUT meth_code. If strict_match == True, return only records with the exact meth_code. If strict_match == False, return rec...
[ "Use", "regex", "to", "see", "if", "meth_code", "is", "in", "the", "method_codes", ":", "delimited", "list", ".", "If", "incl", "==", "True", "return", "all", "records", "WITH", "meth_code", ".", "If", "incl", "==", "False", "return", "all", "records", "...
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/contribution_builder.py#L2001-L2033
PmagPy/PmagPy
pmagpy/contribution_builder.py
MagicDataFrame.merge_dfs
def merge_dfs(self, df1): """ Description: takes new calculated data and replaces the corresponding data in self.df with the new input data preserving the most important metadata if they are not otherwise saved. Note this does not mutate self.df it simply returns the merged dataframe if you want to repl...
python
def merge_dfs(self, df1): """ Description: takes new calculated data and replaces the corresponding data in self.df with the new input data preserving the most important metadata if they are not otherwise saved. Note this does not mutate self.df it simply returns the merged dataframe if you want to repl...
[ "def", "merge_dfs", "(", "self", ",", "df1", ")", ":", "if", "self", ".", "df", ".", "empty", ":", "return", "df1", "elif", "df1", ".", "empty", ":", "return", "self", ".", "df", "#copy to prevent mutation", "cdf2", "=", "self", ".", "df", ".", "copy...
Description: takes new calculated data and replaces the corresponding data in self.df with the new input data preserving the most important metadata if they are not otherwise saved. Note this does not mutate self.df it simply returns the merged dataframe if you want to replace self.df you'll have to do that yourself. ...
[ "Description", ":", "takes", "new", "calculated", "data", "and", "replaces", "the", "corresponding", "data", "in", "self", ".", "df", "with", "the", "new", "input", "data", "preserving", "the", "most", "important", "metadata", "if", "they", "are", "not", "ot...
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/contribution_builder.py#L2038-L2097
PmagPy/PmagPy
pmagpy/contribution_builder.py
MagicDataFrame.write_magic_file
def write_magic_file(self, custom_name=None, dir_path=".", append=False, multi_type=False, df=None): """ Write self.df out to tab-delimited file. By default will use standard MagIC filenames (specimens.txt, etc.), or you can provide a custom_name to write to inst...
python
def write_magic_file(self, custom_name=None, dir_path=".", append=False, multi_type=False, df=None): """ Write self.df out to tab-delimited file. By default will use standard MagIC filenames (specimens.txt, etc.), or you can provide a custom_name to write to inst...
[ "def", "write_magic_file", "(", "self", ",", "custom_name", "=", "None", ",", "dir_path", "=", "\".\"", ",", "append", "=", "False", ",", "multi_type", "=", "False", ",", "df", "=", "None", ")", ":", "# don't let custom name start with \"./\"", "if", "custom_n...
Write self.df out to tab-delimited file. By default will use standard MagIC filenames (specimens.txt, etc.), or you can provide a custom_name to write to instead. By default will write to custom_name if custom_name is a full path, or will write to dir_path + custom_name if custom_name ...
[ "Write", "self", ".", "df", "out", "to", "tab", "-", "delimited", "file", ".", "By", "default", "will", "use", "standard", "MagIC", "filenames", "(", "specimens", ".", "txt", "etc", ".", ")", "or", "you", "can", "provide", "a", "custom_name", "to", "wr...
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/contribution_builder.py#L2102-L2184
PmagPy/PmagPy
pmagpy/contribution_builder.py
MagicDataFrame.get_non_magic_cols
def get_non_magic_cols(self): """ Find all columns in self.df that are not real MagIC 3 columns. Returns -------- unrecognized_cols : list """ table_dm = self.data_model.dm[self.dtype] approved_cols = table_dm.index unrecognized_cols = (set(self.d...
python
def get_non_magic_cols(self): """ Find all columns in self.df that are not real MagIC 3 columns. Returns -------- unrecognized_cols : list """ table_dm = self.data_model.dm[self.dtype] approved_cols = table_dm.index unrecognized_cols = (set(self.d...
[ "def", "get_non_magic_cols", "(", "self", ")", ":", "table_dm", "=", "self", ".", "data_model", ".", "dm", "[", "self", ".", "dtype", "]", "approved_cols", "=", "table_dm", ".", "index", "unrecognized_cols", "=", "(", "set", "(", "self", ".", "df", ".", ...
Find all columns in self.df that are not real MagIC 3 columns. Returns -------- unrecognized_cols : list
[ "Find", "all", "columns", "in", "self", ".", "df", "that", "are", "not", "real", "MagIC", "3", "columns", "." ]
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/contribution_builder.py#L2189-L2200
PmagPy/PmagPy
pmagpy/contribution_builder.py
MagicDataFrame.get_first_non_null_value
def get_first_non_null_value(self, ind_name, col_name): """ For a given index and column, find the first non-null value. Parameters ---------- self : MagicDataFrame ind_name : str index name for indexing col_name : str column name for inde...
python
def get_first_non_null_value(self, ind_name, col_name): """ For a given index and column, find the first non-null value. Parameters ---------- self : MagicDataFrame ind_name : str index name for indexing col_name : str column name for inde...
[ "def", "get_first_non_null_value", "(", "self", ",", "ind_name", ",", "col_name", ")", ":", "short_df", "=", "self", ".", "df", ".", "loc", "[", "ind_name", ",", "col_name", "]", "mask", "=", "pd", ".", "notnull", "(", "short_df", ")", "print", "(", "s...
For a given index and column, find the first non-null value. Parameters ---------- self : MagicDataFrame ind_name : str index name for indexing col_name : str column name for indexing Returns --------- single value of str, float, ...
[ "For", "a", "given", "index", "and", "column", "find", "the", "first", "non", "-", "null", "value", "." ]
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/contribution_builder.py#L2203-L2226
PmagPy/PmagPy
pmagpy/contribution_builder.py
MagicDataFrame.get_singular_and_plural_dtype
def get_singular_and_plural_dtype(self, dtype): """ Parameters ---------- dtype : str MagIC table type (specimens, samples, contribution, etc.) Returns --------- name : str singular name for MagIC table ('specimen' for specimens table, etc....
python
def get_singular_and_plural_dtype(self, dtype): """ Parameters ---------- dtype : str MagIC table type (specimens, samples, contribution, etc.) Returns --------- name : str singular name for MagIC table ('specimen' for specimens table, etc....
[ "def", "get_singular_and_plural_dtype", "(", "self", ",", "dtype", ")", ":", "dtype", "=", "dtype", ".", "strip", "(", ")", "if", "dtype", ".", "endswith", "(", "'s'", ")", ":", "return", "dtype", "[", ":", "-", "1", "]", ",", "dtype", "elif", "dtype...
Parameters ---------- dtype : str MagIC table type (specimens, samples, contribution, etc.) Returns --------- name : str singular name for MagIC table ('specimen' for specimens table, etc.) dtype : str plural dtype for MagIC table ('spec...
[ "Parameters", "----------", "dtype", ":", "str", "MagIC", "table", "type", "(", "specimens", "samples", "contribution", "etc", ".", ")" ]
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/contribution_builder.py#L2229-L2249
PmagPy/PmagPy
programs/chi_magic2.py
main
def main(): """ NAME chi_magic.py DESCRIPTION plots magnetic susceptibility as a function of frequency and temperature and AC field SYNTAX chi_magic.py [command line options] OPTIONS -h prints help message and quits -i allows interactive setting of FILE and...
python
def main(): """ NAME chi_magic.py DESCRIPTION plots magnetic susceptibility as a function of frequency and temperature and AC field SYNTAX chi_magic.py [command line options] OPTIONS -h prints help message and quits -i allows interactive setting of FILE and...
[ "def", "main", "(", ")", ":", "cont", ",", "FTinit", ",", "BTinit", ",", "k", "=", "\"\"", ",", "0", ",", "0", ",", "0", "meas_file", "=", "\"magic_measurements.txt\"", "spec", "=", "\"\"", "Tind", ",", "cont", "=", "0", ",", "\"\"", "EXP", "=", ...
NAME chi_magic.py DESCRIPTION plots magnetic susceptibility as a function of frequency and temperature and AC field SYNTAX chi_magic.py [command line options] OPTIONS -h prints help message and quits -i allows interactive setting of FILE and temperature step ...
[ "NAME", "chi_magic", ".", "py" ]
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/programs/chi_magic2.py#L10-L247
PmagPy/PmagPy
programs/hysteresis_magic.py
main
def main(): """ NAME hysteresis_magic.py DESCRIPTION calculates hystereis parameters and saves them in 3.0 specimen format file makes plots if option selected SYNTAX hysteresis_magic.py [command line options] OPTIONS -h prints help message and quits ...
python
def main(): """ NAME hysteresis_magic.py DESCRIPTION calculates hystereis parameters and saves them in 3.0 specimen format file makes plots if option selected SYNTAX hysteresis_magic.py [command line options] OPTIONS -h prints help message and quits ...
[ "def", "main", "(", ")", ":", "args", "=", "sys", ".", "argv", "fmt", "=", "pmag", ".", "get_named_arg", "(", "'-fmt'", ",", "'svg'", ")", "output_dir_path", "=", "pmag", ".", "get_named_arg", "(", "'-WD'", ",", "'.'", ")", "input_dir_path", "=", "pmag...
NAME hysteresis_magic.py DESCRIPTION calculates hystereis parameters and saves them in 3.0 specimen format file makes plots if option selected SYNTAX hysteresis_magic.py [command line options] OPTIONS -h prints help message and quits -f: specify input file,...
[ "NAME", "hysteresis_magic", ".", "py" ]
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/programs/hysteresis_magic.py#L12-L53
PmagPy/PmagPy
pmagpy/find_pmag_dir.py
get_data_files_dir
def get_data_files_dir(): """ Find directory with data_files (sys.prefix or local PmagPy/data_files) and return the path. """ if 'data_files' in os.listdir(sys.prefix): return os.path.join(sys.prefix, 'data_files') else: return os.path.join(get_pmag_dir(), 'data_files')
python
def get_data_files_dir(): """ Find directory with data_files (sys.prefix or local PmagPy/data_files) and return the path. """ if 'data_files' in os.listdir(sys.prefix): return os.path.join(sys.prefix, 'data_files') else: return os.path.join(get_pmag_dir(), 'data_files')
[ "def", "get_data_files_dir", "(", ")", ":", "if", "'data_files'", "in", "os", ".", "listdir", "(", "sys", ".", "prefix", ")", ":", "return", "os", ".", "path", ".", "join", "(", "sys", ".", "prefix", ",", "'data_files'", ")", "else", ":", "return", "...
Find directory with data_files (sys.prefix or local PmagPy/data_files) and return the path.
[ "Find", "directory", "with", "data_files", "(", "sys", ".", "prefix", "or", "local", "PmagPy", "/", "data_files", ")", "and", "return", "the", "path", "." ]
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/find_pmag_dir.py#L13-L21
PmagPy/PmagPy
pmagpy/find_pmag_dir.py
get_pmag_dir
def get_pmag_dir(): """ Returns directory in which PmagPy is installed """ # this is correct for py2exe (DEPRECATED) #win_frozen = is_frozen() #if win_frozen: # path = os.path.abspath(unicode(sys.executable, sys.getfilesystemencoding())) # path = os.path.split(path)[0] # ret...
python
def get_pmag_dir(): """ Returns directory in which PmagPy is installed """ # this is correct for py2exe (DEPRECATED) #win_frozen = is_frozen() #if win_frozen: # path = os.path.abspath(unicode(sys.executable, sys.getfilesystemencoding())) # path = os.path.split(path)[0] # ret...
[ "def", "get_pmag_dir", "(", ")", ":", "# this is correct for py2exe (DEPRECATED)", "#win_frozen = is_frozen()", "#if win_frozen:", "# path = os.path.abspath(unicode(sys.executable, sys.getfilesystemencoding()))", "# path = os.path.split(path)[0]", "# return path", "# this is correct f...
Returns directory in which PmagPy is installed
[ "Returns", "directory", "in", "which", "PmagPy", "is", "installed" ]
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/find_pmag_dir.py#L23-L80
PmagPy/PmagPy
programs/plot_magmap_basemap.py
main
def main(): """ NAME plot_magmap.py DESCRIPTION makes a color contour map of desired field model SYNTAX plot_magmap.py [command line options] OPTIONS -h prints help and quits -f FILE specify field model file with format: l m g h -fmt [pdf,eps,svg,...
python
def main(): """ NAME plot_magmap.py DESCRIPTION makes a color contour map of desired field model SYNTAX plot_magmap.py [command line options] OPTIONS -h prints help and quits -f FILE specify field model file with format: l m g h -fmt [pdf,eps,svg,...
[ "def", "main", "(", ")", ":", "cmap", "=", "'RdYlBu'", "date", "=", "2016.", "if", "not", "Basemap", ":", "print", "(", "\"-W- Cannot access the Basemap module, which is required to run plot_magmap.py\"", ")", "sys", ".", "exit", "(", ")", "dir_path", "=", "'.'", ...
NAME plot_magmap.py DESCRIPTION makes a color contour map of desired field model SYNTAX plot_magmap.py [command line options] OPTIONS -h prints help and quits -f FILE specify field model file with format: l m g h -fmt [pdf,eps,svg,png] specify format for...
[ "NAME", "plot_magmap", ".", "py" ]
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/programs/plot_magmap_basemap.py#L20-L133
PmagPy/PmagPy
programs/aniso_magic.py
main
def main(): """ NAME aniso_magic.py DESCRIPTION plots anisotropy data with either bootstrap or hext ellipses SYNTAX aniso_magic.py [-h] [command line options] OPTIONS -h plots help message and quits -usr USER: set the user name -f AFILE, specify spec...
python
def main(): """ NAME aniso_magic.py DESCRIPTION plots anisotropy data with either bootstrap or hext ellipses SYNTAX aniso_magic.py [-h] [command line options] OPTIONS -h plots help message and quits -usr USER: set the user name -f AFILE, specify spec...
[ "def", "main", "(", ")", ":", "args", "=", "sys", ".", "argv", "if", "\"-h\"", "in", "args", ":", "print", "(", "main", ".", "__doc__", ")", "sys", ".", "exit", "(", ")", "verbose", "=", "pmagplotlib", ".", "verbose", "dir_path", "=", "pmag", ".", ...
NAME aniso_magic.py DESCRIPTION plots anisotropy data with either bootstrap or hext ellipses SYNTAX aniso_magic.py [-h] [command line options] OPTIONS -h plots help message and quits -usr USER: set the user name -f AFILE, specify specimens.txt formatted file...
[ "NAME", "aniso_magic", ".", "py" ]
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/programs/aniso_magic.py#L16-L98
PmagPy/PmagPy
programs/aniso_magic.py
new
def new(): """ NAME aniso_magic.py DESCRIPTION plots anisotropy data with either bootstrap or hext ellipses SYNTAX aniso_magic.py [-h] [command line options] OPTIONS -h plots help message and quits -f AFILE, specify specimens.txt formatted file for input ...
python
def new(): """ NAME aniso_magic.py DESCRIPTION plots anisotropy data with either bootstrap or hext ellipses SYNTAX aniso_magic.py [-h] [command line options] OPTIONS -h plots help message and quits -f AFILE, specify specimens.txt formatted file for input ...
[ "def", "new", "(", ")", ":", "args", "=", "sys", ".", "argv", "if", "'-h'", "in", "args", ":", "print", "(", "new", ".", "__doc__", ")", "return", "dir_path", "=", "pmag", ".", "get_named_arg", "(", "\"-WD\"", ",", "\".\"", ")", "if", "'-ID'", "in"...
NAME aniso_magic.py DESCRIPTION plots anisotropy data with either bootstrap or hext ellipses SYNTAX aniso_magic.py [-h] [command line options] OPTIONS -h plots help message and quits -f AFILE, specify specimens.txt formatted file for input -fsa SAMPFILE, spe...
[ "NAME", "aniso_magic", ".", "py" ]
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/programs/aniso_magic.py#L100-L183
PmagPy/PmagPy
programs/scalc_magic.py
main
def main(): """ NAME scalc_magic.py DESCRIPTION calculates Sb from pmag_results files SYNTAX scalc_magic -h [command line options] INPUT takes magic formatted pmag_results (2.5) or sites (3.0) table pmag_result_name (2.5) must start with "VGP: Site" mu...
python
def main(): """ NAME scalc_magic.py DESCRIPTION calculates Sb from pmag_results files SYNTAX scalc_magic -h [command line options] INPUT takes magic formatted pmag_results (2.5) or sites (3.0) table pmag_result_name (2.5) must start with "VGP: Site" mu...
[ "def", "main", "(", ")", ":", "coord", ",", "kappa", ",", "cutoff", ",", "n", "=", "0", ",", "0", ",", "180.", ",", "0", "nb", ",", "anti", ",", "spin", ",", "v", ",", "boot", "=", "1000", ",", "0", ",", "0", ",", "0", ",", "0", "data_mod...
NAME scalc_magic.py DESCRIPTION calculates Sb from pmag_results files SYNTAX scalc_magic -h [command line options] INPUT takes magic formatted pmag_results (2.5) or sites (3.0) table pmag_result_name (2.5) must start with "VGP: Site" must have average_lat (2.5...
[ "NAME", "scalc_magic", ".", "py" ]
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/programs/scalc_magic.py#L7-L121
PmagPy/PmagPy
programs/deprecated/plot_magic_keys.py
main
def main(): """ NAME plot_magic_keys.py DESCRIPTION picks out keys and makes and xy plot SYNTAX plot_magic_keys.py [command line options] OPTIONS -h prints help message and quits -f FILE: specify input magic format file -xkey KEY: specify key for X ...
python
def main(): """ NAME plot_magic_keys.py DESCRIPTION picks out keys and makes and xy plot SYNTAX plot_magic_keys.py [command line options] OPTIONS -h prints help message and quits -f FILE: specify input magic format file -xkey KEY: specify key for X ...
[ "def", "main", "(", ")", ":", "dir_path", "=", "\"./\"", "if", "'-WD'", "in", "sys", ".", "argv", ":", "ind", "=", "sys", ".", "argv", ".", "index", "(", "'-WD'", ")", "dir_path", "=", "sys", ".", "argv", "[", "ind", "+", "1", "]", "if", "'-h'"...
NAME plot_magic_keys.py DESCRIPTION picks out keys and makes and xy plot SYNTAX plot_magic_keys.py [command line options] OPTIONS -h prints help message and quits -f FILE: specify input magic format file -xkey KEY: specify key for X -ykey KEY: speci...
[ "NAME", "plot_magic_keys", ".", "py" ]
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/programs/deprecated/plot_magic_keys.py#L11-L87
PmagPy/PmagPy
programs/eqarea.py
main
def main(): """ NAME eqarea.py DESCRIPTION makes equal area projections from declination/inclination data INPUT FORMAT takes dec/inc as first two columns in space delimited file SYNTAX eqarea.py [options] OPTIONS -f FILE, specify file on command line ...
python
def main(): """ NAME eqarea.py DESCRIPTION makes equal area projections from declination/inclination data INPUT FORMAT takes dec/inc as first two columns in space delimited file SYNTAX eqarea.py [options] OPTIONS -f FILE, specify file on command line ...
[ "def", "main", "(", ")", ":", "title", "=", "\"\"", "files", ",", "fmt", "=", "{", "}", ",", "'svg'", "sym", "=", "{", "'lower'", ":", "[", "'o'", ",", "'r'", "]", ",", "'upper'", ":", "[", "'o'", ",", "'w'", "]", "}", "plot", "=", "0", "if...
NAME eqarea.py DESCRIPTION makes equal area projections from declination/inclination data INPUT FORMAT takes dec/inc as first two columns in space delimited file SYNTAX eqarea.py [options] OPTIONS -f FILE, specify file on command line -sav save figure and ...
[ "NAME", "eqarea", ".", "py" ]
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/programs/eqarea.py#L12-L92
PmagPy/PmagPy
programs/find_ei.py
main
def main(): """ NAME find_EI.py DESCRIPTION Applies series of assumed flattening factor and "unsquishes" inclinations assuming tangent function. Finds flattening factor that gives elongation/inclination pair consistent with TK03. Finds bootstrap confidence bounds SYNTAX...
python
def main(): """ NAME find_EI.py DESCRIPTION Applies series of assumed flattening factor and "unsquishes" inclinations assuming tangent function. Finds flattening factor that gives elongation/inclination pair consistent with TK03. Finds bootstrap confidence bounds SYNTAX...
[ "def", "main", "(", ")", ":", "fmt", ",", "nb", "=", "'svg'", ",", "1000", "plot", "=", "0", "if", "'-h'", "in", "sys", ".", "argv", ":", "print", "(", "main", ".", "__doc__", ")", "sys", ".", "exit", "(", ")", "# graceful quit", "elif", "'-f'", ...
NAME find_EI.py DESCRIPTION Applies series of assumed flattening factor and "unsquishes" inclinations assuming tangent function. Finds flattening factor that gives elongation/inclination pair consistent with TK03. Finds bootstrap confidence bounds SYNTAX find_EI.py [com...
[ "NAME", "find_EI", ".", "py" ]
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/programs/find_ei.py#L13-L141
PmagPy/PmagPy
programs/magic_gui2.py
MainFrame.on_change_dir_button
def on_change_dir_button(self, event): """ create change directory frame """ currentDirectory = self.WD #os.getcwd() change_dir_dialog = wx.DirDialog(self.panel, "Choose your working directory to create or edit a MagIC contribution:", ...
python
def on_change_dir_button(self, event): """ create change directory frame """ currentDirectory = self.WD #os.getcwd() change_dir_dialog = wx.DirDialog(self.panel, "Choose your working directory to create or edit a MagIC contribution:", ...
[ "def", "on_change_dir_button", "(", "self", ",", "event", ")", ":", "currentDirectory", "=", "self", ".", "WD", "#os.getcwd()", "change_dir_dialog", "=", "wx", ".", "DirDialog", "(", "self", ".", "panel", ",", "\"Choose your working directory to create or edit a MagIC...
create change directory frame
[ "create", "change", "directory", "frame" ]
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/programs/magic_gui2.py#L210-L236
PmagPy/PmagPy
programs/magic_gui2.py
MainFrame.make_grid_frame
def make_grid_frame(self, event): """ Create a GridFrame for data type of the button that was clicked """ if self.grid_frame: print('-I- You already have a grid frame open') pw.simple_warning("You already have a grid open") return try: ...
python
def make_grid_frame(self, event): """ Create a GridFrame for data type of the button that was clicked """ if self.grid_frame: print('-I- You already have a grid frame open') pw.simple_warning("You already have a grid open") return try: ...
[ "def", "make_grid_frame", "(", "self", ",", "event", ")", ":", "if", "self", ".", "grid_frame", ":", "print", "(", "'-I- You already have a grid frame open'", ")", "pw", ".", "simple_warning", "(", "\"You already have a grid open\"", ")", "return", "try", ":", "gr...
Create a GridFrame for data type of the button that was clicked
[ "Create", "a", "GridFrame", "for", "data", "type", "of", "the", "button", "that", "was", "clicked" ]
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/programs/magic_gui2.py#L251-L292
PmagPy/PmagPy
programs/magic_gui2.py
MainFrame.on_upload_file
def on_upload_file(self, event): """ Write all data to appropriate er_* and pmag_* files. Then use those files to create a MagIC upload format file. Validate the upload file. """ # coherence validations wait = wx.BusyInfo('Validating data, please wait...') ...
python
def on_upload_file(self, event): """ Write all data to appropriate er_* and pmag_* files. Then use those files to create a MagIC upload format file. Validate the upload file. """ # coherence validations wait = wx.BusyInfo('Validating data, please wait...') ...
[ "def", "on_upload_file", "(", "self", ",", "event", ")", ":", "# coherence validations", "wait", "=", "wx", ".", "BusyInfo", "(", "'Validating data, please wait...'", ")", "wx", ".", "SafeYield", "(", ")", "spec_warnings", ",", "samp_warnings", ",", "site_warnings...
Write all data to appropriate er_* and pmag_* files. Then use those files to create a MagIC upload format file. Validate the upload file.
[ "Write", "all", "data", "to", "appropriate", "er_", "*", "and", "pmag_", "*", "files", ".", "Then", "use", "those", "files", "to", "create", "a", "MagIC", "upload", "format", "file", ".", "Validate", "the", "upload", "file", "." ]
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/programs/magic_gui2.py#L294-L367
PmagPy/PmagPy
programs/magic_gui2.py
MagICMenu.on_quit
def on_quit(self, event): """ shut down application """ if self.parent.grid_frame: if self.parent.grid_frame.grid.changes: dlg = wx.MessageDialog(self,caption="Message:", message="Are you sure you want to exit the program?\nYou have a grid open with unsaved ch...
python
def on_quit(self, event): """ shut down application """ if self.parent.grid_frame: if self.parent.grid_frame.grid.changes: dlg = wx.MessageDialog(self,caption="Message:", message="Are you sure you want to exit the program?\nYou have a grid open with unsaved ch...
[ "def", "on_quit", "(", "self", ",", "event", ")", ":", "if", "self", ".", "parent", ".", "grid_frame", ":", "if", "self", ".", "parent", ".", "grid_frame", ".", "grid", ".", "changes", ":", "dlg", "=", "wx", ".", "MessageDialog", "(", "self", ",", ...
shut down application
[ "shut", "down", "application" ]
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/programs/magic_gui2.py#L423-L446
PmagPy/PmagPy
programs/magic_gui2.py
MagICMenu.on_clear
def on_clear(self, event): """ initialize window to allow user to empty the working directory """ dia = pmag_menu_dialogs.ClearWD(self.parent, self.parent.WD) clear = dia.do_clear() if clear: print('-I- Clear data object') self.parent.er_magic = bu...
python
def on_clear(self, event): """ initialize window to allow user to empty the working directory """ dia = pmag_menu_dialogs.ClearWD(self.parent, self.parent.WD) clear = dia.do_clear() if clear: print('-I- Clear data object') self.parent.er_magic = bu...
[ "def", "on_clear", "(", "self", ",", "event", ")", ":", "dia", "=", "pmag_menu_dialogs", ".", "ClearWD", "(", "self", ".", "parent", ",", "self", ".", "parent", ".", "WD", ")", "clear", "=", "dia", ".", "do_clear", "(", ")", "if", "clear", ":", "pr...
initialize window to allow user to empty the working directory
[ "initialize", "window", "to", "allow", "user", "to", "empty", "the", "working", "directory" ]
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/programs/magic_gui2.py#L448-L459
PmagPy/PmagPy
programs/deprecated/convert_samples.py
main
def main(): """ NAME convert_samples.py DESCRIPTION takes an er_samples or magic_measurements format file and creates an orient.txt template SYNTAX convert_samples.py [command line options] OPTIONS -f FILE: specify input file, default is er_samples.txt ...
python
def main(): """ NAME convert_samples.py DESCRIPTION takes an er_samples or magic_measurements format file and creates an orient.txt template SYNTAX convert_samples.py [command line options] OPTIONS -f FILE: specify input file, default is er_samples.txt ...
[ "def", "main", "(", ")", ":", "#", "# initialize variables", "#", "version_num", "=", "pmag", ".", "get_version", "(", ")", "orient_file", ",", "samp_file", "=", "\"orient\"", ",", "\"er_samples.txt\"", "args", "=", "sys", ".", "argv", "dir_path", ",", "out_...
NAME convert_samples.py DESCRIPTION takes an er_samples or magic_measurements format file and creates an orient.txt template SYNTAX convert_samples.py [command line options] OPTIONS -f FILE: specify input file, default is er_samples.txt -F FILE: specify output ...
[ "NAME", "convert_samples", ".", "py", "DESCRIPTION", "takes", "an", "er_samples", "or", "magic_measurements", "format", "file", "and", "creates", "an", "orient", ".", "txt", "template", "SYNTAX", "convert_samples", ".", "py", "[", "command", "line", "options", "...
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/programs/deprecated/convert_samples.py#L8-L94
PmagPy/PmagPy
programs/gobing.py
main
def main(): """ NAME gobing.py DESCRIPTION calculates Bingham parameters from dec inc data INPUT FORMAT takes dec/inc as first two columns in space delimited file SYNTAX gobing.py [options] OPTIONS -f FILE to read from FILE -F, specifies output f...
python
def main(): """ NAME gobing.py DESCRIPTION calculates Bingham parameters from dec inc data INPUT FORMAT takes dec/inc as first two columns in space delimited file SYNTAX gobing.py [options] OPTIONS -f FILE to read from FILE -F, specifies output f...
[ "def", "main", "(", ")", ":", "if", "len", "(", "sys", ".", "argv", ")", ">", "0", ":", "if", "'-h'", "in", "sys", ".", "argv", ":", "# check if help is needed", "print", "(", "main", ".", "__doc__", ")", "sys", ".", "exit", "(", ")", "# graceful q...
NAME gobing.py DESCRIPTION calculates Bingham parameters from dec inc data INPUT FORMAT takes dec/inc as first two columns in space delimited file SYNTAX gobing.py [options] OPTIONS -f FILE to read from FILE -F, specifies output file name < filen...
[ "NAME", "gobing", ".", "py" ]
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/programs/gobing.py#L6-L57
PmagPy/PmagPy
programs/atrm_magic.py
main
def main(): """ NAME atrm_magic.py DESCRIPTION Converts ATRM data to best-fit tensor (6 elements plus sigma) Original program ARMcrunch written to accomodate ARM anisotropy data collected from 6 axial directions (+X,+Y,+Z,-X,-Y,-Z) using the off-axis remanence ...
python
def main(): """ NAME atrm_magic.py DESCRIPTION Converts ATRM data to best-fit tensor (6 elements plus sigma) Original program ARMcrunch written to accomodate ARM anisotropy data collected from 6 axial directions (+X,+Y,+Z,-X,-Y,-Z) using the off-axis remanence ...
[ "def", "main", "(", ")", ":", "# initialize some parameters", "args", "=", "sys", ".", "argv", "if", "\"-h\"", "in", "args", ":", "print", "(", "main", ".", "__doc__", ")", "sys", ".", "exit", "(", ")", "#if \"-Fa\" in args:", "# ind = args.index(\"-Fa\")",...
NAME atrm_magic.py DESCRIPTION Converts ATRM data to best-fit tensor (6 elements plus sigma) Original program ARMcrunch written to accomodate ARM anisotropy data collected from 6 axial directions (+X,+Y,+Z,-X,-Y,-Z) using the off-axis remanence terms to construct the t...
[ "NAME", "atrm_magic", ".", "py" ]
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/programs/atrm_magic.py#L9-L68
PmagPy/PmagPy
programs/conversion_scripts2/iodp_srm_magic2.py
main
def main(command_line=True, **kwargs): """ NAME iodp_srm_magic.py DESCRIPTION converts IODP LIMS and LORE SRM archive half sample format files to magic_measurements format files SYNTAX iodp_srm_magic.py [command line options] OPTIONS -h: prints the help message an...
python
def main(command_line=True, **kwargs): """ NAME iodp_srm_magic.py DESCRIPTION converts IODP LIMS and LORE SRM archive half sample format files to magic_measurements format files SYNTAX iodp_srm_magic.py [command line options] OPTIONS -h: prints the help message an...
[ "def", "main", "(", "command_line", "=", "True", ",", "*", "*", "kwargs", ")", ":", "#", "# initialize defaults", "version_num", "=", "pmag", ".", "get_version", "(", ")", "meas_file", "=", "'magic_measurements.txt'", "spec_file", "=", "'er_specimens.txt'", "sam...
NAME iodp_srm_magic.py DESCRIPTION converts IODP LIMS and LORE SRM archive half sample format files to magic_measurements format files SYNTAX iodp_srm_magic.py [command line options] OPTIONS -h: prints the help message and quits. -f FILE: specify input .csv file, ...
[ "NAME", "iodp_srm_magic", ".", "py" ]
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/programs/conversion_scripts2/iodp_srm_magic2.py#L9-L297
PmagPy/PmagPy
programs/agm_magic2.py
main
def main(): """ NAME agm_magic.py DESCRIPTION converts Micromag agm files to magic format SYNTAX agm_magic.py [-h] [command line options] OPTIONS -usr USER: identify user, default is "" - put in quotation marks! -bak: this is a IRM backfield curve ...
python
def main(): """ NAME agm_magic.py DESCRIPTION converts Micromag agm files to magic format SYNTAX agm_magic.py [-h] [command line options] OPTIONS -usr USER: identify user, default is "" - put in quotation marks! -bak: this is a IRM backfield curve ...
[ "def", "main", "(", ")", ":", "citation", "=", "'This study'", "MeasRecs", "=", "[", "]", "units", "=", "'cgs'", "meth", "=", "\"LP-HYS\"", "version_num", "=", "pmag", ".", "get_version", "(", ")", "args", "=", "sys", ".", "argv", "fmt", "=", "'old'", ...
NAME agm_magic.py DESCRIPTION converts Micromag agm files to magic format SYNTAX agm_magic.py [-h] [command line options] OPTIONS -usr USER: identify user, default is "" - put in quotation marks! -bak: this is a IRM backfield curve -f FILE, specify input...
[ "NAME", "agm_magic", ".", "py" ]
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/programs/agm_magic2.py#L10-L250
PmagPy/PmagPy
programs/di_vgp.py
main
def main(): """ NAME di_vgp.py DESCRIPTION converts declination/inclination to virtual geomagnetic pole SYNTAX di_vgp.py [-h] [options] OPTIONS -h prints help message and quits -i interactive data entry -f FILE to specify intput file -...
python
def main(): """ NAME di_vgp.py DESCRIPTION converts declination/inclination to virtual geomagnetic pole SYNTAX di_vgp.py [-h] [options] OPTIONS -h prints help message and quits -i interactive data entry -f FILE to specify intput file -...
[ "def", "main", "(", ")", ":", "if", "'-h'", "in", "sys", ".", "argv", ":", "print", "(", "main", ".", "__doc__", ")", "sys", ".", "exit", "(", ")", "if", "'-F'", "in", "sys", ".", "argv", ":", "ind", "=", "sys", ".", "argv", ".", "index", "("...
NAME di_vgp.py DESCRIPTION converts declination/inclination to virtual geomagnetic pole SYNTAX di_vgp.py [-h] [options] OPTIONS -h prints help message and quits -i interactive data entry -f FILE to specify intput file -F FILE to specify output...
[ "NAME", "di_vgp", ".", "py", "DESCRIPTION", "converts", "declination", "/", "inclination", "to", "virtual", "geomagnetic", "pole", "SYNTAX", "di_vgp", ".", "py", "[", "-", "h", "]", "[", "options", "]", "OPTIONS", "-", "h", "prints", "help", "message", "an...
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/programs/di_vgp.py#L9-L91
PmagPy/PmagPy
dialogs/pmag_gui_dialogs.py
convert_HUJI_files_to_MagIC.on_okButton
def on_okButton(self, event): """ grab user input values, format them, and run huji_magic.py with the appropriate flags """ os.chdir(self.WD) options = {} HUJI_file = self.bSizer0.return_value() if not HUJI_file: pw.simple_warning("You must select a HU...
python
def on_okButton(self, event): """ grab user input values, format them, and run huji_magic.py with the appropriate flags """ os.chdir(self.WD) options = {} HUJI_file = self.bSizer0.return_value() if not HUJI_file: pw.simple_warning("You must select a HU...
[ "def", "on_okButton", "(", "self", ",", "event", ")", ":", "os", ".", "chdir", "(", "self", ".", "WD", ")", "options", "=", "{", "}", "HUJI_file", "=", "self", ".", "bSizer0", ".", "return_value", "(", ")", "if", "not", "HUJI_file", ":", "pw", ".",...
grab user input values, format them, and run huji_magic.py with the appropriate flags
[ "grab", "user", "input", "values", "format", "them", "and", "run", "huji_magic", ".", "py", "with", "the", "appropriate", "flags" ]
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/dialogs/pmag_gui_dialogs.py#L1214-L1291
PmagPy/PmagPy
dialogs/pmag_gui_dialogs.py
OrientFrameGrid3.create_sheet
def create_sheet(self): ''' create an editable grid showing demag_orient.txt ''' #-------------------------------- # orient.txt supports many other headers # but we will only initialize with # the essential headers for # sample orientation and headers pres...
python
def create_sheet(self): ''' create an editable grid showing demag_orient.txt ''' #-------------------------------- # orient.txt supports many other headers # but we will only initialize with # the essential headers for # sample orientation and headers pres...
[ "def", "create_sheet", "(", "self", ")", ":", "#--------------------------------", "# orient.txt supports many other headers", "# but we will only initialize with", "# the essential headers for", "# sample orientation and headers present", "# in existing demag_orient.txt file", "#-----------...
create an editable grid showing demag_orient.txt
[ "create", "an", "editable", "grid", "showing", "demag_orient", ".", "txt" ]
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/dialogs/pmag_gui_dialogs.py#L2704-L2787
PmagPy/PmagPy
dialogs/pmag_gui_dialogs.py
OrientFrameGrid3.on_m_open_file
def on_m_open_file(self,event): ''' open orient.txt read the data display the data from the file in a new grid ''' dlg = wx.FileDialog( self, message="choose orient file", defaultDir=self.WD, defaultFile="", style=wx.FD_OPEN...
python
def on_m_open_file(self,event): ''' open orient.txt read the data display the data from the file in a new grid ''' dlg = wx.FileDialog( self, message="choose orient file", defaultDir=self.WD, defaultFile="", style=wx.FD_OPEN...
[ "def", "on_m_open_file", "(", "self", ",", "event", ")", ":", "dlg", "=", "wx", ".", "FileDialog", "(", "self", ",", "message", "=", "\"choose orient file\"", ",", "defaultDir", "=", "self", ".", "WD", ",", "defaultFile", "=", "\"\"", ",", "style", "=", ...
open orient.txt read the data display the data from the file in a new grid
[ "open", "orient", ".", "txt", "read", "the", "data", "display", "the", "data", "from", "the", "file", "in", "a", "new", "grid" ]
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/dialogs/pmag_gui_dialogs.py#L2814-L2838
PmagPy/PmagPy
dialogs/pmag_gui_dialogs.py
OrientFrameGrid.add_extra_headers
def add_extra_headers(self, sample_names): """ If there are samples, add any additional keys they might use to supplement the default headers. Return the headers headers for adding, with the format: [(header_name, header_display_name), ....] """ if not sample_name...
python
def add_extra_headers(self, sample_names): """ If there are samples, add any additional keys they might use to supplement the default headers. Return the headers headers for adding, with the format: [(header_name, header_display_name), ....] """ if not sample_name...
[ "def", "add_extra_headers", "(", "self", ",", "sample_names", ")", ":", "if", "not", "sample_names", ":", "return", "[", "]", "full_headers", "=", "list", "(", "self", ".", "orient_data", "[", "sample_names", "[", "0", "]", "]", ".", "keys", "(", ")", ...
If there are samples, add any additional keys they might use to supplement the default headers. Return the headers headers for adding, with the format: [(header_name, header_display_name), ....]
[ "If", "there", "are", "samples", "add", "any", "additional", "keys", "they", "might", "use", "to", "supplement", "the", "default", "headers", ".", "Return", "the", "headers", "headers", "for", "adding", "with", "the", "format", ":", "[", "(", "header_name", ...
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/dialogs/pmag_gui_dialogs.py#L3086-L3100
PmagPy/PmagPy
dialogs/pmag_gui_dialogs.py
OrientFrameGrid.on_m_open_file
def on_m_open_file(self,event): ''' open orient.txt read the data display the data from the file in a new grid ''' dlg = wx.FileDialog( self, message="choose orient file", defaultDir=self.WD, defaultFile="", style=wx.FD_OPEN...
python
def on_m_open_file(self,event): ''' open orient.txt read the data display the data from the file in a new grid ''' dlg = wx.FileDialog( self, message="choose orient file", defaultDir=self.WD, defaultFile="", style=wx.FD_OPEN...
[ "def", "on_m_open_file", "(", "self", ",", "event", ")", ":", "dlg", "=", "wx", ".", "FileDialog", "(", "self", ",", "message", "=", "\"choose orient file\"", ",", "defaultDir", "=", "self", ".", "WD", ",", "defaultFile", "=", "\"\"", ",", "style", "=", ...
open orient.txt read the data display the data from the file in a new grid
[ "open", "orient", ".", "txt", "read", "the", "data", "display", "the", "data", "from", "the", "file", "in", "a", "new", "grid" ]
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/dialogs/pmag_gui_dialogs.py#L3211-L3232
PmagPy/PmagPy
dialogs/pmag_gui_dialogs.py
OrientFrameGrid.on_m_save_file
def on_m_save_file(self,event): ''' save demag_orient.txt (only the columns that appear on the grid frame) ''' fout = open(os.path.join(self.WD, "demag_orient.txt"), 'w') STR = "tab\tdemag_orient\n" fout.write(STR) headers = [header[0] for header in self....
python
def on_m_save_file(self,event): ''' save demag_orient.txt (only the columns that appear on the grid frame) ''' fout = open(os.path.join(self.WD, "demag_orient.txt"), 'w') STR = "tab\tdemag_orient\n" fout.write(STR) headers = [header[0] for header in self....
[ "def", "on_m_save_file", "(", "self", ",", "event", ")", ":", "fout", "=", "open", "(", "os", ".", "path", ".", "join", "(", "self", ".", "WD", ",", "\"demag_orient.txt\"", ")", ",", "'w'", ")", "STR", "=", "\"tab\\tdemag_orient\\n\"", "fout", ".", "wr...
save demag_orient.txt (only the columns that appear on the grid frame)
[ "save", "demag_orient", ".", "txt", "(", "only", "the", "columns", "that", "appear", "on", "the", "grid", "frame", ")" ]
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/dialogs/pmag_gui_dialogs.py#L3234-L3257