repository_name
stringlengths
5
67
func_path_in_repository
stringlengths
4
234
func_name
stringlengths
0
314
whole_func_string
stringlengths
52
3.87M
language
stringclasses
6 values
func_code_string
stringlengths
52
3.87M
func_code_tokens
listlengths
15
672k
func_documentation_string
stringlengths
1
47.2k
func_documentation_tokens
listlengths
1
3.92k
split_name
stringclasses
1 value
func_code_url
stringlengths
85
339
annayqho/TheCannon
code/aaomega/aaomega_munge_data.py
make_full_ivar
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...
python
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...
[ "def", "make_full_ivar", "(", ")", ":", "# 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",...
take the scatters and skylines and make final ivars
[ "take", "the", "scatters", "and", "skylines", "and", "make", "final", "ivars" ]
train
https://github.com/annayqho/TheCannon/blob/8010a0a5dc9a3f9bb91efa79d7756f79b3c7ba9a/code/aaomega/aaomega_munge_data.py#L160-L183
annayqho/TheCannon
TheCannon/normalization.py
_sinusoid
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 ...
python
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 ...
[ "def", "_sinusoid", "(", "x", ",", "p", ",", "L", ",", "y", ")", ":", "N", "=", "int", "(", "len", "(", "p", ")", "/", "2", ")", "n", "=", "np", ".", "linspace", "(", "0", ",", "N", ",", "N", "+", "1", ")", "k", "=", "n", "*", "np", ...
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 ...
[ "Return", "the", "sinusoid", "cont", "func", "evaluated", "at", "input", "x", "for", "the", "continuum", "." ]
train
https://github.com/annayqho/TheCannon/blob/8010a0a5dc9a3f9bb91efa79d7756f79b3c7ba9a/TheCannon/normalization.py#L33-L58
annayqho/TheCannon
TheCannon/normalization.py
_weighted_median
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...
python
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...
[ "def", "_weighted_median", "(", "values", ",", "weights", ",", "quantile", ")", ":", "sindx", "=", "np", ".", "argsort", "(", "values", ")", "cvalues", "=", "1.", "*", "np", ".", "cumsum", "(", "weights", "[", "sindx", "]", ")", "if", "cvalues", "[",...
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...
[ "Calculate", "a", "weighted", "median", "for", "values", "above", "a", "particular", "quantile", "cut" ]
train
https://github.com/annayqho/TheCannon/blob/8010a0a5dc9a3f9bb91efa79d7756f79b3c7ba9a/TheCannon/normalization.py#L61-L88
annayqho/TheCannon
TheCannon/normalization.py
_find_cont_gaussian_smooth
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...
python
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...
[ "def", "_find_cont_gaussian_smooth", "(", "wl", ",", "fluxes", ",", "ivars", ",", "w", ")", ":", "print", "(", "\"Finding the continuum\"", ")", "bot", "=", "np", ".", "dot", "(", "ivars", ",", "w", ".", "T", ")", "top", "=", "np", ".", "dot", "(", ...
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 ------- ...
[ "Returns", "the", "weighted", "mean", "block", "of", "spectra" ]
train
https://github.com/annayqho/TheCannon/blob/8010a0a5dc9a3f9bb91efa79d7756f79b3c7ba9a/TheCannon/normalization.py#L91-L116
annayqho/TheCannon
TheCannon/normalization.py
_cont_norm_gaussian_smooth
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...
python
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...
[ "def", "_cont_norm_gaussian_smooth", "(", "dataset", ",", "L", ")", ":", "print", "(", "\"Gaussian smoothing the entire dataset...\"", ")", "w", "=", "gaussian_weight_matrix", "(", "dataset", ".", "wl", ",", "L", ")", "print", "(", "\"Gaussian smoothing the training s...
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
[ "Continuum", "normalize", "by", "dividing", "by", "a", "Gaussian", "-", "weighted", "smoothed", "spectrum" ]
train
https://github.com/annayqho/TheCannon/blob/8010a0a5dc9a3f9bb91efa79d7756f79b3c7ba9a/TheCannon/normalization.py#L119-L147
annayqho/TheCannon
TheCannon/normalization.py
_find_cont_fitfunc
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...
python
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...
[ "def", "_find_cont_fitfunc", "(", "fluxes", ",", "ivars", ",", "contmask", ",", "deg", ",", "ffunc", ",", "n_proc", "=", "1", ")", ":", "nstars", "=", "fluxes", ".", "shape", "[", "0", "]", "npixels", "=", "fluxes", ".", "shape", "[", "1", "]", "co...
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,...
[ "Fit", "a", "continuum", "to", "a", "continuum", "pixels", "in", "a", "segment", "of", "spectra" ]
train
https://github.com/annayqho/TheCannon/blob/8010a0a5dc9a3f9bb91efa79d7756f79b3c7ba9a/TheCannon/normalization.py#L150-L220
annayqho/TheCannon
TheCannon/normalization.py
_find_cont_fitfunc_regions
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...
python
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...
[ "def", "_find_cont_fitfunc_regions", "(", "fluxes", ",", "ivars", ",", "contmask", ",", "deg", ",", "ranges", ",", "ffunc", ",", "n_proc", "=", "1", ")", ":", "nstars", "=", "fluxes", ".", "shape", "[", "0", "]", "npixels", "=", "fluxes", ".", "shape",...
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...
[ "Run", "fit_cont", "dealing", "with", "spectrum", "in", "regions", "or", "chunks" ]
train
https://github.com/annayqho/TheCannon/blob/8010a0a5dc9a3f9bb91efa79d7756f79b3c7ba9a/TheCannon/normalization.py#L223-L271
annayqho/TheCannon
TheCannon/normalization.py
_find_cont_running_quantile
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) ...
python
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) ...
[ "def", "_find_cont_running_quantile", "(", "wl", ",", "fluxes", ",", "ivars", ",", "q", ",", "delta_lambda", ",", "verbose", "=", "False", ")", ":", "cont", "=", "np", ".", "zeros", "(", "fluxes", ".", "shape", ")", "nstars", "=", "fluxes", ".", "shape...
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:...
[ "Perform", "continuum", "normalization", "using", "a", "running", "quantile" ]
train
https://github.com/annayqho/TheCannon/blob/8010a0a5dc9a3f9bb91efa79d7756f79b3c7ba9a/TheCannon/normalization.py#L274-L310
annayqho/TheCannon
TheCannon/normalization.py
_cont_norm_running_quantile_mp
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 = ...
python
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 = ...
[ "def", "_cont_norm_running_quantile_mp", "(", "wl", ",", "fluxes", ",", "ivars", ",", "q", ",", "delta_lambda", ",", "n_proc", "=", "2", ",", "verbose", "=", "False", ")", ":", "nStar", "=", "fluxes", ".", "shape", "[", "0", "]", "# start mp.Pool", "mp_r...
The same as _cont_norm_running_quantile() above, but using multi-processing. Bo Zhang (NAOC)
[ "The", "same", "as", "_cont_norm_running_quantile", "()", "above", "but", "using", "multi", "-", "processing", "." ]
train
https://github.com/annayqho/TheCannon/blob/8010a0a5dc9a3f9bb91efa79d7756f79b3c7ba9a/TheCannon/normalization.py#L337-L371
annayqho/TheCannon
TheCannon/normalization.py
_cont_norm_running_quantile_regions
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...
python
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...
[ "def", "_cont_norm_running_quantile_regions", "(", "wl", ",", "fluxes", ",", "ivars", ",", "q", ",", "delta_lambda", ",", "ranges", ",", "verbose", "=", "True", ")", ":", "print", "(", "\"contnorm.py: continuum norm using running quantile\"", ")", "print", "(", "\...
Perform continuum normalization using running quantile, for spectrum that comes in chunks
[ "Perform", "continuum", "normalization", "using", "running", "quantile", "for", "spectrum", "that", "comes", "in", "chunks" ]
train
https://github.com/annayqho/TheCannon/blob/8010a0a5dc9a3f9bb91efa79d7756f79b3c7ba9a/TheCannon/normalization.py#L380-L398
annayqho/TheCannon
TheCannon/normalization.py
_cont_norm_running_quantile_regions_mp
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(), ...
python
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(), ...
[ "def", "_cont_norm_running_quantile_regions_mp", "(", "wl", ",", "fluxes", ",", "ivars", ",", "q", ",", "delta_lambda", ",", "ranges", ",", "n_proc", "=", "2", ",", "verbose", "=", "False", ")", ":", "print", "(", "\"contnorm.py: continuum norm using running quant...
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)
[ "Perform", "continuum", "normalization", "using", "running", "quantile", "for", "spectrum", "that", "comes", "in", "chunks", "." ]
train
https://github.com/annayqho/TheCannon/blob/8010a0a5dc9a3f9bb91efa79d7756f79b3c7ba9a/TheCannon/normalization.py#L401-L431
annayqho/TheCannon
TheCannon/normalization.py
_cont_norm
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...
python
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...
[ "def", "_cont_norm", "(", "fluxes", ",", "ivars", ",", "cont", ")", ":", "nstars", "=", "fluxes", ".", "shape", "[", "0", "]", "npixels", "=", "fluxes", ".", "shape", "[", "1", "]", "norm_fluxes", "=", "np", ".", "ones", "(", "fluxes", ".", "shape"...
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...
[ "Continuum", "-", "normalize", "a", "continuous", "segment", "of", "spectra", "." ]
train
https://github.com/annayqho/TheCannon/blob/8010a0a5dc9a3f9bb91efa79d7756f79b3c7ba9a/TheCannon/normalization.py#L434-L461
annayqho/TheCannon
TheCannon/normalization.py
_cont_norm_regions
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...
python
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...
[ "def", "_cont_norm_regions", "(", "fluxes", ",", "ivars", ",", "cont", ",", "ranges", ")", ":", "nstars", "=", "fluxes", ".", "shape", "[", "0", "]", "norm_fluxes", "=", "np", ".", "zeros", "(", "fluxes", ".", "shape", ")", "norm_ivars", "=", "np", "...
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...
[ "Perform", "continuum", "normalization", "for", "spectra", "in", "chunks" ]
train
https://github.com/annayqho/TheCannon/blob/8010a0a5dc9a3f9bb91efa79d7756f79b3c7ba9a/TheCannon/normalization.py#L464-L501
annayqho/TheCannon
TheCannon/model.py
CannonModel.train
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...
python
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...
[ "def", "train", "(", "self", ",", "ds", ")", ":", "if", "self", ".", "useErrors", ":", "self", ".", "coeffs", ",", "self", ".", "scatters", ",", "self", ".", "new_tr_labels", ",", "self", ".", "chisqs", ",", "self", ".", "pivots", ",", "self", ".",...
Run training step: solve for best-fit spectral model
[ "Run", "training", "step", ":", "solve", "for", "best", "-", "fit", "spectral", "model" ]
train
https://github.com/annayqho/TheCannon/blob/8010a0a5dc9a3f9bb91efa79d7756f79b3c7ba9a/TheCannon/model.py#L36-L41
annayqho/TheCannon
TheCannon/model.py
CannonModel.infer_spectra
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...
python
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...
[ "def", "infer_spectra", "(", "self", ",", "ds", ")", ":", "lvec_all", "=", "_get_lvec", "(", "ds", ".", "test_label_vals", ",", "self", ".", "pivots", ",", "self", ".", "scales", ",", "derivs", "=", "False", ")", "self", ".", "model_spectra", "=", "np"...
After inferring labels for the test spectra, infer the model spectra and update the dataset model_spectra attribute. Parameters ---------- ds: Dataset object
[ "After", "inferring", "labels", "for", "the", "test", "spectra", "infer", "the", "model", "spectra", "and", "update", "the", "dataset", "model_spectra", "attribute", ".", "Parameters", "----------", "ds", ":", "Dataset", "object" ]
train
https://github.com/annayqho/TheCannon/blob/8010a0a5dc9a3f9bb91efa79d7756f79b3c7ba9a/TheCannon/model.py#L66-L77
annayqho/TheCannon
TheCannon/model.py
CannonModel.plot_contpix
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...
python
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...
[ "def", "plot_contpix", "(", "self", ",", "x", ",", "y", ",", "contpix_x", ",", "contpix_y", ",", "figname", ")", ":", "fig", ",", "axarr", "=", "plt", ".", "subplots", "(", "2", ",", "sharex", "=", "True", ")", "plt", ".", "xlabel", "(", "r\"Wavele...
Plot baseline spec with continuum pix overlaid Parameters ----------
[ "Plot", "baseline", "spec", "with", "continuum", "pix", "overlaid" ]
train
https://github.com/annayqho/TheCannon/blob/8010a0a5dc9a3f9bb91efa79d7756f79b3c7ba9a/TheCannon/model.py#L80-L111
annayqho/TheCannon
TheCannon/model.py
CannonModel.diagnostics_contpix
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...
python
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...
[ "def", "diagnostics_contpix", "(", "self", ",", "data", ",", "nchunks", "=", "10", ",", "fig", "=", "\"baseline_spec_with_cont_pix\"", ")", ":", "if", "data", ".", "contmask", "is", "None", ":", "print", "(", "\"No contmask set\"", ")", "else", ":", "coeffs_...
Call plot_contpix once for each nth of the spectrum
[ "Call", "plot_contpix", "once", "for", "each", "nth", "of", "the", "spectrum" ]
train
https://github.com/annayqho/TheCannon/blob/8010a0a5dc9a3f9bb91efa79d7756f79b3c7ba9a/TheCannon/model.py#L114-L138
annayqho/TheCannon
TheCannon/model.py
CannonModel.diagnostics_plot_chisq
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() ...
python
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() ...
[ "def", "diagnostics_plot_chisq", "(", "self", ",", "ds", ",", "figname", "=", "\"modelfit_chisqs.png\"", ")", ":", "label_names", "=", "ds", ".", "get_plotting_labels", "(", ")", "lams", "=", "ds", ".", "wl", "pivots", "=", "self", ".", "pivots", "npixels", ...
Produce a set of diagnostic plots for the model Parameters ---------- (optional) chisq_dist_plot_name: str Filename of output saved plot
[ "Produce", "a", "set", "of", "diagnostic", "plots", "for", "the", "model" ]
train
https://github.com/annayqho/TheCannon/blob/8010a0a5dc9a3f9bb91efa79d7756f79b3c7ba9a/TheCannon/model.py#L213-L242
annayqho/TheCannon
code/lamost/mass_age/cn/calc_astroseismic_mass.py
calc_mass
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
python
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
[ "def", "calc_mass", "(", "nu_max", ",", "delta_nu", ",", "teff", ")", ":", "NU_MAX", "=", "3140.0", "# microHz", "DELTA_NU", "=", "135.03", "# microHz", "TEFF", "=", "5777.0", "return", "(", "nu_max", "/", "NU_MAX", ")", "**", "3", "*", "(", "delta_nu", ...
asteroseismic scaling relations
[ "asteroseismic", "scaling", "relations" ]
train
https://github.com/annayqho/TheCannon/blob/8010a0a5dc9a3f9bb91efa79d7756f79b3c7ba9a/code/lamost/mass_age/cn/calc_astroseismic_mass.py#L3-L8
annayqho/TheCannon
code/lamost/mass_age/mass_age_functions.py
calc_mass_2
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...
python
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...
[ "def", "calc_mass_2", "(", "mh", ",", "cm", ",", "nm", ",", "teff", ",", "logg", ")", ":", "CplusN", "=", "calc_sum", "(", "mh", ",", "cm", ",", "nm", ")", "t", "=", "teff", "/", "4000.", "return", "(", "95.8689", "-", "10.4042", "*", "mh", "-"...
Table A2 in Martig 2016
[ "Table", "A2", "in", "Martig", "2016" ]
train
https://github.com/annayqho/TheCannon/blob/8010a0a5dc9a3f9bb91efa79d7756f79b3c7ba9a/code/lamost/mass_age/mass_age_functions.py#L39-L48
annayqho/TheCannon
TheCannon/helpers/corner/corner.py
corner
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=...
python
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=...
[ "def", "corner", "(", "xs", ",", "bins", "=", "20", ",", "range", "=", "None", ",", "weights", "=", "None", ",", "color", "=", "\"k\"", ",", "smooth", "=", "None", ",", "smooth1d", "=", "None", ",", "labels", "=", "None", ",", "label_kwargs", "=", ...
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...
[ "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...
train
https://github.com/annayqho/TheCannon/blob/8010a0a5dc9a3f9bb91efa79d7756f79b3c7ba9a/TheCannon/helpers/corner/corner.py#L43-L392
annayqho/TheCannon
TheCannon/helpers/corner/corner.py
quantile
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]) ...
python
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]) ...
[ "def", "quantile", "(", "x", ",", "q", ",", "weights", "=", "None", ")", ":", "if", "weights", "is", "None", ":", "return", "np", ".", "percentile", "(", "x", ",", "[", "100.", "*", "qi", "for", "qi", "in", "q", "]", ")", "else", ":", "idx", ...
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
[ "Like", "numpy", ".", "percentile", "but", ":" ]
train
https://github.com/annayqho/TheCannon/blob/8010a0a5dc9a3f9bb91efa79d7756f79b3c7ba9a/TheCannon/helpers/corner/corner.py#L395-L411
annayqho/TheCannon
TheCannon/helpers/corner/corner.py
hist2d
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):...
python
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):...
[ "def", "hist2d", "(", "x", ",", "y", ",", "bins", "=", "20", ",", "range", "=", "None", ",", "weights", "=", "None", ",", "levels", "=", "None", ",", "smooth", "=", "None", ",", "ax", "=", "None", ",", "color", "=", "None", ",", "plot_datapoints"...
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) ...
[ "Plot", "a", "2", "-", "D", "histogram", "of", "samples", "." ]
train
https://github.com/annayqho/TheCannon/blob/8010a0a5dc9a3f9bb91efa79d7756f79b3c7ba9a/TheCannon/helpers/corner/corner.py#L414-L592
annayqho/TheCannon
code/lamost/xcalib_5labels/paper_plots/distance_cut.py
calc_dist
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])
python
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])
[ "def", "calc_dist", "(", "lamost_point", ",", "training_points", ",", "coeffs", ")", ":", "diff2", "=", "(", "training_points", "-", "lamost_point", ")", "**", "2", "dist", "=", "np", ".", "sqrt", "(", "np", ".", "sum", "(", "diff2", "*", "coeffs", ","...
avg dist from one lamost point to nearest 10 training points
[ "avg", "dist", "from", "one", "lamost", "point", "to", "nearest", "10", "training", "points" ]
train
https://github.com/annayqho/TheCannon/blob/8010a0a5dc9a3f9bb91efa79d7756f79b3c7ba9a/code/lamost/xcalib_5labels/paper_plots/distance_cut.py#L12-L16
datosgobar/textar
textar/text_classifier.py
TextClassifier.make_classifier
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...
python
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...
[ "def", "make_classifier", "(", "self", ",", "name", ",", "ids", ",", "labels", ")", ":", "if", "not", "all", "(", "np", ".", "in1d", "(", "ids", ",", "self", ".", "ids", ")", ")", ":", "raise", "ValueError", "(", "\"Hay ids de textos que no se encuentran...
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. ...
[ "Entrenar", "un", "clasificador", "SVM", "sobre", "los", "textos", "cargados", "." ]
train
https://github.com/datosgobar/textar/blob/44fb5b537561facae0cdfe4fe1d108dfa26cfc6b/textar/text_classifier.py#L63-L83
datosgobar/textar
textar/text_classifier.py
TextClassifier.retrain
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...
python
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...
[ "def", "retrain", "(", "self", ",", "name", ",", "ids", ",", "labels", ")", ":", "if", "not", "all", "(", "np", ".", "in1d", "(", "ids", ",", "self", ".", "ids", ")", ")", ":", "raise", "ValueError", "(", "\"Hay ids de textos que no se encuentran \\\n ...
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 ...
[ "Reentrenar", "parcialmente", "un", "clasificador", "SVM", "." ]
train
https://github.com/datosgobar/textar/blob/44fb5b537561facae0cdfe4fe1d108dfa26cfc6b/textar/text_classifier.py#L85-L107
datosgobar/textar
textar/text_classifier.py
TextClassifier.classify
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...
python
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...
[ "def", "classify", "(", "self", ",", "classifier_name", ",", "examples", ",", "max_labels", "=", "None", ",", "goodness_of_fit", "=", "False", ")", ":", "classifier", "=", "getattr", "(", "self", ",", "classifier_name", ")", "texts_vectors", "=", "self", "."...
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...
[ "Usar", "un", "clasificador", "SVM", "para", "etiquetar", "textos", "nuevos", "." ]
train
https://github.com/datosgobar/textar/blob/44fb5b537561facae0cdfe4fe1d108dfa26cfc6b/textar/text_classifier.py#L109-L135
datosgobar/textar
textar/text_classifier.py
TextClassifier._make_text_vectors
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...
python
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...
[ "def", "_make_text_vectors", "(", "self", ",", "examples", ")", ":", "if", "isinstance", "(", "examples", ",", "str", ")", ":", "if", "examples", "in", "self", ".", "ids", ":", "textvec", "=", "self", ".", "tfidf_mat", "[", "self", ".", "ids", "==", ...
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...
[ "Funcion", "para", "generar", "los", "vectores", "tf", "-", "idf", "de", "una", "lista", "de", "textos", "." ]
train
https://github.com/datosgobar/textar/blob/44fb5b537561facae0cdfe4fe1d108dfa26cfc6b/textar/text_classifier.py#L137-L167
datosgobar/textar
textar/text_classifier.py
TextClassifier.get_similar
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...
python
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...
[ "def", "get_similar", "(", "self", ",", "example", ",", "max_similars", "=", "3", ",", "similarity_cutoff", "=", "None", ",", "term_diff_max_rank", "=", "10", ",", "filter_list", "=", "None", ",", "term_diff_cutoff", "=", "None", ")", ":", "if", "term_diff_c...
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...
[ "Devuelve", "textos", "similares", "al", "ejemplo", "dentro", "de", "los", "textos", "entrenados", "." ]
train
https://github.com/datosgobar/textar/blob/44fb5b537561facae0cdfe4fe1d108dfa26cfc6b/textar/text_classifier.py#L169-L274
datosgobar/textar
textar/text_classifier.py
TextClassifier.reload_texts
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...
python
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...
[ "def", "reload_texts", "(", "self", ",", "texts", ",", "ids", ",", "vocabulary", "=", "None", ")", ":", "self", ".", "_check_id_length", "(", "ids", ")", "self", ".", "ids", "=", "np", ".", "array", "(", "sorted", "(", "ids", ")", ")", "if", "vocab...
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....
[ "Calcula", "los", "vectores", "de", "terminos", "de", "textos", "y", "los", "almacena", "." ]
train
https://github.com/datosgobar/textar/blob/44fb5b537561facae0cdfe4fe1d108dfa26cfc6b/textar/text_classifier.py#L276-L294
sckott/pygbif
pygbif/species/name_suggest.py
name_suggest
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...
python
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...
[ "def", "name_suggest", "(", "q", "=", "None", ",", "datasetKey", "=", "None", ",", "rank", "=", "None", ",", "limit", "=", "100", ",", "offset", "=", "None", ",", "*", "*", "kwargs", ")", ":", "url", "=", "gbif_baseurl", "+", "'species/suggest'", "ar...
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...
[ "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", "." ]
train
https://github.com/sckott/pygbif/blob/bf54f2920bc46d97d7e2e1b0c8059e5878f3c5ab/pygbif/species/name_suggest.py#L3-L39
sckott/pygbif
pygbif/registry/datasets.py
dataset_metrics
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') ...
python
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') ...
[ "def", "dataset_metrics", "(", "uuid", ",", "*", "*", "kwargs", ")", ":", "def", "getdata", "(", "x", ",", "*", "*", "kwargs", ")", ":", "url", "=", "gbif_baseurl", "+", "'dataset/'", "+", "x", "+", "'/metrics'", "return", "gbif_GET", "(", "url", ","...
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...
[ "Get", "details", "on", "a", "GBIF", "dataset", "." ]
train
https://github.com/sckott/pygbif/blob/bf54f2920bc46d97d7e2e1b0c8059e5878f3c5ab/pygbif/registry/datasets.py#L4-L26
sckott/pygbif
pygbif/registry/datasets.py
datasets
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...
python
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...
[ "def", "datasets", "(", "data", "=", "'all'", ",", "type", "=", "None", ",", "uuid", "=", "None", ",", "query", "=", "None", ",", "id", "=", "None", ",", "limit", "=", "100", ",", "offset", "=", "None", ",", "*", "*", "kwargs", ")", ":", "args"...
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...
[ "Search", "for", "datasets", "and", "dataset", "metadata", "." ]
train
https://github.com/sckott/pygbif/blob/bf54f2920bc46d97d7e2e1b0c8059e5878f3c5ab/pygbif/registry/datasets.py#L28-L63
sckott/pygbif
pygbif/registry/datasets.py
dataset_suggest
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...
python
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...
[ "def", "dataset_suggest", "(", "q", "=", "None", ",", "type", "=", "None", ",", "keyword", "=", "None", ",", "owningOrg", "=", "None", ",", "publishingOrg", "=", "None", ",", "hostingOrg", "=", "None", ",", "publishingCountry", "=", "None", ",", "decade"...
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...
[ "Search", "that", "returns", "up", "to", "20", "matching", "datasets", ".", "Results", "are", "ordered", "by", "relevance", "." ]
train
https://github.com/sckott/pygbif/blob/bf54f2920bc46d97d7e2e1b0c8059e5878f3c5ab/pygbif/registry/datasets.py#L88-L143
sckott/pygbif
pygbif/registry/datasets.py
dataset_search
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...
python
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...
[ "def", "dataset_search", "(", "q", "=", "None", ",", "type", "=", "None", ",", "keyword", "=", "None", ",", "owningOrg", "=", "None", ",", "publishingOrg", "=", "None", ",", "hostingOrg", "=", "None", ",", "decade", "=", "None", ",", "publishingCountry",...
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...
[ "Full", "text", "search", "across", "all", "datasets", ".", "Results", "are", "ordered", "by", "relevance", "." ]
train
https://github.com/sckott/pygbif/blob/bf54f2920bc46d97d7e2e1b0c8059e5878f3c5ab/pygbif/registry/datasets.py#L145-L257
sckott/pygbif
pygbif/utils/wkt_rewind.py
wkt_rewind
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...
python
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...
[ "def", "wkt_rewind", "(", "x", ",", "digits", "=", "None", ")", ":", "z", "=", "wkt", ".", "loads", "(", "x", ")", "if", "digits", "is", "None", ":", "coords", "=", "z", "[", "'coordinates'", "]", "nums", "=", "__flatten", "(", "coords", ")", "de...
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...
[ "reverse", "WKT", "winding", "order" ]
train
https://github.com/sckott/pygbif/blob/bf54f2920bc46d97d7e2e1b0c8059e5878f3c5ab/pygbif/utils/wkt_rewind.py#L6-L36
sckott/pygbif
pygbif/gbifissues.py
occ_issues_lookup
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...
python
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...
[ "def", "occ_issues_lookup", "(", "issue", "=", "None", ",", "code", "=", "None", ")", ":", "if", "code", "is", "None", ":", "bb", "=", "[", "trymatch", "(", "issue", ",", "x", ")", "for", "x", "in", "gbifissues", "[", "'issue'", "]", "]", "tmp", ...
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...
[ "Lookup", "occurrence", "issue", "definitions", "and", "short", "codes" ]
train
https://github.com/sckott/pygbif/blob/bf54f2920bc46d97d7e2e1b0c8059e5878f3c5ab/pygbif/gbifissues.py#L3-L22
sckott/pygbif
pygbif/occurrences/search.py
search
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...
python
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...
[ "def", "search", "(", "taxonKey", "=", "None", ",", "repatriated", "=", "None", ",", "kingdomKey", "=", "None", ",", "phylumKey", "=", "None", ",", "classKey", "=", "None", ",", "orderKey", "=", "None", ",", "familyKey", "=", "None", ",", "genusKey", "...
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. ...
[ "Search", "GBIF", "occurrences" ]
train
https://github.com/sckott/pygbif/blob/bf54f2920bc46d97d7e2e1b0c8059e5878f3c5ab/pygbif/occurrences/search.py#L4-L334
sckott/pygbif
pygbif/registry/networks.py
networks
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 ...
python
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 ...
[ "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 uuid: [str] UUID of the data network provider. This must be specified if data is anything other than ``all``. :param q: [str] Query ne...
[ "Networks", "metadata", "." ]
train
https://github.com/sckott/pygbif/blob/bf54f2920bc46d97d7e2e1b0c8059e5878f3c5ab/pygbif/registry/networks.py#L3-L56
sckott/pygbif
pygbif/maps/map.py
map
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...
python
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...
[ "def", "map", "(", "source", "=", "'density'", ",", "z", "=", "0", ",", "x", "=", "0", ",", "y", "=", "0", ",", "format", "=", "'@1x.png'", ",", "srs", "=", "'EPSG:4326'", ",", "bin", "=", "None", ",", "hexPerTile", "=", "None", ",", "style", "...
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....
[ "GBIF", "maps", "API" ]
train
https://github.com/sckott/pygbif/blob/bf54f2920bc46d97d7e2e1b0c8059e5878f3c5ab/pygbif/maps/map.py#L8-L145
sckott/pygbif
pygbif/species/name_usage.py
name_usage
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: [...
python
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: [...
[ "def", "name_usage", "(", "key", "=", "None", ",", "name", "=", "None", ",", "data", "=", "'all'", ",", "language", "=", "None", ",", "datasetKey", "=", "None", ",", "uuid", "=", "None", ",", "sourceId", "=", "None", ",", "rank", "=", "None", ",", ...
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...
[ "Lookup", "details", "for", "specific", "names", "in", "all", "taxonomies", "in", "GBIF", "." ]
train
https://github.com/sckott/pygbif/blob/bf54f2920bc46d97d7e2e1b0c8059e5878f3c5ab/pygbif/species/name_usage.py#L3-L76
sckott/pygbif
pygbif/occurrences/download.py
_check_environ
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...
python
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...
[ "def", "_check_environ", "(", "variable", ",", "value", ")", ":", "if", "is_not_none", "(", "value", ")", ":", "return", "value", "else", ":", "value", "=", "os", ".", "environ", ".", "get", "(", "variable", ")", "if", "is_none", "(", "value", ")", "...
check if a variable is present in the environmental variables
[ "check", "if", "a", "variable", "is", "present", "in", "the", "environmental", "variables" ]
train
https://github.com/sckott/pygbif/blob/bf54f2920bc46d97d7e2e1b0c8059e5878f3c5ab/pygbif/occurrences/download.py#L18-L29
sckott/pygbif
pygbif/occurrences/download.py
download
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 ...
python
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 ...
[ "def", "download", "(", "queries", ",", "user", "=", "None", ",", "pwd", "=", "None", ",", "email", "=", "None", ",", "pred_type", "=", "'and'", ")", ":", "user", "=", "_check_environ", "(", "'GBIF_USER'", ",", "user", ")", "pwd", "=", "_check_environ"...
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...
[ "Spin", "up", "a", "download", "request", "for", "GBIF", "occurrence", "data", "." ]
train
https://github.com/sckott/pygbif/blob/bf54f2920bc46d97d7e2e1b0c8059e5878f3c5ab/pygbif/occurrences/download.py#L32-L143
sckott/pygbif
pygbif/occurrences/download.py
download_list
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: ``...
python
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: ``...
[ "def", "download_list", "(", "user", "=", "None", ",", "pwd", "=", "None", ",", "limit", "=", "20", ",", "offset", "=", "0", ")", ":", "user", "=", "_check_environ", "(", "'GBIF_USER'", ",", "user", ")", "pwd", "=", "_check_environ", "(", "'GBIF_PWD'",...
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`` ...
[ "Lists", "the", "downloads", "created", "by", "a", "user", "." ]
train
https://github.com/sckott/pygbif/blob/bf54f2920bc46d97d7e2e1b0c8059e5878f3c5ab/pygbif/occurrences/download.py#L331-L358
sckott/pygbif
pygbif/occurrences/download.py
download_get
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...
python
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...
[ "def", "download_get", "(", "key", ",", "path", "=", "\".\"", ",", "*", "*", "kwargs", ")", ":", "meta", "=", "pygbif", ".", "occurrences", ".", "download_meta", "(", "key", ")", "if", "meta", "[", "'status'", "]", "!=", "'SUCCEEDED'", ":", "raise", ...
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...
[ "Get", "a", "download", "from", "GBIF", "." ]
train
https://github.com/sckott/pygbif/blob/bf54f2920bc46d97d7e2e1b0c8059e5878f3c5ab/pygbif/occurrences/download.py#L361-L391
sckott/pygbif
pygbif/occurrences/download.py
GbifDownload.main_pred_type
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`...
python
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`...
[ "def", "main_pred_type", "(", "self", ",", "value", ")", ":", "if", "value", "not", "in", "operators", ":", "value", "=", "operator_lkup", ".", "get", "(", "value", ")", "if", "value", ":", "self", ".", "_main_pred_type", "=", "value", "self", ".", "pa...
set main predicate combination type :param value: (character) One of ``equals`` (``=``), ``and`` (``&``), ``or`` (``|``), ``lessThan`` (``<``), ``lessThanOrEquals`` (``<=``), ``greaterThan`` (``>``), ``greaterThanOrEquals`` (``>=``), ``in``, ``within``, ``not`` (``!``), ``like``
[ "set", "main", "predicate", "combination", "type" ]
train
https://github.com/sckott/pygbif/blob/bf54f2920bc46d97d7e2e1b0c8059e5878f3c5ab/pygbif/occurrences/download.py#L193-L206
sckott/pygbif
pygbif/occurrences/download.py
GbifDownload.add_predicate
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...
python
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...
[ "def", "add_predicate", "(", "self", ",", "key", ",", "value", ",", "predicate_type", "=", "'equals'", ")", ":", "if", "predicate_type", "not", "in", "operators", ":", "predicate_type", "=", "operator_lkup", ".", "get", "(", "predicate_type", ")", "if", "pre...
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``)
[ "add", "key", "value", "type", "combination", "of", "a", "predicate" ]
train
https://github.com/sckott/pygbif/blob/bf54f2920bc46d97d7e2e1b0c8059e5878f3c5ab/pygbif/occurrences/download.py#L208-L224
sckott/pygbif
pygbif/occurrences/download.py
GbifDownload._extract_values
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...
python
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...
[ "def", "_extract_values", "(", "values_list", ")", ":", "values", "=", "[", "]", "# check if file or list of values to iterate", "if", "isinstance", "(", "values_list", ",", "str", ")", ":", "with", "open", "(", "values_list", ")", "as", "ff", ":", "reading", ...
extract values from either file or list :param values_list: list or file name (str) with list of values
[ "extract", "values", "from", "either", "file", "or", "list" ]
train
https://github.com/sckott/pygbif/blob/bf54f2920bc46d97d7e2e1b0c8059e5878f3c5ab/pygbif/occurrences/download.py#L227-L243
sckott/pygbif
pygbif/occurrences/download.py
GbifDownload.add_iterative_predicate
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...
python
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...
[ "def", "add_iterative_predicate", "(", "self", ",", "key", ",", "values_list", ")", ":", "values", "=", "self", ".", "_extract_values", "(", "values_list", ")", "predicate", "=", "{", "'type'", ":", "'equals'", ",", "'key'", ":", "key", ",", "'value'", ":"...
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 ...
[ "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", ...
train
https://github.com/sckott/pygbif/blob/bf54f2920bc46d97d7e2e1b0c8059e5878f3c5ab/pygbif/occurrences/download.py#L245-L267
sckott/pygbif
pygbif/occurrences/get.py
get
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...
python
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...
[ "def", "get", "(", "key", ",", "*", "*", "kwargs", ")", ":", "url", "=", "gbif_baseurl", "+", "'occurrence/'", "+", "str", "(", "key", ")", "out", "=", "gbif_GET", "(", "url", ",", "{", "}", ",", "*", "*", "kwargs", ")", "return", "out" ]
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)
[ "Gets", "details", "for", "a", "single", "interpreted", "occurrence" ]
train
https://github.com/sckott/pygbif/blob/bf54f2920bc46d97d7e2e1b0c8059e5878f3c5ab/pygbif/occurrences/get.py#L3-L20
sckott/pygbif
pygbif/occurrences/get.py
get_verbatim
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...
python
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...
[ "def", "get_verbatim", "(", "key", ",", "*", "*", "kwargs", ")", ":", "url", "=", "gbif_baseurl", "+", "'occurrence/'", "+", "str", "(", "key", ")", "+", "'/verbatim'", "out", "=", "gbif_GET", "(", "url", ",", "{", "}", ",", "*", "*", "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_verbatim(key = 1227768771) occurrences....
[ "Gets", "a", "verbatim", "occurrence", "record", "without", "any", "interpretation" ]
train
https://github.com/sckott/pygbif/blob/bf54f2920bc46d97d7e2e1b0c8059e5878f3c5ab/pygbif/occurrences/get.py#L22-L39
sckott/pygbif
pygbif/occurrences/get.py
get_fragment
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_...
python
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_...
[ "def", "get_fragment", "(", "key", ",", "*", "*", "kwargs", ")", ":", "url", "=", "gbif_baseurl", "+", "'occurrence/'", "+", "str", "(", "key", ")", "+", "'/fragment'", "out", "=", "gbif_GET", "(", "url", ",", "{", "}", ",", "*", "*", "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_fragment(key = 1227768771) occurrence...
[ "Get", "a", "single", "occurrence", "fragment", "in", "its", "raw", "form", "(", "xml", "or", "json", ")" ]
train
https://github.com/sckott/pygbif/blob/bf54f2920bc46d97d7e2e1b0c8059e5878f3c5ab/pygbif/occurrences/get.py#L41-L58
sckott/pygbif
pygbif/species/name_backbone.py
name_backbone
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...
python
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...
[ "def", "name_backbone", "(", "name", ",", "rank", "=", "None", ",", "kingdom", "=", "None", ",", "phylum", "=", "None", ",", "clazz", "=", "None", ",", "order", "=", "None", ",", "family", "=", "None", ",", "genus", "=", "None", ",", "strict", "=",...
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...
[ "Lookup", "names", "in", "the", "GBIF", "backbone", "taxonomy", "." ]
train
https://github.com/sckott/pygbif/blob/bf54f2920bc46d97d7e2e1b0c8059e5878f3c5ab/pygbif/species/name_backbone.py#L3-L63
sckott/pygbif
pygbif/species/name_parser.py
name_parser
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') ...
python
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') ...
[ "def", "name_parser", "(", "name", ",", "*", "*", "kwargs", ")", ":", "url", "=", "gbif_baseurl", "+", "'parser/name'", "if", "name", ".", "__class__", "==", "str", ":", "name", "=", "[", "name", "]", "return", "gbif_POST", "(", "url", ",", "name", "...
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...
[ "Parse", "taxon", "names", "using", "the", "GBIF", "name", "parser" ]
train
https://github.com/sckott/pygbif/blob/bf54f2920bc46d97d7e2e1b0c8059e5878f3c5ab/pygbif/species/name_parser.py#L3-L22
sckott/pygbif
pygbif/species/name_lookup.py
name_lookup
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...
python
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...
[ "def", "name_lookup", "(", "q", "=", "None", ",", "rank", "=", "None", ",", "higherTaxonKey", "=", "None", ",", "status", "=", "None", ",", "isExtinct", "=", "None", ",", "habitat", "=", "None", ",", "nameType", "=", "None", ",", "datasetKey", "=", "...
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``,...
[ "Lookup", "names", "in", "all", "taxonomies", "in", "GBIF", "." ]
train
https://github.com/sckott/pygbif/blob/bf54f2920bc46d97d7e2e1b0c8059e5878f3c5ab/pygbif/species/name_lookup.py#L3-L141
sckott/pygbif
pygbif/occurrences/count.py
count
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...
python
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...
[ "def", "count", "(", "taxonKey", "=", "None", ",", "basisOfRecord", "=", "None", ",", "country", "=", "None", ",", "isGeoreferenced", "=", "None", ",", "datasetKey", "=", "None", ",", "publishingCountry", "=", "None", ",", "typeStatus", "=", "None", ",", ...
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:...
[ "Returns", "occurrence", "counts", "for", "a", "predefined", "set", "of", "dimensions" ]
train
https://github.com/sckott/pygbif/blob/bf54f2920bc46d97d7e2e1b0c8059e5878f3c5ab/pygbif/occurrences/count.py#L3-L34
sckott/pygbif
pygbif/occurrences/count.py
count_year
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') ''' ...
python
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') ''' ...
[ "def", "count_year", "(", "year", ",", "*", "*", "kwargs", ")", ":", "url", "=", "gbif_baseurl", "+", "'occurrence/counts/year'", "out", "=", "gbif_GET", "(", "url", ",", "{", "'year'", ":", "year", "}", ",", "*", "*", "kwargs", ")", "return", "out" ]
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" ]
train
https://github.com/sckott/pygbif/blob/bf54f2920bc46d97d7e2e1b0c8059e5878f3c5ab/pygbif/occurrences/count.py#L51-L66
sckott/pygbif
pygbif/occurrences/count.py
count_datasets
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 ...
python
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 ...
[ "def", "count_datasets", "(", "taxonKey", "=", "None", ",", "country", "=", "None", ",", "*", "*", "kwargs", ")", ":", "url", "=", "gbif_baseurl", "+", "'occurrence/counts/datasets'", "out", "=", "gbif_GET", "(", "url", ",", "{", "'taxonKey'", ":", "taxonK...
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")
[ "Lists", "occurrence", "counts", "for", "datasets", "that", "cover", "a", "given", "taxon", "or", "country" ]
train
https://github.com/sckott/pygbif/blob/bf54f2920bc46d97d7e2e1b0c8059e5878f3c5ab/pygbif/occurrences/count.py#L68-L84
sckott/pygbif
pygbif/occurrences/count.py
count_countries
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...
python
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...
[ "def", "count_countries", "(", "publishingCountry", ",", "*", "*", "kwargs", ")", ":", "url", "=", "gbif_baseurl", "+", "'occurrence/counts/countries'", "out", "=", "gbif_GET", "(", "url", ",", "{", "'publishingCountry'", ":", "publishingCountry", "}", ",", "*",...
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")
[ "Lists", "occurrence", "counts", "for", "all", "countries", "covered", "by", "the", "data", "published", "by", "the", "given", "country" ]
train
https://github.com/sckott/pygbif/blob/bf54f2920bc46d97d7e2e1b0c8059e5878f3c5ab/pygbif/occurrences/count.py#L86-L101
sckott/pygbif
pygbif/occurrences/count.py
count_publishingcountries
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...
python
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...
[ "def", "count_publishingcountries", "(", "country", ",", "*", "*", "kwargs", ")", ":", "url", "=", "gbif_baseurl", "+", "'occurrence/counts/publishingCountries'", "out", "=", "gbif_GET", "(", "url", ",", "{", "\"country\"", ":", "country", "}", ",", "*", "*", ...
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")
[ "Lists", "occurrence", "counts", "for", "all", "countries", "that", "publish", "data", "about", "the", "given", "country" ]
train
https://github.com/sckott/pygbif/blob/bf54f2920bc46d97d7e2e1b0c8059e5878f3c5ab/pygbif/occurrences/count.py#L103-L118
jwkvam/plotlywrapper
plotlywrapper.py
_detect_notebook
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...
python
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...
[ "def", "_detect_notebook", "(", ")", "->", "bool", ":", "try", ":", "from", "IPython", "import", "get_ipython", "from", "ipykernel", "import", "zmqshell", "except", "ImportError", ":", "return", "False", "kernel", "=", "get_ipython", "(", ")", "try", ":", "f...
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.
[ "Detect", "if", "code", "is", "running", "in", "a", "Jupyter", "Notebook", "." ]
train
https://github.com/jwkvam/plotlywrapper/blob/762b42912e824fecb1212c186900f2ebdd0ab12b/plotlywrapper.py#L31-L55
jwkvam/plotlywrapper
plotlywrapper.py
_merge_layout
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)
python
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)
[ "def", "_merge_layout", "(", "x", ":", "go", ".", "Layout", ",", "y", ":", "go", ".", "Layout", ")", "->", "go", ".", "Layout", ":", "xjson", "=", "x", ".", "to_plotly_json", "(", ")", "yjson", "=", "y", ".", "to_plotly_json", "(", ")", "if", "'s...
Merge attributes from two layouts.
[ "Merge", "attributes", "from", "two", "layouts", "." ]
train
https://github.com/jwkvam/plotlywrapper/blob/762b42912e824fecb1212c186900f2ebdd0ab12b/plotlywrapper.py#L58-L65
jwkvam/plotlywrapper
plotlywrapper.py
_try_pydatetime
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...
python
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...
[ "def", "_try_pydatetime", "(", "x", ")", ":", "try", ":", "# for datetimeindex", "x", "=", "[", "y", ".", "isoformat", "(", ")", "for", "y", "in", "x", ".", "to_pydatetime", "(", ")", "]", "except", "AttributeError", ":", "pass", "try", ":", "# for gen...
Try to convert to pandas objects to datetimes. Plotly doesn't know how to handle them.
[ "Try", "to", "convert", "to", "pandas", "objects", "to", "datetimes", "." ]
train
https://github.com/jwkvam/plotlywrapper/blob/762b42912e824fecb1212c186900f2ebdd0ab12b/plotlywrapper.py#L68-L83
jwkvam/plotlywrapper
plotlywrapper.py
spark_shape
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) + ...
python
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) + ...
[ "def", "spark_shape", "(", "points", ",", "shapes", ",", "fill", "=", "None", ",", "color", "=", "'blue'", ",", "width", "=", "5", ",", "yindex", "=", "0", ",", "heights", "=", "None", ")", ":", "assert", "len", "(", "points", ")", "==", "len", "...
TODO: Docstring for spark. Parameters ---------- points : array-like shapes : array-like fill : array-like, optional Returns ------- Chart
[ "TODO", ":", "Docstring", "for", "spark", "." ]
train
https://github.com/jwkvam/plotlywrapper/blob/762b42912e824fecb1212c186900f2ebdd0ab12b/plotlywrapper.py#L472-L519
jwkvam/plotlywrapper
plotlywrapper.py
vertical
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...
python
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...
[ "def", "vertical", "(", "x", ",", "ymin", "=", "0", ",", "ymax", "=", "1", ",", "color", "=", "None", ",", "width", "=", "None", ",", "dash", "=", "None", ",", "opacity", "=", "None", ")", ":", "lineattr", "=", "{", "}", "if", "color", ":", "...
Draws a vertical line from `ymin` to `ymax`. Parameters ---------- xmin : int, optional xmax : int, optional color : str, optional width : number, optional Returns ------- Chart
[ "Draws", "a", "vertical", "line", "from", "ymin", "to", "ymax", "." ]
train
https://github.com/jwkvam/plotlywrapper/blob/762b42912e824fecb1212c186900f2ebdd0ab12b/plotlywrapper.py#L522-L548
jwkvam/plotlywrapper
plotlywrapper.py
horizontal
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 """ ...
python
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 """ ...
[ "def", "horizontal", "(", "y", ",", "xmin", "=", "0", ",", "xmax", "=", "1", ",", "color", "=", "None", ",", "width", "=", "None", ",", "dash", "=", "None", ",", "opacity", "=", "None", ")", ":", "lineattr", "=", "{", "}", "if", "color", ":", ...
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", "." ]
train
https://github.com/jwkvam/plotlywrapper/blob/762b42912e824fecb1212c186900f2ebdd0ab12b/plotlywrapper.py#L551-L577
jwkvam/plotlywrapper
plotlywrapper.py
line
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...
python
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...
[ "def", "line", "(", "x", "=", "None", ",", "y", "=", "None", ",", "label", "=", "None", ",", "color", "=", "None", ",", "width", "=", "None", ",", "dash", "=", "None", ",", "opacity", "=", "None", ",", "mode", "=", "'lines+markers'", ",", "yaxis"...
Draws connected dots. Parameters ---------- x : array-like, optional y : array-like, optional label : array-like, optional Returns ------- Chart
[ "Draws", "connected", "dots", "." ]
train
https://github.com/jwkvam/plotlywrapper/blob/762b42912e824fecb1212c186900f2ebdd0ab12b/plotlywrapper.py#L580-L665
jwkvam/plotlywrapper
plotlywrapper.py
line3d
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...
python
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...
[ "def", "line3d", "(", "x", ",", "y", ",", "z", ",", "label", "=", "None", ",", "color", "=", "None", ",", "width", "=", "None", ",", "dash", "=", "None", ",", "opacity", "=", "None", ",", "mode", "=", "'lines+markers'", ")", ":", "x", "=", "np"...
Create a 3d line chart.
[ "Create", "a", "3d", "line", "chart", "." ]
train
https://github.com/jwkvam/plotlywrapper/blob/762b42912e824fecb1212c186900f2ebdd0ab12b/plotlywrapper.py#L668-L696
jwkvam/plotlywrapper
plotlywrapper.py
scatter
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 : ...
python
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 : ...
[ "def", "scatter", "(", "x", "=", "None", ",", "y", "=", "None", ",", "label", "=", "None", ",", "color", "=", "None", ",", "width", "=", "None", ",", "dash", "=", "None", ",", "opacity", "=", "None", ",", "markersize", "=", "6", ",", "yaxis", "...
Draws dots. Parameters ---------- x : array-like, optional y : array-like, optional label : array-like, optional Returns ------- Chart
[ "Draws", "dots", "." ]
train
https://github.com/jwkvam/plotlywrapper/blob/762b42912e824fecb1212c186900f2ebdd0ab12b/plotlywrapper.py#L746-L786
jwkvam/plotlywrapper
plotlywrapper.py
bar
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...
python
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...
[ "def", "bar", "(", "x", "=", "None", ",", "y", "=", "None", ",", "label", "=", "None", ",", "mode", "=", "'group'", ",", "yaxis", "=", "1", ",", "opacity", "=", "None", ")", ":", "assert", "x", "is", "not", "None", "or", "y", "is", "not", "No...
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.
[ "Create", "a", "bar", "chart", "." ]
train
https://github.com/jwkvam/plotlywrapper/blob/762b42912e824fecb1212c186900f2ebdd0ab12b/plotlywrapper.py#L789-L829
jwkvam/plotlywrapper
plotlywrapper.py
heatmap
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=...
python
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=...
[ "def", "heatmap", "(", "z", ",", "x", "=", "None", ",", "y", "=", "None", ",", "colorscale", "=", "'Viridis'", ")", ":", "z", "=", "np", ".", "atleast_1d", "(", "z", ")", "data", "=", "[", "go", ".", "Heatmap", "(", "z", "=", "z", ",", "x", ...
Create a heatmap. Parameters ---------- z : TODO x : TODO, optional y : TODO, optional colorscale : TODO, optional Returns ------- Chart
[ "Create", "a", "heatmap", "." ]
train
https://github.com/jwkvam/plotlywrapper/blob/762b42912e824fecb1212c186900f2ebdd0ab12b/plotlywrapper.py#L832-L850
jwkvam/plotlywrapper
plotlywrapper.py
fill_zero
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 ------- ...
python
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 ------- ...
[ "def", "fill_zero", "(", "x", "=", "None", ",", "y", "=", "None", ",", "label", "=", "None", ",", "color", "=", "None", ",", "width", "=", "None", ",", "dash", "=", "None", ",", "opacity", "=", "None", ",", "mode", "=", "'lines+markers'", ",", "*...
Fill to zero. Parameters ---------- x : array-like, optional y : TODO, optional label : TODO, optional Returns ------- Chart
[ "Fill", "to", "zero", "." ]
train
https://github.com/jwkvam/plotlywrapper/blob/762b42912e824fecb1212c186900f2ebdd0ab12b/plotlywrapper.py#L853-L888
jwkvam/plotlywrapper
plotlywrapper.py
fill_between
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 :...
python
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 :...
[ "def", "fill_between", "(", "x", "=", "None", ",", "ylow", "=", "None", ",", "yhigh", "=", "None", ",", "label", "=", "None", ",", "color", "=", "None", ",", "width", "=", "None", ",", "dash", "=", "None", ",", "opacity", "=", "None", ",", "mode"...
Fill between `ylow` and `yhigh`. Parameters ---------- x : array-like, optional ylow : TODO, optional yhigh : TODO, optional Returns ------- Chart
[ "Fill", "between", "ylow", "and", "yhigh", "." ]
train
https://github.com/jwkvam/plotlywrapper/blob/762b42912e824fecb1212c186900f2ebdd0ab12b/plotlywrapper.py#L891-L940
jwkvam/plotlywrapper
plotlywrapper.py
rug
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, ...
python
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, ...
[ "def", "rug", "(", "x", ",", "label", "=", "None", ",", "opacity", "=", "None", ")", ":", "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
[ "Rug", "chart", "." ]
train
https://github.com/jwkvam/plotlywrapper/blob/762b42912e824fecb1212c186900f2ebdd0ab12b/plotlywrapper.py#L943-L984
jwkvam/plotlywrapper
plotlywrapper.py
surface
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)
python
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)
[ "def", "surface", "(", "x", ",", "y", ",", "z", ")", ":", "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
[ "Surface", "plot", "." ]
train
https://github.com/jwkvam/plotlywrapper/blob/762b42912e824fecb1212c186900f2ebdd0ab12b/plotlywrapper.py#L987-L1002
jwkvam/plotlywrapper
plotlywrapper.py
hist
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...
python
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...
[ "def", "hist", "(", "x", ",", "mode", "=", "'overlay'", ",", "label", "=", "None", ",", "opacity", "=", "None", ",", "horz", "=", "False", ",", "histnorm", "=", "None", ")", ":", "x", "=", "np", ".", "atleast_1d", "(", "x", ")", "if", "horz", "...
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...
[ "Histogram", "." ]
train
https://github.com/jwkvam/plotlywrapper/blob/762b42912e824fecb1212c186900f2ebdd0ab12b/plotlywrapper.py#L1005-L1040
jwkvam/plotlywrapper
plotlywrapper.py
hist2d
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....
python
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....
[ "def", "hist2d", "(", "x", ",", "y", ",", "label", "=", "None", ",", "opacity", "=", "None", ")", ":", "x", "=", "np", ".", "atleast_1d", "(", "x", ")", "y", "=", "np", ".", "atleast_1d", "(", "y", ")", "data", "=", "[", "go", ".", "Histogram...
2D Histogram. Parameters ---------- x : array-like, optional y : array-like, optional label : TODO, optional opacity : float, optional Returns ------- Chart
[ "2D", "Histogram", "." ]
train
https://github.com/jwkvam/plotlywrapper/blob/762b42912e824fecb1212c186900f2ebdd0ab12b/plotlywrapper.py#L1043-L1061
jwkvam/plotlywrapper
plotlywrapper.py
Chart.ytickangle
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'...
python
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'...
[ "def", "ytickangle", "(", "self", ",", "angle", ",", "index", "=", "1", ")", ":", "self", ".", "layout", "[", "'yaxis'", "+", "str", "(", "index", ")", "]", "[", "'tickangle'", "]", "=", "angle", "return", "self" ]
Set the angle of the y-axis tick labels. Parameters ---------- value : int Angle in degrees index : int, optional Y-axis index Returns ------- Chart
[ "Set", "the", "angle", "of", "the", "y", "-", "axis", "tick", "labels", "." ]
train
https://github.com/jwkvam/plotlywrapper/blob/762b42912e824fecb1212c186900f2ebdd0ab12b/plotlywrapper.py#L221-L237
jwkvam/plotlywrapper
plotlywrapper.py
Chart.ylabelsize
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
python
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
[ "def", "ylabelsize", "(", "self", ",", "size", ",", "index", "=", "1", ")", ":", "self", ".", "layout", "[", "'yaxis'", "+", "str", "(", "index", ")", "]", "[", "'titlefont'", "]", "[", "'size'", "]", "=", "size", "return", "self" ]
Set the size of the label. Parameters ---------- size : int Returns ------- Chart
[ "Set", "the", "size", "of", "the", "label", "." ]
train
https://github.com/jwkvam/plotlywrapper/blob/762b42912e824fecb1212c186900f2ebdd0ab12b/plotlywrapper.py#L254-L267
jwkvam/plotlywrapper
plotlywrapper.py
Chart.yticksize
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
python
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
[ "def", "yticksize", "(", "self", ",", "size", ",", "index", "=", "1", ")", ":", "self", ".", "layout", "[", "'yaxis'", "+", "str", "(", "index", ")", "]", "[", "'tickfont'", "]", "[", "'size'", "]", "=", "size", "return", "self" ]
Set the tick font size. Parameters ---------- size : int Returns ------- Chart
[ "Set", "the", "tick", "font", "size", "." ]
train
https://github.com/jwkvam/plotlywrapper/blob/762b42912e824fecb1212c186900f2ebdd0ab12b/plotlywrapper.py#L284-L297
jwkvam/plotlywrapper
plotlywrapper.py
Chart.ytickvals
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
python
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
[ "def", "ytickvals", "(", "self", ",", "values", ",", "index", "=", "1", ")", ":", "self", ".", "layout", "[", "'yaxis'", "+", "str", "(", "index", ")", "]", "[", "'tickvals'", "]", "=", "values", "return", "self" ]
Set the tick values. Parameters ---------- values : array-like Returns ------- Chart
[ "Set", "the", "tick", "values", "." ]
train
https://github.com/jwkvam/plotlywrapper/blob/762b42912e824fecb1212c186900f2ebdd0ab12b/plotlywrapper.py#L299-L312
jwkvam/plotlywrapper
plotlywrapper.py
Chart.yticktext
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
python
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
[ "def", "yticktext", "(", "self", ",", "labels", ",", "index", "=", "1", ")", ":", "self", ".", "layout", "[", "'yaxis'", "+", "str", "(", "index", ")", "]", "[", "'ticktext'", "]", "=", "labels", "return", "self" ]
Set the tick labels. Parameters ---------- labels : array-like Returns ------- Chart
[ "Set", "the", "tick", "labels", "." ]
train
https://github.com/jwkvam/plotlywrapper/blob/762b42912e824fecb1212c186900f2ebdd0ab12b/plotlywrapper.py#L314-L327
jwkvam/plotlywrapper
plotlywrapper.py
Chart.ylim
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...
python
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...
[ "def", "ylim", "(", "self", ",", "low", ",", "high", ",", "index", "=", "1", ")", ":", "self", ".", "layout", "[", "'yaxis'", "+", "str", "(", "index", ")", "]", "[", "'range'", "]", "=", "[", "low", ",", "high", "]", "return", "self" ]
Set yaxis limits. Parameters ---------- low : number high : number index : int, optional Returns ------- Chart
[ "Set", "yaxis", "limits", "." ]
train
https://github.com/jwkvam/plotlywrapper/blob/762b42912e824fecb1212c186900f2ebdd0ab12b/plotlywrapper.py#L345-L360
jwkvam/plotlywrapper
plotlywrapper.py
Chart.ydtick
def ydtick(self, dtick, index=1): """Set the tick distance.""" self.layout['yaxis' + str(index)]['dtick'] = dtick return self
python
def ydtick(self, dtick, index=1): """Set the tick distance.""" self.layout['yaxis' + str(index)]['dtick'] = dtick return self
[ "def", "ydtick", "(", "self", ",", "dtick", ",", "index", "=", "1", ")", ":", "self", ".", "layout", "[", "'yaxis'", "+", "str", "(", "index", ")", "]", "[", "'dtick'", "]", "=", "dtick", "return", "self" ]
Set the tick distance.
[ "Set", "the", "tick", "distance", "." ]
train
https://github.com/jwkvam/plotlywrapper/blob/762b42912e824fecb1212c186900f2ebdd0ab12b/plotlywrapper.py#L367-L370
jwkvam/plotlywrapper
plotlywrapper.py
Chart.ynticks
def ynticks(self, nticks, index=1): """Set the number of ticks.""" self.layout['yaxis' + str(index)]['nticks'] = nticks return self
python
def ynticks(self, nticks, index=1): """Set the number of ticks.""" self.layout['yaxis' + str(index)]['nticks'] = nticks return self
[ "def", "ynticks", "(", "self", ",", "nticks", ",", "index", "=", "1", ")", ":", "self", ".", "layout", "[", "'yaxis'", "+", "str", "(", "index", ")", "]", "[", "'nticks'", "]", "=", "nticks", "return", "self" ]
Set the number of ticks.
[ "Set", "the", "number", "of", "ticks", "." ]
train
https://github.com/jwkvam/plotlywrapper/blob/762b42912e824fecb1212c186900f2ebdd0ab12b/plotlywrapper.py#L377-L380
jwkvam/plotlywrapper
plotlywrapper.py
Chart.show
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...
python
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...
[ "def", "show", "(", "self", ",", "filename", ":", "Optional", "[", "str", "]", "=", "None", ",", "show_link", ":", "bool", "=", "True", ",", "auto_open", ":", "bool", "=", "True", ",", "detect_notebook", ":", "bool", "=", "True", ",", ")", "->", "N...
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 ...
[ "Display", "the", "chart", "." ]
train
https://github.com/jwkvam/plotlywrapper/blob/762b42912e824fecb1212c186900f2ebdd0ab12b/plotlywrapper.py#L410-L442
jwkvam/plotlywrapper
plotlywrapper.py
Chart.save
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...
python
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...
[ "def", "save", "(", "self", ",", "filename", ":", "Optional", "[", "str", "]", "=", "None", ",", "show_link", ":", "bool", "=", "True", ",", "auto_open", ":", "bool", "=", "False", ",", "output", ":", "str", "=", "'file'", ",", "plotlyjs", ":", "bo...
Save the chart to an html file.
[ "Save", "the", "chart", "to", "an", "html", "file", "." ]
train
https://github.com/jwkvam/plotlywrapper/blob/762b42912e824fecb1212c186900f2ebdd0ab12b/plotlywrapper.py#L444-L464
cgarciae/phi
phi/builder.py
Builder.RegisterMethod
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...
python
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...
[ "def", "RegisterMethod", "(", "cls", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "unpack_error", "=", "True", "try", ":", "f", ",", "library_path", "=", "args", "unpack_error", "=", "False", "cls", ".", "_RegisterMethod", "(", "f", ",", "libra...
**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 * **...
[ "**", "RegisterMethod", "**" ]
train
https://github.com/cgarciae/phi/blob/87fd7100a76f823232f4fd8360498b4b80675265/phi/builder.py#L71-L205
cgarciae/phi
phi/builder.py
Builder.RegisterAt
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...
python
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...
[ "def", "RegisterAt", "(", "cls", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "unpack_error", "=", "True", "try", ":", "n", ",", "f", ",", "library_path", "=", "args", "unpack_error", "=", "False", "cls", ".", "_RegisterAt", "(", "n", ",", ...
**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...
[ "**", "RegisterAt", "**" ]
train
https://github.com/cgarciae/phi/blob/87fd7100a76f823232f4fd8360498b4b80675265/phi/builder.py#L238-L285
cgarciae/phi
phi/builder.py
Builder.PatchAt
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...
python
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...
[ "def", "PatchAt", "(", "cls", ",", "n", ",", "module", ",", "method_wrapper", "=", "None", ",", "module_alias", "=", "None", ",", "method_name_modifier", "=", "utils", ".", "identity", ",", "blacklist_predicate", "=", "_False", ",", "whitelist_predicate", "=",...
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...
[ "This", "classmethod", "lets", "you", "easily", "patch", "all", "of", "functions", "/", "callables", "from", "a", "module", "or", "class", "as", "methods", "a", "Builder", "class", "." ]
train
https://github.com/cgarciae/phi/blob/87fd7100a76f823232f4fd8360498b4b80675265/phi/builder.py#L360-L434
cgarciae/phi
phi/utils.py
get_method_sig
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...
python
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...
[ "def", "get_method_sig", "(", "method", ")", ":", "# The return value of ArgSpec is a bit weird, as the list of arguments and", "# list of defaults are returned in separate array.", "# eg: ArgSpec(args=['first_arg', 'second_arg', 'third_arg'],", "# varargs=None, keywords=None, defaults=(42, 'somet...
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')"
[ "Given", "a", "function", "it", "returns", "a", "string", "that", "pretty", "much", "looks", "how", "the", "function", "signature_", "would", "be", "written", "in", "python", "." ]
train
https://github.com/cgarciae/phi/blob/87fd7100a76f823232f4fd8360498b4b80675265/phi/utils.py#L64-L90
cgarciae/phi
phi/dsl.py
Expression.Pipe
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...
python
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...
[ "def", "Pipe", "(", "self", ",", "*", "sequence", ",", "*", "*", "kwargs", ")", ":", "state", "=", "kwargs", ".", "pop", "(", "\"refs\"", ",", "{", "}", ")", "return", "self", ".", "Seq", "(", "*", "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 using `phi.dsl.Expression.Seq`. * ****kwargs**: ...
[ "Pipe", "runs", "any", "phi", ".", "dsl", ".", "Expression", ".", "Its", "highly", "inspired", "by", "Elixir", "s", "[", "|", ">", "(", "pipe", ")", "]", "(", "https", ":", "//", "hexdocs", ".", "pm", "/", "elixir", "/", "Kernel", ".", "html#%7C%3E...
train
https://github.com/cgarciae/phi/blob/87fd7100a76f823232f4fd8360498b4b80675265/phi/dsl.py#L468-L522
cgarciae/phi
phi/dsl.py
Expression.ThenAt
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...
python
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...
[ "def", "ThenAt", "(", "self", ",", "n", ",", "f", ",", "*", "_args", ",", "*", "*", "kwargs", ")", ":", "_return_type", "=", "None", "n_args", "=", "n", "-", "1", "if", "'_return_type'", "in", "kwargs", ":", "_return_type", "=", "kwargs", "[", "'_r...
`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. * ...
[ "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"...
train
https://github.com/cgarciae/phi/blob/87fd7100a76f823232f4fd8360498b4b80675265/phi/dsl.py#L524-L638
cgarciae/phi
phi/dsl.py
Expression.Then0
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)
python
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)
[ "def", "Then0", "(", "self", ",", "f", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "ThenAt", "(", "0", ",", "f", ",", "*", "args", ",", "*", "*", "kwargs", ")" ]
`Then0(f, ...)` is equivalent to `ThenAt(0, f, ...)`. Checkout `phi.builder.Builder.ThenAt` for more information.
[ "Then0", "(", "f", "...", ")", "is", "equivalent", "to", "ThenAt", "(", "0", "f", "...", ")", ".", "Checkout", "phi", ".", "builder", ".", "Builder", ".", "ThenAt", "for", "more", "information", "." ]
train
https://github.com/cgarciae/phi/blob/87fd7100a76f823232f4fd8360498b4b80675265/phi/dsl.py#L640-L644
cgarciae/phi
phi/dsl.py
Expression.Then
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)
python
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)
[ "def", "Then", "(", "self", ",", "f", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "ThenAt", "(", "1", ",", "f", ",", "*", "args", ",", "*", "*", "kwargs", ")" ]
`Then(f, ...)` is equivalent to `ThenAt(1, f, ...)`. Checkout `phi.builder.Builder.ThenAt` for more information.
[ "Then", "(", "f", "...", ")", "is", "equivalent", "to", "ThenAt", "(", "1", "f", "...", ")", ".", "Checkout", "phi", ".", "builder", ".", "Builder", ".", "ThenAt", "for", "more", "information", "." ]
train
https://github.com/cgarciae/phi/blob/87fd7100a76f823232f4fd8360498b4b80675265/phi/dsl.py#L646-L650
cgarciae/phi
phi/dsl.py
Expression.Then2
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)
python
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)
[ "def", "Then2", "(", "self", ",", "f", ",", "arg1", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "args", "=", "(", "arg1", ",", ")", "+", "args", "return", "self", ".", "ThenAt", "(", "2", ",", "f", ",", "*", "args", ",", "*", "*", ...
`Then2(f, ...)` is equivalent to `ThenAt(2, f, ...)`. Checkout `phi.builder.Builder.ThenAt` for more information.
[ "Then2", "(", "f", "...", ")", "is", "equivalent", "to", "ThenAt", "(", "2", "f", "...", ")", ".", "Checkout", "phi", ".", "builder", ".", "Builder", ".", "ThenAt", "for", "more", "information", "." ]
train
https://github.com/cgarciae/phi/blob/87fd7100a76f823232f4fd8360498b4b80675265/phi/dsl.py#L654-L659
cgarciae/phi
phi/dsl.py
Expression.Then3
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)
python
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)
[ "def", "Then3", "(", "self", ",", "f", ",", "arg1", ",", "arg2", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "args", "=", "(", "arg1", ",", "arg2", ")", "+", "args", "return", "self", ".", "ThenAt", "(", "3", ",", "f", ",", "*", "a...
`Then3(f, ...)` is equivalent to `ThenAt(3, f, ...)`. Checkout `phi.builder.Builder.ThenAt` for more information.
[ "Then3", "(", "f", "...", ")", "is", "equivalent", "to", "ThenAt", "(", "3", "f", "...", ")", ".", "Checkout", "phi", ".", "builder", ".", "Builder", ".", "ThenAt", "for", "more", "information", "." ]
train
https://github.com/cgarciae/phi/blob/87fd7100a76f823232f4fd8360498b4b80675265/phi/dsl.py#L661-L666
cgarciae/phi
phi/dsl.py
Expression.Then4
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)
python
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)
[ "def", "Then4", "(", "self", ",", "f", ",", "arg1", ",", "arg2", ",", "arg3", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "args", "=", "(", "arg1", ",", "arg2", ",", "arg3", ")", "+", "args", "return", "self", ".", "ThenAt", "(", "4"...
`Then4(f, ...)` is equivalent to `ThenAt(4, f, ...)`. Checkout `phi.builder.Builder.ThenAt` for more information.
[ "Then4", "(", "f", "...", ")", "is", "equivalent", "to", "ThenAt", "(", "4", "f", "...", ")", ".", "Checkout", "phi", ".", "builder", ".", "Builder", ".", "ThenAt", "for", "more", "information", "." ]
train
https://github.com/cgarciae/phi/blob/87fd7100a76f823232f4fd8360498b4b80675265/phi/dsl.py#L668-L673
cgarciae/phi
phi/dsl.py
Expression.Then5
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)
python
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)
[ "def", "Then5", "(", "self", ",", "f", ",", "arg1", ",", "arg2", ",", "arg3", ",", "arg4", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "args", "=", "(", "arg1", ",", "arg2", ",", "arg3", ",", "arg4", ")", "+", "args", "return", "self...
`Then5(f, ...)` is equivalent to `ThenAt(5, f, ...)`. Checkout `phi.builder.Builder.ThenAt` for more information.
[ "Then5", "(", "f", "...", ")", "is", "equivalent", "to", "ThenAt", "(", "5", "f", "...", ")", ".", "Checkout", "phi", ".", "builder", ".", "Builder", ".", "ThenAt", "for", "more", "information", "." ]
train
https://github.com/cgarciae/phi/blob/87fd7100a76f823232f4fd8360498b4b80675265/phi/dsl.py#L675-L680
cgarciae/phi
phi/dsl.py
Expression.List
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...
python
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...
[ "def", "List", "(", "self", ",", "*", "branches", ",", "*", "*", "kwargs", ")", ":", "gs", "=", "[", "_parse", "(", "code", ")", ".", "_f", "for", "code", "in", "branches", "]", "def", "h", "(", "x", ",", "state", ")", ":", "ys", "=", "[", ...
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...
[ "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", ...
train
https://github.com/cgarciae/phi/blob/87fd7100a76f823232f4fd8360498b4b80675265/phi/dsl.py#L682-L793