Utilities

This module contains some utilities functions for data manipulation in general, signal processing or/and text processing. For instance function to create a matrix of lagged-time series for input to our forward and backward models.

Also, utilities functions to apply rolling methods (rolling average, variance, or so on) wiht the NumPy side trick see the Python Cookbook recipee for more details.

Classes

Functions

Array manipulation

Utils functions to create shifted version of an array, rolling or moving views along axis, etc.

lag_matrix(data[, lag_samples, filling, ...])

Helper function to create a matrix of lagged time series.

lag_span(tmin, tmax[, srate])

Create an array of lags spanning the time window [tmin, tmax].

lag_sparse(times[, srate])

Create an array of lags for the requested time point in times.

rolling_func(func, data[, winsize, overlap, ...])

Apply a function on a rolling window on the data

moving_average(data[, winsize])

#TODO: pad before calling chunk_data?

chunk_data(data, window_size[, ...])

Nd array version of shift_array()

shift_array(arr[, win, overlap, padding, axis])

Returns segments of an array (overlapping moving windows) using the as_strided function from NumPy.

Signal

Signal processing related.

signal_envelope(signal, srate[, cutoff, ...])

Compute the broadband envelope of the input signal.

fir_order(tbw, srate[, atten, ripples])

Estimate FIR Type II filter order (order will be odd).

find_knee_point(x, y[, tol, plot])

Function to find elbow or knee point (minimum local curvature) in a curve.

is_pos_def(A)

Check if matrix is positive definite

Other

Miscelaneous, e.g. system related, or characterisation…

mem_check([units])

Get available RAM

_is_1d(arr)

Short utility function to check if an array is vector-like