neurodsp.aperiodic.irasa.compute_irasa¶
- neurodsp.aperiodic.irasa.compute_irasa(sig, fs, f_range=None, hset=None, thresh=None, **spectrum_kwargs)[source]¶
Separate aperiodic and periodic components using IRASA.
- Parameters
- sig1d array
Time series.
- fsfloat
The sampling frequency of sig.
- f_rangetuple, optional
Frequency range to restrict the analysis to.
- hset1d array, optional
Resampling factors used in IRASA calculation. If not provided, defaults to values from 1.1 to 1.9 with an increment of 0.05.
- threshfloat, optional
A relative threshold to apply when separating out periodic components. The threshold is defined in terms of standard deviations of the original spectrum.
- spectrum_kwargsdict
Optional keywords arguments that are passed to compute_spectrum.
- Returns
- freqs1d array
Frequency vector.
- psd_aperiodic1d array
The aperiodic component of the power spectrum.
- psd_periodic1d array
The periodic component of the power spectrum.
Notes
Irregular-Resampling Auto-Spectral Analysis (IRASA) is an algorithm ([1]) that aims to separate 1/f and periodic components by resampling time series and computing power spectra, averaging away any activity that is frequency specific to isolate the aperiodic component.
References
- 1
Wen, H., & Liu, Z. (2016). Separating Fractal and Oscillatory Components in the Power Spectrum of Neurophysiological Signal. Brain Topography, 29(1), 13–26. DOI: https://doi.org/10.1007/s10548-015-0448-0
Examples
Apply IRASA to a simulated combined time series:
>>> from neurodsp.sim import sim_combined >>> sig = sim_combined(n_seconds=10, fs=500, ... components={'sim_powerlaw': {}, 'sim_oscillation': {'freq': 10}}) >>> freqs, psd_aperiodic, psd_periodic = compute_irasa(sig, fs=500, f_range=[3, 50])