sc_math#
Extensions to Numpy, including finding array elements and smoothing data.
- Highlights:
sc.findinds()
: find indices of an array matching a conditionsc.findnearest()
: find nearest matching valuesc.rolling()
: calculate rolling averagesc.smooth()
: simple smoothing of 1D or 2D arrays
Functions
Determine whether two scalars (or an array and a scalar) approximately match. |
|
Handle divide-by-zero and divide-by-nan elegantly. |
|
Find matches even if two things aren't eactly equal (e.g. floats vs. |
|
Alias for |
|
Alias for |
|
Return the index of the nearest match in series to value -- like |
|
Count the number of matching elements. |
|
Take an array of data and return either the first or last (or some other) non-NaN entry. |
|
Return the indices that are valid based on the validity of the input data from an arbitrary number of 1-D vector inputs. |
|
Return the data value indices that are valid based on the validity of the input data. |
|
Sanitize input to remove NaNs. |
|
Sanitize input to remove NaNs. |
|
Alias for |
|
Alias for |
|
Compare two or more arrays for equality element-wise, treating NaN values as equal. |
|
Determine if a number is prime. |
|
Count the number of digits in a number (or list of numbers). |
|
Define an array of numbers uniformly perturbed with a mean of 1. |
|
Multiply a list or array by some normalizing factor so that its sum is equal to the total. |
|
Rescale an array between a minimum value and a maximum value. |
|
Like |
|
Round a float, list, or array probabilistically to the nearest integer. |
|
Like |
|
Simple linear regression returning the line of best fit and R value. |
|
Calculate the standard error of the mean (SEM). |
|
Alias to |
|
Like |
|
Very simple function to smooth a 1D or 2D array. |
|
Smoothly interpolate over values |
|
Gaussian 1D smoothing kernel. |
|
Gaussian 2D smoothing kernel. |