specparam.utils.spectral.interpolate_spectra

specparam.utils.spectral.interpolate_spectra(freqs, powers, interp_range, buffer=3)[source]

Interpolate a frequency region across a group of power spectra.

Parameters:
freqs1d array

Frequency values for the power spectrum.

powers2d array

Power values for the power spectra.

interp_rangelist of float or list of list of float

Frequency range to interpolate, as [lowest_freq, highest_freq]. If a list of lists, applies each as it’s own interpolation range.

bufferint or list of int

The number of samples to use on either side of the interpolation range, that are then averaged and used to calculate the interpolation.

Returns:
freqs1d array

Frequency values for the power spectrum.

powers2d array

Power values, with interpolation, for the power spectra.

Notes

% copied in from interpolate_spectrum

Examples

Using simulated spectra, interpolate away line noise peaks:

>>> from specparam.sim import sim_group_power_spectra
>>> freqs, powers = sim_group_power_spectra(5, [1, 75], {'fixed' : [1, 1]},
...                                         {'gaussian' : [[10, 0.5, 1.0], [60, 2, 0.1]]})
>>> freqs, powers = interpolate_spectra(freqs, powers, [58, 62])