sentence1
stringlengths
52
3.87M
sentence2
stringlengths
1
47.2k
label
stringclasses
1 value
def p_ref_type(self, p): '''ref_type : IDENTIFIER''' p[0] = ast.DefinedType(p[1], lineno=p.lineno(1))
ref_type : IDENTIFIER
entailment
def p_base_type(self, p): # noqa '''base_type : BOOL annotations | BYTE annotations | I8 annotations | I16 annotations | I32 annotations | I64 annotations | DOUBLE annotations ...
base_type : BOOL annotations | BYTE annotations | I8 annotations | I16 annotations | I32 annotations | I64 annotations | DOUBLE annotations | STRING annotations ...
entailment
def p_map_type(self, p): '''map_type : MAP '<' field_type ',' field_type '>' annotations''' p[0] = ast.MapType(key_type=p[3], value_type=p[5], annotations=p[7])
map_type : MAP '<' field_type ',' field_type '>' annotations
entailment
def p_list_type(self, p): '''list_type : LIST '<' field_type '>' annotations''' p[0] = ast.ListType(value_type=p[3], annotations=p[5])
list_type : LIST '<' field_type '>' annotations
entailment
def p_set_type(self, p): '''set_type : SET '<' field_type '>' annotations''' p[0] = ast.SetType(value_type=p[3], annotations=p[5])
set_type : SET '<' field_type '>' annotations
entailment
def p_annotation(self, p): '''annotation : IDENTIFIER '=' LITERAL | IDENTIFIER''' if len(p) == 4: p[0] = ast.Annotation(p[1], p[3], lineno=p.lineno(1)) else: p[0] = ast.Annotation(p[1], True, lineno=p.lineno(1))
annotation : IDENTIFIER '=' LITERAL | IDENTIFIER
entailment
def _parse_seq(self, p): """Helper to parse sequence rules. Sequence rules are in the form:: foo : foo_item sep foo | foo_item foo | This function builds a deque of the items in-order. If the number of tokens doesn't match, an exception is ...
Helper to parse sequence rules. Sequence rules are in the form:: foo : foo_item sep foo | foo_item foo | This function builds a deque of the items in-order. If the number of tokens doesn't match, an exception is raised.
entailment
def parse(self, input, **kwargs): """Parse the given input. :param input: String containing the text to be parsed. :raises thriftrw.errors.ThriftParserError: For parsing errors. """ return self._parser.parse(input, lexer=self._lexer, **kwargs)
Parse the given input. :param input: String containing the text to be parsed. :raises thriftrw.errors.ThriftParserError: For parsing errors.
entailment
def _get_comments(session, group_or_user_id, wall_id): """ https://vk.com/dev/wall.getComments """ return session.fetch_items("wall.getComments", Comment.from_json, count=100, owner_id=group_or_user_id, post_id=wall_id, need_likes=1)
https://vk.com/dev/wall.getComments
entailment
def _get_comments_count(session, group_or_user_id, wall_id): """ https://vk.com/dev/wall.getComments """ response = session.fetch("wall.getComments", count=100, owner_id=group_or_user_id, post_id=wall_id) return response.get('count')
https://vk.com/dev/wall.getComments
entailment
def get_likes(self): """ https://vk.com/dev/likes.getList """ from .users import User return self._session.fetch_items('likes.getList', User._get_user, count=100, type='post', owner_id=self.from_id, item_id=self.id)
https://vk.com/dev/likes.getList
entailment
def get_likes_count(self): """ https://vk.com/dev/likes.getList """ response = self._session.fetch('likes.getList', count=1, type='post', owner_id=self.from_id, item_id=self.id) likes_count = response.get('count') return likes_count
https://vk.com/dev/likes.getList
entailment
def get_reposts(self): """ https://vk.com/dev/wall.getReposts """ return self._session.fetch_items('wall.getReposts', self.from_json, count=1000, owner_id=self.from_id, post_id=self.id)
https://vk.com/dev/wall.getReposts
entailment
def _wall_post(session, owner_id, message=None, attachments=None, from_group=True): """ https://vk.com/dev/wall.post attachments: "photo100172_166443618,photo-1_265827614" """ response = session.fetch("wall.post", owner_id=owner_id, message=message, attachments=attachments, from_...
https://vk.com/dev/wall.post attachments: "photo100172_166443618,photo-1_265827614"
entailment
def _get_friends_count(session, user_id): """ https://vk.com/dev/friends.get """ response = session.fetch('friends.get', user_id=user_id, count=1) return response["count"]
https://vk.com/dev/friends.get
entailment
def acquire_fake_data(number_of_points=1000): """ This function generates some fake data and returns two channels of data in the form time_array, [channel1, channel2] """ # time array t = _n.linspace(0,10,number_of_points) return(t, [_n.cos(t)*(1.0+0.2*_n.random.random(number_of_points...
This function generates some fake data and returns two channels of data in the form time_array, [channel1, channel2]
entailment
def load(path=None, first_data_line='auto', filters='*.*', text='Select a file, FACEHEAD.', default_directory='default_directory', quiet=True, header_only=False, transpose=False, **kwargs): """ Loads a data file into the databox data class. Returns the data object. Most keyword arguments are sent to databo...
Loads a data file into the databox data class. Returns the data object. Most keyword arguments are sent to databox.load() so check there for documentation.(if their function isn't obvious). Parameters ---------- path=None Supply a path to a data file; None means use a dialog. first_dat...
entailment
def load_multiple(paths=None, first_data_line="auto", filters="*.*", text="Select some files, FACEHEAD.", default_directory="default_directory", quiet=True, header_only=False, transpose=False, **kwargs): """ Loads a list of data files into a list of databox data objects. Returns said list. Paramete...
Loads a list of data files into a list of databox data objects. Returns said list. Parameters ---------- path=None Supply a path to a data file; None means pop up a dialog. first_data_line="auto" Specify the index of the first data line, or have it figure this out automa...
entailment
def more_info(self): """ Prints out more information about the databox. """ print("\nDatabox Instance", self.path) print("\nHeader") for h in self.hkeys: print(" "+h+":", self.h(h)) s = "\nColumns ("+str(len(self.ckeys))+"): " for c in self.ckeys: s = s+c...
Prints out more information about the databox.
entailment
def _globals(self): """ Returns the globals needed for eval() statements. """ # start with numpy globbies = dict(_n.__dict__) globbies.update(_special.__dict__) # update with required stuff globbies.update({'h':self.h, 'c':self.c, 'd':self, 'self':self})...
Returns the globals needed for eval() statements.
entailment
def load_file(self, path=None, first_data_line='auto', filters='*.*', text='Select a file, FACEPANTS.', default_directory=None, header_only=False, quiet=False): """ This will clear the databox, load a file, storing the header info in self.headers, and the data in self.columns If first_...
This will clear the databox, load a file, storing the header info in self.headers, and the data in self.columns If first_data_line="auto", then the first data line is assumed to be the first line where all the elements are numbers. If you specify a first_data_line (index, starting at...
entailment
def save_file(self, path=None, filters='*.dat', force_extension=None, force_overwrite=False, header_only=False, delimiter='use current', binary=None): """ This will save all the header info and columns to an ascii file with the specified path. Parameters ---------- path=...
This will save all the header info and columns to an ascii file with the specified path. Parameters ---------- path=None Path for saving the data. If None, this will bring up a save file dialog. filters='*.dat' File filter for the fil...
entailment
def get_data_point(self, n): """ Returns the n'th data point (starting at 0) from all columns. Parameters ---------- n Index of data point to return. """ # loop over the columns and pop the data point = [] for k in self.ckeys: p...
Returns the n'th data point (starting at 0) from all columns. Parameters ---------- n Index of data point to return.
entailment
def pop_data_point(self, n): """ This will remove and return the n'th data point (starting at 0) from all columns. Parameters ---------- n Index of data point to pop. """ # loop over the columns and pop the data popped = [] ...
This will remove and return the n'th data point (starting at 0) from all columns. Parameters ---------- n Index of data point to pop.
entailment
def insert_data_point(self, new_data, index=None): """ Inserts a data point at index n. Parameters ---------- new_data A list or array of new data points, one for each column. index Where to insert the point(s) in each column. N...
Inserts a data point at index n. Parameters ---------- new_data A list or array of new data points, one for each column. index Where to insert the point(s) in each column. None => append.
entailment
def execute_script(self, script, g=None): """ Runs a script, returning the result. Parameters ---------- script String script to be evaluated (see below). g=None Optional dictionary of additional globals for the script evaluation. Thes...
Runs a script, returning the result. Parameters ---------- script String script to be evaluated (see below). g=None Optional dictionary of additional globals for the script evaluation. These will automatically be inserted into self.extra_globals. ...
entailment
def _parse_script(self, script, n=0): """ This takes a script such as "a/b where a=c('current'), b=3.3" and returns ["a/b", {"a":self.columns["current"], "b":3.3}] You can also just use an integer for script to reference columns by number or use the column label as the script. ...
This takes a script such as "a/b where a=c('current'), b=3.3" and returns ["a/b", {"a":self.columns["current"], "b":3.3}] You can also just use an integer for script to reference columns by number or use the column label as the script. n is for internal use. Don't use it. In fact, don'...
entailment
def copy_headers(self, source_databox): """ Loops over the hkeys of the source_databox, updating this databoxes' header. """ for k in source_databox.hkeys: self.insert_header(k, source_databox.h(k)) return self
Loops over the hkeys of the source_databox, updating this databoxes' header.
entailment
def copy_columns(self, source_databox): """ Loops over the ckeys of the source_databox, updating this databoxes' columns. """ for k in source_databox.ckeys: self.insert_column(source_databox[k], k) return self
Loops over the ckeys of the source_databox, updating this databoxes' columns.
entailment
def copy_all(self, source_databox): """ Copies the header and columns from source_databox to this databox. """ self.copy_headers(source_databox) self.copy_columns(source_databox) return self
Copies the header and columns from source_databox to this databox.
entailment
def insert_globals(self, *args, **kwargs): """ Appends or overwrites the supplied object in the self.extra_globals. Use this to expose execute_script() or _parse_script() etc... to external objects and functions. Regular arguments are assumed to have a __name__ attribute (as is...
Appends or overwrites the supplied object in the self.extra_globals. Use this to expose execute_script() or _parse_script() etc... to external objects and functions. Regular arguments are assumed to have a __name__ attribute (as is the case for functions) to use as the key, and keyword...
entailment
def insert_header(self, hkey, value, index=None): """ This will insert/overwrite a value to the header and hkeys. Parameters ---------- hkey Header key. Will be appended to self.hkeys if non existent, or inserted at the specified index. If h...
This will insert/overwrite a value to the header and hkeys. Parameters ---------- hkey Header key. Will be appended to self.hkeys if non existent, or inserted at the specified index. If hkey is an integer, uses self.hkeys[hkey]. value Va...
entailment
def is_same_as(self, other_databox, headers=True, columns=True, header_order=True, column_order=True, ckeys=True): """ Tests that the important (i.e. savable) information in this databox is the same as that of the other_databox. Parameters ---------- other_databo...
Tests that the important (i.e. savable) information in this databox is the same as that of the other_databox. Parameters ---------- other_databox Databox with which to compare. headers=True Make sure all header elements match. columns=True...
entailment
def pop_header(self, hkey, ignore_error=False): """ This will remove and return the specified header value. Parameters ---------- hkey Header key you wish to pop. You can specify either a key string or an index. ignore_error=False Whe...
This will remove and return the specified header value. Parameters ---------- hkey Header key you wish to pop. You can specify either a key string or an index. ignore_error=False Whether to quietly ignore any errors (i.e., hkey not found).
entailment
def pop_column(self, ckey): """ This will remove and return the data in the specified column. You can specify either a key string or an index. """ # try the integer approach first to allow negative values if type(ckey) is not str: return self.columns.pop(sel...
This will remove and return the data in the specified column. You can specify either a key string or an index.
entailment
def insert_column(self, data_array, ckey='temp', index=None): """ This will insert/overwrite a new column and fill it with the data from the the supplied array. Parameters ---------- data_array Data; can be a list, but will be converted to numpy arr...
This will insert/overwrite a new column and fill it with the data from the the supplied array. Parameters ---------- data_array Data; can be a list, but will be converted to numpy array ckey Name of the column; if an integer is supplied,...
entailment
def append_column(self, data_array, ckey='temp'): """ This will append a new column and fill it with the data from the the supplied array. Parameters ---------- data_array Data; can be a list, but will be converted to numpy array ckey ...
This will append a new column and fill it with the data from the the supplied array. Parameters ---------- data_array Data; can be a list, but will be converted to numpy array ckey Name of the column.
entailment
def rename_header(self, old_name, new_name): """ This will rename the header. The supplied names need to be strings. """ self.hkeys[self.hkeys.index(old_name)] = new_name self.headers[new_name] = self.headers.pop(old_name) return self
This will rename the header. The supplied names need to be strings.
entailment
def rename_column(self, column, new_name): """ This will rename the column. The supplied column can be an integer or the old column name. """ if type(column) is not str: column = self.ckeys[column] self.ckeys[self.ckeys.index(column)] = new_name self.columns[new_n...
This will rename the column. The supplied column can be an integer or the old column name.
entailment
def trim(self, *conditions): """ Removes data points not satisfying the supplied conditions. Conditions can be truth arrays (having the same length as the columns!) or scripted strings. Example Workflow ---------------- d1 = spinmob.data.load() d2 = d1.tr...
Removes data points not satisfying the supplied conditions. Conditions can be truth arrays (having the same length as the columns!) or scripted strings. Example Workflow ---------------- d1 = spinmob.data.load() d2 = d1.trim( (2<d1[0]) & (d1[0]<10) | (d1[3]==22), 'sin(d[...
entailment
def transpose(self): """ Returns a copy of this databox with the columns as rows. Currently requires that the databox has equal-length columns. """ # Create an empty databox with the same headers and delimiter. d = databox(delimter=self.delimiter) self.co...
Returns a copy of this databox with the columns as rows. Currently requires that the databox has equal-length columns.
entailment
def update_headers(self, dictionary, keys=None): """ Updates the header with the supplied dictionary. If keys=None, it will be unsorted. Otherwise it will loop over the supplied keys (a list) in order. """ if keys is None: keys = list(dictionary.keys()) for k in k...
Updates the header with the supplied dictionary. If keys=None, it will be unsorted. Otherwise it will loop over the supplied keys (a list) in order.
entailment
def c(self, *args, **kwargs): """ Takes a single argument or keyword argument, and returns the specified column. If the argument (or keyword argument) is an integer, return the n'th column, otherwise return the column based on key. If no arguments are supplied, simply ...
Takes a single argument or keyword argument, and returns the specified column. If the argument (or keyword argument) is an integer, return the n'th column, otherwise return the column based on key. If no arguments are supplied, simply print the column information.
entailment
def h(self, *args, **kwargs): """ This function searches through hkeys for one *containing* a key string supplied by args[0] and returns that header value. Also can take integers, returning the key'th header value. kwargs can be specified to set header elements. ...
This function searches through hkeys for one *containing* a key string supplied by args[0] and returns that header value. Also can take integers, returning the key'th header value. kwargs can be specified to set header elements. Finally, if called with no arguments or keyword ...
entailment
def set(self, **kwargs): """ Changes a setting or multiple settings. Can also call self() or change individual parameters with self['parameter'] = value """ if len(kwargs)==0: return self # Set settings for k in list(kwargs.keys()): self[k] = kwargs[k] ...
Changes a setting or multiple settings. Can also call self() or change individual parameters with self['parameter'] = value
entailment
def print_fit_parameters(self): """ Just prints them out in a way that's easy to copy / paste into python. """ s = '' if self.results and self.results[1] is not None: s = s + "\n# FIT RESULTS (reduced chi squared = {:s})\n".format(str(self.reduced_chi_squareds())) ...
Just prints them out in a way that's easy to copy / paste into python.
entailment
def set_functions(self, f='a*x*cos(b*x)+c', p='a=-0.2, b, c=3', c=None, bg=None, **kwargs): """ Sets the function(s) used to describe the data. Parameters ---------- f=['a*x*cos(b*x)+c', 'a*x+c'] This can be a string function, a defined function my_fun...
Sets the function(s) used to describe the data. Parameters ---------- f=['a*x*cos(b*x)+c', 'a*x+c'] This can be a string function, a defined function my_function(x,a,b), or a list of some combination of these two types of objects. The length of such ...
entailment
def _update_functions(self): """ Uses internal settings to update the functions. """ self.f = [] self.bg = [] self._fnames = [] self._bgnames = [] self._odr_models = [] # Like f, but different parameters, for use in ODR...
Uses internal settings to update the functions.
entailment
def set_data(self, xdata=[1,2,3,4,5], ydata=[1.7,2,3,4,3], eydata=None, **kwargs): """ This will handle the different types of supplied data and put everything in a standard format for processing. Parameters ---------- xdata, ydata These can be a single a...
This will handle the different types of supplied data and put everything in a standard format for processing. Parameters ---------- xdata, ydata These can be a single array of data or a list of data arrays. eydata=None Error bars for ydata. Thes...
entailment
def evaluate_script(self, script, **kwargs): """ Evaluates the supplied script (python-executable string). Useful for testing your scripts! globals already include all of numpy objects plus self = self f = self.f bg = self.bg and all the current gu...
Evaluates the supplied script (python-executable string). Useful for testing your scripts! globals already include all of numpy objects plus self = self f = self.f bg = self.bg and all the current guess parameters and constants kwargs are added to globals...
entailment
def get_data(self): """ Returns current xdata, ydata, eydata, after set_data() has been run. """ # make sure we've done a "set data" call if len(self._set_xdata)==0 or len(self._set_ydata)==0: return [[],[],[]] # update the globals with the current fit parameter...
Returns current xdata, ydata, eydata, after set_data() has been run.
entailment
def set_guess_to_fit_result(self): """ If you have a fit result, set the guess parameters to the fit parameters. """ if self.results is None: print("No fit results to use! Run fit() first.") return # loop over the results and set the guess values ...
If you have a fit result, set the guess parameters to the fit parameters.
entailment
def get_processed_data(self, do_coarsen=True, do_trim=True): """ This will coarsen and then trim the data sets according to settings. Returns processed xdata, ydata, eydata. Parameters ---------- do_coarsen=True Whether we should coarsen the ...
This will coarsen and then trim the data sets according to settings. Returns processed xdata, ydata, eydata. Parameters ---------- do_coarsen=True Whether we should coarsen the data do_trim=True Whether we should trim the data ...
entailment
def _massage_data(self): """ Processes the data and stores it. """ self._xdata_massaged, self._ydata_massaged, self._eydata_massaged = self.get_processed_data() # # Create the odr data. # self._odr_datas = [] # for n in range(len(self._xdata_massaged)): # ...
Processes the data and stores it.
entailment
def fit(self, **kwargs): """ This will try to determine fit parameters using scipy.optimize.leastsq algorithm. This function relies on a previous call of set_data() and set_functions(). Notes ----- results of the fit algorithm are stored in self.results. ...
This will try to determine fit parameters using scipy.optimize.leastsq algorithm. This function relies on a previous call of set_data() and set_functions(). Notes ----- results of the fit algorithm are stored in self.results. See scipy.optimize.leastsq for more informa...
entailment
def fix(self, *args, **kwargs): """ Turns parameters to constants. As arguments, parameters must be strings. As keyword arguments, they can be set at the same time. Note this will NOT work when specifying a non-string fit function, because there is no flexibility in the...
Turns parameters to constants. As arguments, parameters must be strings. As keyword arguments, they can be set at the same time. Note this will NOT work when specifying a non-string fit function, because there is no flexibility in the number of arguments. To get around this, su...
entailment
def free(self, *args, **kwargs): """ Turns a constant into a parameter. As arguments, parameters must be strings. As keyword arguments, they can be set at the same time. """ # first set all the keyword argument values self.set(**kwargs) # get everything into one ...
Turns a constant into a parameter. As arguments, parameters must be strings. As keyword arguments, they can be set at the same time.
entailment
def _evaluate_all_functions(self, xdata, p=None): """ This returns a list of function outputs given the stored data sets. This function relies on a previous call of set_data(). p=None means use the fit results """ if p is None: p = self.results[0] output = [] ...
This returns a list of function outputs given the stored data sets. This function relies on a previous call of set_data(). p=None means use the fit results
entailment
def _evaluate_f(self, n, xdata, p=None): """ Evaluates a single function n for arbitrary xdata and p tuple. p=None means use the fit results """ # by default, use the fit values, otherwise, use the guess values. if p is None and self.results is not None: p = self.resul...
Evaluates a single function n for arbitrary xdata and p tuple. p=None means use the fit results
entailment
def _evaluate_bg(self, n, xdata, p=None): """ Evaluates a single background function n for arbitrary xdata and p tuple. p=None means use the fit results """ # by default, use the fit values, otherwise, use the guess values. if p is None and self.results is not None: p ...
Evaluates a single background function n for arbitrary xdata and p tuple. p=None means use the fit results
entailment
def _format_value_error(self, v, e, pm=" +/- "): """ Returns a string v +/- e with the right number of sig figs. """ # If we have weird stuff if not _s.fun.is_a_number(v) or not _s.fun.is_a_number(e) \ or v in [_n.inf, _n.nan, _n.NAN] or e in [_n.inf, _n.nan, _n.NAN]:...
Returns a string v +/- e with the right number of sig figs.
entailment
def _studentized_residuals_fast(self, p=None): """ Returns a list of studentized residuals, (ydata - model)/error This function relies on a previous call to set_data(), and assumes self._massage_data() has been called (to increase speed). Parameters ---------- ...
Returns a list of studentized residuals, (ydata - model)/error This function relies on a previous call to set_data(), and assumes self._massage_data() has been called (to increase speed). Parameters ---------- p=None Function parameters to use. None means u...
entailment
def chi_squareds(self, p=None): """ Returns a list of chi squared for each data set. Also uses ydata_massaged. p=None means use the fit results """ if len(self._set_xdata)==0 or len(self._set_ydata)==0: return None if p is None: p = self.results[0] # ge...
Returns a list of chi squared for each data set. Also uses ydata_massaged. p=None means use the fit results
entailment
def chi_squared(self, p=None): """ Returns the total chi squared (summed over all massaged data sets). p=None means use the fit results. """ chi2s = self.chi_squareds(p) if chi2s == None: return None return sum(self.chi_squareds(p))
Returns the total chi squared (summed over all massaged data sets). p=None means use the fit results.
entailment
def degrees_of_freedom(self): """ Returns the number of degrees of freedom. """ if len(self._set_xdata)==0 or len(self._set_ydata)==0: return None # Temporary hack: get the studentized residuals, which uses the massaged data # This should later be changed to get_...
Returns the number of degrees of freedom.
entailment
def reduced_chi_squareds(self, p=None): """ Returns the reduced chi squared for each massaged data set. p=None means use the fit results. """ if len(self._set_xdata)==0 or len(self._set_ydata)==0: return None if p is None: p = self.results[0] r = self.studentiz...
Returns the reduced chi squared for each massaged data set. p=None means use the fit results.
entailment
def reduced_chi_squared(self, p=None): """ Returns the reduced chi squared for all massaged data sets. p=None means use the fit results. """ if len(self._set_xdata)==0 or len(self._set_ydata)==0: return None if p is None: p = self.results[0] ch...
Returns the reduced chi squared for all massaged data sets. p=None means use the fit results.
entailment
def autoscale_eydata(self): """ Rescales the error so the next fit will give reduced chi squareds of 1. Each data set will be scaled independently, and you may wish to run this a few times until it converges. """ if not self.results: self._error("You must com...
Rescales the error so the next fit will give reduced chi squareds of 1. Each data set will be scaled independently, and you may wish to run this a few times until it converges.
entailment
def plot(self, **kwargs): """ This will plot the data (with error) for inspection. Setting self.figures to a figure instance or list of figure instances will override the creation of new figures. If you specify a list, its length had better be at least as large as the ...
This will plot the data (with error) for inspection. Setting self.figures to a figure instance or list of figure instances will override the creation of new figures. If you specify a list, its length had better be at least as large as the number of data sets. kwargs will up...
entailment
def _get_xdata_for_function(self, n, xdata): """ Generates the x-data for plotting the function. Parameters ---------- n Which data set we're using xdata Data set upon which to base this Returns ------- float ...
Generates the x-data for plotting the function. Parameters ---------- n Which data set we're using xdata Data set upon which to base this Returns ------- float
entailment
def trim(self, n='all', x=True, y=True): """ This will set xmin and xmax based on the current zoom-level of the figures. n='all' Which figure to use for setting xmin and xmax. 'all' means all figures. You may also specify a list. x=True Trim the x-ra...
This will set xmin and xmax based on the current zoom-level of the figures. n='all' Which figure to use for setting xmin and xmax. 'all' means all figures. You may also specify a list. x=True Trim the x-range y=True Trim the y-range
entailment
def untrim(self, n='all'): """ Removes xmin, xmax, ymin, and ymax. Parameters ---------- n='all' Which data set to perform this action upon. 'all' means all data sets, or you can specify a list. """ if len(self._set_xdata)==0 or l...
Removes xmin, xmax, ymin, and ymax. Parameters ---------- n='all' Which data set to perform this action upon. 'all' means all data sets, or you can specify a list.
entailment
def zoom(self, n='all', xfactor=2.0, yfactor=2.0): """ This will scale the chosen data set's plot range by the specified xfactor and yfactor, respectively, and set the trim limits xmin, xmax, ymin, ymax accordingly Parameters ---------- n='all' W...
This will scale the chosen data set's plot range by the specified xfactor and yfactor, respectively, and set the trim limits xmin, xmax, ymin, ymax accordingly Parameters ---------- n='all' Which data set to perform this action upon. 'all' means all data ...
entailment
def ginput(self, data_set=0, **kwargs): """ Pops up the figure for the specified data set. Returns value from pylab.ginput(). kwargs are sent to pylab.ginput() """ # this will temporarily fix the deprecation warning import warnings import matplotlib.cboo...
Pops up the figure for the specified data set. Returns value from pylab.ginput(). kwargs are sent to pylab.ginput()
entailment
def _match_data_sets(x,y): """ Makes sure everything is the same shape. "Intelligently". """ # Handle the None for x or y if x is None: # If x is none, y can be either [1,2] or [[1,2],[1,2]] if _fun.is_iterable(y[0]): # make an array of arrays to match x = []...
Makes sure everything is the same shape. "Intelligently".
entailment
def _match_error_to_data_set(x, ex): """ Inflates ex to match the dimensionality of x, "intelligently". x is assumed to be a 2D array. """ # Simplest case, ex is None or a number if not _fun.is_iterable(ex): # Just make a matched list of Nones if ex is None: ex = [ex]*l...
Inflates ex to match the dimensionality of x, "intelligently". x is assumed to be a 2D array.
entailment
def complex_data(data, edata=None, draw=True, **kwargs): """ Plots the imaginary vs real for complex data. Parameters ---------- data Array of complex data edata=None Array of complex error bars draw=True Draw the plot after it's assembled? Se...
Plots the imaginary vs real for complex data. Parameters ---------- data Array of complex data edata=None Array of complex error bars draw=True Draw the plot after it's assembled? See spinmob.plot.xy.data() for additional optional keyword arguments.
entailment
def complex_databoxes(ds, script='d[1]+1j*d[2]', escript=None, **kwargs): """ Uses databoxes and specified script to generate data and send to spinmob.plot.complex_data() Parameters ---------- ds List of databoxes script='d[1]+1j*d[2]' Complex-valued script fo...
Uses databoxes and specified script to generate data and send to spinmob.plot.complex_data() Parameters ---------- ds List of databoxes script='d[1]+1j*d[2]' Complex-valued script for data array. escript=None Complex-valued script for error bars ...
entailment
def complex_files(script='d[1]+1j*d[2]', escript=None, paths=None, **kwargs): """ Loads files and plots complex data in the real-imaginary plane. Parameters ---------- script='d[1]+1j*d[2]' Complex-valued script for data array. escript=None Complex-valued script fo...
Loads files and plots complex data in the real-imaginary plane. Parameters ---------- script='d[1]+1j*d[2]' Complex-valued script for data array. escript=None Complex-valued script for error bars paths=None List of paths to open. None means use a dialog Se...
entailment
def complex_function(f='1.0/(1+1j*x)', xmin=-1, xmax=1, steps=200, p='x', g=None, erange=False, **kwargs): """ Plots function(s) in the complex plane over the specified range. Parameters ---------- f='1.0/(1+1j*x)' Complex-valued function or list of functions to plot. ...
Plots function(s) in the complex plane over the specified range. Parameters ---------- f='1.0/(1+1j*x)' Complex-valued function or list of functions to plot. These can be string functions or single-argument python functions; additional globals can be supplied by g....
entailment
def magphase_data(xdata, ydata, eydata=None, exdata=None, xscale='linear', mscale='linear', pscale='linear', mlabel='Magnitude', plabel='Phase', phase='degrees', figure='gcf', clear=1, draw=True, **kwargs): """ Plots the magnitude and phase of complex ydata vs xdata. Parameters ---------- xdata ...
Plots the magnitude and phase of complex ydata vs xdata. Parameters ---------- xdata Real-valued x-axis data ydata Complex-valued y-axis data eydata=None Complex-valued y-error exdata=None Real-valued x-error xs...
entailment
def magphase_databoxes(ds, xscript=0, yscript='d[1]+1j*d[2]', eyscript=None, exscript=None, g=None, **kwargs): """ Use databoxes and scripts to generate data and plot the complex magnitude and phase versus xdata. Parameters ---------- ds List of databoxes xscript=0 ...
Use databoxes and scripts to generate data and plot the complex magnitude and phase versus xdata. Parameters ---------- ds List of databoxes xscript=0 Script for x data yscript='d[1]+1j*d[2]' Script for y data eyscript=None Script for y error ...
entailment
def magphase_files(xscript=0, yscript='d[1]+1j*d[2]', eyscript=None, exscript=None, paths=None, g=None, **kwargs): """ This will load a bunch of data files, generate data based on the supplied scripts, and then plot the ydata's magnitude and phase versus xdata. Parameters ---------- xscript=0 ...
This will load a bunch of data files, generate data based on the supplied scripts, and then plot the ydata's magnitude and phase versus xdata. Parameters ---------- xscript=0 Script for x data yscript='d[1]+1j*d[2]' Script for y data eyscript=None Script for y error...
entailment
def magphase_function(f='1.0/(1+1j*x)', xmin=-1, xmax=1, steps=200, p='x', g=None, erange=False, **kwargs): """ Plots function(s) magnitude and phase over the specified range. Parameters ---------- f='1.0/(1+1j*x)' Complex-valued function or list of functions to plot. ...
Plots function(s) magnitude and phase over the specified range. Parameters ---------- f='1.0/(1+1j*x)' Complex-valued function or list of functions to plot. These can be string functions or single-argument python functions; additional globals can be supplied by g. ...
entailment
def realimag_data(xdata, ydata, eydata=None, exdata=None, xscale='linear', rscale='linear', iscale='linear', rlabel='Real', ilabel='Imaginary', figure='gcf', clear=1, draw=True, **kwargs): """ Plots the real and imaginary parts of complex ydata vs xdata. Parameters ---------- xdata Real-val...
Plots the real and imaginary parts of complex ydata vs xdata. Parameters ---------- xdata Real-valued x-axis data ydata Complex-valued y-axis data eydata=None Complex-valued y-error exdata=None Real-valued x-error xscale='line...
entailment
def realimag_databoxes(ds, xscript=0, yscript="d[1]+1j*d[2]", eyscript=None, exscript=None, g=None, **kwargs): """ Use databoxes and scripts to generate data and plot the real and imaginary ydata versus xdata. Parameters ---------- ds List of databoxes xscript=0 Sc...
Use databoxes and scripts to generate data and plot the real and imaginary ydata versus xdata. Parameters ---------- ds List of databoxes xscript=0 Script for x data yscript='d[1]+1j*d[2]' Script for y data eyscript=None Script for y error e...
entailment
def realimag_files(xscript=0, yscript="d[1]+1j*d[2]", eyscript=None, exscript=None, paths=None, g=None, **kwargs): """ This will load a bunch of data files, generate data based on the supplied scripts, and then plot the ydata's real and imaginary parts versus xdata. Parameters ---------- xscrip...
This will load a bunch of data files, generate data based on the supplied scripts, and then plot the ydata's real and imaginary parts versus xdata. Parameters ---------- xscript=0 Script for x data yscript='d[1]+1j*d[2]' Script for y data eyscript=None Script for y ...
entailment
def realimag_function(f='1.0/(1+1j*x)', xmin=-1, xmax=1, steps=200, p='x', g=None, erange=False, **kwargs): """ Plots function(s) real and imaginary parts over the specified range. Parameters ---------- f='1.0/(1+1j*x)' Complex-valued function or list of functions to plot. ...
Plots function(s) real and imaginary parts over the specified range. Parameters ---------- f='1.0/(1+1j*x)' Complex-valued function or list of functions to plot. These can be string functions or single-argument python functions; additional globals can be supplied b...
entailment
def xy_data(xdata, ydata, eydata=None, exdata=None, label=None, xlabel='', ylabel='', \ title='', shell_history=0, xshift=0, yshift=0, xshift_every=1, yshift_every=1, \ coarsen=0, style=None, clear=True, axes=None, xscale='linear', yscale='linear', grid=False, \ ...
Plots specified data. Parameters ---------- xdata, ydata Arrays (or arrays of arrays) of data to plot eydata=None, exdata=None Arrays of x and y errorbar values label=None String or array of strings for the line labels xlabel='' L...
entailment
def xy_databoxes(ds, xscript=0, yscript='d[1]', eyscript=None, exscript=None, g=None, **kwargs): """ Use databoxes and scripts to generate and plot ydata versus xdata. Parameters ---------- ds List of databoxes xscript=0 Script for x data yscript='d[1]' Scr...
Use databoxes and scripts to generate and plot ydata versus xdata. Parameters ---------- ds List of databoxes xscript=0 Script for x data yscript='d[1]' Script for y data eyscript=None Script for y error exscript=None Script for x error ...
entailment
def xy_files(xscript=0, yscript='d[1]', eyscript=None, exscript=None, paths=None, g=None, **kwargs): """ This will load a bunch of data files, generate data based on the supplied scripts, and then plot the ydata versus xdata. Parameters ---------- xscript=0 Script for x data yscrip...
This will load a bunch of data files, generate data based on the supplied scripts, and then plot the ydata versus xdata. Parameters ---------- xscript=0 Script for x data yscript='d[1]' Script for y data eyscript=None Script for y error exscript=None Scr...
entailment
def xy_function(f='sin(x)', xmin=-1, xmax=1, steps=200, p='x', g=None, erange=False, **kwargs): """ Plots function(s) over the specified range. Parameters ---------- f='sin(x)' Function or list of functions to plot. These can be string functions or single-argument ...
Plots function(s) over the specified range. Parameters ---------- f='sin(x)' Function or list of functions to plot. These can be string functions or single-argument python functions; additional globals can be supplied by g. xmin=-1, xmax=1, steps=200 ...
entailment
def databoxes(ds, xscript=0, yscript=1, eyscript=None, exscript=None, g=None, plotter=xy_data, transpose=False, **kwargs): """ Plots the listed databox objects with the specified scripts. ds list of databoxes xscript script for x data yscript script for y data eyscript script for y ...
Plots the listed databox objects with the specified scripts. ds list of databoxes xscript script for x data yscript script for y data eyscript script for y error exscript script for x error plotter function used to do the plotting transpose applies databox.transpose() prior t...
entailment
def files(xscript=0, yscript=1, eyscript=None, exscript=None, g=None, plotter=xy_databoxes, paths=None, **kwargs): """ This will load a bunch of data files, generate data based on the supplied scripts, and then plot this data using the specified databox plotter. xscript, yscript, eyscript, exscript ...
This will load a bunch of data files, generate data based on the supplied scripts, and then plot this data using the specified databox plotter. xscript, yscript, eyscript, exscript scripts to generate x, y, and errors g optional dictionary of globals optional: ...
entailment
def image_data(Z, X=[0,1.0], Y=[0,1.0], aspect=1.0, zmin=None, zmax=None, clear=1, clabel='z', autoformat=True, colormap="Last Used", shell_history=0, **kwargs): """ Generates an image plot. Parameters ---------- Z 2-d array of z-values X=[0,1.0], Y=[0,1.0] 1-d array of x...
Generates an image plot. Parameters ---------- Z 2-d array of z-values X=[0,1.0], Y=[0,1.0] 1-d array of x-values (only the first and last element are used) See matplotlib's imshow() for additional optional arguments.
entailment
def image_function(f='sin(5*x)*cos(5*y)', xmin=-1, xmax=1, ymin=-1, ymax=1, xsteps=100, ysteps=100, p='x,y', g=None, **kwargs): """ Plots a 2-d function over the specified range Parameters ---------- f='sin(5*x)*cos(5*y)' Takes two inputs and returns one value. Can also ...
Plots a 2-d function over the specified range Parameters ---------- f='sin(5*x)*cos(5*y)' Takes two inputs and returns one value. Can also be a string function such as sin(x*y) xmin=-1, xmax=1, ymin=-1, ymax=1 Range over which to generate/plot the data ...
entailment
def image_file(path=None, zscript='self[1:]', xscript='[0,1]', yscript='d[0]', g=None, **kwargs): """ Loads an data file and plots it with color. Data file must have columns of the same length! Parameters ---------- path=None Path to data file. zscript='self[1:]' Determines...
Loads an data file and plots it with color. Data file must have columns of the same length! Parameters ---------- path=None Path to data file. zscript='self[1:]' Determines how to get data from the columns xscript='[0,1]', yscript='d[0]' Determine the x and y arrays us...
entailment
def parametric_function(fx='sin(t)', fy='cos(t)', tmin=-1, tmax=1, steps=200, p='t', g=None, erange=False, **kwargs): """ Plots the parametric function over the specified range Parameters ---------- fx='sin(t)', fy='cos(t)' Functions or (matching) lists of functions to plot; ...
Plots the parametric function over the specified range Parameters ---------- fx='sin(t)', fy='cos(t)' Functions or (matching) lists of functions to plot; can be string functions or python functions taking one argument tmin=-1, tmax=1, steps=200 Range over which...
entailment
def reset(self): """ Resets the style cycle. """ for key in list(self.keys()): self.iterators[key] = _itertools.cycle(self[key]) return self
Resets the style cycle.
entailment
def add_text(text, x=0.01, y=0.01, axes="gca", draw=True, **kwargs): """ Adds text to the axes at the specified position. **kwargs go to the axes.text() function. """ if axes=="gca": axes = _pylab.gca() axes.text(x, y, text, transform=axes.transAxes, **kwargs) if draw: _pylab.draw()
Adds text to the axes at the specified position. **kwargs go to the axes.text() function.
entailment