Source code for src.connectivity.envelope_correlation.envelope_correlation_controller
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Envelope Correlation Controller
"""
from connectivity.envelope_correlation.envelope_correlation_listener import envelopeCorrelationListener
from connectivity.envelope_correlation.envelope_correlation_view import envelopeCorrelationView
from utils.data_exportation.data_exportation_controller import dataExportationController
__author__ = "Lemahieu Antoine"
__copyright__ = "Copyright 2022"
__credits__ = ["Lemahieu Antoine"]
__license__ = "GNU General Public License v3.0"
__maintainer__ = "Lemahieu Antoine"
__email__ = "Antoine.Lemahieu@ulb.be"
__status__ = "Dev"
[docs]class envelopeCorrelationController(envelopeCorrelationListener):
def __init__(self, number_of_channels, file_data):
"""
Controller for computing the envelope correlation on the dataset.
Create a new window for specifying some parameters.
:param number_of_channels: The number of channels
:type number_of_channels: int
:param file_data: The dataset data
:type file_data: MNE.Info
"""
self.main_listener = None
self.envelope_correlation_view = envelopeCorrelationView(number_of_channels, file_data)
self.envelope_correlation_view.set_listener(self)
self.source_estimation_controller = None
self.export_data_controller = None
self.export_path = None
self.envelope_correlation_view.show()
[docs] def additional_parameters_clicked(self):
"""
Create a new window for specifying the exportation path of the computation of the envelope correlation.
"""
self.export_data_controller = dataExportationController()
self.export_data_controller.set_listener(self)
"""
Plot
"""
[docs] def plot_envelope_correlation(self, envelope_correlation_data, psi, channel_names):
"""
Send the information to the view to plot the envelope correlation.
:param envelope_correlation_data: The envelope correlation data to plot.
:type envelope_correlation_data: list of, list of float
:param psi: Values of the computation of the PSI, if None then the computation has not been done.
The PSI give an indication to the directionality of the connectivity.
:type psi: list of, list of float
:param channel_names: Channels' names
:type channel_names: list of str
"""
self.envelope_correlation_view.plot_envelope_correlation(envelope_correlation_data, psi, channel_names)
"""
Setters
"""
[docs] def set_listener(self, listener):
"""
Set the main listener so that the controller is able to communicate with the main controller.
:param listener: main listener
:type listener: mainController
"""
self.main_listener = listener