neurodsp.spectral.compute_absolute_power

neurodsp.spectral.compute_absolute_power(freqs, powers, band, method='sum')[source]

Compute absolute power for a given frequency band.

Parameters
freqs1d array

Frequency values.

powers1d array

Power spectrum power values.

bandlist of [float, float]

Band definition.

method{‘sum’, ‘mean’, ‘median’}, optional

Method to use to compute power across the band.

Returns
abs_powerfloat

Computed absolute power.

Examples

Compute absolute alpha power in a simulated signal:

>>> from neurodsp.sim import sim_combined
>>> from neurodsp.spectral import compute_spectrum
>>> sig = sim_combined(10, 500, {'sim_powerlaw': {}, 'sim_oscillation': {'freq': 10}})
>>> freqs, powers = compute_spectrum(sig, fs=500)
>>> abs_power = compute_absolute_power(freqs, powers, [8, 12])