_id
stringlengths
2
7
title
stringlengths
1
88
partition
stringclasses
3 values
text
stringlengths
75
19.8k
language
stringclasses
1 value
meta_information
dict
q11700
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. Otherwise do nothing. """ if col_label in ['magic_method_codes', 'magic_method_codes++']: self.add_method_drop_down(col_number, col_label) ...
python
{ "resource": "" }
q11701
Menus.clean_up
train
def clean_up(self):#, grid): """ de-select grid cols, refresh grid """ if self.selected_col: col_label_value = self.grid.GetColLabelValue(self.selected_col) col_label_value = col_label_value.strip('\nEDIT ALL') self.grid.SetColLabelValue(self.selected_...
python
{ "resource": "" }
q11702
Menus.on_select_menuitem
train
def on_select_menuitem(self, event, grid, row, col, selection): """ sets value of selected cell to value selected from menu """ if self.grid.changes: # if user selects a menuitem, that is an edit self.grid.changes.add(row) else: self.grid.changes = {row} ...
python
{ "resource": "" }
q11703
main
train
def main(): """ NAME plot_cdf.py DESCRIPTION makes plots of cdfs of data in input file SYNTAX plot_cdf.py [-h][command line options] OPTIONS -h prints help message and quits -f FILE -t TITLE -fmt [svg,eps,png,pdf,jpg..] specify format of ou...
python
{ "resource": "" }
q11704
main
train
def main(): """ NAME bootams.py DESCRIPTION calculates bootstrap statistics for tensor data SYNTAX bootams.py [-h][command line options] OPTIONS: -h prints help message and quits -f FILE specifies input file name -par specifies parametric bootstrap [b...
python
{ "resource": "" }
q11705
Vocabulary.get_json_online
train
def get_json_online(self, url): """ Use requests module to json from Earthref. If this fails or times out, return false. Returns --------- result : requests.models.Response, or [] if unsuccessful """ if not requests: return False try: ...
python
{ "resource": "" }
q11706
Vocabulary.get_controlled_vocabularies
train
def get_controlled_vocabularies(self, vocab_types=default_vocab_types): """ Get all non-method controlled vocabularies """ if len(VOCAB): self.set_vocabularies() return data = [] controlled_vocabularies = [] # try to get online if n...
python
{ "resource": "" }
q11707
main
train
def main(): """ NAME uniform.py DESCRIPTION draws N directions from uniform distribution on a sphere SYNTAX uniform.py [-h][command line options] -h prints help message and quits -n N, specify N on the command line (default is 100) -F file, specify ...
python
{ "resource": "" }
q11708
iodp_samples_srm
train
def iodp_samples_srm(df, spec_file='specimens.txt',samp_file="samples.txt",site_file="sites.txt",dir_path='.', input_dir_path='',comp_depth_key="",lat="",lon=""): """ Convert IODP samples data generated from the SRM measurements file into datamodel 3.0 MagIC samples file. Default is to over...
python
{ "resource": "" }
q11709
make_thing
train
def make_thing(): """ makes example PintPars object """ cwd = os.getcwd() main_dir = cwd + '/SPD' try: import new_lj_thellier_gui_spd as tgs gui = tgs.Arai_GUI('/magic_measurements.txt', main_dir) specimens = list(gui.Data.keys()) thing = PintPars(gui.Data, '0238x6011044'...
python
{ "resource": "" }
q11710
PintPars.get_curve_prime
train
def get_curve_prime(self): """not in SPD documentation. same as k, but using the segment instead of the full data set""" if len(self.x_Arai_segment) < 4: self.pars['specimen_k_prime'], self.pars['specimen_k_prime_sse'] = 0, 0 return 0 data = lib_k.AraiCurvature(self.x_Ar...
python
{ "resource": "" }
q11711
PintPars.get_ptrm_dec_and_inc
train
def get_ptrm_dec_and_inc(self): """not included in spd.""" PTRMS = self.PTRMS[1:] CART_pTRMS_orig = numpy.array([lib_direct.dir2cart(row[1:4]) for row in PTRMS]) #B_lab_dir = [self.B_lab_dir[0], self.B_lab_dir[1], 1.] # dir tmin, tmax = self.t_Arai[0], self.t_Arai[-1] ptr...
python
{ "resource": "" }
q11712
DataModel.get_data_model
train
def get_data_model(self): """ Try to download the data model from Earthref. If that fails, grab the cached data model. """ if len(DM): self.dm = DM self.crit_map = CRIT_MAP return if not set_env.OFFLINE: dm = self.get_dm_onl...
python
{ "resource": "" }
q11713
DataModel.get_dm_online
train
def get_dm_online(self): """ Use requests module to get data model from Earthref. If this fails or times out, return false. Returns --------- result : requests.models.Response, False if unsuccessful """ if not requests: return False tr...
python
{ "resource": "" }
q11714
DataModel.parse_cache
train
def parse_cache(self, full_df): """ Format the cached data model into a dictionary of DataFrames and a criteria map DataFrame. Parameters ---------- full_df : DataFrame result of self.get_dm_offline() Returns ---------- data_model : d...
python
{ "resource": "" }
q11715
DataModel.parse
train
def parse(self, data_model, crit): """ Take the relevant pieces of the data model json and parse into data model and criteria map. Parameters ---------- data_model : data model piece of json (nested dicts) crit : criteria map piece of json (nested dicts) ...
python
{ "resource": "" }
q11716
DataModel.parse_response
train
def parse_response(self, raw): """ Format the requested data model into a dictionary of DataFrames and a criteria map DataFrame. Take data returned by a requests.get call to Earthref. Parameters ---------- raw: 'requests.models.Response' Returns ...
python
{ "resource": "" }
q11717
DataModel.find_cached_dm
train
def find_cached_dm(self): """ Find filename where cached data model json is stored. Returns --------- model_file : str data model json file location """ pmag_dir = find_pmag_dir.get_pmag_dir() if pmag_dir is None: pmag_dir = '.' ...
python
{ "resource": "" }
q11718
DataModel.cache_data_model
train
def cache_data_model(self, raw): """ Cache the data model json. Take data returned by a requests.get call to Earthref. Parameters ---------- raw: requests.models.Response """ output_json = json.loads(raw.content) output_file = self.find_cached_dm...
python
{ "resource": "" }
q11719
DataModel.get_groups
train
def get_groups(self, table_name): """ Return list of all groups for a particular data type """ df = self.dm[table_name] return list(df['group'].unique())
python
{ "resource": "" }
q11720
DataModel.get_group_headers
train
def get_group_headers(self, table_name, group_name): """ Return a list of all headers for a given group """ # get all headers of a particular group df = self.dm[table_name] cond = df['group'] == group_name return df[cond].index
python
{ "resource": "" }
q11721
DataModel.get_reqd_headers
train
def get_reqd_headers(self, table_name): """ Return a list of all required headers for a particular table """ df = self.dm[table_name] cond = df['validations'].map(lambda x: 'required()' in str(x)) return df[cond].index
python
{ "resource": "" }
q11722
DataModel.get_group_for_col
train
def get_group_for_col(self, table_name, col_name): """ Check data model to find group name for a given column header Parameters ---------- table_name: str col_name: str Returns --------- group_name: str """ df = self.dm[table_name...
python
{ "resource": "" }
q11723
main
train
def main(): """ NAME fisher.py DESCRIPTION generates set of Fisher distribed data from specified distribution INPUT (COMMAND LINE ENTRY) OUTPUT dec, inc SYNTAX fisher.py [-h] [-i] [command line options] OPTIONS -h prints help message and quits ...
python
{ "resource": "" }
q11724
main
train
def main(): """ NAME pmm_redo.py DESCRIPTION converts the UCSC PMM files format to PmagPy redo file SYNTAX pmm_redo.py [-h] [command line options] OPTIONS -h: prints help message and quits -f FILE: specify input file -F FILE: specify output file, d...
python
{ "resource": "" }
q11725
get_item_string
train
def get_item_string(items_list): """ take in a list of pmag_objects return a colon-delimited list of the findable names """ if not items_list: return '' string_list = [] for item in items_list: try: name = item.name string_list.append(name) exc...
python
{ "resource": "" }
q11726
combine_dicts
train
def combine_dicts(new_dict, old_dict): """ returns a dictionary with all key, value pairs from new_dict. also returns key, value pairs from old_dict, if that key does not exist in new_dict. if a key is present in both new_dict and old_dict, the new_dict value will take precedence. """ old_data_k...
python
{ "resource": "" }
q11727
ErMagicBuilder.find_by_name
train
def find_by_name(self, item_name, items_list, name_list=None): """ Return item from items_list with name item_name. """ if not name_list: names = [item.name for item in items_list if item] else: names = name_list if item_name in names: ...
python
{ "resource": "" }
q11728
ErMagicBuilder.find_or_create_by_name
train
def find_or_create_by_name(self, item_name, items_list, item_type): """ See if item with item_name exists in item_list. If not, create that item. Either way, return an item of type item_type. """ item = self.find_by_name(item_name, items_list) if not item: ...
python
{ "resource": "" }
q11729
ErMagicBuilder.init_default_headers
train
def init_default_headers(self): """ initialize default required headers. if there were any pre-existing headers, keep them also. """ if not self.data_model: self.data_model = validate_upload.get_data_model() if not self.data_model: print("C...
python
{ "resource": "" }
q11730
ErMagicBuilder.add_measurement
train
def add_measurement(self, exp_name, meas_num, spec_name=None, er_data=None, pmag_data=None): """ Find actual data object for specimen. Then create a measurement belonging to that specimen and add it to the data object """ specimen = self.find_by_name(spec_name, self.specimens) ...
python
{ "resource": "" }
q11731
ErMagicBuilder.delete_specimen
train
def delete_specimen(self, spec_name): """ Remove specimen with name spec_name from self.specimens. If the specimen belonged to a sample, remove it from the sample's specimen list. """ specimen = self.find_by_name(spec_name, self.specimens) if not specimen: ret...
python
{ "resource": "" }
q11732
ErMagicBuilder.delete_sample
train
def delete_sample(self, sample_name, replacement_samp=None): """ Remove sample with name sample_name from self.samples. If the sample belonged to a site, remove it from the site's sample list. If the sample had any specimens, change specimen.sample to "". """ sample = sel...
python
{ "resource": "" }
q11733
ErMagicBuilder.add_site
train
def add_site(self, site_name, location_name=None, er_data=None, pmag_data=None): """ Create a Site object and add it to self.sites. If a location name is provided, add the site to location.sites as well. """ if location_name: location = self.find_by_name(location_name...
python
{ "resource": "" }
q11734
ErMagicBuilder.delete_site
train
def delete_site(self, site_name, replacement_site=None): """ Remove site with name site_name from self.sites. If the site belonged to a location, remove it from the location's site list. If the site had any samples, change sample.site to "". """ site = self.find_by_name(s...
python
{ "resource": "" }
q11735
ErMagicBuilder.change_location
train
def change_location(self, old_location_name, new_location_name, new_parent_name=None, new_er_data=None, new_pmag_data=None, replace_data=False): """ Find actual data object for location with old_location_name. Then call Location class change method to update location name...
python
{ "resource": "" }
q11736
ErMagicBuilder.add_location
train
def add_location(self, location_name, parent_name=None, er_data=None, pmag_data=None): """ Create a Location object and add it to self.locations. """ if not location_name: return False location = Location(location_name, data_model=self.data_model, er_data=er_data, pma...
python
{ "resource": "" }
q11737
ErMagicBuilder.delete_location
train
def delete_location(self, location_name): """ Remove location with name location_name from self.locations. If the location had any sites, change site.location to "". """ location = self.find_by_name(location_name, self.locations) if not location: return False ...
python
{ "resource": "" }
q11738
ErMagicBuilder.change_result
train
def change_result(self, old_result_name, new_result_name, new_er_data=None, new_pmag_data=None, spec_names=None, samp_names=None, site_names=None, loc_names=None, replace_data=False): """ Find actual data object for result with old_result_name. Then ca...
python
{ "resource": "" }
q11739
ErMagicBuilder.get_data
train
def get_data(self): """ attempt to read measurements file in working directory. """ meas_file = os.path.join(self.WD, 'magic_measurements.txt') if not os.path.isfile(meas_file): print("-I- No magic_measurements.txt file") return {} try: ...
python
{ "resource": "" }
q11740
ErMagicBuilder.get_results_info
train
def get_results_info(self, filename=None): """ Read pmag_results.txt file. Parse information into dictionaries for each item. Then add it to the item object as object.results_data. """ if not filename: short_filename = "pmag_results.txt" magic_file...
python
{ "resource": "" }
q11741
ErMagicBuilder.write_age_file
train
def write_age_file(self): """ Write er_ages.txt based on updated ErMagicBuilder data object """ if not self.write_ages: print('-I- No age data available to write') return first_headers = self.first_age_headers actual_headers = sorted(self.headers['...
python
{ "resource": "" }
q11742
ErMagicBuilder.validate_data
train
def validate_data(self): """ Validate specimen, sample, site, and location data. """ warnings = {} spec_warnings, samp_warnings, site_warnings, loc_warnings = {}, {}, {}, {} if self.specimens: spec_warnings = self.validate_items(self.specimens, 'specimen') ...
python
{ "resource": "" }
q11743
Specimen.set_parent
train
def set_parent(self, new_samp): """ Set self.sample as either an empty string, or with a new Sample. """ self.sample = new_samp if new_samp: if not isinstance(new_samp, Sample): raise Exception self.propagate_data() return new_samp
python
{ "resource": "" }
q11744
Sample.set_parent
train
def set_parent(self, new_site): """ Set self.site as either an empty string, or with a new Site. """ if new_site: if not isinstance(new_site, Site): raise Exception self.site = new_site self.propagate_data() return new_site
python
{ "resource": "" }
q11745
Site.change_site
train
def change_site(self, new_name, new_location=None, new_er_data=None, new_pmag_data=None, replace_data=False): """ Update a site's name, location, er_data, and pmag_data. By default, new data will be added in to pre-existing data, overwriting existing values. If replac...
python
{ "resource": "" }
q11746
thellier_auto_interpreter.find_close_value
train
def find_close_value(self, LIST, value): ''' take a LIST and find the nearest value in LIST to 'value' ''' diff = inf for a in LIST: if abs(value - a) < diff: diff = abs(value - a) result = a return(result)
python
{ "resource": "" }
q11747
main
train
def main(): """ NAME sufar4-asc_magic.py DESCRIPTION converts ascii files generated by SUFAR ver.4.0 to MagIC formated files for use with PmagPy plotting software SYNTAX sufar4-asc_magic.py -h [command line options] OPTIONS -h: prints the help message and q...
python
{ "resource": "" }
q11748
Demag_GUI.get_coordinate_system
train
def get_coordinate_system(self): """ Check self.Data for available coordinate systems. Returns --------- initial_coordinate, coordinate_list : str, list i.e., 'geographic', ['specimen', 'geographic'] """ coordinate_list = ['specimen'] initial_coor...
python
{ "resource": "" }
q11749
Demag_GUI.draw_figure
train
def draw_figure(self, s, update_high_plots=True): """ Convenience function that sets current specimen to s and calculates data for that specimen then redraws all plots. Parameters ---------- s : specimen to set current specimen too update_high_plots : bool which ...
python
{ "resource": "" }
q11750
Demag_GUI.plot_high_levels_data
train
def plot_high_levels_data(self): """ Complicated function that draws the high level mean plot on canvas4, draws all specimen, sample, or site interpretations according to the UPPER_LEVEL_SHOW variable, draws the fisher mean or fisher mean by polarity of all interpretations displa...
python
{ "resource": "" }
q11751
Demag_GUI.get_levels_and_coordinates_names
train
def get_levels_and_coordinates_names(self): """ Get the current level of the high level mean plot and the name of the corrisponding site, study, etc. As well as the code for the current coordinate system. Returns ------- (high_level_type,high_level_name,coordinat...
python
{ "resource": "" }
q11752
Demag_GUI.delete_fit
train
def delete_fit(self, fit, specimen=None): """ removes fit from GUI results data Parameters ---------- fit : fit to remove specimen : specimen of fit to remove, if not provided and set to None then the function will find the specimen itself """ if ...
python
{ "resource": "" }
q11753
Demag_GUI.generate_warning_text
train
def generate_warning_text(self): """ generates warnings for the current specimen then adds them to the current warning text for the GUI which will be rendered on a call to update_warning_box. """ self.warning_text = "" if self.s in list(self.pmag_results_data['spe...
python
{ "resource": "" }
q11754
Demag_GUI.read_criteria_file
train
def read_criteria_file(self, criteria_file_name=None): """ reads 2.5 or 3.0 formatted PmagPy criteria file and returns a set of nested dictionary 2.5 formated criteria data that can be passed into pmag.grade to filter data. Parameters ---------- criteria_file : n...
python
{ "resource": "" }
q11755
Demag_GUI.get_PCA_parameters
train
def get_PCA_parameters(self, specimen, fit, tmin, tmax, coordinate_system, calculation_type): """ Uses pmag.domean to preform a line, line-with-origin, line-anchored, or plane least squared regression or a fisher mean on the measurement data of specimen in coordinate system between bound...
python
{ "resource": "" }
q11756
Demag_GUI.autointerpret
train
def autointerpret(self, event, step_size=None, calculation_type="DE-BFL"): """ Clears current interpretations and adds interpretations to every specimen of type = calculation_type by attempting fits of size = step size and type = calculation_type and testing the mad or a95 then f...
python
{ "resource": "" }
q11757
Demag_GUI.calculate_mean
train
def calculate_mean(self, pars_for_mean, calculation_type): """ Uses pmag.dolnp or pmag.fisher_by_pol to do a fisher mean or fisher mean by polarity on the list of dictionaries in pars for mean Parameters ---------- pars_for_mean : list of dictionaries with all data to av...
python
{ "resource": "" }
q11758
Demag_GUI.calculate_high_levels_data
train
def calculate_high_levels_data(self): """ calculates high level mean data for the high level mean plot using information in level_box, level_names, mean_type_box, and mean_fit_box also updates the information in the ie to match high level mean data in main GUI. """ ...
python
{ "resource": "" }
q11759
Demag_GUI.quiet_reset_backend
train
def quiet_reset_backend(self, reset_interps=True): """ Doesn't update plots or logger or any visable data but resets all measurement data, hierarchy data, and optionally resets intepretations. Parameters ---------- reset_interps : bool to tell the function to res...
python
{ "resource": "" }
q11760
Demag_GUI.reset_backend
train
def reset_backend(self, warn_user=True, reset_interps=True): """ Resets GUI data and updates GUI displays such as plots, boxes, and logger Parameters ---------- warn_user : bool which decides if a warning dialog is displayed to the user to ask about reseting ...
python
{ "resource": "" }
q11761
Demag_GUI.recalculate_current_specimen_interpreatations
train
def recalculate_current_specimen_interpreatations(self): """ recalculates all interpretations on all specimens for all coordinate systems. Does not display recalcuated data. """ self.initialize_CART_rot(self.s) if str(self.s) in self.pmag_results_data['specimens']: ...
python
{ "resource": "" }
q11762
Demag_GUI.merge_pmag_recs
train
def merge_pmag_recs(self, old_recs): """ Takes in a list of dictionaries old_recs and returns a list of dictionaries where every dictionary in the returned list has the same keys as all the others. Parameters ---------- old_recs : list of dictionaries to fix ...
python
{ "resource": "" }
q11763
Demag_GUI.select_specimen
train
def select_specimen(self, specimen): """ Goes through the calculations necessary to plot measurement data for specimen and sets specimen as current GUI specimen, also attempts to handle changing current fit. """ try: fit_index = self.pmag_results_data['specime...
python
{ "resource": "" }
q11764
Demag_GUI.clear_interpretations
train
def clear_interpretations(self, message=None): """ Clears all specimen interpretations Parameters ---------- message : message to display when warning the user that all fits will be deleted. If None default message is used (None is default) """ if...
python
{ "resource": "" }
q11765
Demag_GUI.mark_meas_good
train
def mark_meas_good(self, g_index): """ Marks the g_index'th measuremnt of current specimen good Parameters ---------- g_index : int that gives the index of the measurement to mark good, indexed from 0 """ meas_index, ind_data = 0, [] for i, me...
python
{ "resource": "" }
q11766
Demag_GUI.mark_fit_good
train
def mark_fit_good(self, fit, spec=None): """ Marks fit good so it is used in high level means Parameters ---------- fit : fit to mark good spec : specimen of fit to mark good (optional though runtime will increase if not provided) """ if spec ...
python
{ "resource": "" }
q11767
Demag_GUI.mark_fit_bad
train
def mark_fit_bad(self, fit): """ Marks fit bad so it is excluded from high level means Parameters ---------- fit : fit to mark bad """ if fit not in self.bad_fits: self.bad_fits.append(fit) return True else: return Fals...
python
{ "resource": "" }
q11768
Demag_GUI.get_preferences
train
def get_preferences(self): """ Gets preferences for certain display variables from zeq_gui_preferences. """ # default preferences = {} preferences['gui_resolution'] = 100. preferences['show_Zij_treatments'] = True preferences['show_Zij_treatments_s...
python
{ "resource": "" }
q11769
Demag_GUI.read_magic_file
train
def read_magic_file(self, path, sort_by_this_name): """ reads a magic formated data file from path and sorts the keys according to sort_by_this_name Parameters ---------- path : path to file to read sort_by_this_name : variable to sort data by """ ...
python
{ "resource": "" }
q11770
Demag_GUI.read_redo_file
train
def read_redo_file(self, redo_file): """ Reads a .redo formated file and replaces all current interpretations with interpretations taken from the .redo file Parameters ---------- redo_file : path to .redo file to read """ if not self.clear_interpretations...
python
{ "resource": "" }
q11771
Demag_GUI.change_WD
train
def change_WD(self, new_WD, meas_file=""): """ Changes Demag GUI's current WD to new_WD if possible Parameters ---------- new_WD : WD to change to current GUI's WD """ new_WD = os.path.abspath(new_WD) if not os.path.isdir(new_WD): return ...
python
{ "resource": "" }
q11772
Demag_GUI.init_log_file
train
def init_log_file(self): """ redirects stdout to a log file to prevent printing to a hanging terminal when dealing with the compiled binary. """ # redirect terminal output self.old_stdout = sys.stdout sys.stdout = open(os.path.join(self.WD, "demag_gui.log"), 'w+')
python
{ "resource": "" }
q11773
Demag_GUI.write_acceptance_criteria_to_file
train
def write_acceptance_criteria_to_file(self): """ Writes current GUI acceptance criteria to criteria.txt or pmag_criteria.txt depending on data model """ crit_list = list(self.acceptance_criteria.keys()) crit_list.sort() rec = {} rec['pmag_criteria_code'] =...
python
{ "resource": "" }
q11774
Demag_GUI.show_dlg
train
def show_dlg(self, dlg): """ Abstraction function that is to be used instead of dlg.ShowModal Parameters ---------- dlg : dialog to ShowModal if possible """ if not self.test_mode: dlg.Center() return dlg.ShowModal() else: ...
python
{ "resource": "" }
q11775
Demag_GUI.get_DIR
train
def get_DIR(self): """ Dialog that allows user to choose a working directory """ dlg = wx.DirDialog(self, "Choose a directory:", defaultPath=self.currentDirectory, style=wx.DD_DEFAULT_STYLE | wx.DD_NEW_DIR_BUTTON | wx.DD_CHANGE_DIR) ok = self.show_dlg(d...
python
{ "resource": "" }
q11776
Demag_GUI.choose_meas_file
train
def choose_meas_file(self, event=None): """ Opens a dialog allowing the user to pick a measurement file """ dlg = wx.FileDialog( self, message="Please choose a measurement file", defaultDir=self.WD, defaultFile="measurements.txt", wildcard=...
python
{ "resource": "" }
q11777
Demag_GUI.saved_dlg
train
def saved_dlg(self, message, caption='Saved:'): """ Shows a dialog that tells the user that a file has been saved Parameters ---------- message : message to display to user caption : title for dialog (default: "Saved:") """ dlg = wx.MessageDialog(self, ca...
python
{ "resource": "" }
q11778
Demag_GUI.user_warning
train
def user_warning(self, message, caption='Warning!'): """ Shows a dialog that warns the user about some action Parameters ---------- message : message to display to user caption : title for dialog (default: "Warning!") Returns ------- continue_boo...
python
{ "resource": "" }
q11779
Demag_GUI.on_close_criteria_box
train
def on_close_criteria_box(self, dia): """ Function called on close of change acceptance criteria dialog that writes new criteria to the hardrive and sets new criteria as GUI's current criteria. Parameters ---------- dia : closed change criteria dialog """...
python
{ "resource": "" }
q11780
Demag_GUI.show_crit_window_err_messege
train
def show_crit_window_err_messege(self, crit): """ error message if a valid naumber is not entered to criteria dialog boxes """ dlg = wx.MessageDialog( self, caption="Error:", message="not a vaild value for statistic %s\n ignoring value" % crit, style=wx.OK) re...
python
{ "resource": "" }
q11781
Demag_GUI.update_warning_box
train
def update_warning_box(self): """ updates the warning box with whatever the warning_text variable contains for this specimen """ self.warning_box.Clear() if self.warning_text == "": self.warning_box.AppendText("No Problems") else: self.warn...
python
{ "resource": "" }
q11782
Demag_GUI.update_GUI_with_new_interpretation
train
def update_GUI_with_new_interpretation(self): """ update statistics boxes and figures with a new interpretatiom when selecting new temperature bound """ self.update_fit_bounds_and_statistics() self.draw_interpretations() self.calculate_high_levels_data() ...
python
{ "resource": "" }
q11783
Demag_GUI.update_high_level_stats
train
def update_high_level_stats(self): """ updates high level statistics in bottom left of GUI. """ self.clear_high_level_pars() dirtype = str(self.coordinates_box.GetValue()) if dirtype == 'specimen': dirtype = 'DA-DIR' elif dirtype == 'geographic': ...
python
{ "resource": "" }
q11784
Demag_GUI.update_bounds_boxes
train
def update_bounds_boxes(self): """ updates bounds boxes with bounds of current specimen and fit """ if self.s not in list(self.Data.keys()): self.select_specimen(list(self.Data.keys())[0]) self.T_list = self.Data[self.s]['zijdblock_steps'] if self.current_fit:...
python
{ "resource": "" }
q11785
Demag_GUI.update_PCA_box
train
def update_PCA_box(self): """ updates PCA box with current fit's PCA type """ if self.s in list(self.pmag_results_data['specimens'].keys()): if self.current_fit: tmin = self.current_fit.tmin tmax = self.current_fit.tmax calcula...
python
{ "resource": "" }
q11786
Demag_GUI.on_menu_import_meas_file
train
def on_menu_import_meas_file(self, event): """ Open measurement file, reset self.magic_file and self.WD, and reset everything. """ # use new measurement file and corresponding WD meas_file = self.choose_meas_file() WD = os.path.split(meas_file)[0] self.WD ...
python
{ "resource": "" }
q11787
Demag_GUI.on_menu_criteria_file
train
def on_menu_criteria_file(self, event): """ read pmag_criteria.txt file and open changecriteria dialog """ if self.data_model == 3: default_file = "criteria.txt" else: default_file = "pmag_criteria.txt" read_sucsess = False dlg = wx...
python
{ "resource": "" }
q11788
Demag_GUI.right_click_zijderveld
train
def right_click_zijderveld(self, event): """ toggles between zoom and pan effects for the zijderveld on right click Parameters ---------- event : the wx.MouseEvent that triggered the call of this function Alters ------ zijderveld_setting, toolbar...
python
{ "resource": "" }
q11789
Demag_GUI.on_zijd_mark
train
def on_zijd_mark(self, event): """ Get mouse position on double right click find the interpretation in range of mouse position then mark that interpretation bad or good Parameters ---------- event : the wx Mouseevent for that click Alters ------ ...
python
{ "resource": "" }
q11790
Demag_GUI.right_click_specimen_equalarea
train
def right_click_specimen_equalarea(self, event): """ toggles between zoom and pan effects for the specimen equal area on right click Parameters ---------- event : the wx.MouseEvent that triggered the call of this function Alters ------ specimen_E...
python
{ "resource": "" }
q11791
Demag_GUI.right_click_high_equalarea
train
def right_click_high_equalarea(self, event): """ toggles between zoom and pan effects for the high equal area on right click Parameters ---------- event : the wx.MouseEvent that triggered the call of this function Alters ------ high_EA_setting, t...
python
{ "resource": "" }
q11792
Demag_GUI.Add_text
train
def Add_text(self): """ Add measurement data lines to the text window. """ self.selected_meas = [] if self.COORDINATE_SYSTEM == 'geographic': zijdblock = self.Data[self.s]['zijdblock_geo'] elif self.COORDINATE_SYSTEM == 'tilt-corrected': zijdblock ...
python
{ "resource": "" }
q11793
Demag_GUI.on_right_click_listctrl
train
def on_right_click_listctrl(self, event): """ right click on the listctrl toggles measurement bad """ g_index = event.GetIndex() if self.Data[self.s]['measurement_flag'][g_index] == 'g': self.mark_meas_bad(g_index) else: self.mark_meas_good(g_inde...
python
{ "resource": "" }
q11794
Demag_GUI.on_enter_specimen
train
def on_enter_specimen(self, event): """ upon enter on the specimen box it makes that specimen the current specimen """ new_specimen = self.specimens_box.GetValue() if new_specimen not in self.specimens: self.user_warning( "%s is not a valid spe...
python
{ "resource": "" }
q11795
Demag_GUI.get_new_PCA_parameters
train
def get_new_PCA_parameters(self, event): """ calculate statistics when temperatures are selected or PCA type is changed """ tmin = str(self.tmin_box.GetValue()) tmax = str(self.tmax_box.GetValue()) if tmin == "" or tmax == "": return if tmin ...
python
{ "resource": "" }
q11796
Demag_GUI.on_select_fit
train
def on_select_fit(self, event): """ Picks out the fit selected in the fit combobox and sets it to the current fit of the GUI then calls the select function of the fit to set the GUI's bounds boxes and alter other such parameters Parameters ---------- event : the ...
python
{ "resource": "" }
q11797
Demag_GUI.on_enter_fit_name
train
def on_enter_fit_name(self, event): """ Allows the entering of new fit names in the fit combobox Parameters ---------- event : the wx.ComboBoxEvent that triggers this function Alters ------ current_fit.name """ if self.current_fit == None...
python
{ "resource": "" }
q11798
Demag_GUI.on_save_interpretation_button
train
def on_save_interpretation_button(self, event): """ on the save button the interpretation is saved to pmag_results_table data in all coordinate systems """ if self.current_fit: self.current_fit.saved = True calculation_type = self.current_fit.get(self.COO...
python
{ "resource": "" }
q11799
Demag_GUI.on_btn_add_fit
train
def on_btn_add_fit(self, event): """ add a new interpretation to the current specimen Parameters ---------- event : the wx.ButtonEvent that triggered this function Alters ------ pmag_results_data """ if self.auto_save.GetValue(): ...
python
{ "resource": "" }