neurodsp.spectral.compute_spectrum_wavelet(sig, fs, freqs, avg_type='mean', **kwargs)[source]

Compute the power spectral density using wavelets.

sig1d or 2d array

Time series.


Sampling rate, in Hz.

freqs1d array or list of float

If array, frequency values to estimate with morlet wavelets. If list, define the frequency range, as [freq_start, freq_stop, freq_step]. The freq_step is optional, and defaults to 1. Range is inclusive of freq_stop value.

avg_type{‘mean’, ‘median’}, optional

Method to average across the windows.


Optional inputs for using wavelets.

freqs1d array

Frequencies at which the measure was calculated.

spectrum1d or 2d array

Power spectral density.


Compute the power spectrum of a simulated time series using wavelets:

>>> from neurodsp.sim import sim_combined
>>> sig = sim_combined(n_seconds=10, fs=500,
...                    components={'sim_powerlaw': {}, 'sim_oscillation' : {'freq': 10}})
>>> freqs, spectrum = compute_spectrum_wavelet(sig, fs=500, freqs=[1, 30])