meganorm.src package
Submodules
meganorm.src.featureExtraction module
- meganorm.src.featureExtraction.abs_canonical_power(psd: ndarray, freqs: ndarray, fmin: int | float, fmax: int | float) float[source]
Calculates absolute canonical power of a frequency band from a power spectrum density (PSD).
- Parameters:
psd (np.ndarray) – Power spectral density values (in linear scale).
freqs (np.ndarray) – A 1D array of frequency values that were used to compute the PSD.
fmin (Union[int, float]) – Lower bound of the frequency band
fmax (Union[int, float]) – Upper bound of the frequency band.
- Returns:
Log-transformed absolute power in the specified frequency band.
- Return type:
float
Notes
‘psd’ can be both original PSD or periodic PSD.
- meganorm.src.featureExtraction.abs_individual_power(psd, freqs, band_peaks, individualized_band_ranges, band_name)[source]
Calculates absolute power in an individualized frequency band centered around the dominant peak.
- Parameters:
psd (np.ndarray) – Power spectral density values (in linear scale).
freqs (np.ndarray) – A 1D array of frequency values that were used to compute the PSD.
band_peaks (list) – List of peak tuples (frequency, power, width).
individualized_band_ranges (dict) – Dictionary mapping band names to (lower_offset, upper_offset) in Hz.
band_name (str) – Name of the frequency band to compute power for.
- Returns:
Log-transformed absolute power in the individualized frequency band. Returns np.nan if no peaks are found.
- Return type:
float
Notes
‘psd’ can be both original PSD or periodic PSD.
- meganorm.src.featureExtraction.add_feature(feature_container, feature_arr, feature_name, channel_name, band_name)[source]
Add a feature value to the feature container for a specific channel and frequency band.
This function appends a feature to a DataFrame by assigning a value (e.g., from an array) to a row labeled with the combined feature and band name, and a column labeled with the channel name.
- Parameters:
feature_container (pd.DataFrame) – DataFrame used to store features, where rows represent feature names and columns represent channels.
feature_arr (np.ndarray) – Array containing the feature value(s) to add.
feature_name (str) – Name of the feature (e.g., ‘RelativePower_’).
channel_name (str) – Name of the channel (e.g., ‘MEG0121’) to which the feature value should be assigned.
band_name (str) – Frequency band to append to the feature name (e.g., ‘Alpha’).
- Returns:
Updated DataFrame with the new feature added.
- Return type:
pd.DataFrame
- meganorm.src.featureExtraction.create_feature_container(feature_categories, freq_bands, channel_names)[source]
Creates a DataFrame to store features for each channel, with feature names corresponding to the specified categories and frequency bands.
- Parameters:
feature_categories (dict) – Dictionary with feature names as keys and booleans indicating whether the feature should be calculated.
freq_bands (list) – List of frequency bands (e.g., [‘theta’, ‘alpha’, ‘beta’]).
channel_names (list) – List of channel names (e.g., [‘ch1’, ‘ch2’, ‘ch3’]).
- Returns:
A DataFrame with feature names as rows and channels as columns.
- Return type:
pd.DataFrame
- meganorm.src.featureExtraction.exponent(fm: FOOOF, aperiodic_mode: str) float[source]
Extract the exponent value from the aperiodic component of a FOOOF model.
- Parameters:
fm (f.FOOOF) – A FOOOF model object that has been fit to data and contains aperiodic parameters.
aperiodic_mode (str) – The aperiodic mode that has been used to fit the model. Must be one of [‘knee’, ‘fixed’].
- Returns:
The exponent value corresponding to the specified mode (‘knee’ or ‘fixed’)
- Return type:
float
- Raises:
ValueError – Unknown aperiodic_mode; Expected ‘knee’ or ‘fixed’.
- meganorm.src.featureExtraction.feature_extract(subject_id: str, fmGroup: FOOOF, psds: ndarray, feature_categories: Dict[str, bool], freqs: ndarray, freq_bands: Dict[str, tuple], channel_names: List[str], individualized_band_ranges: Dict[str, tuple], extention: str, which_layout: str, which_sensor: Dict[str, bool], aperiodic_mode: str, min_r_squared: float) DataFrame[source]
Extract features from FOOOF models for each channel and frequency band.
This function computes various features from FOOOF models for each channel, based on specified frequency bands. Features such as offset, exponent, peak characteristics, and canonical power are calculated and stored in a DataFrame.
- Parameters:
subject_id (str) – The unique identifier for the subject whose data is being processed.
fmGroup (f.FOOOF) – Group of FOOOF models, where each model corresponds to a channel and its power spectral data.
psds (np.ndarray) – Original power spectral density values, with shape (n_channels, n_freqs).
feature_categories (Dict[str, bool]) – A dictionary where keys are feature names (e.g., ‘Offset’, ‘Exponent’) and values are booleans indicating whether to compute the feature.
freqs (np.ndarray) – Frequency values corresponding to the power values in the psds array.
freq_bands (Dict[str, tuple]) – Dictionary mapping frequency band names (e.g., ‘Alpha’, ‘Beta’) to their corresponding frequency ranges (min_freq, max_freq).
channel_names (List[str]) – List of channel names corresponding to the rows of the psds array.
individualized_band_ranges (Dict[str, tuple]) – A dictionary mapping band names to individualized frequency ranges, which may differ across subjects or datasets.
extention (str) – The extension of the subject’s recording (e.g., ‘FIF’, ‘DS’). Used to read the appropriate layout file from the layout directory.
which_layout (str) – Specifies the sensor layout for feature averaging, either ‘all’ for global averaging or ‘lobe’ for averaging within lobes.
which_sensor (Dict[str, bool]) – A dictionary indicating which modalities (e.g., ‘meg’, ‘eeg’) should be included in the feature extraction.
aperiodic_mode (str) – Defines the aperiodic component fitting mode for FOOOF. Options are ‘knee’ or ‘fixed’.
min_r_squared (float) – Minimum acceptable R-squared value for FOOOF model fitting. Channels with R-squared values below this threshold are excluded.
- Returns:
A DataFrame with features extracted for each channel and frequency band. The DataFrame has features as rows and channels (and frequency bands) as columns.
- Return type:
pd.DataFrame
- Raises:
ValueError – If aperiodic_mode is not ‘knee’ or ‘fixed’.
TypeError – If fmGroup is not an instance of f.FOOOF.
ValueError – If min_r_squared is not between 0 and 1.
- meganorm.src.featureExtraction.find_peak_in_band(fm: FOOOF, fmin: int | float, fmax: int | float) list[source]
Find peaks in a specified frequency band (determined by fmin and fmax) from the peak parameters of a FOOOF model.
- Parameters:
fm (f.FOOOF) – A FOOOF model object that contains peak parameters.
fmin (Union[int, float]) – The lower frequency of the band.
fmax (Union[int, float]) – The upper frequency of the band.
- Returns:
A list of tuples where each tuple represents a peak. In the tuples, the first element is the frequency of the corresponding peak, the second element is the peak value (power), and the third element is the width of the peak.
- Return type:
list
- meganorm.src.featureExtraction.isolate_periodic(fm: FOOOF, psd: ndarray) ndarray[source]
Isolates the periodic component of the power spectrum by subtracting the aperiodic fit from the original pwer spectrum density.
- Parameters:
fm (f.FOOOF) – An already fitted FOOOF model object.
psd (np.ndarray) – Original power spectrum in linear scale.
- Returns:
A 1D array of the peridic component of the power spectrum.
- Return type:
np.ndarray
- meganorm.src.featureExtraction.offset(fm: FOOOF) float[source]
Extract the offset parameter from the aperiodic component of a FOOOF model.
- Parameters:
fm (f.FOOOF) – A FOOOF model object that has been fit to data and contains aperiodic parameters.
- Returns:
The offset value, which is the first element of the aperiodic parameters.
- Return type:
float
- Raises:
TypeError – Expected a FOOOF model instance.
- meganorm.src.featureExtraction.peak_center(band_peaks: list)[source]
Returns the frequency of the center of a dominant peak.
- Parameters:
band_peaks (list) – A list of tuples where each tuple represents a peak. This list is the output of ‘find_peak_in_band’ function. In the tuples, the first element is the frequency, the second element is the peak value, and the third element is the width of the dominant peak.
- Returns:
The frequency of the dominant peak, or np.nan if the list is empty.
- Return type:
float
- meganorm.src.featureExtraction.peak_power(band_peaks: list)[source]
Returns the power of the center of a dominant peak from a list of peaks.
- Parameters:
band_peaks (list) – A list of tuples where each tuple represents a peak. This list is the output of ‘find_peak_in_band’ function. In the tuples, the first element is the frequency, the second element is the peak value, and the third element is the width of the dominant peak.
- Returns:
The power of the dominant peak, or np.nan if the list is empty.
- Return type:
float
- meganorm.src.featureExtraction.peak_width(band_peaks: list)[source]
Returns the width of the dominant peak from a list of peaks.
- Parameters:
band_peaks (A list of tuples where each tuple represents a peak. This list is the output of 'find_peak_in_band') – function. In the tuples, the first element is the frequency, the second element is the peak value, and the third element is the width of the dominant peak.
- Returns:
The width of the dominant peak, or np.nan if the list is empty.
- Return type:
float
- meganorm.src.featureExtraction.psd_ratio(psd, freqs, freqRangeNumerator: float, freqRangeDenominator: float, channelNames: str, name: str, psdType: str)[source]
Calculates the ratio of power in two frequency bands (numerator/denominator) in the power spectral density (PSD).
- Parameters:
psd (np.ndarray) – A 1D array of power spectral density values (in linear scale).
freqs (np.ndarray) – A 1D array of frequency values corresponding to the PSD.
freqRangeNumerator (tuple) – A tuple (min_freq, max_freq) representing the numerator frequency range.
freqRangeDenominator (tuple) – A tuple (min_freq, max_freq) representing the denominator frequency range.
channelNames (str) – Name of the channel for which the ratio is calculated.
name (str) – Descriptive name for the output feature.
psdType (str) – Type of the PSD (e.g., ‘power’, ‘spectrum’).
- Returns:
list – A list with the computed PSD ratio (log of numerator/denominator)
list – A list with the generated feature name
- meganorm.src.featureExtraction.rel_canonical_power(psd: ndarray, freqs: ndarray, fmin: int | float, fmax: int | float) float[source]
Calculates relative canonical power of a frequency band from a power spectrum density.
- Parameters:
psd (np.ndarray) – Power spectral density values (in linear scale).
freqs (np.ndarray) – A 1D array of frequency values that were used to compute the PSD.
fmin (Union[int, float]) – Lower bound of the frequency band.
fmax (Union[int, float]) – Upper bound of the frequency band.
- Returns:
Relative power in the specified frequency band. Returns np.nan if total power is zero.
- Return type:
float
Notes
‘psd’ can be both original PSD or periodic PSD.
- meganorm.src.featureExtraction.rel_individual_power(psd, freqs, band_peaks, individualized_band_ranges, band_name)[source]
Calculates relative power in an individualized frequency band centered around the dominant peak.
- Parameters:
psd (np.ndarray) – Power spectral density values (in linear scale).
freqs (list) – List of peak tuples (frequency, power, width)
band_peaks (list) – List of peak tuples (frequency, power, width)
individualized_band_ranges (dict) – Dictionary mapping band names to (lower_offset, upper_offset) in Hz.
band_name (str) – Name of the frequency band to compute power for.
- Returns:
Relative power in the individualized frequency band. Returns np.nan if total power is zero or input is invalid.
- Return type:
float
Notes
‘psd’ can be both original PSD or periodic PSD.
- meganorm.src.featureExtraction.summarizeFeatures(df, extention, which_layout, which_sensor)[source]
Summarizes a feature DataFrame by averaging channels based on a specified sensor layout.
Since sensor positions may differ across datasets recorded with different MEG hardware systems, this function enables consistent feature extraction by averaging signals across the whole brain or predefined brain regions (e.g., lobes).
The function computes the mean of selected channels (e.g., MEG, EEG) according to a layout specified in a JSON file. The layout file is selected based on the recording extension (e.g., ‘FIF’, ‘DS’) and contains channel groupings for either whole-brain or regional (lobe-level) parcellation.
- Example layout for regional parcellation:
- “FIF_MEG_LOBE”: {
“MAG_frontal_left”: [“MEG0121”, “MEG0341”, “MEG0311”, “MEG0321”, …], “MAG_frontal_right”: [“MEG1411”, “MEG1221”, “MEG1211”, “MEG1231”, …]
}
- Example layout for whole-brain averaging:
- “FIF_MAG_ALL”: {
“MAG_ALL”: [“MEG0121”, “MEG0341”, “MEG0311”, …]
}
Layout files must be stored in a dedicated layout directory and named based on the recording extension (e.g., ‘FIF.json’). The appropriate key in the JSON (e.g., ‘FIF_MEG_LOBE’) is constructed using extention, which_layout, and which_sensor.
- Parameters:
df (pd.DataFrame) – A DataFrame where each column represents a channel and each row a sample (subject or epoch).
extention (str) – The recording file type (e.g., ‘FIF’, ‘DS’). Used to locate the correct layout file.
which_layout (str) – Layout type to use: ‘all’ for global averaging or ‘lobe’ for region-based averaging.
which_sensor (dict) – Dictionary indicating which sensor modalities to include (e.g., {‘meg’: True, ‘eeg’: False}).
- Returns:
A new DataFrame where columns represent averaged parcels and rows represent samples.
- Return type:
pd.DataFrame
meganorm.src.mainParallel module
- meganorm.src.mainParallel.main(*args)[source]
Main function for running a complete spectral feature extraction pipeline using serialized or parallelized workflows.
This function processes raw MEG/EEG recordings through a pipeline that includes preprocessing, segmentation, PSD computation, spectral parameterization using FOOOF, and feature extraction. The resulting features are saved to a CSV file.
meganorm.src.preprocess module
- meganorm.src.preprocess.AutoIca_with_IcaLabel(data, physiological_noise_type, n_components=30, ica_max_iter=1000, IcaMethod='infomax', iclabel_thr=0.8)[source]
- meganorm.src.preprocess.auto_ica(data, physiological_sensor, n_components=30, ica_max_iter=1000, IcaMethod='fastica', which_sensor={'eeg': True, 'meg': True}, auto_ica_corr_thr=0.9)[source]
Performs automated ICA for artifact removal by identifying components that correlate highly with physiological signals (ECG or EOG) which is determined by ‘auto_ica_corr_thr’.
- Parameters:
data (mne.io.Raw) – Raw MEG/EEG data.
physiological_sensor (str) – Name of the physiological sensor (‘ECG’ or ‘EOG’).
n_components (int or float) – Number of ICA components to retain.
ica_max_iter (int) – Maximum number of iterations for the ICA algorithm.
IcaMethod (str) – ICA algorithm to use (e.g., ‘fastica’, ‘picard’, ‘infomax’).
which_sensor (dict) – Dictionary indicating sensor types to include (e.g., {‘meg’: True, ‘eeg’: True}).
auto_ica_corr_thr (float) – Threshold for accepting independent component as noisy based on correlation with the corresponding physiological recording (ECG or EOG).
- Returns:
data (mne.io.Raw) – Raw data with bad ICA components removed (in-place modification).
ICA_flag (bool) – True if no bad components were found, False otherwise.
- meganorm.src.preprocess.auto_ica_with_mean(data, n_components=30, ica_max_iter=1000, IcaMethod='fastica', which_sensor={'eeg': True, 'meg': True}, auto_ica_corr_thr=0.9)[source]
Performs ICA-based artifact rejection using MNE’s built-in ECG correlation method. This function creates a synthetic ECG signal (by avergaing across magnetometers or Gradiometers) and use it to find and remove the noisy independent component.
- Parameters:
data (mne.io.Raw) – Raw MEG/EEG data.
n_components (int, optional) – Number of ICA components to retain, by default 30.
ica_max_iter (int, optional) – Maximum number of iterations for the ICA algorithm, by default 1000.
IcaMethod (str, optional) – ICA algorithm to use (e.g., ‘fastica’, ‘picard’, ‘infomax’), by default “fastica”.
which_sensor (dict, optional) – Dictionary specifying sensor types to include (e.g., {“meg”: True, “eeg”: True}), by default {“meg”: True, “eeg”: True}.
auto_ica_corr_thr (float, optional) – Correlation threshold for detecting ECG-related components, by default 0.9.
- Returns:
Raw data with ECG-related ICA components removed.
- Return type:
mne.io.Raw
- meganorm.src.preprocess.drop_noisy_meg_channels(data: Any, subID: str, args: Any, configs: Dict[str, str]) Any[source]
Identifies and removes noisy or flat MEG/EEG channels using Maxwell filtering, and logs the number of dropped channels for each subject.
- Parameters:
data (instance of mne.io.Raw) – The MEG/EEG recording to process.
subID (str) – Identifier for the subject, used in naming the log file.
args (argparse.Namespace or similar) – Object containing runtime arguments, including ‘saveDir’.
configs (dict) –
- Configuration dictionary containing:
’which_sensor’: one of {“meg”, “mag”, “grad”, “eeg”, “opm”}
- Returns:
data_cleaned – The cleaned data with noisy/flat channels removed.
- Return type:
instance of mne.io.Raw
Notes
If Maxwell filtering has already been applied (e.g., SSS step), the function will skip bad channel detection and proceed to drop previously marked bad channels.
The number of dropped channels is saved to a JSON log file in a directory derived from args.saveDir, replacing ‘temp’ with ‘log_droped_channels’.
- meganorm.src.preprocess.find_ica_component(ica, data, physiological_signal, auto_ica_corr_thr)[source]
Identifies independent components that their correlation with physiological signals (ECG or EOG) is higher than a threshold.
- Parameters:
ica (object) – The fitted ICA object using MNE.
data (mne.io.Raw) – The raw MEG/EEG data used to extract independent components.
physiological_signal (np.ndarray) – The physiological signal (ECG or EOG) to compare with independent componentss.
auto_ica_corr_thr (float) – Pearson correlation threshold (between 0 and 1) for accepting a component as noise.
- Returns:
Index of the component with the highest correlation if it exceeds the threshold. Returns an empty list if no component meets the criterion.
- Return type:
list
- meganorm.src.preprocess.prepare_eeg_data(data, path)[source]
Prepare EEG data by setting channel types and electrode montage when they are not in the data yet
- Parameters:
data (mne.io.Raw) – The raw EEG data.
path (str) – Path to the EEG recording file.
- Returns:
The EEG data with updated channel types and montage (if available).
- Return type:
mne.io.Raw
- meganorm.src.preprocess.preprocess(data, which_sensor: dict, resampling_rate: int = 1000, digital_filter=True, rereference_method='average', n_component: int = 30, ica_max_iter: int = 800, IcaMethod: str = 'fastica', cutoffFreqLow: int = 1, cutoffFreqHigh: int = 45, apply_ica=True, power_line_freq: int = 60, auto_ica_corr_thr: float = 0.9)[source]
Applies a preprocessing pipeline on MEG/EEG data, including filtering, re-referencing (for EEG), ICA for artifact removal, and optional downsampling.
- Parameters:
data (mne.io.Raw) – Raw MEG/EEG data.
which_sensor (dict) – Dictionary specifying which sensor types to include (e.g., {‘meg’: True, ‘eeg’: True}).
resampling_rate (int, optional) – Target sampling rate for resampling. If None, resampling is skipped; by default 1000.
digital_filter (bool, optional) – Whether to apply a bandpass FIR filter to the data; by default True.
rereference_method (str, optional) – EEG re-referencing method. Supported: “average”, “REST”; by default “average”.
n_component (int, optional) – Number of independent component to retain in ICA; by default 30.
ica_max_iter (int, optional) – Maximum number of iterations for ICA; by default 800.
IcaMethod (str, optional) – ICA algorithm to use. Supported: ‘fastica’, ‘picard’, ‘infomax’; by default “fastica”.
cutoffFreqLow (int, optional) – Low cutoff frequency for bandpass filtering; by default 1.
cutoffFreqHigh (int, optional) – High cutoff frequency for bandpass filtering; by default 45.
apply_ica (bool, optional) – Whether to apply ICA to remove artifacts; by default True.
power_line_freq (int, optional) – Power line frequency (for notch filtering); by default 60.
auto_ica_corr_thr (float, optional) – Correlation threshold for automatic ICA artifact rejection; by default 0.9. That is, the correlation between identified independent components and physiological signals (ECG and EOG) must be higher than ‘auto_ica_corr_thr’
- Returns:
Preprocessed MEG/EEG data.
- Return type:
mne.io.Raw
- Raises:
ValueError – auto_ica_corr_thr must be between 0 and 1.
ValueError – ICA method must be one of: ‘fastica’, ‘picard’, ‘infomax’.
- meganorm.src.preprocess.segment_epoch(data: Raw, tmin: float, tmax: float, sampling_rate: float, segmentsLength: float, overlap: float)[source]
Segments continuous raw data into epochs of fixed length.
- Parameters:
data (mne.io.Raw) – MEG/EEG recording.
tmin (float) – Start time (in seconds) for cropping the raw data.
tmax (float) – End time (in seconds) for cropping the raw data. ‘tmax’ must be a negative number, indicating the time difference between the crop end point and the total recording duration.
sampling_rate (float) – Sampling rate of the data (Hz).
segmentsLength (float) – Length of each epoch in seconds.
overlap (float) – Overlap between successive epochs in seconds.
- Returns:
Segmented data with fixed-length segments.
- Return type:
mne.Epochs
meganorm.src.psdParameterize module
- meganorm.src.psdParameterize.computePsd(segments, freq_range_low=3, freq_range_high=40, sampling_rate=1000, psd_method='welch', psd_n_overlap=1, psd_n_fft=2, n_per_seg=2)[source]
Compute the Power Spectral Density (PSD) of EEG/MEG data segments.
- Parameters:
segments (mne.Epochs) – Segmented data for which PSD will be computed.
freq_range_low (int) – Lower frequency bound for PSD calculation (Hz).
freq_range_high (int) – Upper frequency bound for PSD calculation (Hz).
sampling_rate (int) – Sampling rate of the data (Hz).
psd_method (str) – Method for computing the PSD. Default is “welch”.
psd_n_overlap (int) – Overlap between segments (in seconds) for PSD calculation.
psd_n_fft (int) – Number of FFT points used for the PSD calculation.
n_per_seg (int) – Number of samples per segment used for computing PSD.
- Returns:
psds (np.ndarray) – Array of power spectral density values.
freqs (np.ndarray) – Array of frequency values corresponding to the PSD.
- meganorm.src.psdParameterize.parameterizePsd(psds, freqs, freq_range_low=3, freq_range_high=40, min_peak_height=0, peak_threshold=2, peak_width_limits=[1, 12.0], aperiodic_mode='fixed')[source]
Fit a FOOOF model to power spectral density (PSD) data to separate periodic (oscillatory) and aperiodic (background) components.
- Parameters:
psds (np.ndarray) – Power spectral density values.
freqs (np.ndarray) – Frequency values corresponding to the PSD.
freq_range_low (int) – Lower frequency bound for the FOOOF model (Hz).
freq_range_high (int) – Upper frequency bound for the FOOOF model (Hz).
min_peak_height (float) – Minimum height of peaks to be considered in the FOOOF model.
peak_threshold (float) – Threshold for peak detection in the FOOOF model.
peak_width_limits (list) – Limits on the width of peaks (in Hz).
aperiodic_mode (str) – Mode for modeling the aperiodic component. Options are “fixed”, “knee”, or “none”.
- Returns:
fooofModels (FOOOFGroup) – Fitted FOOOF group model containing periodic and aperiodic components.
psds (np.ndarray) – Original power spectral density values.
freqs (np.ndarray) – Frequency values corresponding to the PSD.
- meganorm.src.psdParameterize.psdParameterize(segments, freq_range_low=3, freq_range_high=40, min_peak_height=0, peak_threshold=2, sampling_rate=1000, psd_method='welch', psd_n_overlap=1, psd_n_fft=2, n_per_seg=2, peak_width_limits=None, aperiodic_mode='knee')[source]
Runs the complete pipeline for spectral parameterization using FOOOF. This includes computing the PSD and fitting FOOOF models for each channel.
- Parameters:
segments (mne.Epochs) – Epoched MNE object containing segmented data.
freq_range_low (float) – Lower bound of frequency range for PSD and FOOOF (Hz).
freq_range_high (float) – Upper bound of frequency range for PSD and FOOOF (Hz).
min_peak_height (float) – Minimum height of peaks to be detected by FOOOF.
peak_threshold (float) – Threshold for peak detection relative to the aperiodic fit.
sampling_rate (int) – Sampling frequency of the signal (Hz).
psd_method (str) – Method used to compute PSD. Options: “welch”, “multitaper”.
psd_n_overlap (int) – Overlap (in seconds) between segments in PSD computation.
psd_n_fft (int) – Number of FFT points (in seconds) used in PSD.
n_per_seg (int) – Length (in seconds) of each segment used in PSD.
peak_width_limits (list of float, optional) – Lower and upper bounds on peak width (Hz). Default is [1, 12.0].
aperiodic_mode (str) – Mode of aperiodic fit. Options: “fixed” or “knee”.
- Returns:
fooofModels (FOOOFGroup) – Fitted FOOOF models for each channel.
psds (np.ndarray) – Power spectral densities.
freqs (np.ndarray) – Corresponding frequency values.
- Raises:
ValueError – If psd_method is not ‘welch’ or ‘multitaper’.
ValueError – If aperiodic_mode is not ‘fixed’ or ‘knee’.