fooof.sim.transform.rotate_sim_spectrum

fooof.sim.transform.rotate_sim_spectrum(freqs, power_spectrum, delta_exponent, f_rotation, sim_params)[source]

Rotate a simulated power spectrum, updating a SimParams object.

Parameters
freqs1d array

Frequency axis of input power spectrum, in Hz.

power_spectrum1d array

Power values of the spectrum.

delta_exponentfloat

Change in aperiodic exponent to be applied, where:

  • positive is clockwise rotation (steepen)

  • negative is counterclockwise rotation (flatten)

f_rotationfloat

Frequency value, in Hz, about which rotation is applied, at which power is unchanged.

sim_paramsSimParams

Object storing the current parameter definitions.

Returns
rotated_spectrum1d array

Rotated power spectrum.

new_sim_paramsSimParams

New parameter definitions.

Notes

Warning: This function should only be applied to spectra without a knee. If using simulated data, this is spectra created in ‘fixed’ mode. This is because the rotation applied is inconsistent with the formulation of knee spectra, and will change them in an unspecified way, not just limited to doing the rotation.

Examples

Rotate a simulated spectrum, changing the exponent around a rotation point of 25 Hz:

>>> from fooof.sim.gen import gen_power_spectrum
>>> freqs, powers, sp = gen_power_spectrum([1, 50], [1, 1], [10, 0.5, 1], return_params=True)
>>> rotated_powers, new_sp = rotate_sim_spectrum(freqs, powers, 0.5, 25, sp)

Examples using fooof.sim.transform.rotate_sim_spectrum

Transforming Power Spectra

Transforming Power Spectra