nigsp.operations.timeseries.resize_ts

nigsp.operations.timeseries.resize_ts(timeseries, resize=None, globally=False)[source]

Rescale timeseries with some methods.

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.

resize‘spc’, ‘norm’, ‘gnorm’, ‘demean’, ‘gdemean’ tuple, list, or None, optional

Whether to resize the signal or not before plotting. If ‘spc’, compute signal percentage change. If ‘norm’, normalise signals (z-score). If ‘demean’, remove signal average. If ‘gsr’, remove global signal (average across points). If tuple or list, rescale signals between those two values. If None, don’t do anything (default).

globallybool, optional

If True, rescale timeseries across the first two axes.

Returns:
numpy.ndarray

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