Search is not available for this dataset
text
stringlengths
75
104k
def cpe_superset(cls, source, target): """ Compares two WFNs and returns True if the set-theoretic relation between the names is (non-proper) SUPERSET. :param CPE2_3_WFN source: first WFN CPE Name :param CPE2_3_WFN target: seconds WFN CPE Name :returns: True if the set r...
def append(self, cpe): """ Adds a CPE element to the set if not already. Only WFN CPE Names are valid, so this function converts the input CPE object of version 2.3 to WFN style. :param CPE cpe: CPE Name to store in set :returns: None :exception: ValueError - inv...
def name_match(self, wfn): """ Accepts a set of CPE Names K and a candidate CPE Name X. It returns 'True' if X matches any member of K, and 'False' otherwise. :param CPESet self: A set of m known CPE Names K = {K1, K2, …, Km}. :param CPE cpe: A candidate CPE Name X. :ret...
def _parse(self): """ Checks if the CPE Name is valid. :returns: None :exception: ValueError - bad-formed CPE Name """ # Check prefix and initial bracket of WFN if self._str[0:5] != CPE2_3_WFN.CPE_PREFIX: errmsg = "Bad-formed CPE Name: WFN prefix not...
def language_match(self, cpeset, cpel_dom=None): """ Accepts a set of known CPE Names and an expression in the CPE language, and delivers the answer True if the expression matches with the set. Otherwise, it returns False. :param CPELanguage self: An expression in the CPE Applic...
def append(self, cpe): """ Adds a CPE Name to the set if not already. :param CPE cpe: CPE Name to store in set :returns: None :exception: ValueError - invalid version of CPE Name TEST: >>> from .cpeset2_2 import CPESet2_2 >>> from .cpe2_2 import CPE2_2...
def set_value(self, comp_str, comp_att): """ Set the value of component. :param string comp_str: value of component :param string comp_att: attribute associated with comp_str :returns: None :exception: ValueError - incorrect value of component """ # Del ...
def append(self, cpe): """ Adds a CPE Name to the set if not already. :param CPE cpe: CPE Name to store in set :returns: None :exception: ValueError - invalid version of CPE Name TEST: >>> from .cpeset1_1 import CPESet1_1 >>> from .cpe1_1 import CPE1_1 ...
def name_match(self, cpe): """ Accepts a set of known instances of CPE Names and a candidate CPE Name, and returns 'True' if the candidate can be shown to be an instance based on the content of the known instances. Otherwise, it returns 'False'. :param CPESet self: A set...
def _parse(self): """ Checks if the CPE Name is valid. :returns: None :exception: ValueError - bad-formed CPE Name """ # CPE Name must not have whitespaces if (self._str.find(" ") != -1): msg = "Bad-formed CPE Name: it must not have whitespaces" ...
def get_attribute_values(self, att_name): """ Returns the values of attribute "att_name" of CPE Name. By default a only element in each part. :param string att_name: Attribute name to get :returns: List of attribute values :rtype: list :exception: ValueError - in...
def _parse(self): """ Checks if CPE Name is valid. :returns: None :exception: ValueError - bad-formed CPE Name """ # CPE Name must not have whitespaces if (self._str.find(" ") != -1): msg = "Bad-formed CPE Name: it must not have whitespaces" ...
def as_wfn(self): """ Returns the CPE Name as WFN string of version 2.3. Only shows the first seven components. :return: CPE Name as WFN string :rtype: string :exception: TypeError - incompatible version """ wfn = [] wfn.append(CPE2_3_WFN.CPE_PRE...
def _fact_ref_eval(cls, cpeset, wfn): """ Returns True if wfn is a non-proper superset (True superset or equal to) any of the names in cpeset, otherwise False. :param CPESet cpeset: list of CPE bound Names. :param CPE2_3_WFN wfn: WFN CPE Name. :returns: True if wfn is a ...
def _check_fact_ref_eval(cls, cpel_dom): """ Returns the result (True, False, Error) of performing the specified check, unless the check isn’t supported, in which case it returns False. Error is a catch-all for all results other than True and False. :param string cpel_do...
def _unbind(cls, boundname): """ Unbinds a bound form to a WFN. :param string boundname: CPE name :returns: WFN object associated with boundname. :rtype: CPE2_3_WFN """ try: fs = CPE2_3_FS(boundname) except: # CPE name is not form...
def language_match(self, cpeset, cpel_dom=None): """ Accepts a set of known CPE Names and an expression in the CPE language, and delivers the answer True if the expression matches with the set. Otherwise, it returns False. :param CPELanguage self: An expression in the CPE Applic...
def name_match(self, cpe): """ Accepts a set of known instances of CPE Names and a candidate CPE Name, and returns 'True' if the candidate can be shown to be an instance based on the content of the known instances. Otherwise, it returns 'False'. :param CPESet self: A set...
def _decode(self): """ Convert the encoded value of component to standard value (WFN value). """ result = [] idx = 0 s = self._encoded_value while (idx < len(s)): # Get the idx'th character of s c = s[idx] if (c in CPECompone...
def is_component(w, ids): """Check if the set of ids form a single connected component Parameters ---------- w : spatial weights boject ids : list identifiers of units that are tested to be a single connected component Returns ------- True : if the list of ...
def check_contiguity(w, neighbors, leaver): """Check if contiguity is maintained if leaver is removed from neighbors Parameters ---------- w : spatial weights object simple contiguity based weights neighbors : list nodes that are to be checked if th...
def confirm(question, assume_yes=True): """ Ask user a yes/no question and return their response as a boolean. ``question`` should be a simple, grammatically complete question such as "Do you wish to continue?", and will have a string similar to ``" [Y/n] "`` appended automatically. This function w...
def jsonapi(f): """ Declare the view as a JSON API method This converts view return value into a :cls:JsonResponse. The following return types are supported: - tuple: a tuple of (response, status, headers) - any other object is converted to JSON """ @wraps(f) de...
def _unpack(c, tmp, package, version, git_url=None): """ Download + unpack given package into temp dir ``tmp``. Return ``(real_version, source)`` where ``real_version`` is the "actual" version downloaded (e.g. if a Git master was indicated, it will be the SHA of master HEAD) and ``source`` is the s...
def vendorize( c, distribution, version, vendor_dir, package=None, git_url=None, license=None, ): """ Vendorize Python package ``distribution`` at version/SHA ``version``. Specify the vendor folder (e.g. ``<mypackage>/vendor``) as ``vendor_dir``. For Crate/PyPI releases, ``...
def make_sudouser(c): """ Create a passworded sudo-capable user. Used by other tasks to execute the test suite so sudo tests work. """ user = c.travis.sudo.user password = c.travis.sudo.password # --create-home because we need a place to put conf files, keys etc # --groups travis becaus...
def make_sshable(c): """ Set up passwordless SSH keypair & authorized_hosts access to localhost. """ user = c.travis.sudo.user home = "~{0}".format(user) # Run sudo() as the new sudo user; means less chown'ing, etc. c.config.sudo.user = user ssh_dir = "{0}/.ssh".format(home) # TODO: ...
def sudo_run(c, command): """ Run some command under Travis-oriented sudo subshell/virtualenv. :param str command: Command string to run, e.g. ``inv coverage``, ``inv integration``, etc. (Does not necessarily need to be an Invoke task, but...) """ # NOTE: explicit shell wrapper beca...
def blacken(c): """ Install and execute ``black`` under appropriate circumstances, with diffs. Installs and runs ``black`` under Python 3.6 (the first version it supports). Since this sort of CI based task only needs to run once per commit (formatting is not going to change between interpreters) th...
def _calc(self, x, y): """ List based implementation of binary tree algorithm for concordance measure after :cite:`Christensen2005`. """ x = np.array(x) y = np.array(y) n = len(y) perm = list(range(n)) perm.sort(key=lambda a: (x[a], y[a])) ...
def decorator(self, func): """ Wrapper function to decorate a function """ if inspect.isfunction(func): func._methodview = self elif inspect.ismethod(func): func.__func__._methodview = self else: raise AssertionError('Can only decorate function and met...
def matches(self, verb, params): """ Test if the method matches the provided set of arguments :param verb: HTTP verb. Uppercase :type verb: str :param params: Existing route parameters :type params: set :returns: Whether this view matches :rtype: bool """...
def _match_view(self, method, route_params): """ Detect a view matching the query :param method: HTTP method :param route_params: Route parameters dict :return: Method :rtype: Callable|None """ method = method.upper() route_params = frozenset(k for k, v i...
def route_as_view(cls, app, name, rules, *class_args, **class_kwargs): """ Register the view with an URL route :param app: Flask application :type app: flask.Flask|flask.Blueprint :param name: Unique view name :type name: str :param rules: List of route rules to use ...
def steady_state(P): """ Calculates the steady state probability vector for a regular Markov transition matrix P. Parameters ---------- P : array (k, k), an ergodic Markov transition probability matrix. Returns ------- : array (k, ), st...
def fmpt(P): """ Calculates the matrix of first mean passage times for an ergodic transition probability matrix. Parameters ---------- P : array (k, k), an ergodic Markov transition probability matrix. Returns ------- M : array (k, k), elements are the e...
def var_fmpt(P): """ Variances of first mean passage times for an ergodic transition probability matrix. Parameters ---------- P : array (k, k), an ergodic Markov transition probability matrix. Returns ------- : array (k, k), elements are the v...
def _converge(c): """ Examine world state, returning data on what needs updating for release. :param c: Invoke ``Context`` object or subclass. :returns: Two dicts (technically, dict subclasses, which allow attribute access), ``actions`` and ``state`` (in that order.) ``actions...
def status(c): """ Print current release (version, changelog, tag, etc) status. Doubles as a subroutine, returning the return values from its inner call to ``_converge`` (an ``(actions, state)`` two-tuple of Lexicons). """ # TODO: wants some holistic "you don't actually HAVE any changes to ...
def prepare(c): """ Edit changelog & version, git commit, and git tag, to set up for release. """ # Print dry-run/status/actions-to-take data & grab programmatic result # TODO: maybe expand the enum-based stuff to have values that split up # textual description, command string, etc. See the TODO...
def _release_line(c): """ Examine current repo state to determine what type of release to prep. :returns: A two-tuple of ``(branch-name, line-type)`` where: - ``branch-name`` is the current branch name, e.g. ``1.1``, ``master``, ``gobbledygook`` (or, usually, ``HEAD`` if not on a...
def _versions_from_changelog(changelog): """ Return all released versions from given ``changelog``, sorted. :param dict changelog: A changelog dict as returned by ``releases.util.parse_changelog``. :returns: A sorted list of `semantic_version.Version` objects. """ versions = [Version(x...
def _release_and_issues(changelog, branch, release_type): """ Return most recent branch-appropriate release, if any, and its contents. :param dict changelog: Changelog contents, as returned by ``releases.util.parse_changelog``. :param str branch: Branch name. :param release_type: ...
def _get_tags(c): """ Return sorted list of release-style tags as semver objects. """ tags_ = [] for tagstr in c.run("git tag", hide=True).stdout.strip().split("\n"): try: tags_.append(Version(tagstr)) # Ignore anything non-semver; most of the time they'll be non-release ...
def _find_package(c): """ Try to find 'the' One True Package for this project. Mostly for obtaining the ``_version`` file within it. Uses the ``packaging.package`` config setting if defined. If not defined, fallback is to look for a single top-level Python package (directory containing ``__ini...
def build(c, sdist=True, wheel=False, directory=None, python=None, clean=True): """ Build sdist and/or wheel archives, optionally in a temp base directory. All parameters save ``directory`` honor config settings of the same name, under the ``packaging`` tree. E.g. say ``.configure({'packaging': {'wheel...
def publish( c, sdist=True, wheel=False, index=None, sign=False, dry_run=False, directory=None, dual_wheels=False, alt_python=None, check_desc=False, ): """ Publish code to PyPI or index of choice. All parameters save ``dry_run`` and ``directory`` honor config settin...
def upload(c, directory, index=None, sign=False, dry_run=False): """ Upload (potentially also signing) all artifacts in ``directory``. :param str index: Custom upload index/repository name. By default, uses whatever the invoked ``pip`` is configured to use. Modify your ``pypirc`` f...
def tmpdir(skip_cleanup=False, explicit=None): """ Context-manage a temporary directory. Can be given ``skip_cleanup`` to skip cleanup, and ``explicit`` to choose a specific location. (If both are given, this is basically not doing anything, but it allows code that normally requires a secure t...
def permute(self, permutations=99, alternative='two.sided'): """ Generate ransom spatial permutations for inference on LISA vectors. Parameters ---------- permutations : int, optional Number of random permutations of observations. alternative : string, option...
def plot(self, attribute=None, ax=None, **kwargs): """ Plot the rose diagram. Parameters ---------- attribute : (n,) ndarray, optional Variable to specify colors of the colorbars. ax : Matplotlib Axes instance, optional If given, the figure will b...
def plot_origin(self): # TODO add attribute option to color vectors """ Plot vectors of positional transition of LISA values starting from the same origin. """ import matplotlib.cm as cm import matplotlib.pyplot as plt ax = plt.subplot(111) xlim = [self._...
def plot_vectors(self, arrows=True): """ Plot vectors of positional transition of LISA values within quadrant in scatterplot in a polar plot. Parameters ---------- ax : Matplotlib Axes instance, optional If given, the figure will be created inside this axis. ...
def _clean(c): """ Nuke docs build target directory so next build is clean. """ if isdir(c.sphinx.target): rmtree(c.sphinx.target)
def _browse(c): """ Open build target's index.html in a browser (using 'open'). """ index = join(c.sphinx.target, c.sphinx.target_file) c.run("open {0}".format(index))
def build( c, clean=False, browse=False, nitpick=False, opts=None, source=None, target=None, ): """ Build the project's Sphinx docs. """ if clean: _clean(c) if opts is None: opts = "" if nitpick: opts += " -n -W -T" cmd = "sphinx-build{0} {...
def tree(c): """ Display documentation contents with the 'tree' program. """ ignore = ".git|*.pyc|*.swp|dist|*.egg-info|_static|_build|_templates" c.run('tree -Ca -I "{0}" {1}'.format(ignore, c.sphinx.source))
def sites(c): """ Build both doc sites w/ maxed nitpicking. """ # TODO: This is super lolzy but we haven't actually tackled nontrivial # in-Python task calling yet, so we do this to get a copy of 'our' context, # which has been updated with the per-collection config data of the # docs/www su...
def watch_docs(c): """ Watch both doc trees & rebuild them if files change. This includes e.g. rebuilding the API docs if the source code changes; rebuilding the WWW docs if the README changes; etc. Reuses the configuration values ``packaging.package`` or ``tests.package`` (the former winning ...
def shuffle_matrix(X, ids): """ Random permutation of rows and columns of a matrix Parameters ---------- X : array (k, k), array to be permutated. ids : array range (k, ). Returns ------- X : array (k, k) with rows and columns randomly shuffled. ...
def get_lower(matrix): """ Flattens the lower part of an n x n matrix into an n*(n-1)/2 x 1 vector. Parameters ---------- matrix : array (n, n) numpy array, a distance matrix. Returns ------- lowvec : array numpy array, the lower half of the distance matri...
def blacken( c, line_length=79, folders=None, check=False, diff=False, find_opts=None ): r""" Run black on the current source tree (all ``.py`` files). .. warning:: ``black`` only runs on Python 3.6 or above. (However, it can be executed against Python 2 compatible code.) :param in...
def normalize_response_value(rv): """ Normalize the response value into a 3-tuple (rv, status, headers) :type rv: tuple|* :returns: tuple(rv, status, headers) :rtype: tuple(Response|JsonResponse|*, int|None, dict|None) """ status = headers = None if isinstance(rv, tuple): ...
def make_json_response(rv): """ Make JsonResponse :param rv: Response: the object to encode, or tuple (response, status, headers) :type rv: tuple|* :rtype: JsonResponse """ # Tuple of (response, status, headers) rv, status, headers = normalize_response_value(rv) # JsonResponse if is...
def markov_mobility(p, measure="P", ini=None): """ Markov-based mobility index. Parameters ---------- p : array (k, k), Markov transition probability matrix. measure : string If measure= "P", :math:`M_{P} = \\frac{m-\sum_{i=1}^m P_{ii}}{m-1}`; ...
def chi2(T1, T2): """ chi-squared test of difference between two transition matrices. Parameters ---------- T1 : array (k, k), matrix of transitions (counts). T2 : array (k, k), matrix of transitions (counts) to use to form the probabilities under the n...
def kullback(F): """ Kullback information based test of Markov Homogeneity. Parameters ---------- F : array (s, r, r), values are transitions (not probabilities) for s strata, r initial states, r terminal states. Returns ------- Results : dictionary (key -...
def prais(pmat): """ Prais conditional mobility measure. Parameters ---------- pmat : matrix (k, k), Markov probability transition matrix. Returns ------- pr : matrix (1, k), conditional mobility measures for each of the k classes. Notes ----- Prais...
def homogeneity(transition_matrices, regime_names=[], class_names=[], title="Markov Homogeneity Test"): """ Test for homogeneity of Markov transition probabilities across regimes. Parameters ---------- transition_matrices : list of transition matrices for r...
def sojourn_time(p): """ Calculate sojourn time based on a given transition probability matrix. Parameters ---------- p : array (k, k), a Markov transition probability matrix. Returns ------- : array (k, ), sojourn times. Each element is th...
def _calc(self, y, w): '''Helper to estimate spatial lag conditioned Markov transition probability matrices based on maximum likelihood techniques. ''' if self.discrete: self.lclass_ids = weights.lag_categorical(w, self.class_ids, ...
def summary(self, file_name=None): """ A summary method to call the Markov homogeneity test to test for temporally lagged spatial dependence. To learn more about the properties of the tests, refer to :cite:`Rey2016a` and :cite:`Kang2018`. """ class_names = ["C%d...
def _maybe_classify(self, y, k, cutoffs): '''Helper method for classifying continuous data. ''' rows, cols = y.shape if cutoffs is None: if self.fixed: mcyb = mc.Quantiles(y.flatten(), k=k) yb = mcyb.yb.reshape(y.shape) cutoff...
def spillover(self, quadrant=1, neighbors_on=False): """ Detect spillover locations for diffusion in LISA Markov. Parameters ---------- quadrant : int which quadrant in the scatterplot should form the core of a cluster. n...
def get_entity_propnames(entity): """ Get entity property names :param entity: Entity :type entity: sqlalchemy.ext.declarative.api.DeclarativeMeta :returns: Set of entity property names :rtype: set """ ins = entity if isinstance(entity, InstanceState) else inspect(entity) ...
def get_entity_loaded_propnames(entity): """ Get entity property names that are loaded (e.g. won't produce new queries) :param entity: Entity :type entity: sqlalchemy.ext.declarative.api.DeclarativeMeta :returns: Set of entity property names :rtype: set """ ins = inspect(ent...
def next_minor(self): """ Return a Version whose minor number is one greater than self's. .. note:: The new Version will always have a zeroed-out bugfix/tertiary version number, because the "next minor release" of e.g. 1.2.1 is 1.3.0, not 1.3.1. """ clone = self.clone() ...
def _check_encoding(name, encoding_to_check, alternative_encoding, source=None): """ Check that ``encoding`` is a valid Python encoding :param name: name under which the encoding is known to the user, e.g. 'default encoding' :param encoding_to_check: name of the encoding to check, e.g. 'utf-8' :para...
def lines(text): """ Generator function to yield lines (delimited with ``'\n'``) stored in ``text``. This is useful when a regular expression should only match on a per line basis in a memory efficient way. """ assert text is not None assert '\r' not in text previous_newline_index = 0 ...
def matching_number_line_and_regex(source_lines, generated_regexes, max_line_count=15): """ The first line and its number (starting with 0) in the source code that indicated that the source code is generated. :param source_lines: lines of text to scan :param generated_regexes: regular expressions a ...
def _pythonized_comments(tokens): """ Similar to tokens but converts strings after a colon (:) to comments. """ is_after_colon = True for token_type, token_text in tokens: if is_after_colon and (token_type in pygments.token.String): token_type = pygments.token.Comment eli...
def encoding_for(source_path, encoding='automatic', fallback_encoding=None): """ The encoding used by the text file stored in ``source_path``. The algorithm used is: * If ``encoding`` is ``'automatic``, attempt the following: 1. Check BOM for UTF-8, UTF-16 and UTF-32. 2. Look for XML prolo...
def has_lexer(source_path): """ Initial quick check if there is a lexer for ``source_path``. This removes the need for calling :py:func:`pygments.lexers.guess_lexer_for_filename()` which fully reads the source file. """ result = bool(pygments.lexers.find_lexer_class_for_filename(source_path)) ...
def source_analysis( source_path, group, encoding='automatic', fallback_encoding='cp1252', generated_regexes=pygount.common.regexes_from(DEFAULT_GENERATED_PATTERNS_TEXT), duplicate_pool=None): """ Analysis for line counts in source code stored in ``source_path``. :param source_path:...
def polynomial(img, mask, inplace=False, replace_all=False, max_dev=1e-5, max_iter=20, order=2): ''' replace all masked values calculate flatField from 2d-polynomal fit filling all high gradient areas within averaged fit-image returns flatField, average background level, fitte...
def errorDist(scale, measExpTime, n_events_in_expTime, event_duration, std, points_per_time=100, n_repetitions=300): ''' TODO ''' ntimes = 10 s1 = measExpTime * scale * 10 # exp. time factor 1/16-->16: p2 = np.logspace(-4, 4, 18, base=2) t = np.lin...
def exampleSignals(std=1, dur1=1, dur2=3, dur3=0.2, n1=0.5, n2=0.5, n3=2): ''' std ... standard deviation of every signal dur1...dur3 --> event duration per second n1...n3 --> number of events per second ''' np.random.seed(123) t = np.linspace(0, 10, 100) ...
def _flux(t, n, duration, std, offs=1): ''' returns Gaussian shaped signal fluctuations [events] t --> times to calculate event for n --> numbers of events per sec duration --> event duration per sec std --> std of event if averaged over time offs --> event offset ''' ...
def _capture(f, t, t0, factor): ''' capture signal and return its standard deviation #TODO: more detail ''' n_per_sec = len(t) / t[-1] # len of one split: n = int(t0 * factor * n_per_sec) s = len(f) // n m = s * n f = f[:m] ff = np.split(f, s) m = np.mean(ff...
def genericCameraMatrix(shape, angularField=60): ''' Return a generic camera matrix [[fx, 0, cx], [ 0, fy, cy], [ 0, 0, 1]] for a given image shape ''' # http://nghiaho.com/?page_id=576 # assume that the optical centre is in the middle: cy = int(shape[0] / 2) cx ...
def standardDeviation2d(img, ksize=5, blurred=None): ''' calculate the spatial resolved standard deviation for a given 2d array ksize -> kernel size blurred(optional) -> with same ksize gaussian filtered image setting this parameter reduces processing time ...
def maskedFilter(arr, mask, ksize=30, fill_mask=True, fn='median'): ''' fn['mean', 'median'] fill_mask=True: replaced masked areas with filtered results fill_mask=False: masked areas are ignored ''' if fill_mask: mask1 = mask out = ar...
def vignettingFromDifferentObjects(imgs, bg): ''' Extract vignetting from a set of images containing different devices The devices spatial inhomogeneities are averaged This method is referred as 'Method C' in --- K.Bedrich, M.Bokalic et al.: ELECTROLUMINESCENCE IMAGING OF PV D...
def SNR_IEC(i1, i2, ibg=0, allow_color_images=False): ''' Calculate the averaged signal-to-noise ratio SNR50 as defined by IEC NP 60904-13 needs 2 reference EL images and one background image ''' # ensure images are type float64 (double precision): i1 = np.asfarray(i1) i2 = np....
def _rotate(img, angle): ''' angle [DEG] ''' s = img.shape if angle == 0: return img else: M = cv2.getRotationMatrix2D((s[1] // 2, s[0] // 2), angle, 1) return cv2.warpAffine(img, M, (s...
def _findOverlap(self, img_rgb, overlap, overlapDeviation, rotation, rotationDeviation): ''' return offset(x,y) which fit best self._base_img through template matching ''' # get gray images if len(img_rgb.shape) != len(img_rgb.shape): ...
def estimateFromImages(imgs1, imgs2=None, mn_mx=None, nbins=100): ''' estimate the noise level function as stDev over image intensity from a set of 2 image groups images at the same position have to show the identical setup, so imgs1[i] - imgs2[i] = noise ''' if imgs2 is None: ...
def _evaluate(x, y, weights): ''' get the parameters of the, needed by 'function' through curve fitting ''' i = _validI(x, y, weights) xx = x[i] y = y[i] try: fitParams = _fit(xx, y) # bound noise fn to min defined y value: minY = function(xx[0], *fit...
def boundedFunction(x, minY, ax, ay): ''' limit [function] to a minimum y value ''' y = function(x, ax, ay) return np.maximum(np.nan_to_num(y), minY)
def function(x, ax, ay): ''' general square root function ''' with np.errstate(invalid='ignore'): return ay * (x - ax)**0.5