neurodsp.spectral.compute_spectrum_multitaper

neurodsp.spectral.compute_spectrum_multitaper(sig, fs, bandwidth=None, n_tapers=None, low_bias=True, eigenvalue_weighting=True)[source]

Compute the power spectral density using the multi-taper method.

Parameters:
sigarray

Time series.

fsfloat

Sampling rate, in Hz.

bandwidthfloat, optional

Frequency bandwidth of multi-taper window function. If not provided, defaults to 8 * fs / n_samples.

n_tapersint, optional

Number of slepian windows used to compute the spectrum. If not provided, defaults to bandwidth * n_samples / fs.

low_biasbool, optional, default: True

If True, only use tapers with concentration ratio > 0.9.

eigenvalue_weightingbool, optional

If True, weight spectral estimates by the concentration ratio of their respective tapers before combining. Default is True.

Returns:
freqs1d array

Frequencies at which the measure was calculated.

spectrumarray

Power spectral density using multi-taper method.

Examples

Compute the power spectrum of a simulated time series using the multitaper method:

>>> from neurodsp.sim import sim_combined
>>> sig = sim_combined(n_seconds=10, fs=500,
...                    components={'sim_powerlaw': {}, 'sim_oscillation' : {'freq': 10}})
>>> freqs, spec = compute_spectrum_multitaper(sig, fs=500)