fooof.sim.transform.translate_sim_spectrum

fooof.sim.transform.translate_sim_spectrum(power_spectrum, delta_offset, sim_params)[source]

Translate a simulated spectrum, updating a SimParams object.

Parameters
power_spectrum1d array

Power values of the spectrum.

delta_offsetfloat

Amount to change the offset by, where:

  • positive values are an upwards translation

  • negative are are a downwards translation

sim_paramsSimParams

Object storing the current parameter definitions.

Returns
translated_spectrum1d array

Translated power spectrum.

new_sim_paramsSimParams

New parameter definitions.

Examples

Translate a simulated spectrum, moving the offset up:

>>> 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)
>>> translated_powers, new_sp = translate_sim_spectrum(powers, 0.5, sp)

Examples using fooof.sim.transform.translate_sim_spectrum