specparam.sim.transform.translate_spectrum

specparam.sim.transform.translate_spectrum(power_spectrum, delta_offset)[source]

Translate a spectrum, changing the offset value.

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

Returns:
translated_spectrum1d array

Translated power spectrum.

Examples

Translate a simulated spectrum, moving the offset up:

>>> from specparam.sim import sim_power_spectrum
>>> freqs, powers = sim_power_spectrum([1, 50], [1, 1], [10, 0.5, 1])
>>> translated_powers = translate_spectrum(powers, 0.5)

Examples using specparam.sim.transform.translate_spectrum

Transforming Power Spectra

Transforming Power Spectra