neurodsp.sim.utils.rotate_timeseries

neurodsp.sim.utils.rotate_timeseries(sig, fs, delta_exp, f_rotation=1)[source]

Rotate a timeseries of data, changing it’s 1/f exponent.

Parameters
sig1d array

A time series to rotate.

fsfloat

Sampling rate of the signal, in Hz.

delta_expfloat

Change in power law exponent to be applied. Positive is clockwise rotation (steepen), negative is counter clockwise rotation (flatten).

f_rotationfloat, optional, default: 1

Frequency, in Hz, to rotate the spectrum around, where power is unchanged by the rotation.

Returns
sig_rotated1d array

The rotated version of the signal.

Notes

This function works by taking the FFT and spectrally rotating the input signal. To return a timeseries, the rotated FFT is then turned back into a time series, with an iFFT.

Examples

Rotate a timeseries of simulated data:

>>> from neurodsp.sim import sim_combined
>>> sig = sim_combined(n_seconds=10, fs=500,
...                    components={'sim_powerlaw': {}, 'sim_oscillation' : {'freq': 10}})
>>> rotated_sig = rotate_timeseries(sig, fs=500, delta_exp=0.5)