neurodsp.sim.sim_knee

neurodsp.sim.sim_knee(n_seconds, fs, exponent1, exponent2, knee)[source]

Simulate a signal whose power spectrum has a 1/f structure with a knee.

Parameters
n_secondsfloat

Simulation time, in seconds.

fsfloat

Sampling rate of simulated signal, in Hz.

exponent1float

Power law exponent before the knee.

exponent2float

Power law exponent after the knee.

kneefloat

Knee parameter.

Returns
sig1d array

Time series with the desired power spectrum.

Notes

This simulated time series has a power spectrum that follows the Lorentzian equation:

P(f) = 1 / (f**(exponent1) * f**(exponent2 + exponent1) + knee)

  • This simulation creates this power spectrum shape using a sum of sinusoids.

  • The slope of the log power spectrum before the knee is exponent1

  • The slope after the knee is exponent2, but only when the sign of exponent1 and exponent2 are the same.

Examples

Simulate a time series with exponent1 of -1, exponent2 of -2, and knee of 100:

>> sim_knee(n_seconds=10, fs=1000, exponent1=-1, exponent2=-2, knee=100)

Examples using neurodsp.sim.sim_knee

Simulating Aperiodic Signals

Simulating Aperiodic Signals