sentence1
stringlengths
52
3.87M
sentence2
stringlengths
1
47.2k
label
stringclasses
1 value
def make_full_ivar(): """ take the scatters and skylines and make final ivars """ # skylines come as an ivar # don't use them for now, because I don't really trust them... # skylines = np.load("%s/skylines.npz" %DATA_DIR)['arr_0'] ref_flux = np.load("%s/ref_flux_all.npz" %DATA_DIR)['arr_0'] re...
take the scatters and skylines and make final ivars
entailment
def _sinusoid(x, p, L, y): """ Return the sinusoid cont func evaluated at input x for the continuum. Parameters ---------- x: float or np.array data, input to function p: ndarray coefficients of fitting function L: float width of x data y: float or np.array ...
Return the sinusoid cont func evaluated at input x for the continuum. Parameters ---------- x: float or np.array data, input to function p: ndarray coefficients of fitting function L: float width of x data y: float or np.array output data corresponding to input ...
entailment
def _weighted_median(values, weights, quantile): """ Calculate a weighted median for values above a particular quantile cut Used in pseudo continuum normalization Parameters ---------- values: np ndarray of floats the values to take the median of weights: np ndarray of floats t...
Calculate a weighted median for values above a particular quantile cut Used in pseudo continuum normalization Parameters ---------- values: np ndarray of floats the values to take the median of weights: np ndarray of floats the weights associated with the values quantile: float...
entailment
def _find_cont_gaussian_smooth(wl, fluxes, ivars, w): """ Returns the weighted mean block of spectra Parameters ---------- wl: numpy ndarray wavelength vector flux: numpy ndarray block of flux values ivar: numpy ndarray block of ivar values L: float width of...
Returns the weighted mean block of spectra Parameters ---------- wl: numpy ndarray wavelength vector flux: numpy ndarray block of flux values ivar: numpy ndarray block of ivar values L: float width of Gaussian used to assign weights Returns ------- ...
entailment
def _cont_norm_gaussian_smooth(dataset, L): """ Continuum normalize by dividing by a Gaussian-weighted smoothed spectrum Parameters ---------- dataset: Dataset the dataset to continuum normalize L: float the width of the Gaussian used for weighting Returns ------- datas...
Continuum normalize by dividing by a Gaussian-weighted smoothed spectrum Parameters ---------- dataset: Dataset the dataset to continuum normalize L: float the width of the Gaussian used for weighting Returns ------- dataset: Dataset updated dataset
entailment
def _find_cont_fitfunc(fluxes, ivars, contmask, deg, ffunc, n_proc=1): """ Fit a continuum to a continuum pixels in a segment of spectra Functional form can be either sinusoid or chebyshev, with specified degree Parameters ---------- fluxes: numpy ndarray of shape (nstars, npixels) trainin...
Fit a continuum to a continuum pixels in a segment of spectra Functional form can be either sinusoid or chebyshev, with specified degree Parameters ---------- fluxes: numpy ndarray of shape (nstars, npixels) training set or test set pixel intensities ivars: numpy ndarray of shape (nstars,...
entailment
def _find_cont_fitfunc_regions(fluxes, ivars, contmask, deg, ranges, ffunc, n_proc=1): """ Run fit_cont, dealing with spectrum in regions or chunks This is useful if a spectrum has gaps. Parameters ---------- fluxes: ndarray of shape (nstars, npixels) trainin...
Run fit_cont, dealing with spectrum in regions or chunks This is useful if a spectrum has gaps. Parameters ---------- fluxes: ndarray of shape (nstars, npixels) training set or test set pixel intensities ivars: numpy ndarray of shape (nstars, npixels) inverse variances, parallel t...
entailment
def _find_cont_running_quantile(wl, fluxes, ivars, q, delta_lambda, verbose=False): """ Perform continuum normalization using a running quantile Parameters ---------- wl: numpy ndarray wavelength vector fluxes: numpy ndarray of shape (nstars, npixels) ...
Perform continuum normalization using a running quantile Parameters ---------- wl: numpy ndarray wavelength vector fluxes: numpy ndarray of shape (nstars, npixels) pixel intensities ivars: numpy ndarray of shape (nstars, npixels) inverse variances, parallel to fluxes q:...
entailment
def _cont_norm_running_quantile_mp(wl, fluxes, ivars, q, delta_lambda, n_proc=2, verbose=False): """ The same as _cont_norm_running_quantile() above, but using multi-processing. Bo Zhang (NAOC) """ nStar = fluxes.shape[0] # start mp.Pool mp_results = ...
The same as _cont_norm_running_quantile() above, but using multi-processing. Bo Zhang (NAOC)
entailment
def _cont_norm_running_quantile_regions(wl, fluxes, ivars, q, delta_lambda, ranges, verbose=True): """ Perform continuum normalization using running quantile, for spectrum that comes in chunks """ print("contnorm.py: continuum norm using running quantile") pri...
Perform continuum normalization using running quantile, for spectrum that comes in chunks
entailment
def _cont_norm_running_quantile_regions_mp(wl, fluxes, ivars, q, delta_lambda, ranges, n_proc=2, verbose=False): """ Perform continuum normalization using running quantile, for spectrum that comes in chunks. The same as _cont_norm_running_quantile_regions(), ...
Perform continuum normalization using running quantile, for spectrum that comes in chunks. The same as _cont_norm_running_quantile_regions(), but using multi-processing. Bo Zhang (NAOC)
entailment
def _cont_norm(fluxes, ivars, cont): """ Continuum-normalize a continuous segment of spectra. Parameters ---------- fluxes: numpy ndarray pixel intensities ivars: numpy ndarray inverse variances, parallel to fluxes contmask: boolean mask True indicates that pixel is co...
Continuum-normalize a continuous segment of spectra. Parameters ---------- fluxes: numpy ndarray pixel intensities ivars: numpy ndarray inverse variances, parallel to fluxes contmask: boolean mask True indicates that pixel is continuum Returns ------- norm_flu...
entailment
def _cont_norm_regions(fluxes, ivars, cont, ranges): """ Perform continuum normalization for spectra in chunks Useful for spectra that have gaps Parameters --------- fluxes: numpy ndarray pixel intensities ivars: numpy ndarray inverse variances, parallel to fluxes cont: num...
Perform continuum normalization for spectra in chunks Useful for spectra that have gaps Parameters --------- fluxes: numpy ndarray pixel intensities ivars: numpy ndarray inverse variances, parallel to fluxes cont: numpy ndarray the continuum ranges: list or np ndarr...
entailment
def train(self, ds): """ Run training step: solve for best-fit spectral model """ if self.useErrors: self.coeffs, self.scatters, self.new_tr_labels, self.chisqs, self.pivots, self.scales = _train_model_new(ds) else: self.coeffs, self.scatters, self.chisqs, self.pivots, se...
Run training step: solve for best-fit spectral model
entailment
def infer_spectra(self, ds): """ After inferring labels for the test spectra, infer the model spectra and update the dataset model_spectra attribute. Parameters ---------- ds: Dataset object """ lvec_all = _get_lvec(ds.test_label_vals, se...
After inferring labels for the test spectra, infer the model spectra and update the dataset model_spectra attribute. Parameters ---------- ds: Dataset object
entailment
def plot_contpix(self, x, y, contpix_x, contpix_y, figname): """ Plot baseline spec with continuum pix overlaid Parameters ---------- """ fig, axarr = plt.subplots(2, sharex=True) plt.xlabel(r"Wavelength $\lambda (\AA)$") plt.xlim(min(x), max(x)) ax = ax...
Plot baseline spec with continuum pix overlaid Parameters ----------
entailment
def diagnostics_contpix(self, data, nchunks=10, fig = "baseline_spec_with_cont_pix"): """ Call plot_contpix once for each nth of the spectrum """ if data.contmask is None: print("No contmask set") else: coeffs_all = self.coeffs wl = data.wl baselin...
Call plot_contpix once for each nth of the spectrum
entailment
def diagnostics_plot_chisq(self, ds, figname = "modelfit_chisqs.png"): """ Produce a set of diagnostic plots for the model Parameters ---------- (optional) chisq_dist_plot_name: str Filename of output saved plot """ label_names = ds.get_plotting_labels() ...
Produce a set of diagnostic plots for the model Parameters ---------- (optional) chisq_dist_plot_name: str Filename of output saved plot
entailment
def calc_mass(nu_max, delta_nu, teff): """ asteroseismic scaling relations """ NU_MAX = 3140.0 # microHz DELTA_NU = 135.03 # microHz TEFF = 5777.0 return (nu_max/NU_MAX)**3 * (delta_nu/DELTA_NU)**(-4) * (teff/TEFF)**1.5
asteroseismic scaling relations
entailment
def calc_mass_2(mh,cm,nm,teff,logg): """ Table A2 in Martig 2016 """ CplusN = calc_sum(mh,cm,nm) t = teff/4000. return (95.8689 - 10.4042*mh - 0.7266*mh**2 + 41.3642*cm - 5.3242*cm*mh - 46.7792*cm**2 + 15.0508*nm - 0.9342*nm*mh - 30.5159*nm*cm - 1.6083*nm**2 - 67.6093...
Table A2 in Martig 2016
entailment
def corner(xs, bins=20, range=None, weights=None, color="k", smooth=None, smooth1d=None, labels=None, label_kwargs=None, show_titles=False, title_fmt=".2f", title_kwargs=None, truths=None, truth_color="#4682b4", scale_hist=False, quantiles=None, verbose=False, fig=...
Make a *sick* corner plot showing the projections of a data set in a multi-dimensional space. kwargs are passed to hist2d() or used for `matplotlib` styling. Parameters ---------- xs : array_like (nsamples, ndim) The samples. This should be a 1- or 2-dimensional array. For a 1-D arr...
entailment
def quantile(x, q, weights=None): """ Like numpy.percentile, but: * Values of q are quantiles [0., 1.] rather than percentiles [0., 100.] * scalar q not supported (q must be iterable) * optional weights on x """ if weights is None: return np.percentile(x, [100. * qi for qi in q]) ...
Like numpy.percentile, but: * Values of q are quantiles [0., 1.] rather than percentiles [0., 100.] * scalar q not supported (q must be iterable) * optional weights on x
entailment
def hist2d(x, y, bins=20, range=None, weights=None, levels=None, smooth=None, ax=None, color=None, plot_datapoints=True, plot_density=True, plot_contours=True, no_fill_contours=False, fill_contours=False, contour_kwargs=None, contourf_kwargs=None, data_kwargs=None, **kwargs):...
Plot a 2-D histogram of samples. Parameters ---------- x, y : array_like (nsamples,) The samples. levels : array_like The contour levels to draw. ax : matplotlib.Axes (optional) A axes instance on which to add the 2-D histogram. plot_datapoints : bool (optional) ...
entailment
def calc_dist(lamost_point, training_points, coeffs): """ avg dist from one lamost point to nearest 10 training points """ diff2 = (training_points - lamost_point)**2 dist = np.sqrt(np.sum(diff2*coeffs, axis=1)) return np.mean(dist[dist.argsort()][0:10])
avg dist from one lamost point to nearest 10 training points
entailment
def make_classifier(self, name, ids, labels): """Entrenar un clasificador SVM sobre los textos cargados. Crea un clasificador que se guarda en el objeto bajo el nombre `name`. Args: name (str): Nombre para el clasidicador. ids (list): Se espera una lista de N ids de tex...
Entrenar un clasificador SVM sobre los textos cargados. Crea un clasificador que se guarda en el objeto bajo el nombre `name`. Args: name (str): Nombre para el clasidicador. ids (list): Se espera una lista de N ids de textos ya almacenados en el TextClassifier. ...
entailment
def retrain(self, name, ids, labels): """Reentrenar parcialmente un clasificador SVM. Args: name (str): Nombre para el clasidicador. ids (list): Se espera una lista de N ids de textos ya almacenados en el TextClassifier. labels (list): Se espera una l...
Reentrenar parcialmente un clasificador SVM. Args: name (str): Nombre para el clasidicador. ids (list): Se espera una lista de N ids de textos ya almacenados en el TextClassifier. labels (list): Se espera una lista de N etiquetas. Una por cada id ...
entailment
def classify(self, classifier_name, examples, max_labels=None, goodness_of_fit=False): """Usar un clasificador SVM para etiquetar textos nuevos. Args: classifier_name (str): Nombre del clasidicador a usar. examples (list or str): Se espera un ejemplo o una lista...
Usar un clasificador SVM para etiquetar textos nuevos. Args: classifier_name (str): Nombre del clasidicador a usar. examples (list or str): Se espera un ejemplo o una lista de ejemplos a clasificar en texto plano o en ids. max_labels (int, optional): Cantidad...
entailment
def _make_text_vectors(self, examples): """Funcion para generar los vectores tf-idf de una lista de textos. Args: examples (list or str): Se espera un ejemplo o una lista de: o bien ids, o bien textos. Returns: textvec (sparse matrix): Devuelve una matriz...
Funcion para generar los vectores tf-idf de una lista de textos. Args: examples (list or str): Se espera un ejemplo o una lista de: o bien ids, o bien textos. Returns: textvec (sparse matrix): Devuelve una matriz sparse que contiene los vectores T...
entailment
def get_similar(self, example, max_similars=3, similarity_cutoff=None, term_diff_max_rank=10, filter_list=None, term_diff_cutoff=None): """Devuelve textos similares al ejemplo dentro de los textos entrenados. Nota: Usa la distancia de coseno del vecto...
Devuelve textos similares al ejemplo dentro de los textos entrenados. Nota: Usa la distancia de coseno del vector de features TF-IDF Args: example (str): Se espera un id de texto o un texto a partir del cual se buscaran otros textos similares. max_si...
entailment
def reload_texts(self, texts, ids, vocabulary=None): """Calcula los vectores de terminos de textos y los almacena. A diferencia de :func:`~TextClassifier.TextClassifier.store_text` esta funcion borra cualquier informacion almacenada y comienza el conteo desde cero. Se usa para redefinir...
Calcula los vectores de terminos de textos y los almacena. A diferencia de :func:`~TextClassifier.TextClassifier.store_text` esta funcion borra cualquier informacion almacenada y comienza el conteo desde cero. Se usa para redefinir el vocabulario sobre el que se construyen los vectores....
entailment
def name_suggest(q=None, datasetKey=None, rank=None, limit=100, offset=None, **kwargs): ''' A quick and simple autocomplete service that returns up to 20 name usages by doing prefix matching against the scientific name. Results are ordered by relevance. :param q: [str] Simple search parameter. The value for th...
A quick and simple autocomplete service that returns up to 20 name usages by doing prefix matching against the scientific name. Results are ordered by relevance. :param q: [str] Simple search parameter. The value for this parameter can be a simple word or a phrase. Wildcards can be added to the simple word pa...
entailment
def dataset_metrics(uuid, **kwargs): ''' Get details on a GBIF dataset. :param uuid: [str] One or more dataset UUIDs. See examples. References: http://www.gbif.org/developer/registry#datasetMetrics Usage:: from pygbif import registry registry.dataset_metrics(uuid='3f8a1297-3259-4700-91fc-acc4170b27ce') ...
Get details on a GBIF dataset. :param uuid: [str] One or more dataset UUIDs. See examples. References: http://www.gbif.org/developer/registry#datasetMetrics Usage:: from pygbif import registry registry.dataset_metrics(uuid='3f8a1297-3259-4700-91fc-acc4170b27ce') registry.dataset_metrics(uuid='66dd0960-2...
entailment
def datasets(data = 'all', type = None, uuid = None, query = None, id = None, limit = 100, offset = None, **kwargs): ''' Search for datasets and dataset metadata. :param data: [str] The type of data to get. Default: ``all`` :param type: [str] Type of dataset, options include ``OCCURRENCE``, etc. :param uui...
Search for datasets and dataset metadata. :param data: [str] The type of data to get. Default: ``all`` :param type: [str] Type of dataset, options include ``OCCURRENCE``, etc. :param uuid: [str] UUID of the data node provider. This must be specified if data is anything other than ``all``. :param query: [str] Qu...
entailment
def dataset_suggest(q=None, type=None, keyword=None, owningOrg=None, publishingOrg=None, hostingOrg=None, publishingCountry=None, decade=None, limit = 100, offset = None, **kwargs): ''' Search that returns up to 20 matching datasets. Results are ordered by relevance. :param q: [str] Query term(s) for full text s...
Search that returns up to 20 matching datasets. Results are ordered by relevance. :param q: [str] Query term(s) for full text search. The value for this parameter can be a simple word or a phrase. Wildcards can be added to the simple word parameters only, e.g. ``q=*puma*`` :param type: [str] Type of dataset, optio...
entailment
def dataset_search(q=None, type=None, keyword=None, owningOrg=None, publishingOrg=None, hostingOrg=None, decade=None, publishingCountry = None, facet = None, facetMincount=None, facetMultiselect = None, hl = False, limit = 100, offset = None, **kwargs): ''' Full text search across all datasets. Results are ordere...
Full text search across all datasets. Results are ordered by relevance. :param q: [str] Query term(s) for full text search. The value for this parameter can be a simple word or a phrase. Wildcards can be added to the simple word parameters only, e.g. ``q=*puma*`` :param type: [str] Type of dataset, options in...
entailment
def wkt_rewind(x, digits = None): ''' reverse WKT winding order :param x: [str] WKT string :param digits: [int] number of digits after decimal to use for the return string. by default, we use the mean number of digits in your string. :return: a string Usage:: from py...
reverse WKT winding order :param x: [str] WKT string :param digits: [int] number of digits after decimal to use for the return string. by default, we use the mean number of digits in your string. :return: a string Usage:: from pygbif import wkt_rewind x = 'POLYGON((1...
entailment
def occ_issues_lookup(issue=None, code=None): ''' Lookup occurrence issue definitions and short codes :param issue: Full name of issue, e.g, CONTINENT_COUNTRY_MISMATCH :param code: an issue short code, e.g. ccm Usage pygbif.occ_issues_lookup(issue = 'CONTINENT_COUNTRY_MISMATCH') pygbif.occ...
Lookup occurrence issue definitions and short codes :param issue: Full name of issue, e.g, CONTINENT_COUNTRY_MISMATCH :param code: an issue short code, e.g. ccm Usage pygbif.occ_issues_lookup(issue = 'CONTINENT_COUNTRY_MISMATCH') pygbif.occ_issues_lookup(issue = 'MULTIMEDIA_DATE_INVALID') pygb...
entailment
def search(taxonKey=None, repatriated=None, kingdomKey=None, phylumKey=None, classKey=None, orderKey=None, familyKey=None, genusKey=None, subgenusKey=None, scientificName=None, country=None, publishingCountry=None, hasCoordinate=None, typeStatus=None, recordNumber=None, lastInterpreted=None, continent=N...
Search GBIF occurrences :param taxonKey: [int] A GBIF occurrence identifier :param q: [str] Simple search parameter. The value for this parameter can be a simple word or a phrase. :param spellCheck: [bool] If ``True`` ask GBIF to check your spelling of the value passed to the ``search`` parameter. ...
entailment
def networks(data = 'all', uuid = None, q = None, identifier = None, identifierType = None, limit = 100, offset = None, **kwargs): ''' Networks metadata. Note: there's only 1 network now, so there's not a lot you can do with this method. :param data: [str] The type of data to get. Default: ``all`` :param ...
Networks metadata. Note: there's only 1 network now, so there's not a lot you can do with this method. :param data: [str] The type of data to get. Default: ``all`` :param uuid: [str] UUID of the data network provider. This must be specified if data is anything other than ``all``. :param q: [str] Query ne...
entailment
def map(source = 'density', z = 0, x = 0, y = 0, format = '@1x.png', srs='EPSG:4326', bin=None, hexPerTile=None, style='classic.point', taxonKey=None, country=None, publishingCountry=None, publisher=None, datasetKey=None, year=None, basisOfRecord=None, **kwargs): ''' GBIF maps API :param sou...
GBIF maps API :param source: [str] Either ``density`` for fast, precalculated tiles, or ``adhoc`` for any search :param z: [str] zoom level :param x: [str] longitude :param y: [str] latitude :param format: [str] format of returned data. One of: - ``.mvt`` - vector tile - ``@Hx....
entailment
def name_usage(key = None, name = None, data = 'all', language = None, datasetKey = None, uuid = None, sourceId = None, rank = None, shortname = None, limit = 100, offset = None, **kwargs): ''' Lookup details for specific names in all taxonomies in GBIF. :param key: [fixnum] A GBIF key for a taxon :param name: [...
Lookup details for specific names in all taxonomies in GBIF. :param key: [fixnum] A GBIF key for a taxon :param name: [str] Filters by a case insensitive, canonical namestring, e.g. 'Puma concolor' :param data: [str] The type of data to get. Default: ``all``. Options: ``all``, ``verbatim``, ``name``, ``parents...
entailment
def _check_environ(variable, value): """check if a variable is present in the environmental variables""" if is_not_none(value): return value else: value = os.environ.get(variable) if is_none(value): stop(''.join([variable, """ not supplied and no...
check if a variable is present in the environmental variables
entailment
def download(queries, user=None, pwd=None, email=None, pred_type='and'): """ Spin up a download request for GBIF occurrence data. :param queries: One or more of query arguments to kick of a download job. See Details. :type queries: str or list :param pred_type: (character) One ...
Spin up a download request for GBIF occurrence data. :param queries: One or more of query arguments to kick of a download job. See Details. :type queries: str or list :param pred_type: (character) One of ``equals`` (``=``), ``and`` (``&``), `or`` (``|``), ``lessThan`` (``<``), ``lessThanOrE...
entailment
def download_list(user=None, pwd=None, limit=20, offset=0): """ Lists the downloads created by a user. :param user: [str] A user name, look at env var ``GBIF_USER`` first :param pwd: [str] Your password, look at env var ``GBIF_PWD`` first :param limit: [int] Number of records to return. Default: ``...
Lists the downloads created by a user. :param user: [str] A user name, look at env var ``GBIF_USER`` first :param pwd: [str] Your password, look at env var ``GBIF_PWD`` first :param limit: [int] Number of records to return. Default: ``20`` :param offset: [int] Record number to start at. Default: ``0`` ...
entailment
def download_get(key, path=".", **kwargs): """ Get a download from GBIF. :param key: [str] A key generated from a request, like that from ``download`` :param path: [str] Path to write zip file to. Default: ``"."``, with a ``.zip`` appended to the end. :param **kwargs**: Further named arguments pass...
Get a download from GBIF. :param key: [str] A key generated from a request, like that from ``download`` :param path: [str] Path to write zip file to. Default: ``"."``, with a ``.zip`` appended to the end. :param **kwargs**: Further named arguments passed on to ``requests.get`` Downloads the zip file t...
entailment
def main_pred_type(self, value): """set main predicate combination type :param value: (character) One of ``equals`` (``=``), ``and`` (``&``), ``or`` (``|``), ``lessThan`` (``<``), ``lessThanOrEquals`` (``<=``), ``greaterThan`` (``>``), ``greaterThanOrEquals`` (``>=``), ``in``, ``within`...
set main predicate combination type :param value: (character) One of ``equals`` (``=``), ``and`` (``&``), ``or`` (``|``), ``lessThan`` (``<``), ``lessThanOrEquals`` (``<=``), ``greaterThan`` (``>``), ``greaterThanOrEquals`` (``>=``), ``in``, ``within``, ``not`` (``!``), ``like``
entailment
def add_predicate(self, key, value, predicate_type='equals'): """ add key, value, type combination of a predicate :param key: query KEY parameter :param value: the value used in the predicate :param predicate_type: the type of predicate (e.g. ``equals``) """ if p...
add key, value, type combination of a predicate :param key: query KEY parameter :param value: the value used in the predicate :param predicate_type: the type of predicate (e.g. ``equals``)
entailment
def _extract_values(values_list): """extract values from either file or list :param values_list: list or file name (str) with list of values """ values = [] # check if file or list of values to iterate if isinstance(values_list, str): with open(values_list) a...
extract values from either file or list :param values_list: list or file name (str) with list of values
entailment
def add_iterative_predicate(self, key, values_list): """add an iterative predicate with a key and set of values which it can be equal to in and or function. The individual predicates are specified with the type ``equals`` and combined with a type ``or``. The main reason for this...
add an iterative predicate with a key and set of values which it can be equal to in and or function. The individual predicates are specified with the type ``equals`` and combined with a type ``or``. The main reason for this addition is the inability of using ``in`` as predicate ...
entailment
def get(key, **kwargs): ''' Gets details for a single, interpreted occurrence :param key: [int] A GBIF occurrence key :return: A dictionary, of results Usage:: from pygbif import occurrences occurrences.get(key = 1258202889) occurrences.get(key = 1227768771) occur...
Gets details for a single, interpreted occurrence :param key: [int] A GBIF occurrence key :return: A dictionary, of results Usage:: from pygbif import occurrences occurrences.get(key = 1258202889) occurrences.get(key = 1227768771) occurrences.get(key = 1227769518)
entailment
def get_verbatim(key, **kwargs): ''' Gets a verbatim occurrence record without any interpretation :param key: [int] A GBIF occurrence key :return: A dictionary, of results Usage:: from pygbif import occurrences occurrences.get_verbatim(key = 1258202889) occurrences.get_ve...
Gets a verbatim occurrence record without any interpretation :param key: [int] A GBIF occurrence key :return: A dictionary, of results Usage:: from pygbif import occurrences occurrences.get_verbatim(key = 1258202889) occurrences.get_verbatim(key = 1227768771) occurrences....
entailment
def get_fragment(key, **kwargs): ''' Get a single occurrence fragment in its raw form (xml or json) :param key: [int] A GBIF occurrence key :return: A dictionary, of results Usage:: from pygbif import occurrences occurrences.get_fragment(key = 1052909293) occurrences.get_...
Get a single occurrence fragment in its raw form (xml or json) :param key: [int] A GBIF occurrence key :return: A dictionary, of results Usage:: from pygbif import occurrences occurrences.get_fragment(key = 1052909293) occurrences.get_fragment(key = 1227768771) occurrence...
entailment
def name_backbone(name, rank=None, kingdom=None, phylum=None, clazz=None, order=None, family=None, genus=None, strict=False, verbose=False, offset=None, limit=100, **kwargs): ''' Lookup names in the GBIF backbone taxonomy. :param name: [str] Full scientific name potentially with authorship (required) :para...
Lookup names in the GBIF backbone taxonomy. :param name: [str] Full scientific name potentially with authorship (required) :param rank: [str] The rank given as our rank enum. (optional) :param kingdom: [str] If provided default matching will also try to match against this if no direct match is found for the...
entailment
def name_parser(name, **kwargs): ''' Parse taxon names using the GBIF name parser :param name: [str] A character vector of scientific names. (required) reference: http://www.gbif.org/developer/species#parser Usage:: from pygbif import species species.name_parser('x Agropogon littoralis') ...
Parse taxon names using the GBIF name parser :param name: [str] A character vector of scientific names. (required) reference: http://www.gbif.org/developer/species#parser Usage:: from pygbif import species species.name_parser('x Agropogon littoralis') species.name_parser(['Arrhenatherum elat...
entailment
def name_lookup(q=None, rank=None, higherTaxonKey=None, status=None, isExtinct=None, habitat=None, nameType=None, datasetKey=None, nomenclaturalStatus=None, limit=100, offset=None, facet=False, facetMincount=None, facetMultiselect=None, type=None, hl=False, verbose=False, **kwargs): ''' Lookup names in all taxonom...
Lookup names in all taxonomies in GBIF. This service uses fuzzy lookup so that you can put in partial names and you should get back those things that match. See examples below. :param q: [str] Query term(s) for full text search (optional) :param rank: [str] ``CLASS``, ``CULTIVAR``, ``CULTIVAR_GROUP``, ``DOMAIN``,...
entailment
def count(taxonKey=None, basisOfRecord=None, country=None, isGeoreferenced=None, datasetKey=None, publishingCountry=None, typeStatus=None, issue=None, year=None, **kwargs): ''' Returns occurrence counts for a predefined set of dimensions :param taxonKey: [int] A GBIF occurrence identifier :para...
Returns occurrence counts for a predefined set of dimensions :param taxonKey: [int] A GBIF occurrence identifier :param basisOfRecord: [str] A GBIF occurrence identifier :param country: [str] A GBIF occurrence identifier :param isGeoreferenced: [bool] A GBIF occurrence identifier :param datasetKey:...
entailment
def count_year(year, **kwargs): ''' Lists occurrence counts by year :param year: [int] year range, e.g., ``1990,2000``. Does not support ranges like ``asterisk,2010`` :return: dict Usage:: from pygbif import occurrences occurrences.count_year(year = '1990,2000') ''' ...
Lists occurrence counts by year :param year: [int] year range, e.g., ``1990,2000``. Does not support ranges like ``asterisk,2010`` :return: dict Usage:: from pygbif import occurrences occurrences.count_year(year = '1990,2000')
entailment
def count_datasets(taxonKey = None, country = None, **kwargs): ''' Lists occurrence counts for datasets that cover a given taxon or country :param taxonKey: [int] Taxon key :param country: [str] A country, two letter code :return: dict Usage:: from pygbif import occurrences ...
Lists occurrence counts for datasets that cover a given taxon or country :param taxonKey: [int] Taxon key :param country: [str] A country, two letter code :return: dict Usage:: from pygbif import occurrences occurrences.count_datasets(country = "DE")
entailment
def count_countries(publishingCountry, **kwargs): ''' Lists occurrence counts for all countries covered by the data published by the given country :param publishingCountry: [str] A two letter country code :return: dict Usage:: from pygbif import occurrences occurrences.co...
Lists occurrence counts for all countries covered by the data published by the given country :param publishingCountry: [str] A two letter country code :return: dict Usage:: from pygbif import occurrences occurrences.count_countries(publishingCountry = "DE")
entailment
def count_publishingcountries(country, **kwargs): ''' Lists occurrence counts for all countries that publish data about the given country :param country: [str] A country, two letter code :return: dict Usage:: from pygbif import occurrences occurrences.count_publishingcoun...
Lists occurrence counts for all countries that publish data about the given country :param country: [str] A country, two letter code :return: dict Usage:: from pygbif import occurrences occurrences.count_publishingcountries(country = "DE")
entailment
def _detect_notebook() -> bool: """Detect if code is running in a Jupyter Notebook. This isn't 100% correct but seems good enough Returns ------- bool True if it detects this is a notebook, otherwise False. """ try: from IPython import get_ipython from ipykernel im...
Detect if code is running in a Jupyter Notebook. This isn't 100% correct but seems good enough Returns ------- bool True if it detects this is a notebook, otherwise False.
entailment
def _merge_layout(x: go.Layout, y: go.Layout) -> go.Layout: """Merge attributes from two layouts.""" xjson = x.to_plotly_json() yjson = y.to_plotly_json() if 'shapes' in yjson and 'shapes' in xjson: xjson['shapes'] += yjson['shapes'] yjson.update(xjson) return go.Layout(yjson)
Merge attributes from two layouts.
entailment
def _try_pydatetime(x): """Try to convert to pandas objects to datetimes. Plotly doesn't know how to handle them. """ try: # for datetimeindex x = [y.isoformat() for y in x.to_pydatetime()] except AttributeError: pass try: # for generic series x = [y.isof...
Try to convert to pandas objects to datetimes. Plotly doesn't know how to handle them.
entailment
def spark_shape(points, shapes, fill=None, color='blue', width=5, yindex=0, heights=None): """TODO: Docstring for spark. Parameters ---------- points : array-like shapes : array-like fill : array-like, optional Returns ------- Chart """ assert len(points) == len(shapes) + ...
TODO: Docstring for spark. Parameters ---------- points : array-like shapes : array-like fill : array-like, optional Returns ------- Chart
entailment
def vertical(x, ymin=0, ymax=1, color=None, width=None, dash=None, opacity=None): """Draws a vertical line from `ymin` to `ymax`. Parameters ---------- xmin : int, optional xmax : int, optional color : str, optional width : number, optional Returns ------- Chart """ li...
Draws a vertical line from `ymin` to `ymax`. Parameters ---------- xmin : int, optional xmax : int, optional color : str, optional width : number, optional Returns ------- Chart
entailment
def horizontal(y, xmin=0, xmax=1, color=None, width=None, dash=None, opacity=None): """Draws a horizontal line from `xmin` to `xmax`. Parameters ---------- xmin : int, optional xmax : int, optional color : str, optional width : number, optional Returns ------- Chart """ ...
Draws a horizontal line from `xmin` to `xmax`. Parameters ---------- xmin : int, optional xmax : int, optional color : str, optional width : number, optional Returns ------- Chart
entailment
def line( x=None, y=None, label=None, color=None, width=None, dash=None, opacity=None, mode='lines+markers', yaxis=1, fill=None, text="", markersize=6, ): """Draws connected dots. Parameters ---------- x : array-like, optional y : array-like, optional...
Draws connected dots. Parameters ---------- x : array-like, optional y : array-like, optional label : array-like, optional Returns ------- Chart
entailment
def line3d( x, y, z, label=None, color=None, width=None, dash=None, opacity=None, mode='lines+markers' ): """Create a 3d line chart.""" x = np.atleast_1d(x) y = np.atleast_1d(y) z = np.atleast_1d(z) assert x.shape == y.shape assert y.shape == z.shape lineattr = {} if color: l...
Create a 3d line chart.
entailment
def scatter( x=None, y=None, label=None, color=None, width=None, dash=None, opacity=None, markersize=6, yaxis=1, fill=None, text="", mode='markers', ): """Draws dots. Parameters ---------- x : array-like, optional y : array-like, optional label : ...
Draws dots. Parameters ---------- x : array-like, optional y : array-like, optional label : array-like, optional Returns ------- Chart
entailment
def bar(x=None, y=None, label=None, mode='group', yaxis=1, opacity=None): """Create a bar chart. Parameters ---------- x : array-like, optional y : TODO, optional label : TODO, optional mode : 'group' or 'stack', default 'group' opacity : TODO, optional Returns ------- Char...
Create a bar chart. Parameters ---------- x : array-like, optional y : TODO, optional label : TODO, optional mode : 'group' or 'stack', default 'group' opacity : TODO, optional Returns ------- Chart A Chart with bar graph data.
entailment
def heatmap(z, x=None, y=None, colorscale='Viridis'): """Create a heatmap. Parameters ---------- z : TODO x : TODO, optional y : TODO, optional colorscale : TODO, optional Returns ------- Chart """ z = np.atleast_1d(z) data = [go.Heatmap(z=z, x=x, y=y, colorscale=...
Create a heatmap. Parameters ---------- z : TODO x : TODO, optional y : TODO, optional colorscale : TODO, optional Returns ------- Chart
entailment
def fill_zero( x=None, y=None, label=None, color=None, width=None, dash=None, opacity=None, mode='lines+markers', **kargs ): """Fill to zero. Parameters ---------- x : array-like, optional y : TODO, optional label : TODO, optional Returns ------- ...
Fill to zero. Parameters ---------- x : array-like, optional y : TODO, optional label : TODO, optional Returns ------- Chart
entailment
def fill_between( x=None, ylow=None, yhigh=None, label=None, color=None, width=None, dash=None, opacity=None, mode='lines+markers', **kargs ): """Fill between `ylow` and `yhigh`. Parameters ---------- x : array-like, optional ylow : TODO, optional yhigh :...
Fill between `ylow` and `yhigh`. Parameters ---------- x : array-like, optional ylow : TODO, optional yhigh : TODO, optional Returns ------- Chart
entailment
def rug(x, label=None, opacity=None): """Rug chart. Parameters ---------- x : array-like, optional label : TODO, optional opacity : TODO, optional Returns ------- Chart """ x = _try_pydatetime(x) x = np.atleast_1d(x) data = [ go.Scatter( x=x, ...
Rug chart. Parameters ---------- x : array-like, optional label : TODO, optional opacity : TODO, optional Returns ------- Chart
entailment
def surface(x, y, z): """Surface plot. Parameters ---------- x : array-like, optional y : array-like, optional z : array-like, optional Returns ------- Chart """ data = [go.Surface(x=x, y=y, z=z)] return Chart(data=data)
Surface plot. Parameters ---------- x : array-like, optional y : array-like, optional z : array-like, optional Returns ------- Chart
entailment
def hist(x, mode='overlay', label=None, opacity=None, horz=False, histnorm=None): """Histogram. Parameters ---------- x : array-like mode : str, optional label : TODO, optional opacity : float, optional horz : bool, optional histnorm : None, "percent", "probability", "density", "pro...
Histogram. Parameters ---------- x : array-like mode : str, optional label : TODO, optional opacity : float, optional horz : bool, optional histnorm : None, "percent", "probability", "density", "probability density", optional Specifies the type of normalization used for this his...
entailment
def hist2d(x, y, label=None, opacity=None): """2D Histogram. Parameters ---------- x : array-like, optional y : array-like, optional label : TODO, optional opacity : float, optional Returns ------- Chart """ x = np.atleast_1d(x) y = np.atleast_1d(y) data = [go....
2D Histogram. Parameters ---------- x : array-like, optional y : array-like, optional label : TODO, optional opacity : float, optional Returns ------- Chart
entailment
def ytickangle(self, angle, index=1): """Set the angle of the y-axis tick labels. Parameters ---------- value : int Angle in degrees index : int, optional Y-axis index Returns ------- Chart """ self.layout['yaxis'...
Set the angle of the y-axis tick labels. Parameters ---------- value : int Angle in degrees index : int, optional Y-axis index Returns ------- Chart
entailment
def ylabelsize(self, size, index=1): """Set the size of the label. Parameters ---------- size : int Returns ------- Chart """ self.layout['yaxis' + str(index)]['titlefont']['size'] = size return self
Set the size of the label. Parameters ---------- size : int Returns ------- Chart
entailment
def yticksize(self, size, index=1): """Set the tick font size. Parameters ---------- size : int Returns ------- Chart """ self.layout['yaxis' + str(index)]['tickfont']['size'] = size return self
Set the tick font size. Parameters ---------- size : int Returns ------- Chart
entailment
def ytickvals(self, values, index=1): """Set the tick values. Parameters ---------- values : array-like Returns ------- Chart """ self.layout['yaxis' + str(index)]['tickvals'] = values return self
Set the tick values. Parameters ---------- values : array-like Returns ------- Chart
entailment
def yticktext(self, labels, index=1): """Set the tick labels. Parameters ---------- labels : array-like Returns ------- Chart """ self.layout['yaxis' + str(index)]['ticktext'] = labels return self
Set the tick labels. Parameters ---------- labels : array-like Returns ------- Chart
entailment
def ylim(self, low, high, index=1): """Set yaxis limits. Parameters ---------- low : number high : number index : int, optional Returns ------- Chart """ self.layout['yaxis' + str(index)]['range'] = [low, high] return sel...
Set yaxis limits. Parameters ---------- low : number high : number index : int, optional Returns ------- Chart
entailment
def ydtick(self, dtick, index=1): """Set the tick distance.""" self.layout['yaxis' + str(index)]['dtick'] = dtick return self
Set the tick distance.
entailment
def ynticks(self, nticks, index=1): """Set the number of ticks.""" self.layout['yaxis' + str(index)]['nticks'] = nticks return self
Set the number of ticks.
entailment
def show( self, filename: Optional[str] = None, show_link: bool = True, auto_open: bool = True, detect_notebook: bool = True, ) -> None: """Display the chart. Parameters ---------- filename : str, optional Save plot to this filenam...
Display the chart. Parameters ---------- filename : str, optional Save plot to this filename, otherwise it's saved to a temporary file. show_link : bool, optional Show link to plotly. auto_open : bool, optional Automatically open the plot (in ...
entailment
def save( self, filename: Optional[str] = None, show_link: bool = True, auto_open: bool = False, output: str = 'file', plotlyjs: bool = True, ) -> str: """Save the chart to an html file.""" if filename is None: filename = NamedTemporaryFile...
Save the chart to an html file.
entailment
def RegisterMethod(cls, *args, **kwargs): """ **RegisterMethod** RegisterMethod(f, library_path, alias=None, original_name=None, doc=None, wrapped=None, explanation="", method_type=utils.identity, explain=True) `classmethod` for registering functions as methods of this class. **Arguments** * **f** : the...
**RegisterMethod** RegisterMethod(f, library_path, alias=None, original_name=None, doc=None, wrapped=None, explanation="", method_type=utils.identity, explain=True) `classmethod` for registering functions as methods of this class. **Arguments** * **f** : the particular function being registered as a method * **...
entailment
def RegisterAt(cls, *args, **kwargs): """ **RegisterAt** RegisterAt(n, f, library_path, alias=None, original_name=None, doc=None, wrapped=None, explanation="", method_type=utils.identity, explain=True, _return_type=None) Most of the time you don't want to register an method as such, that is, you don't car...
**RegisterAt** RegisterAt(n, f, library_path, alias=None, original_name=None, doc=None, wrapped=None, explanation="", method_type=utils.identity, explain=True, _return_type=None) Most of the time you don't want to register an method as such, that is, you don't care about the `self` builder object, instead you wan...
entailment
def PatchAt(cls, n, module, method_wrapper=None, module_alias=None, method_name_modifier=utils.identity, blacklist_predicate=_False, whitelist_predicate=_True, return_type_predicate=_None, getmembers_predicate=inspect.isfunction, admit_private=False, explanation=""): """ This classmethod lets you easily patch a...
This classmethod lets you easily patch all of functions/callables from a module or class as methods a Builder class. **Arguments** * **n** : the position the the object being piped will take in the arguments when the function being patched is applied. See `RegisterMethod` and `ThenAt`. * **module** : a module or clas...
entailment
def get_method_sig(method): """ Given a function, it returns a string that pretty much looks how the function signature_ would be written in python. :param method: a python method :return: A string similar describing the pythong method signature_. eg: "my_method(first_argArg, second_arg=42, third_a...
Given a function, it returns a string that pretty much looks how the function signature_ would be written in python. :param method: a python method :return: A string similar describing the pythong method signature_. eg: "my_method(first_argArg, second_arg=42, third_arg='something')"
entailment
def Pipe(self, *sequence, **kwargs): """ `Pipe` runs any `phi.dsl.Expression`. Its highly inspired by Elixir's [|> (pipe)](https://hexdocs.pm/elixir/Kernel.html#%7C%3E/2) operator. **Arguments** * ***sequence**: any variable amount of expressions. All expressions inside of `sequence` will be composed together...
`Pipe` runs any `phi.dsl.Expression`. Its highly inspired by Elixir's [|> (pipe)](https://hexdocs.pm/elixir/Kernel.html#%7C%3E/2) operator. **Arguments** * ***sequence**: any variable amount of expressions. All expressions inside of `sequence` will be composed together using `phi.dsl.Expression.Seq`. * ****kwargs**: ...
entailment
def ThenAt(self, n, f, *_args, **kwargs): """ `ThenAt` enables you to create a partially apply many arguments to a function, the returned partial expects a single arguments which will be applied at the `n`th position of the original function. **Arguments** * **n**: position at which the created partial will a...
`ThenAt` enables you to create a partially apply many arguments to a function, the returned partial expects a single arguments which will be applied at the `n`th position of the original function. **Arguments** * **n**: position at which the created partial will apply its awaited argument on the original function. * ...
entailment
def Then0(self, f, *args, **kwargs): """ `Then0(f, ...)` is equivalent to `ThenAt(0, f, ...)`. Checkout `phi.builder.Builder.ThenAt` for more information. """ return self.ThenAt(0, f, *args, **kwargs)
`Then0(f, ...)` is equivalent to `ThenAt(0, f, ...)`. Checkout `phi.builder.Builder.ThenAt` for more information.
entailment
def Then(self, f, *args, **kwargs): """ `Then(f, ...)` is equivalent to `ThenAt(1, f, ...)`. Checkout `phi.builder.Builder.ThenAt` for more information. """ return self.ThenAt(1, f, *args, **kwargs)
`Then(f, ...)` is equivalent to `ThenAt(1, f, ...)`. Checkout `phi.builder.Builder.ThenAt` for more information.
entailment
def Then2(self, f, arg1, *args, **kwargs): """ `Then2(f, ...)` is equivalent to `ThenAt(2, f, ...)`. Checkout `phi.builder.Builder.ThenAt` for more information. """ args = (arg1,) + args return self.ThenAt(2, f, *args, **kwargs)
`Then2(f, ...)` is equivalent to `ThenAt(2, f, ...)`. Checkout `phi.builder.Builder.ThenAt` for more information.
entailment
def Then3(self, f, arg1, arg2, *args, **kwargs): """ `Then3(f, ...)` is equivalent to `ThenAt(3, f, ...)`. Checkout `phi.builder.Builder.ThenAt` for more information. """ args = (arg1, arg2) + args return self.ThenAt(3, f, *args, **kwargs)
`Then3(f, ...)` is equivalent to `ThenAt(3, f, ...)`. Checkout `phi.builder.Builder.ThenAt` for more information.
entailment
def Then4(self, f, arg1, arg2, arg3, *args, **kwargs): """ `Then4(f, ...)` is equivalent to `ThenAt(4, f, ...)`. Checkout `phi.builder.Builder.ThenAt` for more information. """ args = (arg1, arg2, arg3) + args return self.ThenAt(4, f, *args, **kwargs)
`Then4(f, ...)` is equivalent to `ThenAt(4, f, ...)`. Checkout `phi.builder.Builder.ThenAt` for more information.
entailment
def Then5(self, f, arg1, arg2, arg3, arg4, *args, **kwargs): """ `Then5(f, ...)` is equivalent to `ThenAt(5, f, ...)`. Checkout `phi.builder.Builder.ThenAt` for more information. """ args = (arg1, arg2, arg3, arg4) + args return self.ThenAt(5, f, *args, **kwargs)
`Then5(f, ...)` is equivalent to `ThenAt(5, f, ...)`. Checkout `phi.builder.Builder.ThenAt` for more information.
entailment
def List(self, *branches, **kwargs): """ While `Seq` is sequential, `phi.dsl.Expression.List` allows you to split the computation and get back a list with the result of each path. While the list literal should be the most incarnation of this expresion, it can actually be any iterable (implements `__iter__`) tha...
While `Seq` is sequential, `phi.dsl.Expression.List` allows you to split the computation and get back a list with the result of each path. While the list literal should be the most incarnation of this expresion, it can actually be any iterable (implements `__iter__`) that is not a tuple and yields a valid expresion. T...
entailment