src.runnables package

Submodules

src.runnables.classification_runnable module

Classification runnable

class src.runnables.classification_runnable.classifyRunnable(file_data, directory_path, pipeline_selected, feature_selection, number_of_channels_to_select, hyper_tuning, cross_val_number, trials_selected)[source]

Bases: PyQt5.QtCore.QRunnable

get_classifier()[source]

Get the classifier/pipelines on which the classification is performed. :return: The classifiers :rtype: ApplePyClassifier

run()[source]

Create the classifier and launch the computation of the classification. Notifies the main model that the computation is finished.

transform_file_data_with_trials_selected()[source]

Create a mask to know which trial to keep and which one to remove for the computation. Apply this mask on the data to keep only the trials/epochs selected by the user.

class src.runnables.classification_runnable.classifyWorkerSignals[source]

Bases: PyQt5.QtCore.QObject

Contain the signals used by the classification runnable.

error
finished

src.runnables.connectivity_runnable module

Connectivity runnable

class src.runnables.connectivity_runnable.envelopeCorrelationRunnable(file_data, psi, fmin, fmax, connectivity_method, n_jobs, export_path)[source]

Bases: PyQt5.QtCore.QRunnable

check_data_export()[source]

Check if the envelope correlation data and the PSI must be exported.

compute_correlation_data()[source]

Compute the correct correlation data depending on the method chosen by the user.

get_envelope_correlation_data()[source]

Get the envelope correlation’s data. :return: The envelope correlation’s data. :rtype: list of, list of float

get_psi_data()[source]

Get the psi’s data. :return: The psi’s data. Or nothing if the psi’s data has not been computed. :rtype: list of, list of float

run()[source]

Launch the computation of the envelope correlation on the given data. Notifies the main model that the computation is finished.

save_data(data, channels, file_name)[source]

If it is the case, create the file and write the data in it. :param data: The data to save, either the connectivity of PSI. :type data: list of, list of float :param channels: The channels names to save. :type channels: list of str :param file_name: The name of the data to save. :type file_name: str

class src.runnables.connectivity_runnable.envelopeCorrelationWorkerSignals[source]

Bases: PyQt5.QtCore.QObject

Contain the signals used by the envelope correlation runnable.

error
finished
class src.runnables.connectivity_runnable.sensorSpaceConnectivityRunnable(file_data, export_path)[source]

Bases: PyQt5.QtCore.QRunnable

check_data_export()[source]

Check if the sensor space connectivity data must be exported. If it is the case, create the file and write the data in it.

get_sensor_space_connectivity_data()[source]

Get the sensor space connectivity’s data. :return: The sensor space’s data. :rtype: list of, list of float

run()[source]

Launch the computation of the sensor space connectivity on the given data. Notifies the main model that the computation is finished.

class src.runnables.connectivity_runnable.sensorSpaceConnectivityWorkerSignals[source]

Bases: PyQt5.QtCore.QObject

Contain the signals used by the sensor space connectivity runnable.

error
finished
class src.runnables.connectivity_runnable.sourceSpaceConnectivityRunnable(file_data, file_path, connectivity_method, spectrum_estimation_method, source_estimation_method, save_data, load_data, n_jobs, export_path, psi, fmin, fmax)[source]

Bases: PyQt5.QtCore.QRunnable

check_data_export()[source]

Check if the source space connectivity data must be exported. If it is the case, create the file and write the data in it.

compute_bem_solution()[source]

Compute the BEM solution of the “fsaverage” model. :return: The BEM solution. :rtype: MNE.ConductorModel

compute_envelope_correlation_with_source_space()[source]

Launch the computation of the source space if it is not provided. Once the source space is computed, compute the envelope correlation on this source space, giving the source space connectivity of the given data.

compute_forward_solution(src, bem)[source]

Compute the forward solution of the given data, based on the source space model of the “fsaverage” model. :param src: The source space :type src: MNE.SourceSpaces :param bem: The BEM solution. :type bem: MNE.ConductorModel :return: The forward solution. :rtype: MNE.Forward

compute_inverse(inv)[source]

Apply the inverse operator on the given data. :param inv: The inverse operator. :type inv: MNE.InverseOperator :return: The source estimation of all epochs. :rtype: list of MNE.SourceEstimate

compute_inverse_operator(fwd, noise_cov)[source]

Compute the inverse operator of the given data, based on the forward solution and the noise covariance previously computed. :param fwd: The forward solution. :type fwd: MNE.Forward :param noise_cov: The noise covariance. :type noise_cov: MNE.Covariance :return: The inverse operator. :rtype: MNE.InverseOperator

compute_noise_covariance()[source]

Compute the noise covariance of the given data. :return: The noise covariance. :rtype: MNE.Covariance

compute_source_space()[source]

Compute the source space of the “fsaverage” model. :return: The source space :rtype: MNE.SourceSpaces

create_inverse_operator()[source]

Launch all the necessary computation to compute the inverse operator. :return: The inverse operator. :rtype: MNE.InverseOperator

get_psi_data()[source]

Get the psi’s data. :return: The psi’s data. Or nothing if the psi’s data has not been computed. :rtype: list of, list of float

get_source_space_connectivity_data()[source]

Get the source space connectivity’s data. :return: The source space’s data. :rtype: list of, list of float

run()[source]

Launch the computation of the source space connectivity on the given data. Notifies the main model when the computation is finished. If it is tried to load the source space information file, but that those file does not exist yet, an error message is displayed describing the error. If to extreme parameters are given and the computation fails, an error message is displayed describing the error. Notifies the main model when an error occurs.

class src.runnables.connectivity_runnable.sourceSpaceConnectivityWorkerSignals[source]

Bases: PyQt5.QtCore.QObject

Contain the signals used by the source space connectivity runnable.

error
finished

src.runnables.files_runnable module

Files runnable

class src.runnables.files_runnable.exportDataCSVRunnable(file_data, path_to_file)[source]

Bases: PyQt5.QtCore.QRunnable

run()[source]

Launch the exportation of the data of the dataset into a CSV file. Notifies the main model that the computation is finished.

class src.runnables.files_runnable.exportDataCSVWorkerSignals[source]

Bases: PyQt5.QtCore.QObject

Contain the signals used by the export data CSV runnable.

error
finished
class src.runnables.files_runnable.exportDataSETRunnable(file_data, path_to_file)[source]

Bases: PyQt5.QtCore.QRunnable

run()[source]

Launch the exportation of the data of the dataset into a SET file. Notifies the main model that the computation is finished.

class src.runnables.files_runnable.exportDataSETWorkerSignals[source]

Bases: PyQt5.QtCore.QObject

Contain the signals used by the export data CSV runnable.

error
finished
class src.runnables.files_runnable.exportEventsTXTRunnable(file_data, path_to_file)[source]

Bases: PyQt5.QtCore.QRunnable

run()[source]

Launch the exportation of the events of the dataset into a TXT file. Notifies the main model that the computation is finished.

class src.runnables.files_runnable.exportEventsTXTWorkerSignals[source]

Bases: PyQt5.QtCore.QObject

Contain the signals used by the export events TXT runnable.

error
finished
class src.runnables.files_runnable.findEventsFromChannelRunnable(file_data, stim_channel)[source]

Bases: PyQt5.QtCore.QRunnable

get_read_event_ids()[source]

Get the read event ids. :return: The event ids. :rtype: dict

get_read_events()[source]

Get the read events. :return: The events. :rtype: list of int

run()[source]

Launch the reading of the events based on the stimulation channel of the given data. Notifies the main model that the computation is finished. If no events can be found in the dataset or if the stimulation channel does not contain any information, an error message is displayed describing the error. Notifies the main model when an error occurs.

class src.runnables.files_runnable.findEventsFromChannelWorkerSignals[source]

Bases: PyQt5.QtCore.QObject

Contain the signals used by the find events from channel runnable.

error
finished
class src.runnables.files_runnable.loadDataInfoRunnable(file_data, montage, channels_selected, tmin, tmax)[source]

Bases: PyQt5.QtCore.QRunnable

get_file_data()[source]
run()[source]

Launch the loading of the additional information of the dataset. Notifies the main model that the computation is finished.

class src.runnables.files_runnable.loadDataInfoWorkerSignals[source]

Bases: PyQt5.QtCore.QObject

Contain the signals used by the load data info runnable.

finished
class src.runnables.files_runnable.openCntFileRunnable(path_to_file)[source]

Bases: PyQt5.QtCore.QRunnable

get_file_data()[source]

Get the file data. :return: MNE data of the dataset. :rtype: MNE.Epochs/MNE.Raw

get_file_type()[source]

Get the file type. :return: The file type. :rtype: str

get_path_to_file()[source]

Get the path to the file. :return: The path to the file. :rtype: str

run()[source]

Launch the reading of the ANT eego CNT file. Notifies the main model that the computation is finished.

class src.runnables.files_runnable.openCntFileWorkerSignals[source]

Bases: PyQt5.QtCore.QObject

Contain the signals used by the open CNT file runnable.

error
finished
class src.runnables.files_runnable.openFifFileRunnable(path_to_file)[source]

Bases: PyQt5.QtCore.QRunnable

get_file_data()[source]

Get the file data. :return: MNE data of the dataset. :rtype: MNE.Epochs/MNE.Raw

get_file_type()[source]

Get the file type. :return: The file type. :rtype: str

get_path_to_file()[source]

Get the path to the file. :return: The path to the file. :rtype: str

run()[source]

Launch the reading of the FIF file. Notifies the main model that the computation is finished.

class src.runnables.files_runnable.openFifFileWorkerSignals[source]

Bases: PyQt5.QtCore.QObject

Contain the signals used by the open FIF file runnable.

error
finished
class src.runnables.files_runnable.openSetFileRunnable(path_to_file)[source]

Bases: PyQt5.QtCore.QRunnable

get_file_data()[source]

Get the file data. :return: MNE data of the dataset. :rtype: MNE.Epochs/MNE.Raw

get_file_type()[source]

Get the file type. :return: The file type. :rtype: str

get_path_to_file()[source]

Get the path to the file. :return: The path to the file. :rtype: str

run()[source]

Launch the reading of the SET file. Notifies the main model that the computation is finished.

class src.runnables.files_runnable.openSetFileWorkerSignals[source]

Bases: PyQt5.QtCore.QObject

Contain the signals used by the open SET file runnable.

error
finished

src.runnables.plots_runnable module

Plots runnable

class src.runnables.plots_runnable.powerSpectralDensityRunnable(file_data, minimum_frequency, maximum_frequency, minimum_time, maximum_time, topo_time_points)[source]

Bases: PyQt5.QtCore.QRunnable

get_psd_fig()[source]

Get the power spectral density’s figure :return: The figure of the actual power spectral density’s data computed :rtype: matplotlib.Figure

get_topo_fig()[source]

Get the power spectral density’s figure fo the topographies :return: The figure of the topographies of the actual power spectral density’s data computed :rtype: matplotlib.Figure

run()[source]

Launch the computation of the power spectral density on the given data. Notifies the main model that the computation is finished.

class src.runnables.plots_runnable.powerSpectralDensityWorkerSignals[source]

Bases: PyQt5.QtCore.QObject

Contain the signals used by the power spectral density runnable.

error
finished
class src.runnables.plots_runnable.timeFrequencyRunnable(file_data, method_tfr, channel_selected, min_frequency, max_frequency, n_cycles)[source]

Bases: PyQt5.QtCore.QRunnable

get_channel_selected()[source]

Get the channel selected for the computation. :return: The channel selected. :rtype: str

get_itc()[source]

Get the “itc” data of the time-frequency analysis computation. :return: “itc” data of the time-frequency analysis computation. :rtype: MNE.AverageTFR

get_power()[source]

Get the “power” data of the time-frequency analysis computation. :return: “power” data of the time-frequency analysis computation. :rtype: MNE.AverageTFR

run()[source]

Launch the computation of the time-frequency analysis on the given data. Notifies the main model that the computation is finished. If to extreme parameters are given and the computation fails, an error message is displayed describing the error. Notifies the main model when an error occurs.

class src.runnables.plots_runnable.timeFrequencyWorkerSignals[source]

Bases: PyQt5.QtCore.QObject

Contain the signals used by the time-frequency runnable.

error
finished

src.runnables.statistics_runnable module

Statistics runnable

class src.runnables.statistics_runnable.statisticsConnectivityRunnable(file_data, psi, fmin, fmax, connectivity_method, n_jobs, export_path, stats_first_variable, stats_second_variable)[source]

Bases: PyQt5.QtCore.QRunnable

check_data_export()[source]

Check if the envelope correlation data and the PSI must be exported.

compute_correlation_data(file_data_one, file_data_two)[source]

Compute the correct correlation data depending on the method chosen by the user.

static create_mask_from_variable_to_keep(file_data, stats_variable)[source]

Create a mask to know which trial to keep and which one to remove for the computation. :return mask: Mask of trials to remove. True means remove, and False means keep. :rtype mask: list of boolean

get_connectivity_data_one()[source]

Get the connectivity’s data of the first independent variable. :return: The connectivity’s data. :rtype: list of, list of float

get_connectivity_data_two()[source]

Get the connectivity’s data of the second independent variable. :return: The connectivity’s data. :rtype: list of, list of float

get_psi_data_one()[source]

Get the psi’s data of the first independent variable. :return: The psi’s data. Or nothing if the psi’s data has not been computed. :rtype: list of, list of float

get_psi_data_two()[source]

Get the psi’s data of the first independent variable. :return: The psi’s data. Or nothing if the psi’s data has not been computed. :rtype: list of, list of float

run()[source]

Launch the computation of the envelope correlation on the given data. Notifies the main model that the computation is finished.

save_data(data, channels, file_name)[source]

If it is the case, create the file and write the data in it. :param data: The data to save, either the connectivity of PSI. :type data: list of, list of float :param channels: The channels names to save. :type channels: list of str :param file_name: The name of the data to save. :type file_name: str

class src.runnables.statistics_runnable.statisticsConnectivityWorkerSignals[source]

Bases: PyQt5.QtCore.QObject

Contain the signals used by the envelope correlation runnable.

error
finished
class src.runnables.statistics_runnable.statisticsErspItcRunnable(file_data, method_tfr, channel_selected, min_frequency, max_frequency, n_cycles, stats_first_variable, stats_second_variable)[source]

Bases: PyQt5.QtCore.QRunnable

static create_mask_from_variable_to_keep(file_data, stats_variable)[source]

Create a mask to know which trial to keep and which one to remove for the computation. :return mask: Mask of trials to remove. True means remove, and False means keep. :rtype mask: list of boolean

get_channel_selected()[source]

Get the channel selected for the computation. :return: The channel selected. :rtype: str

get_itc_one()[source]

Get the “itc” data of the time-frequency analysis computation for the first independent variable. :return: “itc” data of the time-frequency analysis computation. :rtype: MNE.AverageTFR

get_itc_two()[source]

Get the “itc” data of the time-frequency analysis computation for the second independent variable. :return: “itc” data of the time-frequency analysis computation. :rtype: MNE.AverageTFR

get_power_one()[source]

Get the “power” data of the time-frequency analysis computation for the first independent variable. :return: “power” data of the time-frequency analysis computation. :rtype: MNE.AverageTFR

get_power_two()[source]

Get the “power” data of the time-frequency analysis computation for the second independent variable. :return: “power” data of the time-frequency analysis computation. :rtype: MNE.AverageTFR

run()[source]

Launch the computation of the time-frequency analysis on the given data. Notifies the main model that the computation is finished. If to extreme parameters are given and the computation fails, an error message is displayed describing the error. Notifies the main model when an error occurs.

class src.runnables.statistics_runnable.statisticsErspItcWorkerSignals[source]

Bases: PyQt5.QtCore.QObject

Contain the signals used by the time-frequency runnable.

error
finished
class src.runnables.statistics_runnable.statisticsSnrRunnable(file_data, snr_methods, source_method, file_path, read_files, write_files, picks, stats_first_variable, stats_second_variable)[source]

Bases: PyQt5.QtCore.QRunnable

SNR_amplitude(axis=1)[source]

Take the data from the Epoch file, average it and give the data to the computation. :param axis: If axis is equal to None, the array is first ravel’d. If axis is an integer, this is the axis over which to operate. Default is 0. :type axis: int or None, optional :return: SNR_estimate :rtype: int

static SNR_amplitude_computation(a, axis=0)[source]

Link : https://www.sciencedirect.com/science/article/pii/S105381190901297X# :param a: An ndarray object containing the sample data. :type a: ndarray :param axis: If axis is equal to None, the array is first ravel’d. If axis is an integer, this is the axis over which to operate. Default is 0. :type axis: int or None, optional :return: SNR_estimate :rtype: int

SNR_maximum_likelihood_estimate()[source]

Take the data from the Epoch file, average it and give the data to the computation. :return: SNR_estimate :rtype: int

static SNR_maximum_likelihood_estimate_computation(a, b)[source]

Paper : Signal to noise ratio and response variability measurements in single trial evoked potentials Link : https://doi.org/10.1016/0013-4694(78)90267-5 — The signal-to-noise ratio of the input data based on the maximum likelihood estimate between successive trials Returns the signal-to-noise ratio of ‘a’ and ‘b’ :param : :type : param a: An ndarray object containing the sample data. :param : :type : type a: ndarray :param : :type : param b: An ndarray object containing the sample data. :param : :type : type b: ndarray :param : :type : return: SNR_estimate :param : :type : rtype: int

SNR_mean_std(axis=1, ddof=0)[source]

Take the data from the Epoch file, average it and give the data to the computation. :param axis: If axis is equal to None, the array is first ravel’d. If axis is an integer, this is the axis over which to operate. Default is 0. :type axis: int or None, optional :param ddof: Degrees of freedom correction for standard deviation. Default is 0. :type ddof: int, optional :return: SNR_estimate :rtype: int

static SNR_mean_std_computation(a, axis=0, ddof=0)[source]

This function comes from an old release of SciPy (version 0.14.0, currently version 1.7.1). It is not implemented anymore in Scipy. Link : https://docs.scipy.org/doc/scipy-0.14.0/reference/generated/scipy.stats.signaltonoise.html — The signal-to-noise ratio of the input data. Returns the signal-to-noise ratio of ‘a’, here defined as the mean divided by the standard deviation. :param a: An ndarray object containing the sample data. :type a: ndarray :param axis: If axis is equal to None, the array is first ravel’d. If axis is an integer, this is the axis over which to operate. Default is 0. :type axis: int or None, optional :param ddof: Degrees of freedom correction for standard deviation. Default is 0. :type ddof: int, optional :return: s2n, The mean to standard deviation ratio(s) along axis, or 0 where the standard deviation is 0. :rtype: ndarray

SNR_mne_frequency()[source]

Compute the power spectral density to give it to the SNR computation. :return: SNR_estimate :rtype: int

static SNR_mne_frequency_computation(psd, noise_n_neighbor_freqs=1, noise_skip_neighbor_freqs=1)[source]
Parameters:
  • psd (ndarray, shape ([n_trials, n_channels,] n_frequency_bins)) – Data object containing PSD values. Works with arrays as produced by MNE’s PSD functions or channel/trial subsets.
  • noise_n_neighbor_freqs (int) – Number of neighboring frequencies used to compute noise level. increment by one to add one frequency bin ON BOTH SIDES
  • noise_skip_neighbor_freqs (int) – set this >=1 if you want to exclude the immediately neighboring frequency bins in noise level calculation
Returns:

Array containing SNR for all epochs, channels, frequency bins. NaN for frequencies on the edges, that do not have enough neighbors on one side to calculate SNR.

Return type:

ndarray, shape ([n_trials, n_channels,] n_frequency_bins)

SNR_mne_source()[source]

Link : https://mne.tools/stable/auto_examples/inverse/source_space_snr.html Compute the source estimate to estimated the SNR from it. :return: SNR_estimate :rtype: int

SNR_plus_minus_averaging(axis=0)[source]

Take the data from the Epoch file give it to the computation. :param axis: If axis is equal to None, the array is first ravel’d. If axis is an integer, this is the axis over which to operate. Default is 0. :type axis: int or None, optional :return: SNR_estimate :rtype: int

SNR_plus_minus_averaging_computation(data, axis=0)[source]
Links : https://ietresearch.onlinelibrary.wiley.com/doi/10.1049/iet-spr.2016.0528
https://link.springer.com/content/pdf/10.1007/BF02522949.pdf
Parameters:
  • data (ndarray) – An ndarray object containing the sample data.
  • axis – If axis is equal to None, the array is first ravel’d. If axis is an integer, this is the axis over

which to operate. Default is 0. :type axis: int or None, optional :return: SNR_estimate :rtype: int

SNR_response_repetition(axis=0)[source]

Take the data from the Epoch file give it to the computation. :param axis: If axis is equal to None, the array is first ravel’d. If axis is an integer, this is the axis over which to operate. Default is 0. :type axis: int or None, optional :return: SNR_estimate :rtype: int

static SNR_response_repetition_computation(data, axis=0)[source]

Link : https://github.com/nipy/nitime/blob/master/nitime/analysis/snr.py :param data: An ndarray object containing the sample data. :type data: ndarray :param axis: If axis is equal to None, the array is first ravel’d. If axis is an integer, this is the axis over which to operate. Default is 0. :type axis: int or None, optional :return: SNR_estimate :rtype: int

SNR_sample_correlation_coefficient()[source]

Compute the average of the SNR of epochs. :return: SNR_estimate :rtype: int

static SNR_sample_correlation_coefficient_computation(a, b)[source]

Paper : Signal to noise ratio and response variability measurements in single trial evoked potentials. Link : https://doi.org/10.1016/0013-4694(78)90267-5 — The signal-to-noise ratio of the input data based on the sample correlation between successive trials. Returns the signal-to-noise ratio of ‘a’ and ‘b’ :param a: An ndarray object containing the sample data. :type a: ndarray :param b: An ndarray object containing the sample data. :type b: ndarray :return: SNR_estimate :rtype: int

compute_all_SNRs()[source]

Launch all the SNR methods selected by the user.

compute_bem_solution()[source]
compute_estimate_SNR(evoked, inv)[source]
compute_forward_solution(src, bem)[source]
compute_inverse_operator(fwd, noise_cov)[source]
compute_noise_covariance()[source]
compute_source_space()[source]
create_inverse()[source]
create_mask_from_variable_to_keep(stats_variable)[source]

Create a mask to know which trial to keep and which one to remove for the computation. :return mask: Mask of trials to remove. True means remove, and False means keep. :rtype mask: list of boolean

get_SNR_methods()[source]

Get the SNR methods used for the computation. :return: SNR methods :rtype: list of str

get_first_SNRs()[source]

Get the SNRs computed over the first independent variable. :return: The SNRs computed over the first independent variable. :rtype: list of, list of float

get_second_SNRs()[source]

Get the SNRs computed over the second independent variable. :return: The SNRs computed over the second independent variable. :rtype: list of, list of float

get_t_values()[source]

Get the T-values computed over the SNRs of the two independent variables. :return: T-values computed over the SNRs of the two independent variables. :rtype: list of float

static mean_squared(data, axis=0)[source]
static plot_SNR_mne_frequency(PSDs, freqs, SNRs, fmin, fmax)[source]
pretty_print_SNRs(SNRs, all_methods=False, means=True)[source]
root_mean_squared(data, axis=0)[source]
run()[source]

Launch the computation of the SNR Notifies the main model when the computation is finished. Notifies the main model when an error occurs.

class src.runnables.statistics_runnable.statisticsSnrSignals[source]

Bases: PyQt5.QtCore.QObject

Contain the signals used by the source estimation runnable.

error
finished

src.runnables.study_runnable module

Study runnable

class src.runnables.study_runnable.studyTimeFrequencyRunnable(file_data, method_tfr, channel_selected, min_frequency, max_frequency, n_cycles)[source]

Bases: PyQt5.QtCore.QRunnable

get_channel_selected()[source]

Get the channel selected for the computation. :return: The channel selected. :rtype: str

get_itc()[source]

Get the “itc” data of the time-frequency analysis computation. :return: “itc” data of the time-frequency analysis computation. :rtype: MNE.AverageTFR

get_power()[source]

Get the “power” data of the time-frequency analysis computation. :return: “power” data of the time-frequency analysis computation. :rtype: MNE.AverageTFR

run()[source]

Launch the computation of the time-frequency analysis on the given data. Notifies the main model that the computation is finished. If to extreme parameters are given and the computation fails, an error message is displayed describing the error. Notifies the main model when an error occurs.

class src.runnables.study_runnable.studyTimeFrequencyWorkerSignals[source]

Bases: PyQt5.QtCore.QObject

Contain the signals used by the time-frequency runnable.

error
finished

src.runnables.tools_runnable module

Tools runnable

class src.runnables.tools_runnable.extractEpochsRunnable(file_data, events, event_ids, tmin, tmax, trials_selected)[source]

Bases: PyQt5.QtCore.QRunnable

get_file_data()[source]

Get the file data. :return: MNE data of the dataset. :rtype: MNE.Epochs/MNE.Raw

run()[source]

Launch the computation of the extraction of the epochs on the given data. Notifies the main model that the computation is finished.

transform_file_data_with_trials_selected()[source]

Create a mask to know which trial to keep and which one to remove for the computation. Apply this mask on the data to keep only the trials/epochs selected by the user.

class src.runnables.tools_runnable.extractEpochsWorkerSignals[source]

Bases: PyQt5.QtCore.QObject

Contain the signals used by the extract epochs runnable.

error
finished
class src.runnables.tools_runnable.filterRunnable(low_frequency, high_frequency, channels_selected, file_data, filter_method)[source]

Bases: PyQt5.QtCore.QRunnable

get_channels_selected()[source]

Gets the channels used for the filtering. :return: The channels :rtype: list of str

get_file_data()[source]

Get the file data. :return: MNE data of the dataset. :rtype: MNE.Epochs/MNE.Raw

get_filter_method()[source]

Gets the method used for the filtering. :return: The method used for the filtering, either FIR or IIR. :rtype: str

get_high_frequency()[source]

Gets the high frequency used for the filtering. :return: The high frequency :rtype: float

get_low_frequency()[source]

Gets the low frequency used for the filtering. :return: The low frequency :rtype: float

run()[source]

Launch the computation of the filtering on the given data. Notifies the main model that the computation is finished.

class src.runnables.tools_runnable.filterWorkerSignals[source]

Bases: PyQt5.QtCore.QObject

Contain the signals used by the filter runnable.

error
finished
class src.runnables.tools_runnable.icaRunnable(ica_method, file_data)[source]

Bases: PyQt5.QtCore.QRunnable

get_file_data()[source]

Get the file data. :return: MNE data of the dataset. :rtype: MNE.Epochs/MNE.Raw

get_ica_method()[source]

Gets the method used for the ICA decomposition. :return: Method used for performing the ICA decomposition :return: str

run()[source]

Launch the computation of the ICA decomposition on the given data. Notifies the main model that the computation is finished.

class src.runnables.tools_runnable.icaWorkerSignals[source]

Bases: PyQt5.QtCore.QObject

Contain the signals used by the ICA Decomposition runnable.

error
finished
class src.runnables.tools_runnable.reReferencingRunnable(references, file_data, file_path, write_files, read_files, n_jobs)[source]

Bases: PyQt5.QtCore.QRunnable

compute_bem_solution()[source]

Compute the BEM solution of the “fsaverage” model. :return: The BEM solution. :rtype: MNE.ConductorModel

compute_forward_solution(src, bem)[source]

Compute the forward solution of the given data, based on the source space model of the “fsaverage” model. :param src: The source space :type src: MNE.SourceSpaces :param bem: The BEM solution. :type bem: MNE.ConductorModel :return: The forward solution. :rtype: MNE.Forward

compute_source_space()[source]

Compute the source space of the “fsaverage” model. :return: The source space :rtype: MNE.SourceSpaces

get_file_data()[source]

Get the file data. :return: MNE data of the dataset. :rtype: MNE.Epochs/MNE.Raw

get_load_data()[source]

Get the boolean indicating if the data must be loaded. :return: True if the data must be loaded, False otherwise. :rtype: bool

get_n_jobs()[source]

Get the number of jobs used for the computation. :return: The number of jobs. :rtype: int

get_references()[source]

Get the references on which the data has been re-referenced. :return: The references :rtype: str/list of str

get_save_data()[source]

Get the boolean indicating if the data must be saved. :return: True if the data must be saved, False otherwise. :rtype: bool

run()[source]

Launch the computation of the re-referencing on the given data. Compute the forward solution and the necessary information for the computation of the re-referencing to the point in infinity, which requires some information of the source space to be done. Notifies the main model that the computation is finished.

class src.runnables.tools_runnable.reReferencingWorkerSignals[source]

Bases: PyQt5.QtCore.QObject

Contain the signals used by the re-referencing runnable.

error
finished
class src.runnables.tools_runnable.resamplingRunnable(frequency, file_data, events)[source]

Bases: PyQt5.QtCore.QRunnable

get_events()[source]

Get the events. :return: The events :rtype: list of, list of int

get_file_data()[source]

Get the file data. :return: MNE data of the dataset. :rtype: MNE.Epochs/MNE.Raw

get_frequency()[source]

Get the frequency used for the resampling :return: The frequency :rtype: int

run()[source]

Launch the computation of the resampling on the given data. Notifies the main model that the computation is finished.

class src.runnables.tools_runnable.resamplingWorkerSignals[source]

Bases: PyQt5.QtCore.QObject

Contain the signals used by the resampling runnable.

error
finished
class src.runnables.tools_runnable.signalToNoiseRatioRunnable(file_data, snr_methods, source_method, file_path, read_files, write_files, picks, trials_selected)[source]

Bases: PyQt5.QtCore.QRunnable

SNR_amplitude(axis=1)[source]

Take the data from the Epoch file, average it and give the data to the computation. :param axis: If axis is equal to None, the array is first ravel’d. If axis is an integer, this is the axis over which to operate. Default is 0. :type axis: int or None, optional :return: SNR_estimate :rtype: int

static SNR_amplitude_computation(a, axis=0)[source]

Link : https://www.sciencedirect.com/science/article/pii/S105381190901297X# :param a: An ndarray object containing the sample data. :type a: ndarray :param axis: If axis is equal to None, the array is first ravel’d. If axis is an integer, this is the axis over which to operate. Default is 0. :type axis: int or None, optional :return: SNR_estimate :rtype: int

SNR_maximum_likelihood_estimate()[source]

Take the data from the Epoch file, average it and give the data to the computation. :return: SNR_estimate :rtype: int

static SNR_maximum_likelihood_estimate_computation(a, b)[source]

Paper : Signal to noise ratio and response variability measurements in single trial evoked potentials Link : https://doi.org/10.1016/0013-4694(78)90267-5 — The signal-to-noise ratio of the input data based on the maximum likelihood estimate between successive trials Returns the signal-to-noise ratio of ‘a’ and ‘b’ :param : :type : param a: An ndarray object containing the sample data. :param : :type : type a: ndarray :param : :type : param b: An ndarray object containing the sample data. :param : :type : type b: ndarray :param : :type : return: SNR_estimate :param : :type : rtype: int

SNR_mean_std(axis=1, ddof=0)[source]

Take the data from the Epoch file, average it and give the data to the computation. :param axis: If axis is equal to None, the array is first ravel’d. If axis is an integer, this is the axis over which to operate. Default is 0. :type axis: int or None, optional :param ddof: Degrees of freedom correction for standard deviation. Default is 0. :type ddof: int, optional :return: SNR_estimate :rtype: int

static SNR_mean_std_computation(a, axis=0, ddof=0)[source]

This function comes from an old release of SciPy (version 0.14.0, currently version 1.7.1). It is not implemented anymore in Scipy. Link : https://docs.scipy.org/doc/scipy-0.14.0/reference/generated/scipy.stats.signaltonoise.html — The signal-to-noise ratio of the input data. Returns the signal-to-noise ratio of ‘a’, here defined as the mean divided by the standard deviation. :param a: An ndarray object containing the sample data. :type a: ndarray :param axis: If axis is equal to None, the array is first ravel’d. If axis is an integer, this is the axis over which to operate. Default is 0. :type axis: int or None, optional :param ddof: Degrees of freedom correction for standard deviation. Default is 0. :type ddof: int, optional :return: s2n, The mean to standard deviation ratio(s) along axis, or 0 where the standard deviation is 0. :rtype: ndarray

SNR_mne_frequency()[source]

Compute the power spectral density to give it to the SNR computation. :return: SNR_estimate :rtype: int

static SNR_mne_frequency_computation(psd, noise_n_neighbor_freqs=1, noise_skip_neighbor_freqs=1)[source]
Parameters:
  • psd (ndarray, shape ([n_trials, n_channels,] n_frequency_bins)) – Data object containing PSD values. Works with arrays as produced by MNE’s PSD functions or channel/trial subsets.
  • noise_n_neighbor_freqs (int) – Number of neighboring frequencies used to compute noise level. increment by one to add one frequency bin ON BOTH SIDES
  • noise_skip_neighbor_freqs (int) – set this >=1 if you want to exclude the immediately neighboring frequency bins in noise level calculation
Returns:

Array containing SNR for all epochs, channels, frequency bins. NaN for frequencies on the edges, that do not have enough neighbors on one side to calculate SNR.

Return type:

ndarray, shape ([n_trials, n_channels,] n_frequency_bins)

SNR_mne_source()[source]

Link : https://mne.tools/stable/auto_examples/inverse/source_space_snr.html Compute the source estimate to estimated the SNR from it. :return: SNR_estimate :rtype: int

SNR_plus_minus_averaging(axis=0)[source]

Take the data from the Epoch file give it to the computation. :param axis: If axis is equal to None, the array is first ravel’d. If axis is an integer, this is the axis over which to operate. Default is 0. :type axis: int or None, optional :return: SNR_estimate :rtype: int

SNR_plus_minus_averaging_computation(data, axis=0)[source]
Links : https://ietresearch.onlinelibrary.wiley.com/doi/10.1049/iet-spr.2016.0528
https://link.springer.com/content/pdf/10.1007/BF02522949.pdf
Parameters:
  • data (ndarray) – An ndarray object containing the sample data.
  • axis – If axis is equal to None, the array is first ravel’d. If axis is an integer, this is the axis over

which to operate. Default is 0. :type axis: int or None, optional :return: SNR_estimate :rtype: int

SNR_response_repetition(axis=0)[source]

Take the data from the Epoch file give it to the computation. :param axis: If axis is equal to None, the array is first ravel’d. If axis is an integer, this is the axis over which to operate. Default is 0. :type axis: int or None, optional :return: SNR_estimate :rtype: int

static SNR_response_repetition_computation(data, axis=0)[source]

Link : https://github.com/nipy/nitime/blob/master/nitime/analysis/snr.py :param data: An ndarray object containing the sample data. :type data: ndarray :param axis: If axis is equal to None, the array is first ravel’d. If axis is an integer, this is the axis over which to operate. Default is 0. :type axis: int or None, optional :return: SNR_estimate :rtype: int

SNR_sample_correlation_coefficient()[source]

Compute the average of the SNR of epochs. :return: SNR_estimate :rtype: int

static SNR_sample_correlation_coefficient_computation(a, b)[source]

Paper : Signal to noise ratio and response variability measurements in single trial evoked potentials. Link : https://doi.org/10.1016/0013-4694(78)90267-5 — The signal-to-noise ratio of the input data based on the sample correlation between successive trials. Returns the signal-to-noise ratio of ‘a’ and ‘b’ :param a: An ndarray object containing the sample data. :type a: ndarray :param b: An ndarray object containing the sample data. :type b: ndarray :return: SNR_estimate :rtype: int

compute_all_SNRs()[source]

Launch all the SNR methods selected by the user.

compute_bem_solution()[source]
compute_estimate_SNR(evoked, inv)[source]
compute_forward_solution(src, bem)[source]
compute_inverse_operator(fwd, noise_cov)[source]
compute_noise_covariance()[source]
compute_source_space()[source]
create_inverse()[source]
create_mask_from_indexes_to_keep()[source]

Create a mask to know which trial to keep and which one to remove for the computation. :return mask: Mask of trials to remove. True means remove, and False means keep. :rtype mask: list of boolean

get_SNR_methods()[source]

Get the SNR methods used for the computation. :return: SNR methods :rtype: list of str

get_SNRs()[source]

Get the SNRs computed over the data. :return: The SNRs computed over the data. :rtype: list of, list of float

static mean_squared(data, axis=0)[source]
static plot_SNR_mne_frequency(PSDs, freqs, SNRs, fmin, fmax)[source]
pretty_print_SNRs(SNRs, all_methods=False, means=True)[source]
root_mean_squared(data, axis=0)[source]
run()[source]

Launch the computation of the SNR Notifies the main model when the computation is finished. Notifies the main model when an error occurs.

class src.runnables.tools_runnable.signalToNoiseRatioWorkerSignals[source]

Bases: PyQt5.QtCore.QObject

Contain the signals used by the source estimation runnable.

error
finished
class src.runnables.tools_runnable.sourceEstimationRunnable(source_estimation_method, file_data, file_path, write_files, read_files, epochs_method, trials_selected, tmin, tmax, n_jobs, export_path)[source]

Bases: PyQt5.QtCore.QRunnable

check_data_export()[source]

Check if the source estimation data must be exported. If it is the case, create the file and write the data in it.

compute_bem_solution()[source]

Compute the BEM solution of the “fsaverage” model. :return: The BEM solution. :rtype: MNE.ConductorModel

compute_forward_solution(src, bem)[source]

Compute the forward solution of the given data, based on the source space model of the “fsaverage” model. :param src: The source space :type src: MNE.SourceSpaces :param bem: The BEM solution. :type bem: MNE.ConductorModel :return: The forward solution. :rtype: MNE.Forward

compute_inverse_averaged(inv)[source]

Apply the inverse operator on all the signals of the given data and then average to give the final result. :param inv: The inverse operator. :type inv: MNE.InverseOperator :return: The source estimation of the evoked response of the data. :rtype: MNE.SourceEstimate

compute_inverse_evoked(inv)[source]

Apply the inverse operator on the evoked signal of the given data. :param inv: The inverse operator. :type inv: MNE.InverseOperator :return: The source estimation of the evoked response of the data. :rtype: MNE.SourceEstimate

compute_inverse_operator(fwd, noise_cov)[source]

Compute the inverse operator of the given data, based on the forward solution and the noise covariance previously computed. :param fwd: The forward solution. :type fwd: MNE.Forward :param noise_cov: The noise covariance. :type noise_cov: MNE.Covariance :return: The inverse operator. :rtype: MNE.InverseOperator

compute_inverse_single_trial(inv)[source]

Apply the inverse operator on a single signal of the given data. :param inv: The inverse operator. :type inv: MNE.InverseOperator :return: The source estimation of the evoked response of the data. :rtype: MNE.SourceEstimate

compute_noise_covariance()[source]

Compute the noise covariance of the given data. :return: The noise covariance. :rtype: MNE.Covariance

compute_source_estimation_on_selected_data(inv)[source]

Call the correct method for applying the inverse operator on the desired signals of the given data.s :param inv: The inverse operator. :type inv: MNE.InverseOperator :return: The source estimation of the evoked response of the data. :rtype: MNE.SourceEstimate

compute_source_space()[source]

Compute the source space of the “fsaverage” model. :return: The source space :rtype: MNE.SourceSpaces

create_inverse_operator()[source]

Launch all the necessary computation to compute the inverse operator. :return: The inverse operator. :rtype: MNE.InverseOperator

create_mask_from_indexes_to_keep()[source]

Create a mask to know which trial to keep and which one to remove for the computation. :return mask: Mask of trials to remove. True means remove, and False means keep. :rtype mask: list of boolean

get_source_estimation_data()[source]

Get the source estimation data. :return: The source estimation of the evoked response of the data. :rtype: MNE.SourceEstimate

mne_source_estimation_computation()[source]

Launch the computation of the source space if it is not provided. Once the source space is computed, compute the source estimation on this source space and the given data. :return: The source estimation of the evoked response of the data. :rtype: MNE.SourceEstimate

run()[source]

Launch the computation of the source estimation. Notifies the main model when the computation is finished. If it is tried to load the source space information file, but that those file does not exist yet, an error message is displayed describing the error. If to extreme parameters are given and the computation fails, an error message is displayed describing the error. Notifies the main model when an error occurs.

class src.runnables.tools_runnable.sourceEstimationWorkerSignals[source]

Bases: PyQt5.QtCore.QObject

Contain the signals used by the source estimation runnable.

error
finished

src.runnables.utils_runnable module

Utils runnable

class src.runnables.utils_runnable.downloadFsaverageMneDataRunnable[source]

Bases: PyQt5.QtCore.QRunnable

run()[source]

Launch the computation of the filtering on the given data. Notifies the main model that the computation is finished.

class src.runnables.utils_runnable.downloadFsaverageMneDataWorkerSignals[source]

Bases: PyQt5.QtCore.QObject

Contain the signals used by the download fsaverage MNE data runnable.

finished

Module contents