Spectral Methods
Contents
Spectral Methods¶
This section examines frequency domain methods, meaning measure that are taken in the frequency domain.
This section includes:
spectral line fitting
spectral parameterization
IRASA
Notably, for the spectral methods, they all estimate the ‘aperiodic exponent’. Given that we also create our simulations to have specified aperiodic exponents (colors of noise), then in this case we can actually evaluate the correctness of the methods, calculated as the accuracy to which these methods estimate the correct aperiodic exponent.
# Setup notebook state
from nbutils import setup_notebook; setup_notebook(set_plt_context=False)
# Import neurodsp functions
from neurodsp.plts import plot_time_series
from neurodsp.spectral import compute_spectrum
# Import spectral parameterization code
from fooof import FOOOF
from fooof.plts.annotate import plot_annotated_model
# Import custom project code
from apm.sim.examples import get_times, get_examples
from apm.sim.settings import FS
Example Neural Data¶
# Define collection of example signals
times = get_times()
examples = get_examples()
# Visualize a simulated neural time series
plot_time_series(times, examples['combined'], xlim=[5, 8])
Spectral Parameterization Demo¶
specparam is one of the methods that will be investigated in this project. SpecParam is a tool for parameterizing neural power spectra.
Here we will briefly demonstrate applying spectral parameterization to an example spectrum, to demonstrate the features of the data of interest.
# Compute a power spectrum from the above signal
freqs, powers = compute_spectrum(examples['combined'], FS)
# Initialize and fit a spectral parameterization model
fm = FOOOF(peak_width_limits=[1, 8], min_peak_height=0.1, verbose=False)
fm.fit(freqs, powers, [1, 75])
# Visualize an annoted model
plot_annotated_model(fm, True)