nigsp.operations.timeseries.demean_ts

nigsp.operations.timeseries.demean_ts(timeseries, globally=False)[source]

Demean timeseries.

It is assumed that time is encoded in the second dimension (axis 1), e.g. for 90 voxels and 300 timepoints, shape is [90, 300].

Parameters:
timeseriesnumpy.ndarray

The input timeseries. It is assumed that the second dimension is time.

globallybool, optional

If True, demean timeseries across the first two axes.

Returns:
numpy.ndarray

The demeaned timeseries if timeseries is not a 1D array. If timeseries is a 1D array, it is returned as is.