neurodsp.sim.sim_powerlaw

neurodsp.sim.sim_powerlaw(n_seconds, fs, exponent=- 2.0, f_range=None, **filter_kwargs)[source]

Simulate a power law time series, with a specified exponent.

Parameters
n_secondsfloat

Simulation time, in seconds.

fsfloat

Sampling rate of simulated signal, in Hz.

exponentfloat, optional, default: -2

Desired power-law exponent, of the form P(f)=f^exponent.

f_rangelist of [float, float] or None, optional

Frequency range to filter simulated data, as [f_lo, f_hi], in Hz.

**filter_kwargskwargs, optional

Keyword arguments to pass to filter_signal.

Returns
sig: 1d array

Time-series with the desired power law exponent.

Examples

Simulate a power law signal, with an exponent of -2 (brown noise):

>>> sig = sim_powerlaw(n_seconds=1, fs=500, exponent=-2.0)

Simulate a power law signal, with a highpass filter applied at 2 Hz:

>>> sig = sim_powerlaw(n_seconds=1, fs=500, exponent=-1.5, f_range=(2, None))

Examples using neurodsp.sim.sim_powerlaw