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
awacha/sastool
sastool/io/credo_saxsctrl/header.py
Header.date
def date(self) -> datetime.datetime: """Date of the experiment (start of exposure)""" return self._data['Date'] - datetime.timedelta(0, float(self.exposuretime), 0)
python
def date(self) -> datetime.datetime: """Date of the experiment (start of exposure)""" return self._data['Date'] - datetime.timedelta(0, float(self.exposuretime), 0)
[ "def", "date", "(", "self", ")", "->", "datetime", ".", "datetime", ":", "return", "self", ".", "_data", "[", "'Date'", "]", "-", "datetime", ".", "timedelta", "(", "0", ",", "float", "(", "self", ".", "exposuretime", ")", ",", "0", ")" ]
Date of the experiment (start of exposure)
[ "Date", "of", "the", "experiment", "(", "start", "of", "exposure", ")" ]
train
https://github.com/awacha/sastool/blob/deaddfa3002f3f6818697e36139633b7e30427a3/sastool/io/credo_saxsctrl/header.py#L211-L213
awacha/sastool
sastool/io/credo_saxsctrl/header.py
Header.flux
def flux(self) -> ErrorValue: """X-ray flux in photons/sec.""" try: return ErrorValue(self._data['Flux'], self._data.setdefault('FluxError',0.0)) except KeyError: return 1 / self.pixelsizex / self.pixelsizey / ErrorValue(self._data['NormFactor'], ...
python
def flux(self) -> ErrorValue: """X-ray flux in photons/sec.""" try: return ErrorValue(self._data['Flux'], self._data.setdefault('FluxError',0.0)) except KeyError: return 1 / self.pixelsizex / self.pixelsizey / ErrorValue(self._data['NormFactor'], ...
[ "def", "flux", "(", "self", ")", "->", "ErrorValue", ":", "try", ":", "return", "ErrorValue", "(", "self", ".", "_data", "[", "'Flux'", "]", ",", "self", ".", "_data", ".", "setdefault", "(", "'FluxError'", ",", "0.0", ")", ")", "except", "KeyError", ...
X-ray flux in photons/sec.
[ "X", "-", "ray", "flux", "in", "photons", "/", "sec", "." ]
train
https://github.com/awacha/sastool/blob/deaddfa3002f3f6818697e36139633b7e30427a3/sastool/io/credo_saxsctrl/header.py#L276-L282
awacha/sastool
sastool/misc/easylsq.py
nonlinear_leastsquares
def nonlinear_leastsquares(x: np.ndarray, y: np.ndarray, dy: np.ndarray, func: Callable, params_init: np.ndarray, verbose: bool = False, **kwargs): """Perform a non-linear least squares fit, return the results as ErrorValue() instances. Inputs: x: one-dimensional numpy ar...
python
def nonlinear_leastsquares(x: np.ndarray, y: np.ndarray, dy: np.ndarray, func: Callable, params_init: np.ndarray, verbose: bool = False, **kwargs): """Perform a non-linear least squares fit, return the results as ErrorValue() instances. Inputs: x: one-dimensional numpy ar...
[ "def", "nonlinear_leastsquares", "(", "x", ":", "np", ".", "ndarray", ",", "y", ":", "np", ".", "ndarray", ",", "dy", ":", "np", ".", "ndarray", ",", "func", ":", "Callable", ",", "params_init", ":", "np", ".", "ndarray", ",", "verbose", ":", "bool",...
Perform a non-linear least squares fit, return the results as ErrorValue() instances. Inputs: x: one-dimensional numpy array of the independent variable y: one-dimensional numpy array of the dependent variable dy: absolute error (square root of the variance) of the dependent ...
[ "Perform", "a", "non", "-", "linear", "least", "squares", "fit", "return", "the", "results", "as", "ErrorValue", "()", "instances", "." ]
train
https://github.com/awacha/sastool/blob/deaddfa3002f3f6818697e36139633b7e30427a3/sastool/misc/easylsq.py#L64-L114
awacha/sastool
sastool/misc/easylsq.py
nonlinear_odr
def nonlinear_odr(x, y, dx, dy, func, params_init, **kwargs): """Perform a non-linear orthogonal distance regression, return the results as ErrorValue() instances. Inputs: x: one-dimensional numpy array of the independent variable y: one-dimensional numpy array of the dependent variable ...
python
def nonlinear_odr(x, y, dx, dy, func, params_init, **kwargs): """Perform a non-linear orthogonal distance regression, return the results as ErrorValue() instances. Inputs: x: one-dimensional numpy array of the independent variable y: one-dimensional numpy array of the dependent variable ...
[ "def", "nonlinear_odr", "(", "x", ",", "y", ",", "dx", ",", "dy", ",", "func", ",", "params_init", ",", "*", "*", "kwargs", ")", ":", "odrmodel", "=", "odr", ".", "Model", "(", "lambda", "pars", ",", "x", ":", "func", "(", "x", ",", "*", "pars"...
Perform a non-linear orthogonal distance regression, return the results as ErrorValue() instances. Inputs: x: one-dimensional numpy array of the independent variable y: one-dimensional numpy array of the dependent variable dx: absolute error (square root of the variance) of the independ...
[ "Perform", "a", "non", "-", "linear", "orthogonal", "distance", "regression", "return", "the", "results", "as", "ErrorValue", "()", "instances", "." ]
train
https://github.com/awacha/sastool/blob/deaddfa3002f3f6818697e36139633b7e30427a3/sastool/misc/easylsq.py#L116-L179
awacha/sastool
sastool/misc/easylsq.py
simultaneous_nonlinear_leastsquares
def simultaneous_nonlinear_leastsquares(xs, ys, dys, func, params_inits, verbose=False, **kwargs): """Do a simultaneous nonlinear least-squares fit and return the fitted parameters as instances of ErrorValue. Input: ------ `xs`: tuple of abscissa vectors (1d numpy ndarrays) `ys`: tuple of ordin...
python
def simultaneous_nonlinear_leastsquares(xs, ys, dys, func, params_inits, verbose=False, **kwargs): """Do a simultaneous nonlinear least-squares fit and return the fitted parameters as instances of ErrorValue. Input: ------ `xs`: tuple of abscissa vectors (1d numpy ndarrays) `ys`: tuple of ordin...
[ "def", "simultaneous_nonlinear_leastsquares", "(", "xs", ",", "ys", ",", "dys", ",", "func", ",", "params_inits", ",", "verbose", "=", "False", ",", "*", "*", "kwargs", ")", ":", "p", ",", "dp", ",", "statdict", "=", "simultaneous_nlsq_fit", "(", "xs", "...
Do a simultaneous nonlinear least-squares fit and return the fitted parameters as instances of ErrorValue. Input: ------ `xs`: tuple of abscissa vectors (1d numpy ndarrays) `ys`: tuple of ordinate vectors (1d numpy ndarrays) `dys`: tuple of the errors of ordinate vectors (1d numpy ndarrays or N...
[ "Do", "a", "simultaneous", "nonlinear", "least", "-", "squares", "fit", "and", "return", "the", "fitted", "parameters", "as", "instances", "of", "ErrorValue", "." ]
train
https://github.com/awacha/sastool/blob/deaddfa3002f3f6818697e36139633b7e30427a3/sastool/misc/easylsq.py#L182-L215
awacha/sastool
sastool/misc/easylsq.py
nlsq_fit
def nlsq_fit(x, y, dy, func, params_init, verbose=False, **kwargs): """Perform a non-linear least squares fit Inputs: x: one-dimensional numpy array of the independent variable y: one-dimensional numpy array of the dependent variable dy: absolute error (square root of the variance) of t...
python
def nlsq_fit(x, y, dy, func, params_init, verbose=False, **kwargs): """Perform a non-linear least squares fit Inputs: x: one-dimensional numpy array of the independent variable y: one-dimensional numpy array of the dependent variable dy: absolute error (square root of the variance) of t...
[ "def", "nlsq_fit", "(", "x", ",", "y", ",", "dy", ",", "func", ",", "params_init", ",", "verbose", "=", "False", ",", "*", "*", "kwargs", ")", ":", "if", "verbose", ":", "t0", "=", "time", ".", "monotonic", "(", ")", "print", "(", "\"nlsq_fit start...
Perform a non-linear least squares fit Inputs: x: one-dimensional numpy array of the independent variable y: one-dimensional numpy array of the dependent variable dy: absolute error (square root of the variance) of the dependent variable. Either a one-dimensional numpy array or ...
[ "Perform", "a", "non", "-", "linear", "least", "squares", "fit" ]
train
https://github.com/awacha/sastool/blob/deaddfa3002f3f6818697e36139633b7e30427a3/sastool/misc/easylsq.py#L217-L319
awacha/sastool
sastool/misc/easylsq.py
simultaneous_nlsq_fit
def simultaneous_nlsq_fit(xs, ys, dys, func, params_inits, verbose=False, **kwargs): """Do a simultaneous nonlinear least-squares fit Input: ------ `xs`: tuple of abscissa vectors (1d numpy ndarrays) `ys`: tuple of ordinate vectors (1d numpy ndarrays) `dys`: tuple o...
python
def simultaneous_nlsq_fit(xs, ys, dys, func, params_inits, verbose=False, **kwargs): """Do a simultaneous nonlinear least-squares fit Input: ------ `xs`: tuple of abscissa vectors (1d numpy ndarrays) `ys`: tuple of ordinate vectors (1d numpy ndarrays) `dys`: tuple o...
[ "def", "simultaneous_nlsq_fit", "(", "xs", ",", "ys", ",", "dys", ",", "func", ",", "params_inits", ",", "verbose", "=", "False", ",", "*", "*", "kwargs", ")", ":", "if", "not", "isinstance", "(", "xs", ",", "collections", ".", "Sequence", ")", "or", ...
Do a simultaneous nonlinear least-squares fit Input: ------ `xs`: tuple of abscissa vectors (1d numpy ndarrays) `ys`: tuple of ordinate vectors (1d numpy ndarrays) `dys`: tuple of the errors of ordinate vectors (1d numpy ndarrays or Nones) `func`: fitting function (the same for all the datasets...
[ "Do", "a", "simultaneous", "nonlinear", "least", "-", "squares", "fit" ]
train
https://github.com/awacha/sastool/blob/deaddfa3002f3f6818697e36139633b7e30427a3/sastool/misc/easylsq.py#L329-L449
awacha/sastool
sastool/misc/errorvalue.py
ErrorValue.tostring
def tostring(self: 'ErrorValue', extra_digits: int = 0, plusminus: str = ' +/- ', fmt: str = None) -> str: """Make a string representation of the value and its uncertainty. Inputs: ------- ``extra_digits``: integer how many extra digits should be shown (plus or minus...
python
def tostring(self: 'ErrorValue', extra_digits: int = 0, plusminus: str = ' +/- ', fmt: str = None) -> str: """Make a string representation of the value and its uncertainty. Inputs: ------- ``extra_digits``: integer how many extra digits should be shown (plus or minus...
[ "def", "tostring", "(", "self", ":", "'ErrorValue'", ",", "extra_digits", ":", "int", "=", "0", ",", "plusminus", ":", "str", "=", "' +/- '", ",", "fmt", ":", "str", "=", "None", ")", "->", "str", ":", "if", "isinstance", "(", "fmt", ",", "str", ")...
Make a string representation of the value and its uncertainty. Inputs: ------- ``extra_digits``: integer how many extra digits should be shown (plus or minus, zero means that the number of digits should be defined by the magnitude of the uncer...
[ "Make", "a", "string", "representation", "of", "the", "value", "and", "its", "uncertainty", "." ]
train
https://github.com/awacha/sastool/blob/deaddfa3002f3f6818697e36139633b7e30427a3/sastool/misc/errorvalue.py#L157-L190
awacha/sastool
sastool/misc/errorvalue.py
ErrorValue.random
def random(self: 'ErrorValue') -> np.ndarray: """Sample a random number (array) of the distribution defined by mean=`self.val` and variance=`self.err`^2. """ if isinstance(self.val, np.ndarray): # IGNORE:E1103 return np.random.randn(self.val.shape) * self.err + se...
python
def random(self: 'ErrorValue') -> np.ndarray: """Sample a random number (array) of the distribution defined by mean=`self.val` and variance=`self.err`^2. """ if isinstance(self.val, np.ndarray): # IGNORE:E1103 return np.random.randn(self.val.shape) * self.err + se...
[ "def", "random", "(", "self", ":", "'ErrorValue'", ")", "->", "np", ".", "ndarray", ":", "if", "isinstance", "(", "self", ".", "val", ",", "np", ".", "ndarray", ")", ":", "# IGNORE:E1103", "return", "np", ".", "random", ".", "randn", "(", "self", "."...
Sample a random number (array) of the distribution defined by mean=`self.val` and variance=`self.err`^2.
[ "Sample", "a", "random", "number", "(", "array", ")", "of", "the", "distribution", "defined", "by", "mean", "=", "self", ".", "val", "and", "variance", "=", "self", ".", "err", "^2", "." ]
train
https://github.com/awacha/sastool/blob/deaddfa3002f3f6818697e36139633b7e30427a3/sastool/misc/errorvalue.py#L240-L248
awacha/sastool
sastool/misc/errorvalue.py
ErrorValue.evalfunc
def evalfunc(cls, func, *args, **kwargs): """Evaluate a function with error propagation. Inputs: ------- ``func``: callable this is the function to be evaluated. Should return either a number or a np.ndarray. ``*args``: other positional ar...
python
def evalfunc(cls, func, *args, **kwargs): """Evaluate a function with error propagation. Inputs: ------- ``func``: callable this is the function to be evaluated. Should return either a number or a np.ndarray. ``*args``: other positional ar...
[ "def", "evalfunc", "(", "cls", ",", "func", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "def", "do_random", "(", "x", ")", ":", "if", "isinstance", "(", "x", ",", "cls", ")", ":", "return", "x", ".", "random", "(", ")", "else", ":", ...
Evaluate a function with error propagation. Inputs: ------- ``func``: callable this is the function to be evaluated. Should return either a number or a np.ndarray. ``*args``: other positional arguments of func. Arguments which are ...
[ "Evaluate", "a", "function", "with", "error", "propagation", "." ]
train
https://github.com/awacha/sastool/blob/deaddfa3002f3f6818697e36139633b7e30427a3/sastool/misc/errorvalue.py#L251-L311
awacha/sastool
sastool/fitting/fitfunctions/sasbasic.py
Fsphere
def Fsphere(q, R): """Scattering form-factor amplitude of a sphere normalized to F(q=0)=V Inputs: ------- ``q``: independent variable ``R``: sphere radius Formula: -------- ``4*pi/q^3 * (sin(qR) - qR*cos(qR))`` """ return 4 * np.pi / q ** 3 * (np.sin(q * R) - q * R ...
python
def Fsphere(q, R): """Scattering form-factor amplitude of a sphere normalized to F(q=0)=V Inputs: ------- ``q``: independent variable ``R``: sphere radius Formula: -------- ``4*pi/q^3 * (sin(qR) - qR*cos(qR))`` """ return 4 * np.pi / q ** 3 * (np.sin(q * R) - q * R ...
[ "def", "Fsphere", "(", "q", ",", "R", ")", ":", "return", "4", "*", "np", ".", "pi", "/", "q", "**", "3", "*", "(", "np", ".", "sin", "(", "q", "*", "R", ")", "-", "q", "*", "R", "*", "np", ".", "cos", "(", "q", "*", "R", ")", ")" ]
Scattering form-factor amplitude of a sphere normalized to F(q=0)=V Inputs: ------- ``q``: independent variable ``R``: sphere radius Formula: -------- ``4*pi/q^3 * (sin(qR) - qR*cos(qR))``
[ "Scattering", "form", "-", "factor", "amplitude", "of", "a", "sphere", "normalized", "to", "F", "(", "q", "=", "0", ")", "=", "V" ]
train
https://github.com/awacha/sastool/blob/deaddfa3002f3f6818697e36139633b7e30427a3/sastool/fitting/fitfunctions/sasbasic.py#L10-L22
awacha/sastool
sastool/fitting/fitfunctions/sasbasic.py
GeneralGuinier
def GeneralGuinier(q, G, Rg, s): """Generalized Guinier scattering Inputs: ------- ``q``: independent variable ``G``: factor ``Rg``: radius of gyration ``s``: dimensionality parameter (can be 1, 2, 3) Formula: -------- ``G/q**(3-s)*exp(-(q^2*Rg^2)/s)`` "...
python
def GeneralGuinier(q, G, Rg, s): """Generalized Guinier scattering Inputs: ------- ``q``: independent variable ``G``: factor ``Rg``: radius of gyration ``s``: dimensionality parameter (can be 1, 2, 3) Formula: -------- ``G/q**(3-s)*exp(-(q^2*Rg^2)/s)`` "...
[ "def", "GeneralGuinier", "(", "q", ",", "G", ",", "Rg", ",", "s", ")", ":", "return", "G", "/", "q", "**", "(", "3", "-", "s", ")", "*", "np", ".", "exp", "(", "-", "(", "q", "*", "Rg", ")", "**", "2", "/", "s", ")" ]
Generalized Guinier scattering Inputs: ------- ``q``: independent variable ``G``: factor ``Rg``: radius of gyration ``s``: dimensionality parameter (can be 1, 2, 3) Formula: -------- ``G/q**(3-s)*exp(-(q^2*Rg^2)/s)``
[ "Generalized", "Guinier", "scattering" ]
train
https://github.com/awacha/sastool/blob/deaddfa3002f3f6818697e36139633b7e30427a3/sastool/fitting/fitfunctions/sasbasic.py#L39-L53
awacha/sastool
sastool/fitting/fitfunctions/sasbasic.py
GuinierPorod
def GuinierPorod(q, G, Rg, alpha): """Empirical Guinier-Porod scattering Inputs: ------- ``q``: independent variable ``G``: factor of the Guinier-branch ``Rg``: radius of gyration ``alpha``: power-law exponent Formula: -------- ``G * exp(-q^2*Rg^2/3)`` if ``...
python
def GuinierPorod(q, G, Rg, alpha): """Empirical Guinier-Porod scattering Inputs: ------- ``q``: independent variable ``G``: factor of the Guinier-branch ``Rg``: radius of gyration ``alpha``: power-law exponent Formula: -------- ``G * exp(-q^2*Rg^2/3)`` if ``...
[ "def", "GuinierPorod", "(", "q", ",", "G", ",", "Rg", ",", "alpha", ")", ":", "return", "GuinierPorodMulti", "(", "q", ",", "G", ",", "Rg", ",", "alpha", ")" ]
Empirical Guinier-Porod scattering Inputs: ------- ``q``: independent variable ``G``: factor of the Guinier-branch ``Rg``: radius of gyration ``alpha``: power-law exponent Formula: -------- ``G * exp(-q^2*Rg^2/3)`` if ``q<q_sep`` and ``a*q^alpha`` otherwise. ...
[ "Empirical", "Guinier", "-", "Porod", "scattering" ]
train
https://github.com/awacha/sastool/blob/deaddfa3002f3f6818697e36139633b7e30427a3/sastool/fitting/fitfunctions/sasbasic.py#L86-L107
awacha/sastool
sastool/fitting/fitfunctions/sasbasic.py
PorodGuinier
def PorodGuinier(q, a, alpha, Rg): """Empirical Porod-Guinier scattering Inputs: ------- ``q``: independent variable ``a``: factor of the power-law branch ``alpha``: power-law exponent ``Rg``: radius of gyration Formula: -------- ``G * exp(-q^2*Rg^2/3)`` if ...
python
def PorodGuinier(q, a, alpha, Rg): """Empirical Porod-Guinier scattering Inputs: ------- ``q``: independent variable ``a``: factor of the power-law branch ``alpha``: power-law exponent ``Rg``: radius of gyration Formula: -------- ``G * exp(-q^2*Rg^2/3)`` if ...
[ "def", "PorodGuinier", "(", "q", ",", "a", ",", "alpha", ",", "Rg", ")", ":", "return", "PorodGuinierMulti", "(", "q", ",", "a", ",", "alpha", ",", "Rg", ")" ]
Empirical Porod-Guinier scattering Inputs: ------- ``q``: independent variable ``a``: factor of the power-law branch ``alpha``: power-law exponent ``Rg``: radius of gyration Formula: -------- ``G * exp(-q^2*Rg^2/3)`` if ``q>q_sep`` and ``a*q^alpha`` otherwise. ...
[ "Empirical", "Porod", "-", "Guinier", "scattering" ]
train
https://github.com/awacha/sastool/blob/deaddfa3002f3f6818697e36139633b7e30427a3/sastool/fitting/fitfunctions/sasbasic.py#L109-L130
awacha/sastool
sastool/fitting/fitfunctions/sasbasic.py
PorodGuinierPorod
def PorodGuinierPorod(q, a, alpha, Rg, beta): """Empirical Porod-Guinier-Porod scattering Inputs: ------- ``q``: independent variable ``a``: factor of the first power-law branch ``alpha``: exponent of the first power-law branch ``Rg``: radius of gyration ``beta``: ex...
python
def PorodGuinierPorod(q, a, alpha, Rg, beta): """Empirical Porod-Guinier-Porod scattering Inputs: ------- ``q``: independent variable ``a``: factor of the first power-law branch ``alpha``: exponent of the first power-law branch ``Rg``: radius of gyration ``beta``: ex...
[ "def", "PorodGuinierPorod", "(", "q", ",", "a", ",", "alpha", ",", "Rg", ",", "beta", ")", ":", "return", "PorodGuinierMulti", "(", "q", ",", "a", ",", "alpha", ",", "Rg", ",", "beta", ")" ]
Empirical Porod-Guinier-Porod scattering Inputs: ------- ``q``: independent variable ``a``: factor of the first power-law branch ``alpha``: exponent of the first power-law branch ``Rg``: radius of gyration ``beta``: exponent of the second power-law branch Formula: ...
[ "Empirical", "Porod", "-", "Guinier", "-", "Porod", "scattering" ]
train
https://github.com/awacha/sastool/blob/deaddfa3002f3f6818697e36139633b7e30427a3/sastool/fitting/fitfunctions/sasbasic.py#L132-L155
awacha/sastool
sastool/fitting/fitfunctions/sasbasic.py
GuinierPorodGuinier
def GuinierPorodGuinier(q, G, Rg1, alpha, Rg2): """Empirical Guinier-Porod-Guinier scattering Inputs: ------- ``q``: independent variable ``G``: factor for the first Guinier-branch ``Rg1``: the first radius of gyration ``alpha``: the power-law exponent ``Rg2``: the s...
python
def GuinierPorodGuinier(q, G, Rg1, alpha, Rg2): """Empirical Guinier-Porod-Guinier scattering Inputs: ------- ``q``: independent variable ``G``: factor for the first Guinier-branch ``Rg1``: the first radius of gyration ``alpha``: the power-law exponent ``Rg2``: the s...
[ "def", "GuinierPorodGuinier", "(", "q", ",", "G", ",", "Rg1", ",", "alpha", ",", "Rg2", ")", ":", "return", "GuinierPorodMulti", "(", "q", ",", "G", ",", "Rg1", ",", "alpha", ",", "Rg2", ")" ]
Empirical Guinier-Porod-Guinier scattering Inputs: ------- ``q``: independent variable ``G``: factor for the first Guinier-branch ``Rg1``: the first radius of gyration ``alpha``: the power-law exponent ``Rg2``: the second radius of gyration Formula: -------- ...
[ "Empirical", "Guinier", "-", "Porod", "-", "Guinier", "scattering" ]
train
https://github.com/awacha/sastool/blob/deaddfa3002f3f6818697e36139633b7e30427a3/sastool/fitting/fitfunctions/sasbasic.py#L157-L182
awacha/sastool
sastool/fitting/fitfunctions/sasbasic.py
DampedPowerlaw
def DampedPowerlaw(q, a, alpha, sigma): """Damped power-law Inputs: ------- ``q``: independent variable ``a``: factor ``alpha``: exponent ``sigma``: hwhm of the damping Gaussian Formula: -------- ``a*q^alpha*exp(-q^2/(2*sigma^2))`` """ return a * q *...
python
def DampedPowerlaw(q, a, alpha, sigma): """Damped power-law Inputs: ------- ``q``: independent variable ``a``: factor ``alpha``: exponent ``sigma``: hwhm of the damping Gaussian Formula: -------- ``a*q^alpha*exp(-q^2/(2*sigma^2))`` """ return a * q *...
[ "def", "DampedPowerlaw", "(", "q", ",", "a", ",", "alpha", ",", "sigma", ")", ":", "return", "a", "*", "q", "**", "alpha", "*", "np", ".", "exp", "(", "-", "q", "**", "2", "/", "(", "2", "*", "sigma", "**", "2", ")", ")" ]
Damped power-law Inputs: ------- ``q``: independent variable ``a``: factor ``alpha``: exponent ``sigma``: hwhm of the damping Gaussian Formula: -------- ``a*q^alpha*exp(-q^2/(2*sigma^2))``
[ "Damped", "power", "-", "law" ]
train
https://github.com/awacha/sastool/blob/deaddfa3002f3f6818697e36139633b7e30427a3/sastool/fitting/fitfunctions/sasbasic.py#L185-L199
awacha/sastool
sastool/fitting/fitfunctions/sasbasic.py
LogNormSpheres
def LogNormSpheres(q, A, mu, sigma, N=1000): """Scattering of a population of non-correlated spheres (radii from a log-normal distribution) Inputs: ------- ``q``: independent variable ``A``: scaling factor ``mu``: expectation of ``ln(R)`` ``sigma``: hwhm of ``ln(R)`` No...
python
def LogNormSpheres(q, A, mu, sigma, N=1000): """Scattering of a population of non-correlated spheres (radii from a log-normal distribution) Inputs: ------- ``q``: independent variable ``A``: scaling factor ``mu``: expectation of ``ln(R)`` ``sigma``: hwhm of ``ln(R)`` No...
[ "def", "LogNormSpheres", "(", "q", ",", "A", ",", "mu", ",", "sigma", ",", "N", "=", "1000", ")", ":", "Rmin", "=", "0", "Rmax", "=", "np", ".", "exp", "(", "mu", "+", "3", "*", "sigma", ")", "R", "=", "np", ".", "linspace", "(", "Rmin", ",...
Scattering of a population of non-correlated spheres (radii from a log-normal distribution) Inputs: ------- ``q``: independent variable ``A``: scaling factor ``mu``: expectation of ``ln(R)`` ``sigma``: hwhm of ``ln(R)`` Non-fittable inputs: -------------------- ...
[ "Scattering", "of", "a", "population", "of", "non", "-", "correlated", "spheres", "(", "radii", "from", "a", "log", "-", "normal", "distribution", ")" ]
train
https://github.com/awacha/sastool/blob/deaddfa3002f3f6818697e36139633b7e30427a3/sastool/fitting/fitfunctions/sasbasic.py#L201-L230
awacha/sastool
sastool/fitting/fitfunctions/sasbasic.py
GaussSpheres
def GaussSpheres(q, A, R0, sigma, N=1000, weighting='intensity'): """Scattering of a population of non-correlated spheres (radii from a gaussian distribution) Inputs: ------- ``q``: independent variable ``A``: scaling factor ``R0``: expectation of ``R`` ``sigma``: hwhm of ``...
python
def GaussSpheres(q, A, R0, sigma, N=1000, weighting='intensity'): """Scattering of a population of non-correlated spheres (radii from a gaussian distribution) Inputs: ------- ``q``: independent variable ``A``: scaling factor ``R0``: expectation of ``R`` ``sigma``: hwhm of ``...
[ "def", "GaussSpheres", "(", "q", ",", "A", ",", "R0", ",", "sigma", ",", "N", "=", "1000", ",", "weighting", "=", "'intensity'", ")", ":", "Rmin", "=", "max", "(", "0", ",", "R0", "-", "3", "*", "sigma", ")", "Rmax", "=", "R0", "+", "3", "*",...
Scattering of a population of non-correlated spheres (radii from a gaussian distribution) Inputs: ------- ``q``: independent variable ``A``: scaling factor ``R0``: expectation of ``R`` ``sigma``: hwhm of ``R`` ``weighting``: 'intensity' (default), 'volume' or 'number' ...
[ "Scattering", "of", "a", "population", "of", "non", "-", "correlated", "spheres", "(", "radii", "from", "a", "gaussian", "distribution", ")" ]
train
https://github.com/awacha/sastool/blob/deaddfa3002f3f6818697e36139633b7e30427a3/sastool/fitting/fitfunctions/sasbasic.py#L232-L270
awacha/sastool
sastool/fitting/fitfunctions/sasbasic.py
PowerlawGuinierPorodConst
def PowerlawGuinierPorodConst(q, A, alpha, G, Rg, beta, C): """Sum of a Power-law, a Guinier-Porod curve and a constant. Inputs: ------- ``q``: independent variable (momentum transfer) ``A``: scaling factor of the power-law ``alpha``: power-law exponent ``G``: scaling factor...
python
def PowerlawGuinierPorodConst(q, A, alpha, G, Rg, beta, C): """Sum of a Power-law, a Guinier-Porod curve and a constant. Inputs: ------- ``q``: independent variable (momentum transfer) ``A``: scaling factor of the power-law ``alpha``: power-law exponent ``G``: scaling factor...
[ "def", "PowerlawGuinierPorodConst", "(", "q", ",", "A", ",", "alpha", ",", "G", ",", "Rg", ",", "beta", ",", "C", ")", ":", "return", "PowerlawPlusConstant", "(", "q", ",", "A", ",", "alpha", ",", "C", ")", "+", "GuinierPorod", "(", "q", ",", "G", ...
Sum of a Power-law, a Guinier-Porod curve and a constant. Inputs: ------- ``q``: independent variable (momentum transfer) ``A``: scaling factor of the power-law ``alpha``: power-law exponent ``G``: scaling factor of the Guinier-Porod curve ``Rg``: Radius of gyration ...
[ "Sum", "of", "a", "Power", "-", "law", "a", "Guinier", "-", "Porod", "curve", "and", "a", "constant", "." ]
train
https://github.com/awacha/sastool/blob/deaddfa3002f3f6818697e36139633b7e30427a3/sastool/fitting/fitfunctions/sasbasic.py#L273-L290
awacha/sastool
sastool/fitting/fitfunctions/sasbasic.py
GuinierPorodMulti
def GuinierPorodMulti(q, G, *Rgsalphas): """Empirical multi-part Guinier-Porod scattering Inputs: ------- ``q``: independent variable ``G``: factor for the first Guinier-branch other arguments: [Rg1, alpha1, Rg2, alpha2, Rg3 ...] the radii of gyration and power-law exponents...
python
def GuinierPorodMulti(q, G, *Rgsalphas): """Empirical multi-part Guinier-Porod scattering Inputs: ------- ``q``: independent variable ``G``: factor for the first Guinier-branch other arguments: [Rg1, alpha1, Rg2, alpha2, Rg3 ...] the radii of gyration and power-law exponents...
[ "def", "GuinierPorodMulti", "(", "q", ",", "G", ",", "*", "Rgsalphas", ")", ":", "scalefactor", "=", "G", "funcs", "=", "[", "lambda", "q", ":", "Guinier", "(", "q", ",", "G", ",", "Rgsalphas", "[", "0", "]", ")", "]", "indices", "=", "np", ".", ...
Empirical multi-part Guinier-Porod scattering Inputs: ------- ``q``: independent variable ``G``: factor for the first Guinier-branch other arguments: [Rg1, alpha1, Rg2, alpha2, Rg3 ...] the radii of gyration and power-law exponents of the consecutive parts Formula: ----...
[ "Empirical", "multi", "-", "part", "Guinier", "-", "Porod", "scattering" ]
train
https://github.com/awacha/sastool/blob/deaddfa3002f3f6818697e36139633b7e30427a3/sastool/fitting/fitfunctions/sasbasic.py#L320-L364
awacha/sastool
sastool/fitting/fitfunctions/sasbasic.py
PorodGuinierMulti
def PorodGuinierMulti(q, A, *alphasRgs): """Empirical multi-part Porod-Guinier scattering Inputs: ------- ``q``: independent variable ``A``: factor for the first Power-law-branch other arguments: [alpha1, Rg1, alpha2, Rg2, alpha3 ...] the radii of gyration and power-law expo...
python
def PorodGuinierMulti(q, A, *alphasRgs): """Empirical multi-part Porod-Guinier scattering Inputs: ------- ``q``: independent variable ``A``: factor for the first Power-law-branch other arguments: [alpha1, Rg1, alpha2, Rg2, alpha3 ...] the radii of gyration and power-law expo...
[ "def", "PorodGuinierMulti", "(", "q", ",", "A", ",", "*", "alphasRgs", ")", ":", "scalefactor", "=", "A", "funcs", "=", "[", "lambda", "q", ":", "Powerlaw", "(", "q", ",", "A", ",", "alphasRgs", "[", "0", "]", ")", "]", "indices", "=", "np", ".",...
Empirical multi-part Porod-Guinier scattering Inputs: ------- ``q``: independent variable ``A``: factor for the first Power-law-branch other arguments: [alpha1, Rg1, alpha2, Rg2, alpha3 ...] the radii of gyration and power-law exponents of the consecutive parts Formula: ...
[ "Empirical", "multi", "-", "part", "Porod", "-", "Guinier", "scattering" ]
train
https://github.com/awacha/sastool/blob/deaddfa3002f3f6818697e36139633b7e30427a3/sastool/fitting/fitfunctions/sasbasic.py#L366-L410
awacha/sastool
sastool/fitting/fitfunctions/sasbasic.py
GeneralGuinierPorod
def GeneralGuinierPorod(q, factor, *args, **kwargs): """Empirical generalized multi-part Guinier-Porod scattering Inputs: ------- ``q``: independent variable ``factor``: factor for the first branch other arguments (*args): the defining arguments of the consecutive parts...
python
def GeneralGuinierPorod(q, factor, *args, **kwargs): """Empirical generalized multi-part Guinier-Porod scattering Inputs: ------- ``q``: independent variable ``factor``: factor for the first branch other arguments (*args): the defining arguments of the consecutive parts...
[ "def", "GeneralGuinierPorod", "(", "q", ",", "factor", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "kwargs", ".", "get", "(", "'startswithguinier'", ",", "True", ")", ":", "funcs", "=", "[", "lambda", "q", ",", "A", "=", "factor", ":...
Empirical generalized multi-part Guinier-Porod scattering Inputs: ------- ``q``: independent variable ``factor``: factor for the first branch other arguments (*args): the defining arguments of the consecutive parts: radius of gyration (``Rg``) and dimensionality ...
[ "Empirical", "generalized", "multi", "-", "part", "Guinier", "-", "Porod", "scattering" ]
train
https://github.com/awacha/sastool/blob/deaddfa3002f3f6818697e36139633b7e30427a3/sastool/fitting/fitfunctions/sasbasic.py#L412-L472
awacha/sastool
sastool/fitting/fitfunctions/saspolymer.py
DebyeChain
def DebyeChain(q, Rg): """Scattering form-factor intensity of a Gaussian chain (Debye) Inputs: ------- ``q``: independent variable ``Rg``: radius of gyration Formula: -------- ``2*(exp(-a)-1+a)/a^2`` where ``a=(q*Rg)^2`` """ a = (q * Rg) ** 2 return 2 * (np.exp(...
python
def DebyeChain(q, Rg): """Scattering form-factor intensity of a Gaussian chain (Debye) Inputs: ------- ``q``: independent variable ``Rg``: radius of gyration Formula: -------- ``2*(exp(-a)-1+a)/a^2`` where ``a=(q*Rg)^2`` """ a = (q * Rg) ** 2 return 2 * (np.exp(...
[ "def", "DebyeChain", "(", "q", ",", "Rg", ")", ":", "a", "=", "(", "q", "*", "Rg", ")", "**", "2", "return", "2", "*", "(", "np", ".", "exp", "(", "-", "a", ")", "-", "1", "+", "a", ")", "/", "a", "**", "2" ]
Scattering form-factor intensity of a Gaussian chain (Debye) Inputs: ------- ``q``: independent variable ``Rg``: radius of gyration Formula: -------- ``2*(exp(-a)-1+a)/a^2`` where ``a=(q*Rg)^2``
[ "Scattering", "form", "-", "factor", "intensity", "of", "a", "Gaussian", "chain", "(", "Debye", ")" ]
train
https://github.com/awacha/sastool/blob/deaddfa3002f3f6818697e36139633b7e30427a3/sastool/fitting/fitfunctions/saspolymer.py#L6-L19
awacha/sastool
sastool/fitting/fitfunctions/saspolymer.py
ExcludedVolumeChain
def ExcludedVolumeChain(q, Rg, nu): """Scattering intensity of a generalized excluded-volume Gaussian chain Inputs: ------- ``q``: independent variable ``Rg``: radius of gyration ``nu``: excluded volume exponent Formula: -------- ``(u^(1/nu)*gamma(0.5/nu)*gammainc_l...
python
def ExcludedVolumeChain(q, Rg, nu): """Scattering intensity of a generalized excluded-volume Gaussian chain Inputs: ------- ``q``: independent variable ``Rg``: radius of gyration ``nu``: excluded volume exponent Formula: -------- ``(u^(1/nu)*gamma(0.5/nu)*gammainc_l...
[ "def", "ExcludedVolumeChain", "(", "q", ",", "Rg", ",", "nu", ")", ":", "u", "=", "(", "q", "*", "Rg", ")", "**", "2", "*", "(", "2", "*", "nu", "+", "1", ")", "*", "(", "2", "*", "nu", "+", "2", ")", "/", "6.", "return", "(", "u", "**"...
Scattering intensity of a generalized excluded-volume Gaussian chain Inputs: ------- ``q``: independent variable ``Rg``: radius of gyration ``nu``: excluded volume exponent Formula: -------- ``(u^(1/nu)*gamma(0.5/nu)*gammainc_lower(0.5/nu,u)- gamma(1/nu)*gam...
[ "Scattering", "intensity", "of", "a", "generalized", "excluded", "-", "volume", "Gaussian", "chain" ]
train
https://github.com/awacha/sastool/blob/deaddfa3002f3f6818697e36139633b7e30427a3/sastool/fitting/fitfunctions/saspolymer.py#L21-L44
awacha/sastool
sastool/fitting/fitfunctions/saspolymer.py
BorueErukhimovich
def BorueErukhimovich(q, C, r0, s, t): """Borue-Erukhimovich model of microphase separation in polyelectrolytes Inputs: ------- ``q``: independent variable ``C``: scaling factor ``r0``: typical el.stat. screening length ``s``: dimensionless charge concentration ``t``...
python
def BorueErukhimovich(q, C, r0, s, t): """Borue-Erukhimovich model of microphase separation in polyelectrolytes Inputs: ------- ``q``: independent variable ``C``: scaling factor ``r0``: typical el.stat. screening length ``s``: dimensionless charge concentration ``t``...
[ "def", "BorueErukhimovich", "(", "q", ",", "C", ",", "r0", ",", "s", ",", "t", ")", ":", "x", "=", "q", "*", "r0", "return", "C", "*", "(", "x", "**", "2", "+", "s", ")", "/", "(", "(", "x", "**", "2", "+", "s", ")", "*", "(", "x", "*...
Borue-Erukhimovich model of microphase separation in polyelectrolytes Inputs: ------- ``q``: independent variable ``C``: scaling factor ``r0``: typical el.stat. screening length ``s``: dimensionless charge concentration ``t``: dimensionless temperature Formula: ...
[ "Borue", "-", "Erukhimovich", "model", "of", "microphase", "separation", "in", "polyelectrolytes" ]
train
https://github.com/awacha/sastool/blob/deaddfa3002f3f6818697e36139633b7e30427a3/sastool/fitting/fitfunctions/saspolymer.py#L46-L69
awacha/sastool
sastool/fitting/fitfunctions/saspolymer.py
BorueErukhimovich_Powerlaw
def BorueErukhimovich_Powerlaw(q, C, r0, s, t, nu): """Borue-Erukhimovich model ending in a power-law. Inputs: ------- ``q``: independent variable ``C``: scaling factor ``r0``: typical el.stat. screening length ``s``: dimensionless charge concentration ``t``: dimensi...
python
def BorueErukhimovich_Powerlaw(q, C, r0, s, t, nu): """Borue-Erukhimovich model ending in a power-law. Inputs: ------- ``q``: independent variable ``C``: scaling factor ``r0``: typical el.stat. screening length ``s``: dimensionless charge concentration ``t``: dimensi...
[ "def", "BorueErukhimovich_Powerlaw", "(", "q", ",", "C", ",", "r0", ",", "s", ",", "t", ",", "nu", ")", ":", "def", "get_xsep", "(", "alpha", ",", "s", ",", "t", ")", ":", "A", "=", "alpha", "+", "2", "B", "=", "2", "*", "s", "*", "alpha", ...
Borue-Erukhimovich model ending in a power-law. Inputs: ------- ``q``: independent variable ``C``: scaling factor ``r0``: typical el.stat. screening length ``s``: dimensionless charge concentration ``t``: dimensionless temperature ``nu``: excluded volume paramete...
[ "Borue", "-", "Erukhimovich", "model", "ending", "in", "a", "power", "-", "law", "." ]
train
https://github.com/awacha/sastool/blob/deaddfa3002f3f6818697e36139633b7e30427a3/sastool/fitting/fitfunctions/saspolymer.py#L71-L104
bmcfee/pumpp
pumpp/sampler.py
Sampler.sample
def sample(self, data, interval): '''Sample a patch from the data object Parameters ---------- data : dict A data dict as produced by pumpp.Pump.transform interval : slice The time interval to sample Returns ------- data_slice : ...
python
def sample(self, data, interval): '''Sample a patch from the data object Parameters ---------- data : dict A data dict as produced by pumpp.Pump.transform interval : slice The time interval to sample Returns ------- data_slice : ...
[ "def", "sample", "(", "self", ",", "data", ",", "interval", ")", ":", "data_slice", "=", "dict", "(", ")", "for", "key", "in", "data", ":", "if", "'_valid'", "in", "key", ":", "continue", "index", "=", "[", "slice", "(", "None", ")", "]", "*", "d...
Sample a patch from the data object Parameters ---------- data : dict A data dict as produced by pumpp.Pump.transform interval : slice The time interval to sample Returns ------- data_slice : dict `data` restricted to `interv...
[ "Sample", "a", "patch", "from", "the", "data", "object" ]
train
https://github.com/bmcfee/pumpp/blob/06a17b888271dd1f6cd41bddb22b0eb04d494056/pumpp/sampler.py#L87-L120
bmcfee/pumpp
pumpp/sampler.py
Sampler.indices
def indices(self, data): '''Generate patch indices Parameters ---------- data : dict of np.ndarray As produced by pumpp.transform Yields ------ start : int >= 0 The start index of a sample patch ''' duration = self.data_du...
python
def indices(self, data): '''Generate patch indices Parameters ---------- data : dict of np.ndarray As produced by pumpp.transform Yields ------ start : int >= 0 The start index of a sample patch ''' duration = self.data_du...
[ "def", "indices", "(", "self", ",", "data", ")", ":", "duration", "=", "self", ".", "data_duration", "(", "data", ")", "if", "self", ".", "duration", ">", "duration", ":", "raise", "DataError", "(", "'Data duration={} is less than '", "'sample duration={}'", "...
Generate patch indices Parameters ---------- data : dict of np.ndarray As produced by pumpp.transform Yields ------ start : int >= 0 The start index of a sample patch
[ "Generate", "patch", "indices" ]
train
https://github.com/bmcfee/pumpp/blob/06a17b888271dd1f6cd41bddb22b0eb04d494056/pumpp/sampler.py#L122-L143
bmcfee/pumpp
pumpp/sampler.py
SequentialSampler.indices
def indices(self, data): '''Generate patch start indices Parameters ---------- data : dict of np.ndarray As produced by pumpp.transform Yields ------ start : int >= 0 The start index of a sample patch ''' duration = self.d...
python
def indices(self, data): '''Generate patch start indices Parameters ---------- data : dict of np.ndarray As produced by pumpp.transform Yields ------ start : int >= 0 The start index of a sample patch ''' duration = self.d...
[ "def", "indices", "(", "self", ",", "data", ")", ":", "duration", "=", "self", ".", "data_duration", "(", "data", ")", "for", "start", "in", "range", "(", "0", ",", "duration", "-", "self", ".", "duration", ",", "self", ".", "stride", ")", ":", "yi...
Generate patch start indices Parameters ---------- data : dict of np.ndarray As produced by pumpp.transform Yields ------ start : int >= 0 The start index of a sample patch
[ "Generate", "patch", "start", "indices" ]
train
https://github.com/bmcfee/pumpp/blob/06a17b888271dd1f6cd41bddb22b0eb04d494056/pumpp/sampler.py#L210-L226
bmcfee/pumpp
pumpp/sampler.py
VariableLengthSampler.indices
def indices(self, data): '''Generate patch indices Parameters ---------- data : dict of np.ndarray As produced by pumpp.transform Yields ------ start : int >= 0 The start index of a sample patch ''' duration = self.data_du...
python
def indices(self, data): '''Generate patch indices Parameters ---------- data : dict of np.ndarray As produced by pumpp.transform Yields ------ start : int >= 0 The start index of a sample patch ''' duration = self.data_du...
[ "def", "indices", "(", "self", ",", "data", ")", ":", "duration", "=", "self", ".", "data_duration", "(", "data", ")", "while", "True", ":", "# Generate a sampling interval", "yield", "self", ".", "rng", ".", "randint", "(", "0", ",", "duration", "-", "s...
Generate patch indices Parameters ---------- data : dict of np.ndarray As produced by pumpp.transform Yields ------ start : int >= 0 The start index of a sample patch
[ "Generate", "patch", "indices" ]
train
https://github.com/bmcfee/pumpp/blob/06a17b888271dd1f6cd41bddb22b0eb04d494056/pumpp/sampler.py#L279-L296
bmcfee/pumpp
pumpp/base.py
Scope.scope
def scope(self, key): '''Apply the name scope to a key Parameters ---------- key : string Returns ------- `name/key` if `name` is not `None`; otherwise, `key`. ''' if self.name is None: return key return '{:s}/{:s}'.fo...
python
def scope(self, key): '''Apply the name scope to a key Parameters ---------- key : string Returns ------- `name/key` if `name` is not `None`; otherwise, `key`. ''' if self.name is None: return key return '{:s}/{:s}'.fo...
[ "def", "scope", "(", "self", ",", "key", ")", ":", "if", "self", ".", "name", "is", "None", ":", "return", "key", "return", "'{:s}/{:s}'", ".", "format", "(", "self", ".", "name", ",", "key", ")" ]
Apply the name scope to a key Parameters ---------- key : string Returns ------- `name/key` if `name` is not `None`; otherwise, `key`.
[ "Apply", "the", "name", "scope", "to", "a", "key" ]
train
https://github.com/bmcfee/pumpp/blob/06a17b888271dd1f6cd41bddb22b0eb04d494056/pumpp/base.py#L36-L50
bmcfee/pumpp
pumpp/base.py
Scope.register
def register(self, field, shape, dtype): '''Register a field as a tensor with specified shape and type. A `Tensor` of the given shape and type will be registered in this object's `fields` dict. Parameters ---------- field : str The name of the field ...
python
def register(self, field, shape, dtype): '''Register a field as a tensor with specified shape and type. A `Tensor` of the given shape and type will be registered in this object's `fields` dict. Parameters ---------- field : str The name of the field ...
[ "def", "register", "(", "self", ",", "field", ",", "shape", ",", "dtype", ")", ":", "if", "not", "isinstance", "(", "dtype", ",", "type", ")", ":", "raise", "ParameterError", "(", "'dtype={} must be a type'", ".", "format", "(", "dtype", ")", ")", "if", ...
Register a field as a tensor with specified shape and type. A `Tensor` of the given shape and type will be registered in this object's `fields` dict. Parameters ---------- field : str The name of the field shape : iterable of `int` or `None` The...
[ "Register", "a", "field", "as", "a", "tensor", "with", "specified", "shape", "and", "type", "." ]
train
https://github.com/bmcfee/pumpp/blob/06a17b888271dd1f6cd41bddb22b0eb04d494056/pumpp/base.py#L52-L84
bmcfee/pumpp
pumpp/base.py
Scope.merge
def merge(self, data): '''Merge an array of output dictionaries into a single dictionary with properly scoped names. Parameters ---------- data : list of dict Output dicts as produced by `pumpp.task.BaseTaskTransformer.transform` or `pumpp.feature.Feature...
python
def merge(self, data): '''Merge an array of output dictionaries into a single dictionary with properly scoped names. Parameters ---------- data : list of dict Output dicts as produced by `pumpp.task.BaseTaskTransformer.transform` or `pumpp.feature.Feature...
[ "def", "merge", "(", "self", ",", "data", ")", ":", "data_out", "=", "dict", "(", ")", "# Iterate over all keys in data", "for", "key", "in", "set", "(", ")", ".", "union", "(", "*", "data", ")", ":", "data_out", "[", "self", ".", "scope", "(", "key"...
Merge an array of output dictionaries into a single dictionary with properly scoped names. Parameters ---------- data : list of dict Output dicts as produced by `pumpp.task.BaseTaskTransformer.transform` or `pumpp.feature.FeatureExtractor.transform`. Ret...
[ "Merge", "an", "array", "of", "output", "dictionaries", "into", "a", "single", "dictionary", "with", "properly", "scoped", "names", "." ]
train
https://github.com/bmcfee/pumpp/blob/06a17b888271dd1f6cd41bddb22b0eb04d494056/pumpp/base.py#L89-L111
bmcfee/pumpp
pumpp/base.py
Slicer.add
def add(self, operator): '''Add an operator to the Slicer Parameters ---------- operator : Scope (TaskTransformer or FeatureExtractor) The new operator to add ''' if not isinstance(operator, Scope): raise ParameterError('Operator {} must be a Task...
python
def add(self, operator): '''Add an operator to the Slicer Parameters ---------- operator : Scope (TaskTransformer or FeatureExtractor) The new operator to add ''' if not isinstance(operator, Scope): raise ParameterError('Operator {} must be a Task...
[ "def", "add", "(", "self", ",", "operator", ")", ":", "if", "not", "isinstance", "(", "operator", ",", "Scope", ")", ":", "raise", "ParameterError", "(", "'Operator {} must be a TaskTransformer '", "'or FeatureExtractor'", ".", "format", "(", "operator", ")", ")...
Add an operator to the Slicer Parameters ---------- operator : Scope (TaskTransformer or FeatureExtractor) The new operator to add
[ "Add", "an", "operator", "to", "the", "Slicer" ]
train
https://github.com/bmcfee/pumpp/blob/06a17b888271dd1f6cd41bddb22b0eb04d494056/pumpp/base.py#L132-L148
bmcfee/pumpp
pumpp/base.py
Slicer.data_duration
def data_duration(self, data): '''Compute the valid data duration of a dict Parameters ---------- data : dict As produced by pumpp.transform Returns ------- length : int The minimum temporal extent of a dynamic observation in data ...
python
def data_duration(self, data): '''Compute the valid data duration of a dict Parameters ---------- data : dict As produced by pumpp.transform Returns ------- length : int The minimum temporal extent of a dynamic observation in data ...
[ "def", "data_duration", "(", "self", ",", "data", ")", ":", "# Find all the time-like indices of the data", "lengths", "=", "[", "]", "for", "key", "in", "self", ".", "_time", ":", "for", "idx", "in", "self", ".", "_time", ".", "get", "(", "key", ",", "[...
Compute the valid data duration of a dict Parameters ---------- data : dict As produced by pumpp.transform Returns ------- length : int The minimum temporal extent of a dynamic observation in data
[ "Compute", "the", "valid", "data", "duration", "of", "a", "dict" ]
train
https://github.com/bmcfee/pumpp/blob/06a17b888271dd1f6cd41bddb22b0eb04d494056/pumpp/base.py#L150-L169
bmcfee/pumpp
pumpp/base.py
Slicer.crop
def crop(self, data): '''Crop a data dictionary down to its common time Parameters ---------- data : dict As produced by pumpp.transform Returns ------- data_cropped : dict Like `data` but with all time-like axes truncated to the ...
python
def crop(self, data): '''Crop a data dictionary down to its common time Parameters ---------- data : dict As produced by pumpp.transform Returns ------- data_cropped : dict Like `data` but with all time-like axes truncated to the ...
[ "def", "crop", "(", "self", ",", "data", ")", ":", "duration", "=", "self", ".", "data_duration", "(", "data", ")", "data_out", "=", "dict", "(", ")", "for", "key", "in", "data", ":", "idx", "=", "[", "slice", "(", "None", ")", "]", "*", "data", ...
Crop a data dictionary down to its common time Parameters ---------- data : dict As produced by pumpp.transform Returns ------- data_cropped : dict Like `data` but with all time-like axes truncated to the minimum common duration
[ "Crop", "a", "data", "dictionary", "down", "to", "its", "common", "time" ]
train
https://github.com/bmcfee/pumpp/blob/06a17b888271dd1f6cd41bddb22b0eb04d494056/pumpp/base.py#L171-L194
bmcfee/pumpp
pumpp/feature/mel.py
Mel.transform_audio
def transform_audio(self, y): '''Compute the Mel spectrogram Parameters ---------- y : np.ndarray The audio buffer Returns ------- data : dict data['mag'] : np.ndarray, shape=(n_frames, n_mels) The Mel spectrogram ...
python
def transform_audio(self, y): '''Compute the Mel spectrogram Parameters ---------- y : np.ndarray The audio buffer Returns ------- data : dict data['mag'] : np.ndarray, shape=(n_frames, n_mels) The Mel spectrogram ...
[ "def", "transform_audio", "(", "self", ",", "y", ")", ":", "n_frames", "=", "self", ".", "n_frames", "(", "get_duration", "(", "y", "=", "y", ",", "sr", "=", "self", ".", "sr", ")", ")", "mel", "=", "np", ".", "sqrt", "(", "melspectrogram", "(", ...
Compute the Mel spectrogram Parameters ---------- y : np.ndarray The audio buffer Returns ------- data : dict data['mag'] : np.ndarray, shape=(n_frames, n_mels) The Mel spectrogram
[ "Compute", "the", "Mel", "spectrogram" ]
train
https://github.com/bmcfee/pumpp/blob/06a17b888271dd1f6cd41bddb22b0eb04d494056/pumpp/feature/mel.py#L54-L81
bmcfee/pumpp
pumpp/task/regression.py
VectorTransformer.empty
def empty(self, duration): '''Empty vector annotations. This returns an annotation with a single observation vector consisting of all-zeroes. Parameters ---------- duration : number >0 Length of the track Returns ------- ann : jams.A...
python
def empty(self, duration): '''Empty vector annotations. This returns an annotation with a single observation vector consisting of all-zeroes. Parameters ---------- duration : number >0 Length of the track Returns ------- ann : jams.A...
[ "def", "empty", "(", "self", ",", "duration", ")", ":", "ann", "=", "super", "(", "VectorTransformer", ",", "self", ")", ".", "empty", "(", "duration", ")", "ann", ".", "append", "(", "time", "=", "0", ",", "duration", "=", "duration", ",", "confiden...
Empty vector annotations. This returns an annotation with a single observation vector consisting of all-zeroes. Parameters ---------- duration : number >0 Length of the track Returns ------- ann : jams.Annotation The empty annota...
[ "Empty", "vector", "annotations", "." ]
train
https://github.com/bmcfee/pumpp/blob/06a17b888271dd1f6cd41bddb22b0eb04d494056/pumpp/task/regression.py#L42-L62
bmcfee/pumpp
pumpp/task/regression.py
VectorTransformer.transform_annotation
def transform_annotation(self, ann, duration): '''Apply the vector transformation. Parameters ---------- ann : jams.Annotation The input annotation duration : number > 0 The duration of the track Returns ------- data : dict ...
python
def transform_annotation(self, ann, duration): '''Apply the vector transformation. Parameters ---------- ann : jams.Annotation The input annotation duration : number > 0 The duration of the track Returns ------- data : dict ...
[ "def", "transform_annotation", "(", "self", ",", "ann", ",", "duration", ")", ":", "_", ",", "values", "=", "ann", ".", "to_interval_values", "(", ")", "vector", "=", "np", ".", "asarray", "(", "values", "[", "0", "]", ",", "dtype", "=", "self", ".",...
Apply the vector transformation. Parameters ---------- ann : jams.Annotation The input annotation duration : number > 0 The duration of the track Returns ------- data : dict data['vector'] : np.ndarray, shape=(dimension,) ...
[ "Apply", "the", "vector", "transformation", "." ]
train
https://github.com/bmcfee/pumpp/blob/06a17b888271dd1f6cd41bddb22b0eb04d494056/pumpp/task/regression.py#L64-L92
bmcfee/pumpp
pumpp/task/regression.py
VectorTransformer.inverse
def inverse(self, vector, duration=None): '''Inverse vector transformer''' ann = jams.Annotation(namespace=self.namespace, duration=duration) if duration is None: duration = 0 ann.append(time=0, duration=duration, value=vector) return ann
python
def inverse(self, vector, duration=None): '''Inverse vector transformer''' ann = jams.Annotation(namespace=self.namespace, duration=duration) if duration is None: duration = 0 ann.append(time=0, duration=duration, value=vector) return ann
[ "def", "inverse", "(", "self", ",", "vector", ",", "duration", "=", "None", ")", ":", "ann", "=", "jams", ".", "Annotation", "(", "namespace", "=", "self", ".", "namespace", ",", "duration", "=", "duration", ")", "if", "duration", "is", "None", ":", ...
Inverse vector transformer
[ "Inverse", "vector", "transformer" ]
train
https://github.com/bmcfee/pumpp/blob/06a17b888271dd1f6cd41bddb22b0eb04d494056/pumpp/task/regression.py#L94-L103
bmcfee/pumpp
pumpp/task/tags.py
DynamicLabelTransformer.set_transition
def set_transition(self, p_self): '''Set the transition matrix according to self-loop probabilities. Parameters ---------- p_self : None, float in (0, 1), or np.ndarray [shape=(n_labels,)] Optional self-loop probability(ies), used for Viterbi decoding ''' if ...
python
def set_transition(self, p_self): '''Set the transition matrix according to self-loop probabilities. Parameters ---------- p_self : None, float in (0, 1), or np.ndarray [shape=(n_labels,)] Optional self-loop probability(ies), used for Viterbi decoding ''' if ...
[ "def", "set_transition", "(", "self", ",", "p_self", ")", ":", "if", "p_self", "is", "None", ":", "self", ".", "transition", "=", "None", "else", ":", "self", ".", "transition", "=", "np", ".", "empty", "(", "(", "len", "(", "self", ".", "_classes", ...
Set the transition matrix according to self-loop probabilities. Parameters ---------- p_self : None, float in (0, 1), or np.ndarray [shape=(n_labels,)] Optional self-loop probability(ies), used for Viterbi decoding
[ "Set", "the", "transition", "matrix", "according", "to", "self", "-", "loop", "probabilities", "." ]
train
https://github.com/bmcfee/pumpp/blob/06a17b888271dd1f6cd41bddb22b0eb04d494056/pumpp/task/tags.py#L86-L104
bmcfee/pumpp
pumpp/task/tags.py
DynamicLabelTransformer.empty
def empty(self, duration): '''Empty label annotations. Constructs a single observation with an empty value (None). Parameters ---------- duration : number > 0 The duration of the annotation ''' ann = super(DynamicLabelTransformer, self).empty(duratio...
python
def empty(self, duration): '''Empty label annotations. Constructs a single observation with an empty value (None). Parameters ---------- duration : number > 0 The duration of the annotation ''' ann = super(DynamicLabelTransformer, self).empty(duratio...
[ "def", "empty", "(", "self", ",", "duration", ")", ":", "ann", "=", "super", "(", "DynamicLabelTransformer", ",", "self", ")", ".", "empty", "(", "duration", ")", "ann", ".", "append", "(", "time", "=", "0", ",", "duration", "=", "duration", ",", "va...
Empty label annotations. Constructs a single observation with an empty value (None). Parameters ---------- duration : number > 0 The duration of the annotation
[ "Empty", "label", "annotations", "." ]
train
https://github.com/bmcfee/pumpp/blob/06a17b888271dd1f6cd41bddb22b0eb04d494056/pumpp/task/tags.py#L106-L118
bmcfee/pumpp
pumpp/task/tags.py
DynamicLabelTransformer.transform_annotation
def transform_annotation(self, ann, duration): '''Transform an annotation to dynamic label encoding. Parameters ---------- ann : jams.Annotation The annotation to convert duration : number > 0 The duration of the track Returns ------- ...
python
def transform_annotation(self, ann, duration): '''Transform an annotation to dynamic label encoding. Parameters ---------- ann : jams.Annotation The annotation to convert duration : number > 0 The duration of the track Returns ------- ...
[ "def", "transform_annotation", "(", "self", ",", "ann", ",", "duration", ")", ":", "intervals", ",", "values", "=", "ann", ".", "to_interval_values", "(", ")", "# Suppress all intervals not in the encoder", "tags", "=", "[", "]", "for", "v", "in", "values", ":...
Transform an annotation to dynamic label encoding. Parameters ---------- ann : jams.Annotation The annotation to convert duration : number > 0 The duration of the track Returns ------- data : dict data['tags'] : np.ndarray, s...
[ "Transform", "an", "annotation", "to", "dynamic", "label", "encoding", "." ]
train
https://github.com/bmcfee/pumpp/blob/06a17b888271dd1f6cd41bddb22b0eb04d494056/pumpp/task/tags.py#L120-L150
bmcfee/pumpp
pumpp/task/tags.py
DynamicLabelTransformer.inverse
def inverse(self, encoded, duration=None): '''Inverse transformation''' ann = jams.Annotation(namespace=self.namespace, duration=duration) for start, end, value in self.decode_intervals(encoded, duration=duration, ...
python
def inverse(self, encoded, duration=None): '''Inverse transformation''' ann = jams.Annotation(namespace=self.namespace, duration=duration) for start, end, value in self.decode_intervals(encoded, duration=duration, ...
[ "def", "inverse", "(", "self", ",", "encoded", ",", "duration", "=", "None", ")", ":", "ann", "=", "jams", ".", "Annotation", "(", "namespace", "=", "self", ".", "namespace", ",", "duration", "=", "duration", ")", "for", "start", ",", "end", ",", "va...
Inverse transformation
[ "Inverse", "transformation" ]
train
https://github.com/bmcfee/pumpp/blob/06a17b888271dd1f6cd41bddb22b0eb04d494056/pumpp/task/tags.py#L152-L176
bmcfee/pumpp
pumpp/task/tags.py
StaticLabelTransformer.transform_annotation
def transform_annotation(self, ann, duration): '''Transform an annotation to static label encoding. Parameters ---------- ann : jams.Annotation The annotation to convert duration : number > 0 The duration of the track Returns ------- ...
python
def transform_annotation(self, ann, duration): '''Transform an annotation to static label encoding. Parameters ---------- ann : jams.Annotation The annotation to convert duration : number > 0 The duration of the track Returns ------- ...
[ "def", "transform_annotation", "(", "self", ",", "ann", ",", "duration", ")", ":", "intervals", "=", "np", ".", "asarray", "(", "[", "[", "0", ",", "1", "]", "]", ")", "values", "=", "list", "(", "[", "obs", ".", "value", "for", "obs", "in", "ann...
Transform an annotation to static label encoding. Parameters ---------- ann : jams.Annotation The annotation to convert duration : number > 0 The duration of the track Returns ------- data : dict data['tags'] : np.ndarray, sh...
[ "Transform", "an", "annotation", "to", "static", "label", "encoding", "." ]
train
https://github.com/bmcfee/pumpp/blob/06a17b888271dd1f6cd41bddb22b0eb04d494056/pumpp/task/tags.py#L214-L242
bmcfee/pumpp
pumpp/task/tags.py
StaticLabelTransformer.inverse
def inverse(self, encoded, duration=None): '''Inverse static tag transformation''' ann = jams.Annotation(namespace=self.namespace, duration=duration) if np.isrealobj(encoded): detected = (encoded >= 0.5) else: detected = encoded for vd in self.encoder.i...
python
def inverse(self, encoded, duration=None): '''Inverse static tag transformation''' ann = jams.Annotation(namespace=self.namespace, duration=duration) if np.isrealobj(encoded): detected = (encoded >= 0.5) else: detected = encoded for vd in self.encoder.i...
[ "def", "inverse", "(", "self", ",", "encoded", ",", "duration", "=", "None", ")", ":", "ann", "=", "jams", ".", "Annotation", "(", "namespace", "=", "self", ".", "namespace", ",", "duration", "=", "duration", ")", "if", "np", ".", "isrealobj", "(", "...
Inverse static tag transformation
[ "Inverse", "static", "tag", "transformation" ]
train
https://github.com/bmcfee/pumpp/blob/06a17b888271dd1f6cd41bddb22b0eb04d494056/pumpp/task/tags.py#L244-L260
bmcfee/pumpp
pumpp/feature/time.py
TimePosition.transform_audio
def transform_audio(self, y): '''Compute the time position encoding Parameters ---------- y : np.ndarray Audio buffer Returns ------- data : dict data['relative'] = np.ndarray, shape=(n_frames, 2) data['absolute'] = np.ndarray...
python
def transform_audio(self, y): '''Compute the time position encoding Parameters ---------- y : np.ndarray Audio buffer Returns ------- data : dict data['relative'] = np.ndarray, shape=(n_frames, 2) data['absolute'] = np.ndarray...
[ "def", "transform_audio", "(", "self", ",", "y", ")", ":", "duration", "=", "get_duration", "(", "y", "=", "y", ",", "sr", "=", "self", ".", "sr", ")", "n_frames", "=", "self", ".", "n_frames", "(", "duration", ")", "relative", "=", "np", ".", "zer...
Compute the time position encoding Parameters ---------- y : np.ndarray Audio buffer Returns ------- data : dict data['relative'] = np.ndarray, shape=(n_frames, 2) data['absolute'] = np.ndarray, shape=(n_frames, 2) Re...
[ "Compute", "the", "time", "position", "encoding" ]
train
https://github.com/bmcfee/pumpp/blob/06a17b888271dd1f6cd41bddb22b0eb04d494056/pumpp/feature/time.py#L34-L61
bmcfee/pumpp
pumpp/core.py
Pump.add
def add(self, operator): '''Add an operation to this pump. Parameters ---------- operator : BaseTaskTransformer, FeatureExtractor The operation to add Raises ------ ParameterError if `op` is not of a correct type ''' if no...
python
def add(self, operator): '''Add an operation to this pump. Parameters ---------- operator : BaseTaskTransformer, FeatureExtractor The operation to add Raises ------ ParameterError if `op` is not of a correct type ''' if no...
[ "def", "add", "(", "self", ",", "operator", ")", ":", "if", "not", "isinstance", "(", "operator", ",", "(", "BaseTaskTransformer", ",", "FeatureExtractor", ")", ")", ":", "raise", "ParameterError", "(", "'operator={} must be one of '", "'(BaseTaskTransformer, Featur...
Add an operation to this pump. Parameters ---------- operator : BaseTaskTransformer, FeatureExtractor The operation to add Raises ------ ParameterError if `op` is not of a correct type
[ "Add", "an", "operation", "to", "this", "pump", "." ]
train
https://github.com/bmcfee/pumpp/blob/06a17b888271dd1f6cd41bddb22b0eb04d494056/pumpp/core.py#L72-L96
bmcfee/pumpp
pumpp/core.py
Pump.transform
def transform(self, audio_f=None, jam=None, y=None, sr=None, crop=False): '''Apply the transformations to an audio file, and optionally JAMS object. Parameters ---------- audio_f : str Path to audio file jam : optional, `jams.JAMS`, str or file-like Opti...
python
def transform(self, audio_f=None, jam=None, y=None, sr=None, crop=False): '''Apply the transformations to an audio file, and optionally JAMS object. Parameters ---------- audio_f : str Path to audio file jam : optional, `jams.JAMS`, str or file-like Opti...
[ "def", "transform", "(", "self", ",", "audio_f", "=", "None", ",", "jam", "=", "None", ",", "y", "=", "None", ",", "sr", "=", "None", ",", "crop", "=", "False", ")", ":", "if", "y", "is", "None", ":", "if", "audio_f", "is", "None", ":", "raise"...
Apply the transformations to an audio file, and optionally JAMS object. Parameters ---------- audio_f : str Path to audio file jam : optional, `jams.JAMS`, str or file-like Optional JAMS object/path to JAMS file/open file descriptor. If provided, th...
[ "Apply", "the", "transformations", "to", "an", "audio", "file", "and", "optionally", "JAMS", "object", "." ]
train
https://github.com/bmcfee/pumpp/blob/06a17b888271dd1f6cd41bddb22b0eb04d494056/pumpp/core.py#L98-L161
bmcfee/pumpp
pumpp/core.py
Pump.sampler
def sampler(self, n_samples, duration, random_state=None): '''Construct a sampler object for this pump's operators. Parameters ---------- n_samples : None or int > 0 The number of samples to generate duration : int > 0 The duration (in frames) of each sa...
python
def sampler(self, n_samples, duration, random_state=None): '''Construct a sampler object for this pump's operators. Parameters ---------- n_samples : None or int > 0 The number of samples to generate duration : int > 0 The duration (in frames) of each sa...
[ "def", "sampler", "(", "self", ",", "n_samples", ",", "duration", ",", "random_state", "=", "None", ")", ":", "return", "Sampler", "(", "n_samples", ",", "duration", ",", "random_state", "=", "random_state", ",", "*", "self", ".", "ops", ")" ]
Construct a sampler object for this pump's operators. Parameters ---------- n_samples : None or int > 0 The number of samples to generate duration : int > 0 The duration (in frames) of each sample patch random_state : None, int, or np.random.RandomState...
[ "Construct", "a", "sampler", "object", "for", "this", "pump", "s", "operators", "." ]
train
https://github.com/bmcfee/pumpp/blob/06a17b888271dd1f6cd41bddb22b0eb04d494056/pumpp/core.py#L163-L196
bmcfee/pumpp
pumpp/core.py
Pump.fields
def fields(self): '''A dictionary of fields constructed by this pump''' out = dict() for operator in self.ops: out.update(**operator.fields) return out
python
def fields(self): '''A dictionary of fields constructed by this pump''' out = dict() for operator in self.ops: out.update(**operator.fields) return out
[ "def", "fields", "(", "self", ")", ":", "out", "=", "dict", "(", ")", "for", "operator", "in", "self", ".", "ops", ":", "out", ".", "update", "(", "*", "*", "operator", ".", "fields", ")", "return", "out" ]
A dictionary of fields constructed by this pump
[ "A", "dictionary", "of", "fields", "constructed", "by", "this", "pump" ]
train
https://github.com/bmcfee/pumpp/blob/06a17b888271dd1f6cd41bddb22b0eb04d494056/pumpp/core.py#L199-L205
bmcfee/pumpp
pumpp/core.py
Pump.layers
def layers(self): '''Construct Keras input layers for all feature transformers in the pump. Returns ------- layers : {field: keras.layers.Input} A dictionary of keras input layers, keyed by the corresponding fields. ''' layermap = dict() ...
python
def layers(self): '''Construct Keras input layers for all feature transformers in the pump. Returns ------- layers : {field: keras.layers.Input} A dictionary of keras input layers, keyed by the corresponding fields. ''' layermap = dict() ...
[ "def", "layers", "(", "self", ")", ":", "layermap", "=", "dict", "(", ")", "for", "operator", "in", "self", ".", "ops", ":", "if", "hasattr", "(", "operator", ",", "'layers'", ")", ":", "layermap", ".", "update", "(", "operator", ".", "layers", "(", ...
Construct Keras input layers for all feature transformers in the pump. Returns ------- layers : {field: keras.layers.Input} A dictionary of keras input layers, keyed by the corresponding fields.
[ "Construct", "Keras", "input", "layers", "for", "all", "feature", "transformers", "in", "the", "pump", "." ]
train
https://github.com/bmcfee/pumpp/blob/06a17b888271dd1f6cd41bddb22b0eb04d494056/pumpp/core.py#L207-L222
bmcfee/pumpp
pumpp/task/beat.py
BeatTransformer.set_transition_beat
def set_transition_beat(self, p_self): '''Set the beat-tracking transition matrix according to self-loop probabilities. Parameters ---------- p_self : None, float in (0, 1), or np.ndarray [shape=(2,)] Optional self-loop probability(ies), used for Viterbi decoding ...
python
def set_transition_beat(self, p_self): '''Set the beat-tracking transition matrix according to self-loop probabilities. Parameters ---------- p_self : None, float in (0, 1), or np.ndarray [shape=(2,)] Optional self-loop probability(ies), used for Viterbi decoding ...
[ "def", "set_transition_beat", "(", "self", ",", "p_self", ")", ":", "if", "p_self", "is", "None", ":", "self", ".", "beat_transition", "=", "None", "else", ":", "self", ".", "beat_transition", "=", "transition_loop", "(", "2", ",", "p_self", ")" ]
Set the beat-tracking transition matrix according to self-loop probabilities. Parameters ---------- p_self : None, float in (0, 1), or np.ndarray [shape=(2,)] Optional self-loop probability(ies), used for Viterbi decoding
[ "Set", "the", "beat", "-", "tracking", "transition", "matrix", "according", "to", "self", "-", "loop", "probabilities", "." ]
train
https://github.com/bmcfee/pumpp/blob/06a17b888271dd1f6cd41bddb22b0eb04d494056/pumpp/task/beat.py#L92-L104
bmcfee/pumpp
pumpp/task/beat.py
BeatTransformer.set_transition_down
def set_transition_down(self, p_self): '''Set the downbeat-tracking transition matrix according to self-loop probabilities. Parameters ---------- p_self : None, float in (0, 1), or np.ndarray [shape=(2,)] Optional self-loop probability(ies), used for Viterbi decoding...
python
def set_transition_down(self, p_self): '''Set the downbeat-tracking transition matrix according to self-loop probabilities. Parameters ---------- p_self : None, float in (0, 1), or np.ndarray [shape=(2,)] Optional self-loop probability(ies), used for Viterbi decoding...
[ "def", "set_transition_down", "(", "self", ",", "p_self", ")", ":", "if", "p_self", "is", "None", ":", "self", ".", "down_transition", "=", "None", "else", ":", "self", ".", "down_transition", "=", "transition_loop", "(", "2", ",", "p_self", ")" ]
Set the downbeat-tracking transition matrix according to self-loop probabilities. Parameters ---------- p_self : None, float in (0, 1), or np.ndarray [shape=(2,)] Optional self-loop probability(ies), used for Viterbi decoding
[ "Set", "the", "downbeat", "-", "tracking", "transition", "matrix", "according", "to", "self", "-", "loop", "probabilities", "." ]
train
https://github.com/bmcfee/pumpp/blob/06a17b888271dd1f6cd41bddb22b0eb04d494056/pumpp/task/beat.py#L106-L118
bmcfee/pumpp
pumpp/task/beat.py
BeatTransformer.transform_annotation
def transform_annotation(self, ann, duration): '''Apply the beat transformer Parameters ---------- ann : jams.Annotation The input annotation duration : number > 0 The duration of the audio Returns ------- data : dict ...
python
def transform_annotation(self, ann, duration): '''Apply the beat transformer Parameters ---------- ann : jams.Annotation The input annotation duration : number > 0 The duration of the audio Returns ------- data : dict ...
[ "def", "transform_annotation", "(", "self", ",", "ann", ",", "duration", ")", ":", "mask_downbeat", "=", "False", "intervals", ",", "values", "=", "ann", ".", "to_interval_values", "(", ")", "values", "=", "np", ".", "asarray", "(", "values", ")", "beat_ev...
Apply the beat transformer Parameters ---------- ann : jams.Annotation The input annotation duration : number > 0 The duration of the audio Returns ------- data : dict data['beat'] : np.ndarray, shape=(n, 1) B...
[ "Apply", "the", "beat", "transformer" ]
train
https://github.com/bmcfee/pumpp/blob/06a17b888271dd1f6cd41bddb22b0eb04d494056/pumpp/task/beat.py#L120-L171
bmcfee/pumpp
pumpp/task/beat.py
BeatTransformer.inverse
def inverse(self, encoded, downbeat=None, duration=None): '''Inverse transformation for beats and optional downbeats''' ann = jams.Annotation(namespace=self.namespace, duration=duration) beat_times = np.asarray([t for t, _ in self.decode_events(encoded, ...
python
def inverse(self, encoded, downbeat=None, duration=None): '''Inverse transformation for beats and optional downbeats''' ann = jams.Annotation(namespace=self.namespace, duration=duration) beat_times = np.asarray([t for t, _ in self.decode_events(encoded, ...
[ "def", "inverse", "(", "self", ",", "encoded", ",", "downbeat", "=", "None", ",", "duration", "=", "None", ")", ":", "ann", "=", "jams", ".", "Annotation", "(", "namespace", "=", "self", ".", "namespace", ",", "duration", "=", "duration", ")", "beat_ti...
Inverse transformation for beats and optional downbeats
[ "Inverse", "transformation", "for", "beats", "and", "optional", "downbeats" ]
train
https://github.com/bmcfee/pumpp/blob/06a17b888271dd1f6cd41bddb22b0eb04d494056/pumpp/task/beat.py#L173-L209
bmcfee/pumpp
pumpp/task/beat.py
BeatPositionTransformer.transform_annotation
def transform_annotation(self, ann, duration): '''Transform an annotation to the beat-position encoding Parameters ---------- ann : jams.Annotation The annotation to convert duration : number > 0 The duration of the track Returns -------...
python
def transform_annotation(self, ann, duration): '''Transform an annotation to the beat-position encoding Parameters ---------- ann : jams.Annotation The annotation to convert duration : number > 0 The duration of the track Returns -------...
[ "def", "transform_annotation", "(", "self", ",", "ann", ",", "duration", ")", ":", "# 1. get all the events", "# 2. find all the downbeats", "# 3. map each downbeat to a subdivision counter", "# number of beats until the next downbeat", "# 4. pad out events to intervals", "# 5. e...
Transform an annotation to the beat-position encoding Parameters ---------- ann : jams.Annotation The annotation to convert duration : number > 0 The duration of the track Returns ------- data : dict data['position'] : np.nda...
[ "Transform", "an", "annotation", "to", "the", "beat", "-", "position", "encoding" ]
train
https://github.com/bmcfee/pumpp/blob/06a17b888271dd1f6cd41bddb22b0eb04d494056/pumpp/task/beat.py#L265-L339
bmcfee/pumpp
pumpp/feature/rhythm.py
Tempogram.transform_audio
def transform_audio(self, y): '''Compute the tempogram Parameters ---------- y : np.ndarray Audio buffer Returns ------- data : dict data['tempogram'] : np.ndarray, shape=(n_frames, win_length) The tempogram ''' ...
python
def transform_audio(self, y): '''Compute the tempogram Parameters ---------- y : np.ndarray Audio buffer Returns ------- data : dict data['tempogram'] : np.ndarray, shape=(n_frames, win_length) The tempogram ''' ...
[ "def", "transform_audio", "(", "self", ",", "y", ")", ":", "n_frames", "=", "self", ".", "n_frames", "(", "get_duration", "(", "y", "=", "y", ",", "sr", "=", "self", ".", "sr", ")", ")", "tgram", "=", "tempogram", "(", "y", "=", "y", ",", "sr", ...
Compute the tempogram Parameters ---------- y : np.ndarray Audio buffer Returns ------- data : dict data['tempogram'] : np.ndarray, shape=(n_frames, win_length) The tempogram
[ "Compute", "the", "tempogram" ]
train
https://github.com/bmcfee/pumpp/blob/06a17b888271dd1f6cd41bddb22b0eb04d494056/pumpp/feature/rhythm.py#L39-L60
bmcfee/pumpp
pumpp/feature/rhythm.py
TempoScale.transform_audio
def transform_audio(self, y): '''Apply the scale transform to the tempogram Parameters ---------- y : np.ndarray The audio buffer Returns ------- data : dict data['temposcale'] : np.ndarray, shape=(n_frames, n_fmt) The sca...
python
def transform_audio(self, y): '''Apply the scale transform to the tempogram Parameters ---------- y : np.ndarray The audio buffer Returns ------- data : dict data['temposcale'] : np.ndarray, shape=(n_frames, n_fmt) The sca...
[ "def", "transform_audio", "(", "self", ",", "y", ")", ":", "data", "=", "super", "(", "TempoScale", ",", "self", ")", ".", "transform_audio", "(", "y", ")", "data", "[", "'temposcale'", "]", "=", "np", ".", "abs", "(", "fmt", "(", "data", ".", "pop...
Apply the scale transform to the tempogram Parameters ---------- y : np.ndarray The audio buffer Returns ------- data : dict data['temposcale'] : np.ndarray, shape=(n_frames, n_fmt) The scale transform magnitude coefficients
[ "Apply", "the", "scale", "transform", "to", "the", "tempogram" ]
train
https://github.com/bmcfee/pumpp/blob/06a17b888271dd1f6cd41bddb22b0eb04d494056/pumpp/feature/rhythm.py#L93-L111
bmcfee/pumpp
pumpp/task/structure.py
StructureTransformer.transform_annotation
def transform_annotation(self, ann, duration): '''Apply the structure agreement transformation. Parameters ---------- ann : jams.Annotation The segment annotation duration : number > 0 The target duration Returns ------- data : d...
python
def transform_annotation(self, ann, duration): '''Apply the structure agreement transformation. Parameters ---------- ann : jams.Annotation The segment annotation duration : number > 0 The target duration Returns ------- data : d...
[ "def", "transform_annotation", "(", "self", ",", "ann", ",", "duration", ")", ":", "intervals", ",", "values", "=", "ann", ".", "to_interval_values", "(", ")", "intervals", ",", "values", "=", "adjust_intervals", "(", "intervals", ",", "values", ",", "t_min"...
Apply the structure agreement transformation. Parameters ---------- ann : jams.Annotation The segment annotation duration : number > 0 The target duration Returns ------- data : dict data['agree'] : np.ndarray, shape=(n, n), ...
[ "Apply", "the", "structure", "agreement", "transformation", "." ]
train
https://github.com/bmcfee/pumpp/blob/06a17b888271dd1f6cd41bddb22b0eb04d494056/pumpp/task/structure.py#L47-L76
bmcfee/pumpp
pumpp/feature/fft.py
STFT.transform_audio
def transform_audio(self, y): '''Compute the STFT magnitude and phase. Parameters ---------- y : np.ndarray The audio buffer Returns ------- data : dict data['mag'] : np.ndarray, shape=(n_frames, 1 + n_fft//2) STFT magnitu...
python
def transform_audio(self, y): '''Compute the STFT magnitude and phase. Parameters ---------- y : np.ndarray The audio buffer Returns ------- data : dict data['mag'] : np.ndarray, shape=(n_frames, 1 + n_fft//2) STFT magnitu...
[ "def", "transform_audio", "(", "self", ",", "y", ")", ":", "n_frames", "=", "self", ".", "n_frames", "(", "get_duration", "(", "y", "=", "y", ",", "sr", "=", "self", ".", "sr", ")", ")", "D", "=", "stft", "(", "y", ",", "hop_length", "=", "self",...
Compute the STFT magnitude and phase. Parameters ---------- y : np.ndarray The audio buffer Returns ------- data : dict data['mag'] : np.ndarray, shape=(n_frames, 1 + n_fft//2) STFT magnitude data['phase'] : np.ndarra...
[ "Compute", "the", "STFT", "magnitude", "and", "phase", "." ]
train
https://github.com/bmcfee/pumpp/blob/06a17b888271dd1f6cd41bddb22b0eb04d494056/pumpp/feature/fft.py#L51-L80
bmcfee/pumpp
pumpp/feature/fft.py
STFTPhaseDiff.transform_audio
def transform_audio(self, y): '''Compute the STFT with phase differentials. Parameters ---------- y : np.ndarray the audio buffer Returns ------- data : dict data['mag'] : np.ndarray, shape=(n_frames, 1 + n_fft//2) The STF...
python
def transform_audio(self, y): '''Compute the STFT with phase differentials. Parameters ---------- y : np.ndarray the audio buffer Returns ------- data : dict data['mag'] : np.ndarray, shape=(n_frames, 1 + n_fft//2) The STF...
[ "def", "transform_audio", "(", "self", ",", "y", ")", ":", "data", "=", "super", "(", "STFTPhaseDiff", ",", "self", ")", ".", "transform_audio", "(", "y", ")", "data", "[", "'dphase'", "]", "=", "self", ".", "phase_diff", "(", "data", ".", "pop", "("...
Compute the STFT with phase differentials. Parameters ---------- y : np.ndarray the audio buffer Returns ------- data : dict data['mag'] : np.ndarray, shape=(n_frames, 1 + n_fft//2) The STFT magnitude data['dphase'] :...
[ "Compute", "the", "STFT", "with", "phase", "differentials", "." ]
train
https://github.com/bmcfee/pumpp/blob/06a17b888271dd1f6cd41bddb22b0eb04d494056/pumpp/feature/fft.py#L95-L114
bmcfee/pumpp
pumpp/feature/fft.py
STFTMag.transform_audio
def transform_audio(self, y): '''Compute the STFT Parameters ---------- y : np.ndarray The audio buffer Returns ------- data : dict data['mag'] : np.ndarray, shape=(n_frames, 1 + n_fft//2) The STFT magnitude ''' ...
python
def transform_audio(self, y): '''Compute the STFT Parameters ---------- y : np.ndarray The audio buffer Returns ------- data : dict data['mag'] : np.ndarray, shape=(n_frames, 1 + n_fft//2) The STFT magnitude ''' ...
[ "def", "transform_audio", "(", "self", ",", "y", ")", ":", "data", "=", "super", "(", "STFTMag", ",", "self", ")", ".", "transform_audio", "(", "y", ")", "data", ".", "pop", "(", "'phase'", ")", "return", "data" ]
Compute the STFT Parameters ---------- y : np.ndarray The audio buffer Returns ------- data : dict data['mag'] : np.ndarray, shape=(n_frames, 1 + n_fft//2) The STFT magnitude
[ "Compute", "the", "STFT" ]
train
https://github.com/bmcfee/pumpp/blob/06a17b888271dd1f6cd41bddb22b0eb04d494056/pumpp/feature/fft.py#L128-L145
bmcfee/pumpp
pumpp/task/chord.py
_pad_nochord
def _pad_nochord(target, axis=-1): '''Pad a chord annotation with no-chord flags. Parameters ---------- target : np.ndarray the input data axis : int the axis along which to pad Returns ------- target_pad `target` expanded by 1 along the specified `axis`. ...
python
def _pad_nochord(target, axis=-1): '''Pad a chord annotation with no-chord flags. Parameters ---------- target : np.ndarray the input data axis : int the axis along which to pad Returns ------- target_pad `target` expanded by 1 along the specified `axis`. ...
[ "def", "_pad_nochord", "(", "target", ",", "axis", "=", "-", "1", ")", ":", "ncmask", "=", "~", "np", ".", "max", "(", "target", ",", "axis", "=", "axis", ",", "keepdims", "=", "True", ")", "return", "np", ".", "concatenate", "(", "[", "target", ...
Pad a chord annotation with no-chord flags. Parameters ---------- target : np.ndarray the input data axis : int the axis along which to pad Returns ------- target_pad `target` expanded by 1 along the specified `axis`. The expanded dimension will be 0 when `...
[ "Pad", "a", "chord", "annotation", "with", "no", "-", "chord", "flags", "." ]
train
https://github.com/bmcfee/pumpp/blob/06a17b888271dd1f6cd41bddb22b0eb04d494056/pumpp/task/chord.py#L24-L44
bmcfee/pumpp
pumpp/task/chord.py
ChordTransformer.empty
def empty(self, duration): '''Empty chord annotations Parameters ---------- duration : number The length (in seconds) of the empty annotation Returns ------- ann : jams.Annotation A chord annotation consisting of a single `no-chord` obser...
python
def empty(self, duration): '''Empty chord annotations Parameters ---------- duration : number The length (in seconds) of the empty annotation Returns ------- ann : jams.Annotation A chord annotation consisting of a single `no-chord` obser...
[ "def", "empty", "(", "self", ",", "duration", ")", ":", "ann", "=", "super", "(", "ChordTransformer", ",", "self", ")", ".", "empty", "(", "duration", ")", "ann", ".", "append", "(", "time", "=", "0", ",", "duration", "=", "duration", ",", "value", ...
Empty chord annotations Parameters ---------- duration : number The length (in seconds) of the empty annotation Returns ------- ann : jams.Annotation A chord annotation consisting of a single `no-chord` observation.
[ "Empty", "chord", "annotations" ]
train
https://github.com/bmcfee/pumpp/blob/06a17b888271dd1f6cd41bddb22b0eb04d494056/pumpp/task/chord.py#L92-L111
bmcfee/pumpp
pumpp/task/chord.py
ChordTransformer.transform_annotation
def transform_annotation(self, ann, duration): '''Apply the chord transformation. Parameters ---------- ann : jams.Annotation The chord annotation duration : number > 0 The target duration Returns ------- data : dict ...
python
def transform_annotation(self, ann, duration): '''Apply the chord transformation. Parameters ---------- ann : jams.Annotation The chord annotation duration : number > 0 The target duration Returns ------- data : dict ...
[ "def", "transform_annotation", "(", "self", ",", "ann", ",", "duration", ")", ":", "# Construct a blank annotation with mask = 0", "intervals", ",", "chords", "=", "ann", ".", "to_interval_values", "(", ")", "# Get the dtype for root/bass", "if", "self", ".", "sparse"...
Apply the chord transformation. Parameters ---------- ann : jams.Annotation The chord annotation duration : number > 0 The target duration Returns ------- data : dict data['pitch'] : np.ndarray, shape=(n, 12) data...
[ "Apply", "the", "chord", "transformation", "." ]
train
https://github.com/bmcfee/pumpp/blob/06a17b888271dd1f6cd41bddb22b0eb04d494056/pumpp/task/chord.py#L113-L213
bmcfee/pumpp
pumpp/task/chord.py
SimpleChordTransformer.transform_annotation
def transform_annotation(self, ann, duration): '''Apply the chord transformation. Parameters ---------- ann : jams.Annotation The chord annotation duration : number > 0 The target duration Returns ------- data : dict ...
python
def transform_annotation(self, ann, duration): '''Apply the chord transformation. Parameters ---------- ann : jams.Annotation The chord annotation duration : number > 0 The target duration Returns ------- data : dict ...
[ "def", "transform_annotation", "(", "self", ",", "ann", ",", "duration", ")", ":", "data", "=", "super", "(", "SimpleChordTransformer", ",", "self", ")", ".", "transform_annotation", "(", "ann", ",", "duration", ")", "data", ".", "pop", "(", "'root'", ",",...
Apply the chord transformation. Parameters ---------- ann : jams.Annotation The chord annotation duration : number > 0 The target duration Returns ------- data : dict data['pitch'] : np.ndarray, shape=(n, 12) `pi...
[ "Apply", "the", "chord", "transformation", "." ]
train
https://github.com/bmcfee/pumpp/blob/06a17b888271dd1f6cd41bddb22b0eb04d494056/pumpp/task/chord.py#L246-L270
bmcfee/pumpp
pumpp/task/chord.py
ChordTagTransformer.set_transition
def set_transition(self, p_self): '''Set the transition matrix according to self-loop probabilities. Parameters ---------- p_self : None, float in (0, 1), or np.ndarray [shape=(n_labels,)] Optional self-loop probability(ies), used for Viterbi decoding ''' if ...
python
def set_transition(self, p_self): '''Set the transition matrix according to self-loop probabilities. Parameters ---------- p_self : None, float in (0, 1), or np.ndarray [shape=(n_labels,)] Optional self-loop probability(ies), used for Viterbi decoding ''' if ...
[ "def", "set_transition", "(", "self", ",", "p_self", ")", ":", "if", "p_self", "is", "None", ":", "self", ".", "transition", "=", "None", "else", ":", "self", ".", "transition", "=", "transition_loop", "(", "len", "(", "self", ".", "_classes", ")", ","...
Set the transition matrix according to self-loop probabilities. Parameters ---------- p_self : None, float in (0, 1), or np.ndarray [shape=(n_labels,)] Optional self-loop probability(ies), used for Viterbi decoding
[ "Set", "the", "transition", "matrix", "according", "to", "self", "-", "loop", "probabilities", "." ]
train
https://github.com/bmcfee/pumpp/blob/06a17b888271dd1f6cd41bddb22b0eb04d494056/pumpp/task/chord.py#L416-L427
bmcfee/pumpp
pumpp/task/chord.py
ChordTagTransformer.simplify
def simplify(self, chord): '''Simplify a chord string down to the vocabulary space''' # Drop inversions chord = re.sub(r'/.*$', r'', chord) # Drop any additional or suppressed tones chord = re.sub(r'\(.*?\)', r'', chord) # Drop dangling : indicators chord = re.sub...
python
def simplify(self, chord): '''Simplify a chord string down to the vocabulary space''' # Drop inversions chord = re.sub(r'/.*$', r'', chord) # Drop any additional or suppressed tones chord = re.sub(r'\(.*?\)', r'', chord) # Drop dangling : indicators chord = re.sub...
[ "def", "simplify", "(", "self", ",", "chord", ")", ":", "# Drop inversions", "chord", "=", "re", ".", "sub", "(", "r'/.*$'", ",", "r''", ",", "chord", ")", "# Drop any additional or suppressed tones", "chord", "=", "re", ".", "sub", "(", "r'\\(.*?\\)'", ",",...
Simplify a chord string down to the vocabulary space
[ "Simplify", "a", "chord", "string", "down", "to", "the", "vocabulary", "space" ]
train
https://github.com/bmcfee/pumpp/blob/06a17b888271dd1f6cd41bddb22b0eb04d494056/pumpp/task/chord.py#L475-L498
bmcfee/pumpp
pumpp/task/chord.py
ChordTagTransformer.transform_annotation
def transform_annotation(self, ann, duration): '''Transform an annotation to chord-tag encoding Parameters ---------- ann : jams.Annotation The annotation to convert duration : number > 0 The duration of the track Returns ------- ...
python
def transform_annotation(self, ann, duration): '''Transform an annotation to chord-tag encoding Parameters ---------- ann : jams.Annotation The annotation to convert duration : number > 0 The duration of the track Returns ------- ...
[ "def", "transform_annotation", "(", "self", ",", "ann", ",", "duration", ")", ":", "intervals", ",", "values", "=", "ann", ".", "to_interval_values", "(", ")", "chords", "=", "[", "]", "for", "v", "in", "values", ":", "chords", ".", "extend", "(", "sel...
Transform an annotation to chord-tag encoding Parameters ---------- ann : jams.Annotation The annotation to convert duration : number > 0 The duration of the track Returns ------- data : dict data['chord'] : np.ndarray, shape...
[ "Transform", "an", "annotation", "to", "chord", "-", "tag", "encoding" ]
train
https://github.com/bmcfee/pumpp/blob/06a17b888271dd1f6cd41bddb22b0eb04d494056/pumpp/task/chord.py#L500-L534
bmcfee/pumpp
pumpp/feature/cqt.py
CQT.transform_audio
def transform_audio(self, y): '''Compute the CQT Parameters ---------- y : np.ndarray The audio buffer Returns ------- data : dict data['mag'] : np.ndarray, shape = (n_frames, n_bins) The CQT magnitude data['p...
python
def transform_audio(self, y): '''Compute the CQT Parameters ---------- y : np.ndarray The audio buffer Returns ------- data : dict data['mag'] : np.ndarray, shape = (n_frames, n_bins) The CQT magnitude data['p...
[ "def", "transform_audio", "(", "self", ",", "y", ")", ":", "n_frames", "=", "self", ".", "n_frames", "(", "get_duration", "(", "y", "=", "y", ",", "sr", "=", "self", ".", "sr", ")", ")", "C", "=", "cqt", "(", "y", "=", "y", ",", "sr", "=", "s...
Compute the CQT Parameters ---------- y : np.ndarray The audio buffer Returns ------- data : dict data['mag'] : np.ndarray, shape = (n_frames, n_bins) The CQT magnitude data['phase']: np.ndarray, shape = mag.shape ...
[ "Compute", "the", "CQT" ]
train
https://github.com/bmcfee/pumpp/blob/06a17b888271dd1f6cd41bddb22b0eb04d494056/pumpp/feature/cqt.py#L61-L92
bmcfee/pumpp
pumpp/feature/cqt.py
CQTMag.transform_audio
def transform_audio(self, y): '''Compute CQT magnitude. Parameters ---------- y : np.ndarray the audio buffer Returns ------- data : dict data['mag'] : np.ndarray, shape=(n_frames, n_bins) The CQT magnitude ''' ...
python
def transform_audio(self, y): '''Compute CQT magnitude. Parameters ---------- y : np.ndarray the audio buffer Returns ------- data : dict data['mag'] : np.ndarray, shape=(n_frames, n_bins) The CQT magnitude ''' ...
[ "def", "transform_audio", "(", "self", ",", "y", ")", ":", "data", "=", "super", "(", "CQTMag", ",", "self", ")", ".", "transform_audio", "(", "y", ")", "data", ".", "pop", "(", "'phase'", ")", "return", "data" ]
Compute CQT magnitude. Parameters ---------- y : np.ndarray the audio buffer Returns ------- data : dict data['mag'] : np.ndarray, shape=(n_frames, n_bins) The CQT magnitude
[ "Compute", "CQT", "magnitude", "." ]
train
https://github.com/bmcfee/pumpp/blob/06a17b888271dd1f6cd41bddb22b0eb04d494056/pumpp/feature/cqt.py#L107-L123
bmcfee/pumpp
pumpp/feature/cqt.py
CQTPhaseDiff.transform_audio
def transform_audio(self, y): '''Compute the CQT with unwrapped phase Parameters ---------- y : np.ndarray The audio buffer Returns ------- data : dict data['mag'] : np.ndarray, shape=(n_frames, n_bins) CQT magnitude ...
python
def transform_audio(self, y): '''Compute the CQT with unwrapped phase Parameters ---------- y : np.ndarray The audio buffer Returns ------- data : dict data['mag'] : np.ndarray, shape=(n_frames, n_bins) CQT magnitude ...
[ "def", "transform_audio", "(", "self", ",", "y", ")", ":", "data", "=", "super", "(", "CQTPhaseDiff", ",", "self", ")", ".", "transform_audio", "(", "y", ")", "data", "[", "'dphase'", "]", "=", "self", ".", "phase_diff", "(", "data", ".", "pop", "(",...
Compute the CQT with unwrapped phase Parameters ---------- y : np.ndarray The audio buffer Returns ------- data : dict data['mag'] : np.ndarray, shape=(n_frames, n_bins) CQT magnitude data['dphase'] : np.ndarray, shap...
[ "Compute", "the", "CQT", "with", "unwrapped", "phase" ]
train
https://github.com/bmcfee/pumpp/blob/06a17b888271dd1f6cd41bddb22b0eb04d494056/pumpp/feature/cqt.py#L141-L160
bmcfee/pumpp
pumpp/feature/cqt.py
HCQT.transform_audio
def transform_audio(self, y): '''Compute the HCQT Parameters ---------- y : np.ndarray The audio buffer Returns ------- data : dict data['mag'] : np.ndarray, shape = (n_frames, n_bins, n_harmonics) The CQT magnitude ...
python
def transform_audio(self, y): '''Compute the HCQT Parameters ---------- y : np.ndarray The audio buffer Returns ------- data : dict data['mag'] : np.ndarray, shape = (n_frames, n_bins, n_harmonics) The CQT magnitude ...
[ "def", "transform_audio", "(", "self", ",", "y", ")", ":", "cqtm", ",", "phase", "=", "[", "]", ",", "[", "]", "n_frames", "=", "self", ".", "n_frames", "(", "get_duration", "(", "y", "=", "y", ",", "sr", "=", "self", ".", "sr", ")", ")", "for"...
Compute the HCQT Parameters ---------- y : np.ndarray The audio buffer Returns ------- data : dict data['mag'] : np.ndarray, shape = (n_frames, n_bins, n_harmonics) The CQT magnitude data['phase']: np.ndarray, shape =...
[ "Compute", "the", "HCQT" ]
train
https://github.com/bmcfee/pumpp/blob/06a17b888271dd1f6cd41bddb22b0eb04d494056/pumpp/feature/cqt.py#L231-L270
bmcfee/pumpp
pumpp/feature/cqt.py
HCQT._index
def _index(self, value): '''Rearrange a tensor according to the convolution mode Input is assumed to be in (channels, bins, time) format. ''' if self.conv in ('channels_last', 'tf'): return np.transpose(value, (2, 1, 0)) else: # self.conv in ('channels_first', 'th...
python
def _index(self, value): '''Rearrange a tensor according to the convolution mode Input is assumed to be in (channels, bins, time) format. ''' if self.conv in ('channels_last', 'tf'): return np.transpose(value, (2, 1, 0)) else: # self.conv in ('channels_first', 'th...
[ "def", "_index", "(", "self", ",", "value", ")", ":", "if", "self", ".", "conv", "in", "(", "'channels_last'", ",", "'tf'", ")", ":", "return", "np", ".", "transpose", "(", "value", ",", "(", "2", ",", "1", ",", "0", ")", ")", "else", ":", "# s...
Rearrange a tensor according to the convolution mode Input is assumed to be in (channels, bins, time) format.
[ "Rearrange", "a", "tensor", "according", "to", "the", "convolution", "mode" ]
train
https://github.com/bmcfee/pumpp/blob/06a17b888271dd1f6cd41bddb22b0eb04d494056/pumpp/feature/cqt.py#L272-L282
bmcfee/pumpp
pumpp/feature/cqt.py
HCQTMag.transform_audio
def transform_audio(self, y): '''Compute HCQT magnitude. Parameters ---------- y : np.ndarray the audio buffer Returns ------- data : dict data['mag'] : np.ndarray, shape=(n_frames, n_bins) The CQT magnitude ''' ...
python
def transform_audio(self, y): '''Compute HCQT magnitude. Parameters ---------- y : np.ndarray the audio buffer Returns ------- data : dict data['mag'] : np.ndarray, shape=(n_frames, n_bins) The CQT magnitude ''' ...
[ "def", "transform_audio", "(", "self", ",", "y", ")", ":", "data", "=", "super", "(", "HCQTMag", ",", "self", ")", ".", "transform_audio", "(", "y", ")", "data", ".", "pop", "(", "'phase'", ")", "return", "data" ]
Compute HCQT magnitude. Parameters ---------- y : np.ndarray the audio buffer Returns ------- data : dict data['mag'] : np.ndarray, shape=(n_frames, n_bins) The CQT magnitude
[ "Compute", "HCQT", "magnitude", "." ]
train
https://github.com/bmcfee/pumpp/blob/06a17b888271dd1f6cd41bddb22b0eb04d494056/pumpp/feature/cqt.py#L297-L313
bmcfee/pumpp
pumpp/feature/cqt.py
HCQTPhaseDiff.transform_audio
def transform_audio(self, y): '''Compute the HCQT with unwrapped phase Parameters ---------- y : np.ndarray The audio buffer Returns ------- data : dict data['mag'] : np.ndarray, shape=(n_frames, n_bins) CQT magnitude ...
python
def transform_audio(self, y): '''Compute the HCQT with unwrapped phase Parameters ---------- y : np.ndarray The audio buffer Returns ------- data : dict data['mag'] : np.ndarray, shape=(n_frames, n_bins) CQT magnitude ...
[ "def", "transform_audio", "(", "self", ",", "y", ")", ":", "data", "=", "super", "(", "HCQTPhaseDiff", ",", "self", ")", ".", "transform_audio", "(", "y", ")", "data", "[", "'dphase'", "]", "=", "self", ".", "phase_diff", "(", "data", ".", "pop", "("...
Compute the HCQT with unwrapped phase Parameters ---------- y : np.ndarray The audio buffer Returns ------- data : dict data['mag'] : np.ndarray, shape=(n_frames, n_bins) CQT magnitude data['dphase'] : np.ndarray, sha...
[ "Compute", "the", "HCQT", "with", "unwrapped", "phase" ]
train
https://github.com/bmcfee/pumpp/blob/06a17b888271dd1f6cd41bddb22b0eb04d494056/pumpp/feature/cqt.py#L332-L351
bmcfee/pumpp
pumpp/task/base.py
fill_value
def fill_value(dtype): '''Get a fill-value for a given dtype Parameters ---------- dtype : type Returns ------- `np.nan` if `dtype` is real or complex 0 otherwise ''' if np.issubdtype(dtype, np.floating) or np.issubdtype(dtype, np.complexfloating): return dtype(np.nan)...
python
def fill_value(dtype): '''Get a fill-value for a given dtype Parameters ---------- dtype : type Returns ------- `np.nan` if `dtype` is real or complex 0 otherwise ''' if np.issubdtype(dtype, np.floating) or np.issubdtype(dtype, np.complexfloating): return dtype(np.nan)...
[ "def", "fill_value", "(", "dtype", ")", ":", "if", "np", ".", "issubdtype", "(", "dtype", ",", "np", ".", "floating", ")", "or", "np", ".", "issubdtype", "(", "dtype", ",", "np", ".", "complexfloating", ")", ":", "return", "dtype", "(", "np", ".", ...
Get a fill-value for a given dtype Parameters ---------- dtype : type Returns ------- `np.nan` if `dtype` is real or complex 0 otherwise
[ "Get", "a", "fill", "-", "value", "for", "a", "given", "dtype" ]
train
https://github.com/bmcfee/pumpp/blob/06a17b888271dd1f6cd41bddb22b0eb04d494056/pumpp/task/base.py#L15-L31
bmcfee/pumpp
pumpp/task/base.py
BaseTaskTransformer.empty
def empty(self, duration): '''Create an empty jams.Annotation for this task. This method should be overridden by derived classes. Parameters ---------- duration : int >= 0 Duration of the annotation ''' return jams.Annotation(namespace=self.namespace...
python
def empty(self, duration): '''Create an empty jams.Annotation for this task. This method should be overridden by derived classes. Parameters ---------- duration : int >= 0 Duration of the annotation ''' return jams.Annotation(namespace=self.namespace...
[ "def", "empty", "(", "self", ",", "duration", ")", ":", "return", "jams", ".", "Annotation", "(", "namespace", "=", "self", ".", "namespace", ",", "time", "=", "0", ",", "duration", "=", "0", ")" ]
Create an empty jams.Annotation for this task. This method should be overridden by derived classes. Parameters ---------- duration : int >= 0 Duration of the annotation
[ "Create", "an", "empty", "jams", ".", "Annotation", "for", "this", "task", "." ]
train
https://github.com/bmcfee/pumpp/blob/06a17b888271dd1f6cd41bddb22b0eb04d494056/pumpp/task/base.py#L62-L72
bmcfee/pumpp
pumpp/task/base.py
BaseTaskTransformer.transform
def transform(self, jam, query=None): '''Transform jam object to make data for this task Parameters ---------- jam : jams.JAMS The jams container object query : string, dict, or callable [optional] An optional query to narrow the elements of `jam.annotat...
python
def transform(self, jam, query=None): '''Transform jam object to make data for this task Parameters ---------- jam : jams.JAMS The jams container object query : string, dict, or callable [optional] An optional query to narrow the elements of `jam.annotat...
[ "def", "transform", "(", "self", ",", "jam", ",", "query", "=", "None", ")", ":", "anns", "=", "[", "]", "if", "query", ":", "results", "=", "jam", ".", "search", "(", "*", "*", "query", ")", "else", ":", "results", "=", "jam", ".", "annotations"...
Transform jam object to make data for this task Parameters ---------- jam : jams.JAMS The jams container object query : string, dict, or callable [optional] An optional query to narrow the elements of `jam.annotations` to be considered. ...
[ "Transform", "jam", "object", "to", "make", "data", "for", "this", "task" ]
train
https://github.com/bmcfee/pumpp/blob/06a17b888271dd1f6cd41bddb22b0eb04d494056/pumpp/task/base.py#L74-L129
bmcfee/pumpp
pumpp/task/base.py
BaseTaskTransformer.encode_events
def encode_events(self, duration, events, values, dtype=np.bool): '''Encode labeled events as a time-series matrix. Parameters ---------- duration : number The duration of the track events : ndarray, shape=(n,) Time index of the events values : ...
python
def encode_events(self, duration, events, values, dtype=np.bool): '''Encode labeled events as a time-series matrix. Parameters ---------- duration : number The duration of the track events : ndarray, shape=(n,) Time index of the events values : ...
[ "def", "encode_events", "(", "self", ",", "duration", ",", "events", ",", "values", ",", "dtype", "=", "np", ".", "bool", ")", ":", "frames", "=", "time_to_frames", "(", "events", ",", "sr", "=", "self", ".", "sr", ",", "hop_length", "=", "self", "."...
Encode labeled events as a time-series matrix. Parameters ---------- duration : number The duration of the track events : ndarray, shape=(n,) Time index of the events values : ndarray, shape=(n, m) Values array. Must have the same first ind...
[ "Encode", "labeled", "events", "as", "a", "time", "-", "series", "matrix", "." ]
train
https://github.com/bmcfee/pumpp/blob/06a17b888271dd1f6cd41bddb22b0eb04d494056/pumpp/task/base.py#L131-L170
bmcfee/pumpp
pumpp/task/base.py
BaseTaskTransformer.encode_intervals
def encode_intervals(self, duration, intervals, values, dtype=np.bool, multi=True, fill=None): '''Encode labeled intervals as a time-series matrix. Parameters ---------- duration : number The duration (in frames) of the track intervals : np....
python
def encode_intervals(self, duration, intervals, values, dtype=np.bool, multi=True, fill=None): '''Encode labeled intervals as a time-series matrix. Parameters ---------- duration : number The duration (in frames) of the track intervals : np....
[ "def", "encode_intervals", "(", "self", ",", "duration", ",", "intervals", ",", "values", ",", "dtype", "=", "np", ".", "bool", ",", "multi", "=", "True", ",", "fill", "=", "None", ")", ":", "if", "fill", "is", "None", ":", "fill", "=", "fill_value",...
Encode labeled intervals as a time-series matrix. Parameters ---------- duration : number The duration (in frames) of the track intervals : np.ndarray, shape=(n, 2) The list of intervals values : np.ndarray, shape=(n, m) The (encoded) values...
[ "Encode", "labeled", "intervals", "as", "a", "time", "-", "series", "matrix", "." ]
train
https://github.com/bmcfee/pumpp/blob/06a17b888271dd1f6cd41bddb22b0eb04d494056/pumpp/task/base.py#L172-L230
bmcfee/pumpp
pumpp/task/base.py
BaseTaskTransformer.decode_events
def decode_events(self, encoded, transition=None, p_state=None, p_init=None): '''Decode labeled events into (time, value) pairs Real-valued inputs are thresholded at 0.5. Optionally, viterbi decoding can be applied to each event class. Parameters ---------- encoded : n...
python
def decode_events(self, encoded, transition=None, p_state=None, p_init=None): '''Decode labeled events into (time, value) pairs Real-valued inputs are thresholded at 0.5. Optionally, viterbi decoding can be applied to each event class. Parameters ---------- encoded : n...
[ "def", "decode_events", "(", "self", ",", "encoded", ",", "transition", "=", "None", ",", "p_state", "=", "None", ",", "p_init", "=", "None", ")", ":", "if", "np", ".", "isrealobj", "(", "encoded", ")", ":", "if", "transition", "is", "None", ":", "en...
Decode labeled events into (time, value) pairs Real-valued inputs are thresholded at 0.5. Optionally, viterbi decoding can be applied to each event class. Parameters ---------- encoded : np.ndarray, shape=(n_frames, m) Frame-level annotation encodings as produced b...
[ "Decode", "labeled", "events", "into", "(", "time", "value", ")", "pairs" ]
train
https://github.com/bmcfee/pumpp/blob/06a17b888271dd1f6cd41bddb22b0eb04d494056/pumpp/task/base.py#L232-L276
bmcfee/pumpp
pumpp/task/base.py
BaseTaskTransformer.decode_intervals
def decode_intervals(self, encoded, duration=None, multi=True, sparse=False, transition=None, p_state=None, p_init=None): '''Decode labeled intervals into (start, end, value) triples Parameters ---------- encoded : np.ndarray, shape=(n_frames, m) Fra...
python
def decode_intervals(self, encoded, duration=None, multi=True, sparse=False, transition=None, p_state=None, p_init=None): '''Decode labeled intervals into (start, end, value) triples Parameters ---------- encoded : np.ndarray, shape=(n_frames, m) Fra...
[ "def", "decode_intervals", "(", "self", ",", "encoded", ",", "duration", "=", "None", ",", "multi", "=", "True", ",", "sparse", "=", "False", ",", "transition", "=", "None", ",", "p_state", "=", "None", ",", "p_init", "=", "None", ")", ":", "if", "np...
Decode labeled intervals into (start, end, value) triples Parameters ---------- encoded : np.ndarray, shape=(n_frames, m) Frame-level annotation encodings as produced by ``encode_intervals`` duration : None or float > 0 The max duration of the annota...
[ "Decode", "labeled", "intervals", "into", "(", "start", "end", "value", ")", "triples" ]
train
https://github.com/bmcfee/pumpp/blob/06a17b888271dd1f6cd41bddb22b0eb04d494056/pumpp/task/base.py#L278-L373
bmcfee/pumpp
pumpp/feature/base.py
FeatureExtractor.transform
def transform(self, y, sr): '''Transform an audio signal Parameters ---------- y : np.ndarray The audio signal sr : number > 0 The native sampling rate of y Returns ------- dict Data dictionary containing features ext...
python
def transform(self, y, sr): '''Transform an audio signal Parameters ---------- y : np.ndarray The audio signal sr : number > 0 The native sampling rate of y Returns ------- dict Data dictionary containing features ext...
[ "def", "transform", "(", "self", ",", "y", ",", "sr", ")", ":", "if", "sr", "!=", "self", ".", "sr", ":", "y", "=", "resample", "(", "y", ",", "sr", ",", "self", ".", "sr", ")", "return", "self", ".", "merge", "(", "[", "self", ".", "transfor...
Transform an audio signal Parameters ---------- y : np.ndarray The audio signal sr : number > 0 The native sampling rate of y Returns ------- dict Data dictionary containing features extracted from y See Also ...
[ "Transform", "an", "audio", "signal" ]
train
https://github.com/bmcfee/pumpp/blob/06a17b888271dd1f6cd41bddb22b0eb04d494056/pumpp/feature/base.py#L71-L94
bmcfee/pumpp
pumpp/feature/base.py
FeatureExtractor.phase_diff
def phase_diff(self, phase): '''Compute the phase differential along a given axis Parameters ---------- phase : np.ndarray Input phase (in radians) Returns ------- dphase : np.ndarray like `phase` The phase differential. ''' ...
python
def phase_diff(self, phase): '''Compute the phase differential along a given axis Parameters ---------- phase : np.ndarray Input phase (in radians) Returns ------- dphase : np.ndarray like `phase` The phase differential. ''' ...
[ "def", "phase_diff", "(", "self", ",", "phase", ")", ":", "if", "self", ".", "conv", "is", "None", ":", "axis", "=", "0", "elif", "self", ".", "conv", "in", "(", "'channels_last'", ",", "'tf'", ")", ":", "axis", "=", "0", "elif", "self", ".", "co...
Compute the phase differential along a given axis Parameters ---------- phase : np.ndarray Input phase (in radians) Returns ------- dphase : np.ndarray like `phase` The phase differential.
[ "Compute", "the", "phase", "differential", "along", "a", "given", "axis" ]
train
https://github.com/bmcfee/pumpp/blob/06a17b888271dd1f6cd41bddb22b0eb04d494056/pumpp/feature/base.py#L99-L130
bmcfee/pumpp
pumpp/feature/base.py
FeatureExtractor.layers
def layers(self): '''Construct Keras input layers for the given transformer Returns ------- layers : {field: keras.layers.Input} A dictionary of keras input layers, keyed by the corresponding field keys. ''' from keras.layers import Input ...
python
def layers(self): '''Construct Keras input layers for the given transformer Returns ------- layers : {field: keras.layers.Input} A dictionary of keras input layers, keyed by the corresponding field keys. ''' from keras.layers import Input ...
[ "def", "layers", "(", "self", ")", ":", "from", "keras", ".", "layers", "import", "Input", "L", "=", "dict", "(", ")", "for", "key", "in", "self", ".", "fields", ":", "L", "[", "key", "]", "=", "Input", "(", "name", "=", "key", ",", "shape", "=...
Construct Keras input layers for the given transformer Returns ------- layers : {field: keras.layers.Input} A dictionary of keras input layers, keyed by the corresponding field keys.
[ "Construct", "Keras", "input", "layers", "for", "the", "given", "transformer" ]
train
https://github.com/bmcfee/pumpp/blob/06a17b888271dd1f6cd41bddb22b0eb04d494056/pumpp/feature/base.py#L132-L149
bmcfee/pumpp
pumpp/feature/base.py
FeatureExtractor.n_frames
def n_frames(self, duration): '''Get the number of frames for a given duration Parameters ---------- duration : number >= 0 The duration, in seconds Returns ------- n_frames : int >= 0 The number of frames at this extractor's sampling rat...
python
def n_frames(self, duration): '''Get the number of frames for a given duration Parameters ---------- duration : number >= 0 The duration, in seconds Returns ------- n_frames : int >= 0 The number of frames at this extractor's sampling rat...
[ "def", "n_frames", "(", "self", ",", "duration", ")", ":", "return", "int", "(", "time_to_frames", "(", "duration", ",", "sr", "=", "self", ".", "sr", ",", "hop_length", "=", "self", ".", "hop_length", ")", ")" ]
Get the number of frames for a given duration Parameters ---------- duration : number >= 0 The duration, in seconds Returns ------- n_frames : int >= 0 The number of frames at this extractor's sampling rate and hop length
[ "Get", "the", "number", "of", "frames", "for", "a", "given", "duration" ]
train
https://github.com/bmcfee/pumpp/blob/06a17b888271dd1f6cd41bddb22b0eb04d494056/pumpp/feature/base.py#L151-L167
novopl/peltak
src/peltak/extra/gitflow/logic/release.py
start
def start(component, exact): # type: (str, str) -> None """ Create a new release branch. Args: component (str): Version component to bump when creating the release. Can be *major*, *minor* or *patch*. exact (str): The exact version to set for the release....
python
def start(component, exact): # type: (str, str) -> None """ Create a new release branch. Args: component (str): Version component to bump when creating the release. Can be *major*, *minor* or *patch*. exact (str): The exact version to set for the release....
[ "def", "start", "(", "component", ",", "exact", ")", ":", "# type: (str, str) -> None", "version_file", "=", "conf", ".", "get_path", "(", "'version_file'", ",", "'VERSION'", ")", "develop", "=", "conf", ".", "get", "(", "'git.devel_branch'", ",", "'develop'", ...
Create a new release branch. Args: component (str): Version component to bump when creating the release. Can be *major*, *minor* or *patch*. exact (str): The exact version to set for the release. Overrides the component argument. This allows to re-rel...
[ "Create", "a", "new", "release", "branch", "." ]
train
https://github.com/novopl/peltak/blob/b627acc019e3665875fe76cdca0a14773b69beaa/src/peltak/extra/gitflow/logic/release.py#L34-L78
novopl/peltak
src/peltak/extra/gitflow/logic/release.py
tag
def tag(message): # type: () -> None """ Tag the current commit with the current version. """ release_ver = versioning.current() message = message or 'v{} release'.format(release_ver) with conf.within_proj_dir(): log.info("Creating release tag") git.tag( author=git.lates...
python
def tag(message): # type: () -> None """ Tag the current commit with the current version. """ release_ver = versioning.current() message = message or 'v{} release'.format(release_ver) with conf.within_proj_dir(): log.info("Creating release tag") git.tag( author=git.lates...
[ "def", "tag", "(", "message", ")", ":", "# type: () -> None", "release_ver", "=", "versioning", ".", "current", "(", ")", "message", "=", "message", "or", "'v{} release'", ".", "format", "(", "release_ver", ")", "with", "conf", ".", "within_proj_dir", "(", "...
Tag the current commit with the current version.
[ "Tag", "the", "current", "commit", "with", "the", "current", "version", "." ]
train
https://github.com/novopl/peltak/blob/b627acc019e3665875fe76cdca0a14773b69beaa/src/peltak/extra/gitflow/logic/release.py#L144-L156
novopl/peltak
src/peltak/logic/lint.py
lint
def lint(exclude, skip_untracked, commit_only): # type: (List[str], bool, bool) -> None """ Lint python files. Args: exclude (list[str]): A list of glob string patterns to test against. If the file/path matches any of those patters, it will be filtered out. skip_untr...
python
def lint(exclude, skip_untracked, commit_only): # type: (List[str], bool, bool) -> None """ Lint python files. Args: exclude (list[str]): A list of glob string patterns to test against. If the file/path matches any of those patters, it will be filtered out. skip_untr...
[ "def", "lint", "(", "exclude", ",", "skip_untracked", ",", "commit_only", ")", ":", "# type: (List[str], bool, bool) -> None", "exclude", "=", "list", "(", "exclude", ")", "+", "conf", ".", "get", "(", "'lint.exclude'", ",", "[", "]", ")", "runner", "=", "Li...
Lint python files. Args: exclude (list[str]): A list of glob string patterns to test against. If the file/path matches any of those patters, it will be filtered out. skip_untracked (bool): If set to **True** it will skip all files not tracked by git. comm...
[ "Lint", "python", "files", "." ]
train
https://github.com/novopl/peltak/blob/b627acc019e3665875fe76cdca0a14773b69beaa/src/peltak/logic/lint.py#L41-L58
novopl/peltak
src/peltak/logic/lint.py
tool
def tool(name): # type: (str) -> FunctionType """ Decorator for defining lint tools. Args: name (str): The name of the tool. This name will be used to identify the tool in `pelconf.yaml`. """ global g_tools def decorator(fn): # pylint: disable=missing-docstring...
python
def tool(name): # type: (str) -> FunctionType """ Decorator for defining lint tools. Args: name (str): The name of the tool. This name will be used to identify the tool in `pelconf.yaml`. """ global g_tools def decorator(fn): # pylint: disable=missing-docstring...
[ "def", "tool", "(", "name", ")", ":", "# type: (str) -> FunctionType", "global", "g_tools", "def", "decorator", "(", "fn", ")", ":", "# pylint: disable=missing-docstring", "# type: (FunctionType) -> FunctionType", "g_tools", "[", "name", "]", "=", "fn", "return", "fn"...
Decorator for defining lint tools. Args: name (str): The name of the tool. This name will be used to identify the tool in `pelconf.yaml`.
[ "Decorator", "for", "defining", "lint", "tools", "." ]
train
https://github.com/novopl/peltak/blob/b627acc019e3665875fe76cdca0a14773b69beaa/src/peltak/logic/lint.py#L61-L77
novopl/peltak
src/peltak/logic/lint.py
pep8_check
def pep8_check(files): # type: (List[str]) -> int """ Run code checks using pep8. Args: files (list[str]): A list of files to check Returns: bool: **True** if all files passed the checks, **False** otherwise. pep8 tool is **very** fast. Especially compared to pylint an...
python
def pep8_check(files): # type: (List[str]) -> int """ Run code checks using pep8. Args: files (list[str]): A list of files to check Returns: bool: **True** if all files passed the checks, **False** otherwise. pep8 tool is **very** fast. Especially compared to pylint an...
[ "def", "pep8_check", "(", "files", ")", ":", "# type: (List[str]) -> int", "files", "=", "fs", ".", "wrap_paths", "(", "files", ")", "cfg_path", "=", "conf", ".", "get_path", "(", "'lint.pep8_cfg'", ",", "'ops/tools/pep8.ini'", ")", "pep8_cmd", "=", "'pep8 --con...
Run code checks using pep8. Args: files (list[str]): A list of files to check Returns: bool: **True** if all files passed the checks, **False** otherwise. pep8 tool is **very** fast. Especially compared to pylint and the bigger the code base the bigger the difference. If y...
[ "Run", "code", "checks", "using", "pep8", "." ]
train
https://github.com/novopl/peltak/blob/b627acc019e3665875fe76cdca0a14773b69beaa/src/peltak/logic/lint.py#L208-L229
novopl/peltak
src/peltak/logic/lint.py
pylint_check
def pylint_check(files): # type: (List[str]) -> int """ Run code checks using pylint. Args: files (list[str]): A list of files to check Returns: bool: **True** if all files passed the checks, **False** otherwise. """ files = fs.wrap_paths(files) cfg_path = conf....
python
def pylint_check(files): # type: (List[str]) -> int """ Run code checks using pylint. Args: files (list[str]): A list of files to check Returns: bool: **True** if all files passed the checks, **False** otherwise. """ files = fs.wrap_paths(files) cfg_path = conf....
[ "def", "pylint_check", "(", "files", ")", ":", "# type: (List[str]) -> int", "files", "=", "fs", ".", "wrap_paths", "(", "files", ")", "cfg_path", "=", "conf", ".", "get_path", "(", "'lint.pylint_cfg'", ",", "'ops/tools/pylint.ini'", ")", "pylint_cmd", "=", "'py...
Run code checks using pylint. Args: files (list[str]): A list of files to check Returns: bool: **True** if all files passed the checks, **False** otherwise.
[ "Run", "code", "checks", "using", "pylint", "." ]
train
https://github.com/novopl/peltak/blob/b627acc019e3665875fe76cdca0a14773b69beaa/src/peltak/logic/lint.py#L233-L248
novopl/peltak
src/peltak/logic/lint.py
LintRunner.run
def run(self): # type: () -> bool """ Run all linters and report results. Returns: bool: **True** if all checks were successful, **False** otherwise. """ with util.timed_block() as t: files = self._collect_files() log.info("Collected <33>{} <32>f...
python
def run(self): # type: () -> bool """ Run all linters and report results. Returns: bool: **True** if all checks were successful, **False** otherwise. """ with util.timed_block() as t: files = self._collect_files() log.info("Collected <33>{} <32>f...
[ "def", "run", "(", "self", ")", ":", "# type: () -> bool", "with", "util", ".", "timed_block", "(", ")", "as", "t", ":", "files", "=", "self", ".", "_collect_files", "(", ")", "log", ".", "info", "(", "\"Collected <33>{} <32>files in <33>{}s\"", ".", "format...
Run all linters and report results. Returns: bool: **True** if all checks were successful, **False** otherwise.
[ "Run", "all", "linters", "and", "report", "results", "." ]
train
https://github.com/novopl/peltak/blob/b627acc019e3665875fe76cdca0a14773b69beaa/src/peltak/logic/lint.py#L118-L152
dacker-team/pyzure
pyzure/send/send.py
send_to_azure
def send_to_azure(instance, data, replace=True, types=None, primary_key=(), sub_commit=True): """ data = { "table_name" : 'name_of_the_azure_schema' + '.' + 'name_of_the_azure_table' #Must already exist, "columns_name" : [first_column_name,second_column_name,...,last_column_name], "row...
python
def send_to_azure(instance, data, replace=True, types=None, primary_key=(), sub_commit=True): """ data = { "table_name" : 'name_of_the_azure_schema' + '.' + 'name_of_the_azure_table' #Must already exist, "columns_name" : [first_column_name,second_column_name,...,last_column_name], "row...
[ "def", "send_to_azure", "(", "instance", ",", "data", ",", "replace", "=", "True", ",", "types", "=", "None", ",", "primary_key", "=", "(", ")", ",", "sub_commit", "=", "True", ")", ":", "# Time initialization", "start", "=", "datetime", ".", "datetime", ...
data = { "table_name" : 'name_of_the_azure_schema' + '.' + 'name_of_the_azure_table' #Must already exist, "columns_name" : [first_column_name,second_column_name,...,last_column_name], "rows" : [[first_raw_value,second_raw_value,...,last_raw_value],...] }
[ "data", "=", "{", "table_name", ":", "name_of_the_azure_schema", "+", ".", "+", "name_of_the_azure_table", "#Must", "already", "exist", "columns_name", ":", "[", "first_column_name", "second_column_name", "...", "last_column_name", "]", "rows", ":", "[[", "first_raw_v...
train
https://github.com/dacker-team/pyzure/blob/1e6d202f91ca0f080635adc470d9d18585056d53/pyzure/send/send.py#L15-L121
cons3rt/pycons3rt
pycons3rt/dyndict.py
getdict
def getdict(source): """Returns a standard python Dict with computed values from the DynDict :param source: (DynDict) input :return: (dict) Containing computed values """ std_dict = {} for var, val in source.iteritems(): std_dict[var] = source[var] return std_dict
python
def getdict(source): """Returns a standard python Dict with computed values from the DynDict :param source: (DynDict) input :return: (dict) Containing computed values """ std_dict = {} for var, val in source.iteritems(): std_dict[var] = source[var] return std_dict
[ "def", "getdict", "(", "source", ")", ":", "std_dict", "=", "{", "}", "for", "var", ",", "val", "in", "source", ".", "iteritems", "(", ")", ":", "std_dict", "[", "var", "]", "=", "source", "[", "var", "]", "return", "std_dict" ]
Returns a standard python Dict with computed values from the DynDict :param source: (DynDict) input :return: (dict) Containing computed values
[ "Returns", "a", "standard", "python", "Dict", "with", "computed", "values", "from", "the", "DynDict", ":", "param", "source", ":", "(", "DynDict", ")", "input", ":", "return", ":", "(", "dict", ")", "Containing", "computed", "values" ]
train
https://github.com/cons3rt/pycons3rt/blob/f004ab3a35c5bff2f698131fef3b2a8ed5a7596d/pycons3rt/dyndict.py#L20-L29
Varkal/chuda
chuda/plugins.py
Plugin.enrich_app
def enrich_app(self, name, value): ''' Add a new property to the app (with setattr) Args: name (str): the name of the new property value (any): the value of the new property ''' #Method shouldn't be added: https://stackoverflow.com/a/28060251/3042398 ...
python
def enrich_app(self, name, value): ''' Add a new property to the app (with setattr) Args: name (str): the name of the new property value (any): the value of the new property ''' #Method shouldn't be added: https://stackoverflow.com/a/28060251/3042398 ...
[ "def", "enrich_app", "(", "self", ",", "name", ",", "value", ")", ":", "#Method shouldn't be added: https://stackoverflow.com/a/28060251/3042398", "if", "type", "(", "value", ")", "==", "type", "(", "self", ".", "enrich_app", ")", ":", "raise", "ValueError", "(",...
Add a new property to the app (with setattr) Args: name (str): the name of the new property value (any): the value of the new property
[ "Add", "a", "new", "property", "to", "the", "app", "(", "with", "setattr", ")" ]
train
https://github.com/Varkal/chuda/blob/0d93b716dede35231c21be97bcc19a656655983f/chuda/plugins.py#L21-L33
Vital-Fernandez/dazer
bin/lib/Math_Libraries/fitting_methods.py
linfit
def linfit(x_true, y, sigmay=None, relsigma=True, cov=False, chisq=False, residuals=False): """ Least squares linear fit. Fit a straight line `f(x_true) = a + bx` to points `(x_true, y)`. Returns coefficients `a` and `b` that minimize the squared error. Parameters ---------- x_t...
python
def linfit(x_true, y, sigmay=None, relsigma=True, cov=False, chisq=False, residuals=False): """ Least squares linear fit. Fit a straight line `f(x_true) = a + bx` to points `(x_true, y)`. Returns coefficients `a` and `b` that minimize the squared error. Parameters ---------- x_t...
[ "def", "linfit", "(", "x_true", ",", "y", ",", "sigmay", "=", "None", ",", "relsigma", "=", "True", ",", "cov", "=", "False", ",", "chisq", "=", "False", ",", "residuals", "=", "False", ")", ":", "x_true", "=", "asarray", "(", "x_true", ")", "y", ...
Least squares linear fit. Fit a straight line `f(x_true) = a + bx` to points `(x_true, y)`. Returns coefficients `a` and `b` that minimize the squared error. Parameters ---------- x_true : array_like one dimensional array of `x_true` data with `n`>2 data points. y : array_li...
[ "Least", "squares", "linear", "fit", ".", "Fit", "a", "straight", "line", "f", "(", "x_true", ")", "=", "a", "+", "bx", "to", "points", "(", "x_true", "y", ")", ".", "Returns", "coefficients", "a", "and", "b", "that", "minimize", "the", "squared", "e...
train
https://github.com/Vital-Fernandez/dazer/blob/3c9ae8ae6d40ea33f22cc20dc11365d6d6e65244/bin/lib/Math_Libraries/fitting_methods.py#L53-L305