nigsp.operations.timeseries.rescale_ts¶
- nigsp.operations.timeseries.rescale_ts(timeseries, vmin=0, vmax=1, globally=False)[source]¶
Rescale given timeseries between given max and min value.
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].
Any timeseries with std == 0 is returned as a series of 0s.
- Parameters:
- timeseries
numpy.ndarray
The input timeseries. It is assumed that the second dimension is time.
- vmin
float
, optional The minimum value to scale between.
- vmax
float
, optional The maximum value to scale between.
- globally
bool
, optional If True, rescale timeseries across the first two axes.
- timeseries
- Returns:
numpy.ndarray
The normalised timeseries (mean=0 std=1) if timeseries is not a 1D array. If timeseries is a 1D array, it is returned as is.