specparam.analysis.get_band_peak_group

specparam.analysis.get_band_peak_group(group, band, threshold=None, thresh_param='PW', attribute='peak_params')[source]

Extract peaks from a band of interest from a group model object.

Parameters:
groupSpectralGroupModel

Object to extract peak data from.

bandtuple of (float, float)

Frequency range for the band of interest. Defined as: (lower_frequency_bound, upper_frequency_bound).

thresholdfloat, optional

A minimum threshold value to apply.

thresh_param{‘PW’, ‘BW’}

Which parameter to threshold on. ‘PW’ is power and ‘BW’ is bandwidth.

attribute{‘peak_params’, ‘gaussian_params’}

Which attribute of peak data to extract data from.

Returns:
peaks2d array

Peak data. Each row is a peak, as [CF, PW, BW]. Each row represents an individual model from the input object.

Notes

The returned array keeps track of which model each extracted peak comes from, returning a [n_models, 3] array, with one peak returned per model.

  • To do so, this function necessarily extracts and returns one peak per model fit.

  • Each row reflects an individual model fit, in order, filled with nan if no peak was present.

If, instead, you wish to extract all peaks within a band, per model fit, you can do something like:

>>> peaks = np.empty((0, 3))
>>> for res in group:  
...     peaks = np.vstack((peaks, get_band_peak(res.peak_params, band, select_highest=False)))

Examples

Extract alpha peaks from a group model object ‘group’ that already has model results:

>>> alphas = get_band_peak_group(group, [7, 14])  

Extract peaks from a group model object ‘group’, selecting those above a power threshold:

>>> betas = get_band_peak_group(group, [13, 30], threshold=0.1)  

Examples using specparam.analysis.get_band_peak_group

Plot Model Components

Plot Model Components

Developmental Data Demo

Developmental Data Demo

Topographical Analyses with MNE

Topographical Analyses with MNE

08: Further Analysis

08: Further Analysis