_id stringlengths 2 7 | title stringlengths 1 88 | partition stringclasses 3
values | text stringlengths 75 19.8k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q11800 | Demag_GUI.on_btn_delete_fit | train | def on_btn_delete_fit(self, event):
"""
removes the current interpretation
Parameters
----------
event : the wx.ButtonEvent that triggered this function
"""
self.delete_fit(self.current_fit, specimen=self.s) | python | {
"resource": ""
} |
q11801 | Demag_GUI.do_auto_save | train | def do_auto_save(self):
"""
Delete current fit if auto_save==False,
unless current fit has explicitly been saved.
"""
if not self.auto_save.GetValue():
if self.current_fit:
if not self.current_fit.saved:
self.delete_fit(self.current... | python | {
"resource": ""
} |
q11802 | Demag_GUI.on_next_button | train | def on_next_button(self, event):
"""
update figures and text when a next button is selected
"""
self.do_auto_save()
self.selected_meas = []
index = self.specimens.index(self.s)
try:
fit_index = self.pmag_results_data['specimens'][self.s].index(
... | python | {
"resource": ""
} |
q11803 | main | train | def main():
"""
NAME
watsons_f.py
DESCRIPTION
calculates Watson's F statistic from input files
INPUT FORMAT
takes dec/inc as first two columns in two space delimited files
SYNTAX
watsons_f.py [command line options]
OPTIONS
-h prints help message and qui... | python | {
"resource": ""
} |
q11804 | in_SCAT_box | train | def in_SCAT_box(x, y, low_bound, high_bound, x_max, y_max):
"""determines if a particular point falls within a box"""
passing = True
upper_limit = high_bound(x)
lower_limit = low_bound(x)
if x > x_max or y > y_max:
passing = False
if x < 0 or y < 0:
passing = False
if y > upp... | python | {
"resource": ""
} |
q11805 | get_SCAT_points | train | def get_SCAT_points(x_Arai_segment, y_Arai_segment, tmin, tmax, ptrm_checks_temperatures,
ptrm_checks_starting_temperatures, x_ptrm_check, y_ptrm_check,
tail_checks_temperatures, tail_checks_starting_temperatures,
x_tail_check, y_tail_check):
"""returns re... | python | {
"resource": ""
} |
q11806 | get_SCAT | train | def get_SCAT(points, low_bound, high_bound, x_max, y_max):
"""
runs SCAT test and returns boolean
"""
# iterate through all relevant points and see if any of them fall outside of your SCAT box
SCAT = True
for point in points:
result = in_SCAT_box(point[0], point[1], low_bound, high_bound... | python | {
"resource": ""
} |
q11807 | fancy_SCAT | train | def fancy_SCAT(points, low_bound, high_bound, x_max, y_max):
"""
runs SCAT test and returns 'Pass' or 'Fail'
"""
# iterate through all relevant points and see if any of them fall outside of your SCAT box
# {'points_arai': [(x,y),(x,y)], 'points_ptrm': [(x,y),(x,y)], ...}
SCAT = 'Pass'
SCATs ... | python | {
"resource": ""
} |
q11808 | get_R_det2 | train | def get_R_det2(y_segment, y_avg, y_prime):
"""
takes in an array of y values, the mean of those values, and the array of y prime values.
returns R_det2
"""
numerator = sum((numpy.array(y_segment) - numpy.array(y_prime))**2)
denominator = sum((numpy.array(y_segment) - y_avg)**2)
if denominato... | python | {
"resource": ""
} |
q11809 | get_b_wiggle | train | def get_b_wiggle(x, y, y_int):
"""returns instantaneous slope from the ratio of NRM lost to TRM gained at the ith step"""
if x == 0:
b_wiggle = 0
else:
b_wiggle = old_div((y_int - y), x)
return b_wiggle | python | {
"resource": ""
} |
q11810 | main | train | def main():
"""
NAME
stats.py
DEFINITION
calculates Gauss statistics for input data
SYNTAX
stats [command line options][< filename]
INPUT
single column of numbers
OPTIONS
-h prints help message and quits
-i interactive entry of file name
... | python | {
"resource": ""
} |
q11811 | main | train | def main():
"""
NAME
magic_select.py
DESCRIPTION
picks out records and dictitem options saves to magic_special file
SYNTAX
magic_select.py [command line optins]
OPTIONS
-h prints help message and quits
-f FILE: specify input magic format file
-F FIL... | python | {
"resource": ""
} |
q11812 | main | train | def main():
"""
NAME
di_geo.py
DESCRIPTION
rotates specimen coordinate dec, inc data to geographic
coordinates using the azimuth and plunge of the X direction
INPUT FORMAT
declination inclination azimuth plunge
SYNTAX
di_geo.py [-h][-i][-f FILE] [< filename ]
... | python | {
"resource": ""
} |
q11813 | LinInt.call | train | def call(self, x):
"""
Evaluate the interpolant, assuming x is a scalar.
"""
# if out of range, return endpoint
if x <= self.x_vals[0]:
return self.y_vals[0]
if x >= self.x_vals[-1]:
return self.y_vals[-1]
pos = numpy.searchsorted(self.x_vals,... | python | {
"resource": ""
} |
q11814 | main | train | def main():
"""
NAME
aarm_magic.py
DESCRIPTION
Converts AARM 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 | {
"resource": ""
} |
q11815 | main | train | def main():
"""
NAME
mini_magic.py
DESCRIPTION
converts the Yale minispin format to magic_measurements format files
SYNTAX
mini_magic.py [command line options]
OPTIONS
-h: prints the help message and quits.
-usr USER: identify user, default is ""
... | python | {
"resource": ""
} |
q11816 | Arai_GUI.get_DIR | train | def get_DIR(self, WD=None):
"""
open dialog box for choosing a working directory
"""
if "-WD" in sys.argv and FIRST_RUN:
ind = sys.argv.index('-WD')
self.WD = sys.argv[ind + 1]
elif not WD: # if no arg was passed in for WD, make a dialog to choose one
... | python | {
"resource": ""
} |
q11817 | Arai_GUI.update_selection | train | def update_selection(self):
"""
update figures and statistics windows with a new selection of specimen
"""
# clear all boxes
self.clear_boxes()
self.draw_figure(self.s)
# update temperature list
if self.Data[self.s]['T_or_MW'] == "T":
self.te... | python | {
"resource": ""
} |
q11818 | Arai_GUI.on_info_click | train | def on_info_click(self, event):
"""
Show popup info window when user clicks "?"
"""
def on_close(event, wind):
wind.Close()
wind.Destroy()
event.Skip()
wind = wx.PopupTransientWindow(self, wx.RAISED_BORDER)
if self.auto_save.GetValue():
... | python | {
"resource": ""
} |
q11819 | Arai_GUI.on_prev_button | train | def on_prev_button(self, event):
"""
update figures and text when a previous button is selected
"""
if 'saved' not in self.Data[self.s]['pars'] or self.Data[self.s]['pars']['saved'] != True:
# check preferences
if self.auto_save.GetValue():
self.on... | python | {
"resource": ""
} |
q11820 | Arai_GUI.read_preferences_file | train | def read_preferences_file(self):
"""
If json preferences file exists, read it in.
"""
user_data_dir = find_pmag_dir.find_user_data_dir("thellier_gui")
if not user_data_dir:
return {}
if os.path.exists(user_data_dir):
pref_file = os.path.join(user_d... | python | {
"resource": ""
} |
q11821 | Arai_GUI.on_menu_exit | train | def on_menu_exit(self, event):
"""
Runs whenever Thellier GUI exits
"""
if self.close_warning:
TEXT = "Data is not saved to a file yet!\nTo properly save your data:\n1) Analysis --> Save current interpretations to a redo file.\nor\n1) File --> Save MagIC tables.\n\n Press OK ... | python | {
"resource": ""
} |
q11822 | Arai_GUI.On_close_criteria_box | train | def On_close_criteria_box(self, dia):
"""
after criteria dialog window is closed.
Take the acceptance criteria values and update
self.acceptance_criteria
"""
criteria_list = list(self.acceptance_criteria.keys())
criteria_list.sort()
#---------------------... | python | {
"resource": ""
} |
q11823 | Arai_GUI.read_criteria_file | train | def read_criteria_file(self, criteria_file):
'''
read criteria file.
initialize self.acceptance_criteria
try to guess if averaging by sample or by site.
'''
if self.data_model == 3:
self.acceptance_criteria = pmag.initialize_acceptance_criteria(
... | python | {
"resource": ""
} |
q11824 | Arai_GUI.on_menu_save_interpretation | train | def on_menu_save_interpretation(self, event):
'''
save interpretations to a redo file
'''
thellier_gui_redo_file = open(
os.path.join(self.WD, "thellier_GUI.redo"), 'w')
#--------------------------------------------------
# write interpretations to thellier... | python | {
"resource": ""
} |
q11825 | Arai_GUI.on_menu_clear_interpretation | train | def on_menu_clear_interpretation(self, event):
'''
clear all current interpretations.
'''
# delete all previous interpretation
for sp in list(self.Data.keys()):
del self.Data[sp]['pars']
self.Data[sp]['pars'] = {}
self.Data[sp]['pars']['lab_d... | python | {
"resource": ""
} |
q11826 | Arai_GUI.get_new_T_PI_parameters | train | def get_new_T_PI_parameters(self, event):
"""
calcualte statisics when temperatures are selected
"""
# remember the last saved interpretation
if "saved" in list(self.pars.keys()):
if self.pars['saved']:
self.last_saved_pars = {}
for ke... | python | {
"resource": ""
} |
q11827 | main | train | def main():
"""
NAME
histplot.py
DESCRIPTION
makes histograms for data
OPTIONS
-h prints help message and quits
-f input file name
-b binsize
-fmt [svg,png,pdf,eps,jpg] specify format for image, default is svg
-sav save figure and quit
-F output ... | python | {
"resource": ""
} |
q11828 | Menus.InitUI | train | def InitUI(self):
"""
Initialize interface for drop down menu
"""
if self.data_type in ['orient', 'ages']:
belongs_to = []
else:
parent_table_name = self.parent_type + "s"
if parent_table_name in self.contribution.tables:
belong... | python | {
"resource": ""
} |
q11829 | Menus.add_drop_down | train | def add_drop_down(self, col_number, col_label):
"""
Add a correctly formatted drop-down-menu for given col_label,
if required or suggested.
Otherwise do nothing.
Parameters
----------
col_number : int
grid position at which to add a drop down menu... | python | {
"resource": ""
} |
q11830 | main | train | def main():
"""
NAME
di_tilt.py
DESCRIPTION
rotates geographic coordinate dec, inc data to stratigraphic
coordinates using the dip and dip direction (strike+90, dip if dip to right of strike)
INPUT FORMAT
declination inclination dip_direction dip
SYNTAX
di_til... | python | {
"resource": ""
} |
q11831 | main | train | def main():
"""
NAME
convert2unix.py
DESCRIPTION
converts mac or dos formatted file to unix file in place
SYNTAX
convert2unix.py FILE
OPTIONS
-h prints help and quits
"""
if '-h' in sys.argv:
print(main.__doc__)
sys.exit()
... | python | {
"resource": ""
} |
q11832 | main | train | def main():
"""
NAME
gokent.py
DESCRIPTION
calculates Kent parameters from dec inc data
INPUT FORMAT
takes dec/inc as first two columns in space delimited file
SYNTAX
gokent.py [options]
OPTIONS
-h prints help message and quits
-i for interactive f... | python | {
"resource": ""
} |
q11833 | plot3d_init | train | def plot3d_init(fignum):
"""
initializes 3D plot
"""
from mpl_toolkits.mplot3d import Axes3D
fig = plt.figure(fignum)
ax = fig.add_subplot(111, projection='3d')
return ax | python | {
"resource": ""
} |
q11834 | plot_xy | train | def plot_xy(fignum, X, Y, **kwargs):
"""
deprecated, used in curie
"""
plt.figure(num=fignum)
# if 'poly' in kwargs.keys():
# coeffs=np.polyfit(X,Y,kwargs['poly'])
# polynomial=np.poly1d(coeffs)
# xs=np.arange(np.min(X),np.max(X))
# ys=polynomial(xs)
# plt... | python | {
"resource": ""
} |
q11835 | plot_qq_exp | train | def plot_qq_exp(fignum, I, title, subplot=False):
"""
plots data against an exponential distribution in 0=>90.
Parameters
_________
fignum : matplotlib figure number
I : data
title : plot title
subplot : boolean, if True plot as subplot with 1 row, two columns with fignum the plot numbe... | python | {
"resource": ""
} |
q11836 | plot_zed | train | def plot_zed(ZED, datablock, angle, s, units):
"""
function to make equal area plot and zijderveld plot
Parameters
_________
ZED : dictionary with keys for plots
eqarea : figure number for equal area projection
zijd : figure number for zijderveld plot
demag : figure numb... | python | {
"resource": ""
} |
q11837 | plot_arai_zij | train | def plot_arai_zij(ZED, araiblock, zijdblock, s, units):
"""
calls the four plotting programs for Thellier-Thellier experiments
Parameters
__________
ZED : dictionary with plotting figure keys:
deremag : figure for de (re) magnezation plots
arai : figure for the Arai diagram
... | python | {
"resource": ""
} |
q11838 | plot_lnp | train | def plot_lnp(fignum, s, datablock, fpars, direction_type_key):
"""
plots lines and planes on a great circle with alpha 95 and mean
Parameters
_________
fignum : number of plt.figure() object
datablock : nested list of dictionaries with keys in 3.0 or 2.5 format
3.0 keys: dir_dec, dir_i... | python | {
"resource": ""
} |
q11839 | plot_teq | train | def plot_teq(fignum, araiblock, s, pars):
"""
plots directions of pTRM steps and zero field steps
Parameters
__________
fignum : figure number for matplotlib object
araiblock : nested list of data from pmag.sortarai()
s : specimen name
pars : default is "",
otherwise is diction... | python | {
"resource": ""
} |
q11840 | plot_evec | train | def plot_evec(fignum, Vs, symsize, title):
"""
plots eigenvector directions of S vectors
Paramters
________
fignum : matplotlib figure number
Vs : nested list of eigenvectors
symsize : size in pts for symbol
title : title for plot
"""
#
plt.figure(num=fignum)
plt.text(-1.1, ... | python | {
"resource": ""
} |
q11841 | plot_hs | train | def plot_hs(fignum, Ys, c, ls):
"""
plots horizontal lines at Ys values
Parameters
_________
fignum : matplotlib figure number
Ys : list of Y values for lines
c : color for lines
ls : linestyle for lines
"""
fig = plt.figure(num=fignum)
for yv in Ys:
bounds = plt.ax... | python | {
"resource": ""
} |
q11842 | plot_vs | train | def plot_vs(fignum, Xs, c, ls):
"""
plots vertical lines at Xs values
Parameters
_________
fignum : matplotlib figure number
Xs : list of X values for lines
c : color for lines
ls : linestyle for lines
"""
fig = plt.figure(num=fignum)
for xv in Xs:
bounds = plt.axis... | python | {
"resource": ""
} |
q11843 | plot_ts | train | def plot_ts(fignum, dates, ts):
"""
plot the geomagnetic polarity time scale
Parameters
__________
fignum : matplotlib figure number
dates : bounding dates for plot
ts : time scale ck95, gts04, or gts12
"""
vertical_plot_init(fignum, 10, 3)
TS, Chrons = pmag.get_ts(ts)
p = 1... | python | {
"resource": ""
} |
q11844 | plot_delta_m | train | def plot_delta_m(fignum, B, DM, Bcr, s):
"""
function to plot Delta M curves
Parameters
__________
fignum : matplotlib figure number
B : array of field values
DM : array of difference between top and bottom curves in hysteresis loop
Bcr : coercivity of remanence
s : specimen name
... | python | {
"resource": ""
} |
q11845 | plot_day | train | def plot_day(fignum, BcrBc, S, sym, **kwargs):
"""
function to plot Day plots
Parameters
_________
fignum : matplotlib figure number
BcrBc : list or array ratio of coercivity of remenance to coercivity
S : list or array ratio of saturation remanence to saturation magnetization (squareness)
... | python | {
"resource": ""
} |
q11846 | plot_s_bc | train | def plot_s_bc(fignum, Bc, S, sym):
"""
function to plot Squareness,Coercivity
Parameters
__________
fignum : matplotlib figure number
Bc : list or array coercivity values
S : list or array of ratio of saturation remanence to saturation
sym : matplotlib symbol (e.g., 'g^' for green trian... | python | {
"resource": ""
} |
q11847 | plot_s_bcr | train | def plot_s_bcr(fignum, Bcr, S, sym):
"""
function to plot Squareness,Coercivity of remanence
Parameters
__________
fignum : matplotlib figure number
Bcr : list or array coercivity of remenence values
S : list or array of ratio of saturation remanence to saturation
sym : matplotlib symbo... | python | {
"resource": ""
} |
q11848 | plot_bcr | train | def plot_bcr(fignum, Bcr1, Bcr2):
"""
function to plot two estimates of Bcr against each other
"""
plt.figure(num=fignum)
plt.plot(Bcr1, Bcr2, 'ro')
plt.xlabel('Bcr1')
plt.ylabel('Bcr2')
plt.title('Compare coercivity of remanence') | python | {
"resource": ""
} |
q11849 | plot_irm | train | def plot_irm(fignum, B, M, title):
"""
function to plot IRM backfield curves
Parameters
_________
fignum : matplotlib figure number
B : list or array of field values
M : list or array of magnetizations
title : string title for plot
"""
rpars = {}
Mnorm = []
backfield = 0... | python | {
"resource": ""
} |
q11850 | plot_xtb | train | def plot_xtb(fignum, XTB, Bs, e, f):
""" function to plot series of chi measurements as a function of temperature, holding frequency constant and varying B
"""
plt.figure(num=fignum)
plt.xlabel('Temperature (K)')
plt.ylabel('Susceptibility (m^3/kg)')
k = 0
Blab = []
for field in XTB:
... | python | {
"resource": ""
} |
q11851 | plot_ltc | train | def plot_ltc(LTC_CM, LTC_CT, LTC_WM, LTC_WT, e):
"""
function to plot low temperature cycling experiments
"""
leglist, init = [], 0
if len(LTC_CM) > 2:
if init == 0:
plot_init(1, 5, 5)
plt.plot(LTC_CT, LTC_CM, 'b')
leglist.append('RT SIRM, measured while cooling')... | python | {
"resource": ""
} |
q11852 | plot_conf | train | def plot_conf(fignum, s, datablock, pars, new):
"""
plots directions and confidence ellipses
"""
# make the stereonet
if new == 1:
plot_net(fignum)
#
# plot the data
#
DIblock = []
for plotrec in datablock:
DIblock.append((float(plotrec["dec"]), float(plotrec["inc"])))
if l... | python | {
"resource": ""
} |
q11853 | plot_ts | train | def plot_ts(ax, agemin, agemax, timescale='gts12', ylabel="Age (Ma)"):
"""
Make a time scale plot between specified ages.
Parameters:
------------
ax : figure object
agemin : Minimum age for timescale
agemax : Maximum age for timescale
timescale : Time Scale [ default is Gradstein et al... | python | {
"resource": ""
} |
q11854 | InterpretationEditorFrame.update_editor | train | def update_editor(self):
"""
updates the logger and plot on the interpretation editor window
"""
self.fit_list = []
self.search_choices = []
for specimen in self.specimens_list:
if specimen not in self.parent.pmag_results_data['specimens']: continue
... | python | {
"resource": ""
} |
q11855 | InterpretationEditorFrame.logger_focus | train | def logger_focus(self,i,focus_shift=16):
"""
focuses the logger on an index 12 entries below i
@param: i -> index to focus on
"""
if self.logger.GetItemCount()-1 > i+focus_shift:
i += focus_shift
else:
i = self.logger.GetItemCount()-1
self.... | python | {
"resource": ""
} |
q11856 | InterpretationEditorFrame.OnClick_listctrl | train | def OnClick_listctrl(self, event):
"""
Edits the logger and the Zeq_GUI parent object to select the fit that was newly selected by a double click
@param: event -> wx.ListCtrlEvent that triggered this function
"""
i = event.GetIndex()
if self.parent.current_fit == self.fit... | python | {
"resource": ""
} |
q11857 | InterpretationEditorFrame.OnRightClickListctrl | train | def OnRightClickListctrl(self, event):
"""
Edits the logger and the Zeq_GUI parent object so that the selected interpretation is now marked as bad
@param: event -> wx.ListCtrlEvent that triggered this function
"""
i = event.GetIndex()
fit,spec = self.fit_list[i][0],self.f... | python | {
"resource": ""
} |
q11858 | InterpretationEditorFrame.on_select_show_box | train | def on_select_show_box(self,event):
"""
Changes the type of mean shown on the high levels mean plot so that single dots represent one of whatever the value of this box is.
@param: event -> the wx.COMBOBOXEVENT that triggered this function
"""
self.parent.UPPER_LEVEL_SHOW=self.sho... | python | {
"resource": ""
} |
q11859 | InterpretationEditorFrame.on_select_high_level | train | def on_select_high_level(self,event,called_by_parent=False):
"""
alters the possible entries in level_names combobox to give the user selections for which specimen interpretations to display in the logger
@param: event -> the wx.COMBOBOXEVENT that triggered this function
"""
UPPE... | python | {
"resource": ""
} |
q11860 | InterpretationEditorFrame.on_select_level_name | train | def on_select_level_name(self,event,called_by_parent=False):
"""
change this objects specimens_list to control which specimen interpretatoins are displayed in this objects logger
@param: event -> the wx.ComboBoxEvent that triggered this function
"""
high_level_name=str(self.level... | python | {
"resource": ""
} |
q11861 | InterpretationEditorFrame.on_select_mean_type_box | train | def on_select_mean_type_box(self, event):
"""
set parent Zeq_GUI to reflect change in this box and change the
@param: event -> the wx.ComboBoxEvent that triggered this function
"""
new_mean_type = self.mean_type_box.GetValue()
if new_mean_type == "None":
self.... | python | {
"resource": ""
} |
q11862 | InterpretationEditorFrame.on_select_mean_fit_box | train | def on_select_mean_fit_box(self, event):
"""
set parent Zeq_GUI to reflect the change in this box then replot the high level means plot
@param: event -> the wx.COMBOBOXEVENT that triggered this function
"""
new_mean_fit = self.mean_fit_box.GetValue()
self.parent.mean_fit_... | python | {
"resource": ""
} |
q11863 | InterpretationEditorFrame.add_highlighted_fits | train | def add_highlighted_fits(self, evnet):
"""
adds a new interpretation to each specimen highlighted in logger if multiple interpretations are highlighted of the same specimen only one new interpretation is added
@param: event -> the wx.ButtonEvent that triggered this function
"""
... | python | {
"resource": ""
} |
q11864 | InterpretationEditorFrame.delete_highlighted_fits | train | def delete_highlighted_fits(self, event):
"""
iterates through all highlighted fits in the logger of this object and removes them from the logger and the Zeq_GUI parent object
@param: event -> the wx.ButtonEvent that triggered this function
"""
next_i = -1
deleted_items ... | python | {
"resource": ""
} |
q11865 | InterpretationEditorFrame.delete_entry | train | def delete_entry(self, fit = None, index = None):
"""
deletes the single item from the logger of this object that corrisponds to either the passed in fit or index. Note this function mutaits the logger of this object if deleting more than one entry be sure to pass items to delete in from highest index t... | python | {
"resource": ""
} |
q11866 | InterpretationEditorFrame.apply_changes | train | def apply_changes(self, event):
"""
applies the changes in the various attribute boxes of this object to all highlighted fit objects in the logger, these changes are reflected both in this object and in the Zeq_GUI parent object.
@param: event -> the wx.ButtonEvent that triggered this function
... | python | {
"resource": ""
} |
q11867 | InterpretationEditorFrame.pan_zoom_high_equalarea | train | def pan_zoom_high_equalarea(self,event):
"""
Uses the toolbar for the canvas to change the function from zoom to pan or pan to zoom
@param: event -> the wx.MouseEvent that triggered this funciton
"""
if event.LeftIsDown() or event.ButtonDClick():
return
elif s... | python | {
"resource": ""
} |
q11868 | main | train | def main():
"""
NAME
tk03.py
DESCRIPTION
generates set of vectors drawn from TK03.gad at given lat and
rotated about vertical axis by given Dec
INPUT (COMMAND LINE ENTRY)
OUTPUT
dec, inc, int
SYNTAX
tk03.py [command line options] [> OutputFileName]
... | python | {
"resource": ""
} |
q11869 | main | train | def main():
"""
NAME
gaussian.py
DESCRIPTION
generates set of normally distribed data from specified distribution
INPUT (COMMAND LINE ENTRY)
OUTPUT
x
SYNTAX
gaussian.py [command line options]
OPTIONS
-h prints help message and quits
-s spe... | python | {
"resource": ""
} |
q11870 | main | train | def main():
"""
NAME
qqunf.py
DESCRIPTION
makes qq plot from input data against uniform distribution
SYNTAX
qqunf.py [command line options]
OPTIONS
-h help message
-f FILE, specify file on command line
"""
fmt,plot='svg',0
if '-h' in sys.argv: # c... | python | {
"resource": ""
} |
q11871 | main | train | def main():
"""
NAME
qqplot.py
DESCRIPTION
makes qq plot of input data against a Normal distribution.
INPUT FORMAT
takes real numbers in single column
SYNTAX
qqplot.py [-h][-i][-f FILE]
OPTIONS
-f FILE, specify file on command line
-f... | python | {
"resource": ""
} |
q11872 | GridFrame.on_key_down | train | def on_key_down(self, event):
"""
If user does command v,
re-size window in case pasting has changed the content size.
"""
keycode = event.GetKeyCode()
meta_down = event.MetaDown() or event.GetCmdDown()
if keycode == 86 and meta_down:
# treat it as if ... | python | {
"resource": ""
} |
q11873 | GridFrame.add_new_header_groups | train | def add_new_header_groups(self, groups):
"""
compile list of all headers belonging to all specified groups
eliminate all headers that are already included
add any req'd drop-down menus
return errors
"""
already_present = []
for group in groups:
... | python | {
"resource": ""
} |
q11874 | GridFrame.on_add_rows | train | def on_add_rows(self, event):
"""
add rows to grid
"""
num_rows = self.rows_spin_ctrl.GetValue()
#last_row = self.grid.GetNumberRows()
for row in range(num_rows):
self.grid.add_row()
#if not self.grid.changes:
# self.grid.changes = s... | python | {
"resource": ""
} |
q11875 | GridFrame.onImport | train | def onImport(self, event):
"""
Import a MagIC-format file
"""
if self.grid.changes:
print("-W- Your changes will be overwritten...")
wind = pw.ChooseOne(self, "Import file anyway", "Save grid first",
"-W- Your grid has unsaved chang... | python | {
"resource": ""
} |
q11876 | GridFrame.onCancelButton | train | def onCancelButton(self, event):
"""
Quit grid with warning if unsaved changes present
"""
if self.grid.changes:
dlg1 = wx.MessageDialog(self, caption="Message:",
message="Are you sure you want to exit this grid?\nYour changes will not be s... | python | {
"resource": ""
} |
q11877 | GridFrame.onSave | train | def onSave(self, event, alert=False, destroy=True):
"""
Save grid data
"""
# tidy up drop_down menu
if self.drop_down_menu:
self.drop_down_menu.clean_up()
# then save actual data
self.grid_builder.save_grid_data()
if not event and not alert:
... | python | {
"resource": ""
} |
q11878 | GridFrame.onDragSelection | train | def onDragSelection(self, event):
"""
Set self.df_slice based on user's selection
"""
if self.grid.GetSelectionBlockTopLeft():
#top_left = self.grid.GetSelectionBlockTopLeft()
#bottom_right = self.grid.GetSelectionBlockBottomRight()
# awkward hack to f... | python | {
"resource": ""
} |
q11879 | GridFrame.onKey | train | def onKey(self, event):
"""
Copy selection if control down and 'c'
"""
if event.CmdDown() or event.ControlDown():
if event.GetKeyCode() == 67:
self.onCopySelection(None) | python | {
"resource": ""
} |
q11880 | GridFrame.onSelectAll | train | def onSelectAll(self, event):
"""
Selects full grid and copies it to the Clipboard
"""
# do clean up here!!!
if self.drop_down_menu:
self.drop_down_menu.clean_up()
# save all grid data
self.grid_builder.save_grid_data()
df = self.contribution.t... | python | {
"resource": ""
} |
q11881 | GridFrame.onCopySelection | train | def onCopySelection(self, event):
"""
Copies self.df_slice to the Clipboard if slice exists
"""
if self.df_slice is not None:
pd.DataFrame.to_clipboard(self.df_slice, header=False, index=False)
self.grid.ClearSelection()
self.df_slice = None
... | python | {
"resource": ""
} |
q11882 | GridBuilder.current_grid_empty | train | def current_grid_empty(self):
"""
Check to see if grid is empty except for default values
"""
empty = True
# df IS empty if there are no rows
if not any(self.magic_dataframe.df.index):
empty = True
# df is NOT empty if there are at least two rows
... | python | {
"resource": ""
} |
q11883 | GridBuilder.fill_defaults | train | def fill_defaults(self):
"""
Fill in self.grid with default values in certain columns.
Only fill in new values if grid is missing those values.
"""
defaults = {'result_quality': 'g',
'result_type': 'i',
'orientation_quality': 'g',
... | python | {
"resource": ""
} |
q11884 | GridFrame.on_remove_cols | train | def on_remove_cols(self, event):
"""
enter 'remove columns' mode
"""
# open the help message
self.toggle_help(event=None, mode='open')
# first unselect any selected cols/cells
self.remove_cols_mode = True
self.grid.ClearSelection()
self.remove_cols... | python | {
"resource": ""
} |
q11885 | GridFrame.exit_col_remove_mode | train | def exit_col_remove_mode(self, event):
"""
go back from 'remove cols' mode to normal
"""
# close help messge
self.toggle_help(event=None, mode='close')
# update mode
self.remove_cols_mode = False
# re-enable all buttons
for btn in [self.add_cols_bu... | python | {
"resource": ""
} |
q11886 | main | train | def main():
"""
NAME
mst_magic.py
DESCRIPTION
converts MsT data (T,M) to measurements format files
SYNTAX
mst_magic.py [command line options]
OPTIONS
-h: prints the help message and quits.
-usr USER: identify user, default is ""
-f FILE: specify T... | python | {
"resource": ""
} |
q11887 | main | train | def main():
"""
NAME
parse_measurements.py
DESCRIPTION
takes measurments file and creates specimen and instrument files
SYNTAX
parse_measurements.py [command line options]
OPTIONS
-h prints help message and quits
-f FILE magic_measurements input file, defau... | python | {
"resource": ""
} |
q11888 | OrientFrameGrid3.on_m_calc_orient | train | def on_m_calc_orient(self,event):
'''
This fucntion does exactly what the 'import orientation' fuction does in MagIC.py
after some dialog boxes the function calls orientation_magic.py
'''
# first see if demag_orient.txt
self.on_m_save_file(None)
orient_convention_... | python | {
"resource": ""
} |
q11889 | main | train | def main():
"""
NAME
eigs_s.py
DESCRIPTION
converts eigenparamters format data to s format
SYNTAX
eigs_s.py [-h][-i][command line options][<filename]
OPTIONS
-h prints help message and quits
-i allows interactive file name entry
-f FILE, specifies input file name
... | python | {
"resource": ""
} |
q11890 | get_numpy_dtype | train | def get_numpy_dtype(obj):
"""Return NumPy data type associated to obj
Return None if NumPy is not available
or if obj is not a NumPy array or scalar"""
if ndarray is not FakeObject:
# NumPy is available
import numpy as np
if isinstance(obj, np.generic) or isinstance(obj, np.ndarr... | python | {
"resource": ""
} |
q11891 | get_size | train | def get_size(item):
"""Return size of an item of arbitrary type"""
if isinstance(item, (list, set, tuple, dict)):
return len(item)
elif isinstance(item, (ndarray, MaskedArray)):
return item.shape
elif isinstance(item, Image):
return item.size
if isinstance(item, (DataFrame, I... | python | {
"resource": ""
} |
q11892 | get_object_attrs | train | def get_object_attrs(obj):
"""
Get the attributes of an object using dir.
This filters protected attributes
"""
attrs = [k for k in dir(obj) if not k.startswith('__')]
if not attrs:
attrs = dir(obj)
return attrs | python | {
"resource": ""
} |
q11893 | str_to_timedelta | train | def str_to_timedelta(value):
"""Convert a string to a datetime.timedelta value.
The following strings are accepted:
- 'datetime.timedelta(1, 5, 12345)'
- 'timedelta(1, 5, 12345)'
- '(1, 5, 12345)'
- '1, 5, 12345'
- '1'
if there are less then three parameters, the m... | python | {
"resource": ""
} |
q11894 | get_color_name | train | def get_color_name(value):
"""Return color name depending on value type"""
if not is_known_type(value):
return CUSTOM_TYPE_COLOR
for typ, name in list(COLORS.items()):
if isinstance(value, typ):
return name
else:
np_dtype = get_numpy_dtype(value)
if np_dtype i... | python | {
"resource": ""
} |
q11895 | default_display | train | def default_display(value, with_module=True):
"""Default display for unknown objects."""
object_type = type(value)
try:
name = object_type.__name__
module = object_type.__module__
if with_module:
return name + ' object of ' + module + ' module'
else:
r... | python | {
"resource": ""
} |
q11896 | display_to_value | train | def display_to_value(value, default_value, ignore_errors=True):
"""Convert back to value"""
from qtpy.compat import from_qvariant
value = from_qvariant(value, to_text_string)
try:
np_dtype = get_numpy_dtype(default_value)
if isinstance(default_value, bool):
# We must test for... | python | {
"resource": ""
} |
q11897 | get_type_string | train | def get_type_string(item):
"""Return type string of an object."""
if isinstance(item, DataFrame):
return "DataFrame"
if isinstance(item, Index):
return type(item).__name__
if isinstance(item, Series):
return "Series"
found = re.findall(r"<(?:type|class) '(\S*)'>",
... | python | {
"resource": ""
} |
q11898 | get_human_readable_type | train | def get_human_readable_type(item):
"""Return human-readable type string of an item"""
if isinstance(item, (ndarray, MaskedArray)):
return item.dtype.name
elif isinstance(item, Image):
return "Image"
else:
text = get_type_string(item)
if text is None:
text = to... | python | {
"resource": ""
} |
q11899 | is_supported | train | def is_supported(value, check_all=False, filters=None, iterate=False):
"""Return True if the value is supported, False otherwise"""
assert filters is not None
if value is None:
return True
if not is_editable_type(value):
return False
elif not isinstance(value, filters):
retur... | python | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.