Package mvpa :: Package misc :: Module signal
[hide private]
[frames] | no frames]

Module signal

source code

Simple preprocessing utilities
Functions [hide private]
 
detrend(data, perchunk=False, model='linear', polyord=None, opt_reg=None)
Given a dataset, detrend the data inplace either entirely or per each chunk
source code
 
__detrend_regress(data, perchunk=True, polyord=None, opt_reg=None)
Given a dataset, perform a detrend inplace, regressing out polynomial terms as well as optional regressors, such as motion parameters.
source code

Imports: N, signal, lstsq, legendre, isSequenceType, getBreakPoints


Function Details [hide private]

detrend(data, perchunk=False, model='linear', polyord=None, opt_reg=None)

source code 
Given a dataset, detrend the data inplace either entirely or per each chunk
Parameters:
  • data (Dataset) - dataset to operate on
  • perchunk (bool) - either to operate on whole dataset at once or on each chunk separately
  • model - Type of detrending model to run. If 'linear' or 'constant', scipy.signal.detrend is used to perform a linear or demeaning detrend. If 'regress', then you specify the polyord and opt_reg arguments to define regressors to regress out of the dataset.
  • polyord (int or list) - Order of the Legendre polynomial to remove from the data. This will remove every polynomial up to and including the provided value. For example, 3 will remove 0th, 1st, 2nd, and 3rd order polynomials from the data. N.B.: The 0th polynomial is the baseline shift, the 1st is the linear trend. If you specify a single int and perchunk is True, then this value is used for each chunk. You can also specify a differnt polyord value for each chunk by providing a list or ndarray of polyord values the length of the number of chunks.
  • opt_reg (ndarray) - Optional ndarray of additional information to regress out from the dataset. One example would be to regress out motion parameters. As with the data, time is on the first axis.

__detrend_regress(data, perchunk=True, polyord=None, opt_reg=None)

source code 
Given a dataset, perform a detrend inplace, regressing out polynomial terms as well as optional regressors, such as motion parameters.

Parameters:

data: Dataset
Dataset to operate on
perchunk : bool
Either to operate on whole dataset at once or on each chunk separately. If perchunk is True, all the samples within a chunk should be contiguous and the chunks should be sorted in order from low to high.
polyord : int
Order of the Legendre polynomial to remove from the data. This will remove every polynomial up to and including the provided value. For example, 3 will remove 0th, 1st, 2nd, and 3rd order polynomials from the data. N.B.: The 0th polynomial is the baseline shift, the 1st is the linear trend. If you specify a single int and perchunk is True, then this value is used for each chunk. You can also specify a differnt polyord value for each chunk by providing a list or ndarray of polyord values the length of the number of chunks.
opt_reg : ndarray
Optional ndarray of additional information to regress out from the dataset. One example would be to regress out motion parameters. As with the data, time is on the first axis.