Package gmisclib :: Module Numeric_gpk
[frames] | no frames]

Module Numeric_gpk

source code

Classes
  EdgesTooWide
Functions
 
add_overlap(a, astart, b, bstart)
Add arrays a and b in the overlap region.
source code
 
zero_pad_end(d, padfactor=1) source code
 
Poisson(nbar)
Return a Poisson random integer, whose distribution has a mean = nbar.
source code
 
bevel_concat(a, b, bevel=0, bevel_overlap=1.0, delay=0, ta=None, tb=None)
Concatenate two time series.
source code
 
argmax(a) source code
 
N_maximum(a) source code
 
N_minimum(a) source code
 
N_frac_rank(a, fr) source code
 
N_mean_ad(a)
Mean absolute deviation.
source code
 
median_across(list_of_vec)
Returns an element-by-element median of a list of Numeric vectors.
source code
 
N_median(a, axis=0)
Returns an element-by-element median of a list of Numeric vectors.
source code
 
N_median_across(a) source code
 
set_diag(x, a)
Set the diagonal of a matrix x to be the vector a.
source code
 
limit(low, x, high) source code
 
trimmed_mean_sigma_across(list_of_vec, weights, clip) source code
 
trimmed_mean_across(list_of_vec, weights, clip) source code
 
trimmed_stdev_across(list_of_vec, weights, clip) source code
 
vec_variance(x)
Take a component-by-component variance of a list of vectors.
source code
 
qform(vec, mat)
A quadratic form: vec*mat*vec, or vecs*mat*transpose(vecs)
source code
 
KolmogorovSmirnov(d1, d2, w1=None, w2=None) source code
 
interpN(a, t)
Interpolate array a to floating point indices, t, via nearest-neighbor interpolation.
source code
numpy array.
interp(a, t)
Interpolate to a specified time axis.
source code
 
split_into_clumps(x, threshold, minsize=1)
This reports when the signal is above the threshold.
source code
 
block_stdev(x)
This is just a alternative implementation of the standard deviation of each channel, but it is designed in a block-wise fashion so the total memory usage is not large.
source code
 
convolve(x, kernel)
This is basically like numpy.convolve(x, kernel, 1) except that it properly handles the case where the kernel is longer than the data.
source code
 
edge_window(n, eleft, eright, typeleft='linear', typeright='linear', norm=None)
Creates a window which is basically flat, but tapers off on the left and right edges.
source code
 
edge_window_t(t, eleft, eright, typeleft='linear', typeright='linear', norm=None)
Computes a window which is basically flat, but tapers off on the left and right edges.
source code
Variables
  pylab = None
hash(x)
  asinh = <ufunc 'arcsinh'>
  acosh = <ufunc 'arccosh'>
  BLOCK = 8192
  __package__ = 'gmisclib'

Imports: numpy, math, variance, stdev, make_diag


Function Details

add_overlap(a, astart, b, bstart)

source code 

Add arrays a and b in the overlap region. Return (data, start). If a, b are time series, they are assumed to have the same sampling rate. Astart and Bstart apply to the zeroth index. All other indices are assumed to match start and length.

bevel_concat(a, b, bevel=0, bevel_overlap=1.0, delay=0, ta=None, tb=None)

source code 

Concatenate two time series. Bevel the edges, and overlap them slightly.

Bevel_overlap controls the fractional overlap of the two bevels, and delay specifies an extra delay for b.

If ta and/or tb are specified, return a tuple of (concatenated_time_series, tma, tmb) where tma and tmb are the locations corresponding to ta and tb in the corresponding input arrays.

N_mean_ad(a)

source code 

Mean absolute deviation. For a multi-dimensional array, it takes the MAD along the first axis, so N_mean_ad(x)[0]==N_mean_ad(x[:,0]).

set_diag(x, a)

source code 

Set the diagonal of a matrix x to be the vector a. If a is shorter than the diagonal of x, just set the beginning.

interpN(a, t)

source code 

Interpolate array a to floating point indices, t, via nearest-neighbor interpolation. Returns a Numeric array.

interp(a, t)

source code 

Interpolate to a specified time axis. This does a linear interpolation. A is a Numpy array, and t is an array of times.

Returns: numpy array.
interpolated values

split_into_clumps(x, threshold, minsize=1)

source code 

This reports when the signal is above the threshold.

Parameters:
  • x (numpy.ndarray, one-dimensional.) - a signal
  • threshold (float) - a threshold.
Returns:
[(start, stop), ...] for each region ("clump") where x>threshold.

edge_window(n, eleft, eright, typeleft='linear', typeright='linear', norm=None)

source code 

Creates a window which is basically flat, but tapers off on the left and right edges. The widths of the tapers can be controlled, as can the shapes.

Parameters:
  • n (int) - the width of the window
  • eleft (int) - the width of the left taper (i.e. at zero index, in samples).
  • eright (int) - the width of the right taper (i.e. at index near n, in samples).
  • typeleft ('linear' or 'cos') - what kind of taper on the left? (Defaults to "linear").
  • typeright ('linear' or 'cos') - what kind of taper on the right? (Defaults to "linear").
  • norm (None or float != 0.) - How to normalize? The default is None, which means no normalization. Providing a number x will normalize the window so that the average of the window**x==1.

edge_window_t(t, eleft, eright, typeleft='linear', typeright='linear', norm=None)

source code 

Computes a window which is basically flat, but tapers off on the left and right edges. The widths of the tapers can be controlled, as can the shapes.

Parameters:
  • t (numpy.ndarray) - an array of time values. They are required to be monotonically increasing, and assumed to be linearly spaced.
  • eleft (float) - the width of the left taper (i.e. at zero index, in time units).
  • eright (float) - the width of the right taper (i.e. at index near n, in time units).
  • typeleft ('linear' or 'cos') - what kind of taper on the left? (Defaults to "linear").
  • typeright ('linear' or 'cos') - what kind of taper on the right? (Defaults to "linear").
  • norm (None or float != 0.) - How to normalize? The default is None, which means no normalization. Providing a number x will normalize the window so that the average of the window**x==1.