macro_eeg_model.evaluation.peak_tester#
Classes#
A class responsible for testing the significance of peak power values compared to other frequency ranges. |
Module Contents#
- class macro_eeg_model.evaluation.peak_tester.PeakTester(frequencies, peaks_range, others_range)[source]#
A class responsible for testing the significance of peak power values compared to other frequency ranges.
- frequencies#
The array of frequencies corresponding to the power spectrum.
- Type:
numpy.ndarray
- peaks_range#
The range of frequencies where peaks are expected.
- Type:
tuple
- others_range#
The range of frequencies where other values are expected.
- Type:
tuple
- powers#
The epoched power spectrum of the simulated EEG data.
- Type:
list
- peak_values#
The mean power values in the peak range for each epoch.
- Type:
list
- other_values#
The mean power values in the other range for each epoch.
- Type:
list
- __init__(frequencies, peaks_range, others_range)[source]#
Initializes the PeakTester class with the provided frequency ranges.
- Parameters:
frequencies (numpy.ndarray) – The array of frequencies corresponding to the power spectrum.
peaks_range (tuple) – The range of frequencies where peaks are expected.
others_range (tuple) – The range of frequencies where other values are expected.
- compute_test_result(simulation_name, epoched_powers)[source]#
Computes the statistical test result for the peak power values compared to other frequency ranges.
- Parameters:
simulation_name (str) – The name of the simulation. (should include “pink” if the data was simulated with pink noise)
epoched_powers (list) – The epoched power spectrum of the simulated EEG data.
- Returns:
A tuple containing:
frequencies (numpy.ndarray): The array of frequencies corresponding to the power spectrum.
mean_power (numpy.ndarray): The mean power spectrum across epochs of the simulated EEG data.
p_value (float): The calculated p-value.
test_name (str): The name of the statistical test used.
- Return type:
tuple
- _separate_peaks(power)[source]#
Separates the power values in the peak and other frequency ranges.
- Parameters:
power (numpy.ndarray) – The power spectrum of the simulated EEG data.
- _detrend_data(powers, is_pink)[source]#
Detrend the pink noise in the power spectrum by fitting a power-law trend and removing it.
- Parameters:
powers (numpy.ndarray) – The power spectrum of the simulated EEG data.
is_pink (bool) – A flag indicating whether the data was simulated with pink noise.
- Returns:
A tuple containing:
non_zero_freqs (numpy.ndarray): The array of non-zero frequencies.
flattened_powers (numpy.ndarray): The corresponding detrended power spectrum
- Return type:
tuple
- _choose_and_run_test(paired=True)[source]#
Automatically selects and runs the correct statistical test based on data characteristics.
- Parameters:
paired (bool) – A flag indicating whether the data is paired or independent.
- Returns:
A tuple containing:
t_stat (float): The calculated t-statistic.
p_value (float): The calculated p-value.
test_name (str): The name of the statistical test used.
- Return type:
tuple