Exemplo n.º 1
0
    def __init__(self, dmg, parent=None):
        QMainWindow.__init__(self, parent=parent)
        self.dmg = dmg
        ### BIOSIGNALS gui design ##############################
        self.setupUi(self)
        self.MplWidget.emitter.connect(self.manage_selection)
        self.show()
        ###### dynamic auxiliar scripts ########################
        self.dyn = dynamic(self.dmg, self.listWidget_3, self.RawCode)
        self.dyn.load_auxiliar_code()
        ######### init logger ####################
        self.log = log(self.logger)
        ######### callbacks ####################
        self.channel_comboBox.activated.connect(
            lambda: self.toChannelID(self.channel_comboBox.currentText()))
        self.unit_comboBox.activated.connect(
            lambda: self.toUnitID(self.unit_comboBox.currentText()))
        self.U2ID_comboBox.activated.connect(
            lambda: self.selected_unit2ID(self.U2ID_comboBox.currentText()))
        self.threshold_btn.clicked.connect(lambda: self.update_threshold())
        self.delete_btn.clicked.connect(lambda: self.delete())
        self.undo_btn.clicked.connect(lambda: self.undo())
        self.clean_btn.clicked.connect(lambda: self.spikes_clean())
        self.sorting_btn.clicked.connect(lambda: self.sorting())

        self.btn_load.clicked.connect(self.openFileNameDialog)
        self.btn_save.clicked.connect(self.saveFileDialog)

        self.btn_run.clicked.connect(lambda: self.dyn.load_module(
            self.listWidget_3.currentItem().text()))
        self.btn_save_changes.clicked.connect(self.dyn.save_script)
        ###########
        self.global_shortcuts = self._define_global_shortcuts()
    def __init__(self, dmg):
        QMainWindow.__init__(self, parent=None)
        self.setupUi(self)
        self.show()

        self.dmg = dmg
        self.log = log(self.logger)
        self.scripts_log = log(self.scripts_logger)
        self.dyn = dynamic(self.dmg, self.scripts_log, self.listWidget_3,
                           self.RawCode)
        self.dyn.load_auxiliar_code()

        self.MplWidget.emitter.connect(self.manage_selection)

        self.btn_load.clicked.connect(self.openFileNameDialog)
        self.btn_save.clicked.connect(self.saveFileDialog)
        self.all_denoising_btn.clicked.connect(self.automatic_denoising)
        self.all_sorting_btn.clicked.connect(self.automatic_sorting)
        self.amplitude_threshold_btn.clicked.connect(
            lambda: self.update_amplitude_threshold())
        self.temporal_threshold_btn.clicked.connect(
            lambda: self.update_cross_talk())
        self.delete_btn.clicked.connect(lambda: self.delete())
        self.undo_btn.clicked.connect(lambda: self.undo())
        self.denoising_btn.clicked.connect(lambda: self.spikes_clean())
        self.sorting_btn.clicked.connect(lambda: self.sorting())
        self.all_in_btn.clicked.connect(lambda: self.all_in_one_step())
        self.btn_run.clicked.connect(lambda: self.dyn.load_module(
            self.listWidget_3.currentItem().text()))
        self.btn_save_changes.clicked.connect(self.dyn.save_script)
        self.btn_new_file.clicked.connect(self.create_file)

        self.channel_comboBox.activated.connect(
            lambda: self.toChannelID(self.channel_comboBox.currentText()))
        self.unit_comboBox.activated.connect(
            lambda: self.toUnitID(self.unit_comboBox.currentText()))
        self.U2ID_comboBox.activated.connect(
            lambda: self.selected_unit2ID(self.U2ID_comboBox.currentText()))

        self.global_shortcuts = self._define_global_shortcuts()
        self.update_U2ID_combobox()
Exemplo n.º 3
0
 def __init__(self, app, callbacks):    
     self.app = app;        
     ### BIOSIGNALS gui design ##############################
     self.MainWindow = QtWidgets.QMainWindow()
     self.bio_graph = ui()
     self.bio_graph.setupUi(self.MainWindow)
     self.initQwtCurves()
     self.loadStyle()
     self.contextServer()
     self.MainWindow.show()
     ######### init logger ####################
     self.log = log(self.bio_graph.logger)
     ######### data managets ####################
     self.dmgs = []
     delay = 10
     self.dmgs.append(data_manager(signal='bvp', signal_numbers=1, seconds_max=self.bio_graph.bvpWindowsSize_spinBox.maximum(), seconds=self.bio_graph.bvpWindowsSize_spinBox.value(), sample_rate=64, block_size=11, delay_max=delay))
     self.dmgs.append(data_manager(signal='gsr', signal_numbers=1, seconds_max=self.bio_graph.gsrWindowsSize_spinBox.maximum(), seconds=self.bio_graph.gsrWindowsSize_spinBox.value(), sample_rate=4, block_size=6, delay_max=delay))
     self.dmgs.append(data_manager(signal='tmp', signal_numbers=1, seconds_max=self.bio_graph.tmpWindowsSize_spinBox.maximum(), seconds=self.bio_graph.tmpWindowsSize_spinBox.value(), sample_rate=4, block_size=8, delay_max=delay))
     self.dmgs.append(data_manager(signal='acc', signal_numbers=3, seconds_max=self.bio_graph.accWindowsSize_spinBox.maximum(), seconds=self.bio_graph.accWindowsSize_spinBox.value(), sample_rate=32, block_size=6, delay_max=delay))
     ####### set callbacks ####################################
     self.bio_graph.btn_server.clicked.connect(callbacks[0])
     self.bio_graph.btn_refresh.clicked.connect(callbacks[1])
     self.bio_graph.btn_connect.clicked.connect(callbacks[2])
     self.bio_graph.btn_start.clicked.connect(callbacks[3])
     self.bio_graph.bvpWindowsSize_spinBox.valueChanged.connect(lambda:  self.windowsSize(0))
     self.bio_graph.gsrWindowsSize_spinBox.valueChanged.connect(lambda:  self.windowsSize(1))
     self.bio_graph.tmpWindowsSize_spinBox.valueChanged.connect(lambda:  self.windowsSize(2))
     self.bio_graph.accWindowsSize_spinBox.valueChanged.connect(lambda:  self.windowsSize(3))    
     self.bio_graph.btn_user.clicked.connect(self.saveFileDialog)
     self.bio_graph.btn_loadScript.clicked.connect(self.openFileNameDialog)
     ###############  set timers for updating plots #############
     self.bvp_timer = QtCore.QTimer()
     self.bvp_timer.setTimerType(QtCore.Qt.PreciseTimer) 
     self.bvp_timer.timeout.connect(self.bvp_update)               
     self.gsr_timer = QtCore.QTimer()
     self.gsr_timer.setTimerType(QtCore.Qt.PreciseTimer) 
     self.gsr_timer.timeout.connect(self.gsr_update)      
     self.tmp_timer = QtCore.QTimer()
     self.tmp_timer.setTimerType(QtCore.Qt.PreciseTimer) 
     self.tmp_timer.timeout.connect(self.tmp_update)        
     self.acc_timer = QtCore.QTimer() 
     self.acc_timer.setTimerType(QtCore.Qt.PreciseTimer) 
     self.acc_timer.timeout.connect(self.acc_update)
Exemplo n.º 4
0
 def __init__(self):
     QtWidgets.QApplication.__init__(self, [''])
     # -- CREATE SHARED VARIABLES AND QUEUES ------------
     self.constants = constants()
     # -- shared values for streaming control --
     self.video_streaming = Value('b', 0)
     self.BCI_streaming = Value('b', 0)
     # -- shared values to check socket connections --
     self.OpenBCI_connected = Value('b', 0)
     self.E4_connected = Value('b', 0)
     self.CAM_connected = Value('b', 0)
     # -- queues --
     self.video_queue = Queue()
     self.eeg_queue = Queue()
     ############# GUI DEFINITION ############################
     self.gui = GUI(self,
                    callbacks=[
                        self.saveFileDialog, self.openFileNameDialog,
                        self.E4_server_link, self.E4_connect,
                        self.E4_refresh, self.OpenBCI_connection_manager,
                        self.webcam_connection_manager
                    ])
     # -- CREATE SERVICES ----------------
     self.log = log(self.gui.logger)
     # ------------ DRIVERS definitions --------------------
     #-- OpenBCI DataManager
     self.eeg_dmg = OpenBCI_data_manager(self.eeg_queue)
     self.eeg_dmg.start()
     # # -- Empatica E4 DataManagers--
     self.E4_dmgs = []
     self.E4_dmgs.append(
         E4_data_manager(signal='bvp', num_signals=1, sample_rate=64))
     self.E4_dmgs.append(
         E4_data_manager(signal='gsr', num_signals=1, sample_rate=4))
     self.E4_dmgs.append(
         E4_data_manager(signal='tmp', num_signals=1, sample_rate=4))
     # -- webcam --
     self.video_dmg = VideoDMG(self.video_queue, self.video_streaming)
     self.video_dmg.start()
     # ---------- INITIALIZE GUI -----------
     self.gui.init_values()