Пример #1
0
    def __init__(self):
        'Initial method to generate the "SigCon_interface" menu'

        # ============== Variable Declaration ==============
        blue = '#466289'
        lblue = '#A0AEC1'
        orange = '#FA6121'
        large_font = 'Trebuchet 16'
        font = "Trebuchet 14"
        sigcon_menu, CheckBoxLabel, RadioLabel = [], [], []
        ##-- Out data from SigCon_menu class
        self.sigcon_output = [
            '', ['Monopolar', ''], '', 'off', 'off', ['off', 'off']
        ]

        # ========= SigCon_interface tab creation ==========
        # (1) TABLE: Widget container
        ## --14 x 6 table creation
        self.table = gtk.Table(14, 6, True)

        # (2) LABEL: Window title
        titulo = Label(' BCI System - Signal Processing', 'Neuropol 20', blue,
                       0, 0.5)
        self.table.attach(titulo, 0, 5, 0, 1)
        subtitulo = Label(' A VE Plataform for Simulated BCI-Enabled Independent Living', \
                          'Neuropol 18', orange, 0, 0.5)
        self.table.attach(subtitulo, 0, 5, 1, 2)

        # (3) IMAGES: General menu & EEG layout
        url = 'Images\\minilogo.jpg'
        logo = Image(url)
        logo.set_alignment(xalign=0.5, yalign=0.5)
        self.table.attach(logo, 5, 6, 0, 2)
        url = 'Images\\layout.png'
        eeg = Image(url)
        eeg.set_alignment(xalign=0.8, yalign=0)
        self.table.attach(eeg, 2, 6, 2, 14)

        # (4) LABEL & TEXT-ENTRY: downsampling rate submenu
        tempo = Label('DOWNSAMPLE RATE', large_font, 'black', 1, 0.5)
        self.table.attach(tempo, 0, 2, 2, 3)
        icon = Image('Images\\downsampling.png')
        icon.set_alignment(xalign=0.2, yalign=0)
        self.table.attach(icon, 2, 3, 2, 4)
        tempo = TextEntry(self.read_text, [0])
        self.table.attach(tempo, 1, 2, 3, 4)
        sigcon_menu.append(tempo)

        # (5) LABEL, RADIO BUTTONS & TEXT-ENTRY: spatial filtering submenu
        tempo = Label('SPATIAL FILTERING', large_font, 'black', 1, 0.5)
        self.table.attach(tempo, 0, 2, 4, 5)
        icon = Image('Images\\filter.png')
        icon.set_alignment(xalign=0.2, yalign=0)
        self.table.attach(icon, 2, 3, 4, 6)
        ##-- monopolar referencing
        tempo, label = Radio_Button(None, 'Monopolar', font, 'black')
        RadioLabel.append(label)
        tempo.connect("toggled", self.Monopolar, sigcon_menu, RadioLabel)
        self.table.attach(tempo, 0, 1, 5, 6)
        ##-- bipolar referencing
        tempo, label = Radio_Button(tempo, 'Bipolar', font, lblue)
        RadioLabel.append(label)
        tempo.connect("toggled", self.Bipolar, sigcon_menu, RadioLabel)
        self.table.attach(tempo, 0, 1, 6, 7)
        ##-- small Laplace referencing
        tempo, label = Radio_Button(tempo, 'Small Laplacian', font, lblue)
        RadioLabel.append(label)
        tempo.connect("toggled", self.SLaplace, sigcon_menu, RadioLabel)
        self.table.attach(tempo, 0, 1, 7, 8)
        ##-- large Laplace referencing
        tempo, label = Radio_Button(tempo, 'Large Laplacian', font, lblue)
        RadioLabel.append(label)
        tempo.connect("toggled", self.LLaplace, sigcon_menu, RadioLabel)
        self.table.attach(tempo, 0, 1, 8, 9)
        ##-- CAR referencing
        tempo, label = Radio_Button(tempo, 'Common average', font, lblue)
        RadioLabel.append(label)
        tempo.connect("toggled", self.CAR, sigcon_menu, RadioLabel)
        self.table.attach(tempo, 0, 1, 9, 10)
        ##-- positive electrodes
        tempo = Label('+ Channels', font, 'black', 0.5, 0.5)
        self.table.attach(tempo, 1, 2, 6, 7)
        tempo = TextEntry(self.read_text, [2])
        tempo.set_editable(True)
        self.table.attach(tempo, 1, 2, 7, 8)
        sigcon_menu.append(tempo)
        ##-- negative electrodes
        tempo = Label('- Channels', font, 'black', 0.5, 0.5)
        self.table.attach(tempo, 1, 2, 8, 9)
        tempo = TextEntry(self.read_text, [1, 1])
        tempo.set_editable(True)
        self.table.attach(tempo, 1, 2, 9, 10)
        sigcon_menu.append(tempo)

        # (6) LABEL, CHECK BUTTONS & TEXTENTRY: spectral filtering submenu
        tempo = Label('SPECTRAL FILTERING', large_font, 'black', 1, 0.5)
        self.table.attach(tempo, 0, 2, 10, 11)
        icon = Image('Images\\filter.png')
        icon.set_alignment(xalign=0.2, yalign=0)
        self.table.attach(icon, 2, 3, 10, 12)
        ##-- 50Hz rejection
        button, label = Check_Button(' 50Hz-rejection', font, lblue)
        button.connect("toggled", self.Rejection, CheckBoxLabel)
        self.table.attach(button, 0, 1, 11, 12)
        CheckBoxLabel.append(label)
        ##-- DC removal
        button, label = Check_Button(' DC removal', font, lblue)
        button.connect("toggled", self.DCRemoval, CheckBoxLabel)
        self.table.attach(button, 0, 1, 12, 13)
        CheckBoxLabel.append(label)
        ##-- bandwidth
        button, label = Check_Button(' Bandwidth(fH:fL)', font, lblue)
        button.connect("toggled", self.bandwidth, sigcon_menu, CheckBoxLabel)
        self.table.attach(button, 0, 1, 13, 14)
        CheckBoxLabel.append(label)
        tempo = TextEntry(self.read_text, [5, 1])
        tempo.set_editable(False)
        self.table.attach(tempo, 1, 2, 13, 14)
        sigcon_menu.append(tempo)

        self.table.show()
Пример #2
0
    def __init__(self):
        'Initial method to generate the "DAQ_interface" menu'

        # ============== Variable Declaration ==============
        tab_bg = '#DCDCDC'
        small_font = "Trebuchet 12"
        large_font = 'Trebuchet 16'
        font = "Trebuchet 14"
        OffLine_menu, OnLine_menu, RadioLabel = [], [], []
        ##-- Out data from DAQ_menu class
        self.daq_output = [
            'offline', [], '', 'off', '', '', '', '', '', '', ''
        ]

        # ========== DAQ_interface tab creation ============
        # (1) TABLE: Widget container
        ## --14 x 6 table creation
        self.table = gtk.Table(14, 6, True)

        # (2) LABEL: Window title
        titulo = Label(' BCI System - Data Acquisition', 'Neuropol 20', blue,
                       0, 0.5)
        self.table.attach(titulo, 0, 5, 0, 1)
        subtitulo = Label(' A VE Plataform for Simulated BCI-Enabled Independent Living', \
                          'Neuropol 18', orange, 0, 0.5)
        self.table.attach(subtitulo, 0, 5, 1, 2)

        # (3) IMAGES: General menu images
        url = 'Images\\minilogo.jpg'
        logo = Image(url)
        logo.set_alignment(xalign=0.5, yalign=0.5)
        self.table.attach(logo, 5, 6, 0, 2)

        # (4) RADIO-BUTTONS: Offline & Online Selection
        ## -- Offline selection
        option1, label = Radio_Button(None, ' OFFLINE BCI SYSTEM', large_font,
                                      'black')
        RadioLabel.append(label)
        self.mnum = 0
        option1.connect("toggled", self.OffLine, OffLine_menu, RadioLabel)
        self.table.attach(option1, 0, 2, 2, 4)
        icon = Image('Images\\offline.png')
        icon.set_alignment(xalign=0.75, yalign=0.5)
        self.table.attach(icon, 1, 2, 2, 4)

        # (5) LABELS: offline & online submenu selection
        ## -- OffLine selection
        tempo = Label('', font, lblue, 0.5, 0.5)
        self.table.attach(tempo, 0, 1, 4, 5)
        OffLine_menu.append(tempo)
        tempo = Label('', font, lblue, 0.5, 0.5)
        self.table.attach(tempo, 1, 2, 4, 5)
        OffLine_menu.append(tempo)
        tempo = Label('Biosemi cap electrodes: ', font, 'black', 1, 0.5)
        self.table.attach(tempo, 0, 2, 5, 6)
        OffLine_menu.append(tempo)
        tempo = Label('External electrodes: ', font, 'black', 1, 0.5)
        self.table.attach(tempo, 0, 2, 6, 7)
        OffLine_menu.append(tempo)
        tempo = Label('Bad electrodes: ', font, 'black', 1, 0.5)
        self.table.attach(tempo, 0, 2, 7, 8)
        OffLine_menu.append(tempo)
        tempo = Label('Training trials (BS1;BS2;...): ', font, 'black', 1, 0.5)
        self.table.attach(tempo, 0, 2, 8, 9)
        OffLine_menu.append(tempo)
        tempo = Label('Testing trials (BS1;BS2;...): ', font, 'black', 1, 0.5)
        self.table.attach(tempo, 0, 2, 9, 10)
        OffLine_menu.append(tempo)
        tempo = Label('Samples per trial (BS1;BS2;...): ', font, 'black', 1,
                      0.5)
        self.table.attach(tempo, 0, 2, 10, 11)
        OffLine_menu.append(tempo)
        tempo = Label('Segmentation length (BS1;BS2;...): ', font, 'black', 1,
                      0.5)
        self.table.attach(tempo, 0, 2, 11, 12)
        OffLine_menu.append(tempo)
        tempo = Label('Overlapping rate [%]: ', font, 'black', 1, 0.5)
        self.table.attach(tempo, 0, 2, 12, 13)
        OffLine_menu.append(tempo)
        tempo = Label('Sample rate [Hz]: ', font, 'black', 1, 0.5)
        self.table.attach(tempo, 0, 2, 13, 14)
        OffLine_menu.append(tempo)
        ## -- OnLine selection
        tempo = Label('ActiveTwo hostname: ', font, 'black', 1, 0.5)
        self.table.attach(tempo, 3, 5, 4, 5)
        OnLine_menu.append(tempo)
        tempo = Label('Assistive-software hostname: ', font, 'black', 1, 0.5)
        self.table.attach(tempo, 3, 5, 5, 6)
        OnLine_menu.append(tempo)
        tempo = Label('Bytes in TCP array: ', font, 'black', 1, 0.5)
        self.table.attach(tempo, 3, 5, 6, 7)
        OnLine_menu.append(tempo)
        tempo = Label('Biosemi cap electrodes: ', font, 'black', 1, 0.5)
        self.table.attach(tempo, 3, 5, 7, 8)
        OnLine_menu.append(tempo)
        tempo = Label('External electrodes: ', font, 'black', 1, 0.5)
        self.table.attach(tempo, 3, 5, 8, 9)
        OnLine_menu.append(tempo)
        tempo = Label('Samples for controlling: ', font, 'black', 1, 0.5)
        self.table.attach(tempo, 3, 5, 9, 10)
        OnLine_menu.append(tempo)
        tempo = Label('Samples for referencing: ', font, 'black', 1, 0.5)
        self.table.attach(tempo, 3, 5, 10, 11)
        OnLine_menu.append(tempo)
        tempo = Label('Segmentation length [s]: ', font, 'black', 1, 0.5)
        self.table.attach(tempo, 3, 5, 11, 12)
        OnLine_menu.append(tempo)
        tempo = Label('Overlapping rate [%]: ', font, 'black', 1, 0.5)
        self.table.attach(tempo, 3, 5, 12, 13)
        OnLine_menu.append(tempo)
        tempo = Label('Sample rate [Hz]: ', font, 'black', 1, 0.5)
        self.table.attach(tempo, 3, 5, 13, 14)
        OnLine_menu.append(tempo)

        # (6) TEXT-ENTRY BOXES: selection panel for previous submenus
        ## -- OffLine selection
        tempo = TextEntry(self.read_offline, 2)
        self.table.attach(tempo, 2, 3, 5, 6)
        OffLine_menu.append(tempo)
        tempo = TextEntry(self.read_offline, 3)
        self.table.attach(tempo, 2, 3, 6, 7)
        OffLine_menu.append(tempo)
        tempo = TextEntry(self.read_offline, 10)
        self.table.attach(tempo, 2, 3, 7, 8)
        OffLine_menu.append(tempo)
        tempo = TextEntry(self.read_offline, 5)
        self.table.attach(tempo, 2, 3, 8, 9)
        OffLine_menu.append(tempo)
        tempo = TextEntry(self.read_offline, 6)
        self.table.attach(tempo, 2, 3, 9, 10)
        OffLine_menu.append(tempo)
        tempo = TextEntry(self.read_offline, 4)
        self.table.attach(tempo, 2, 3, 10, 11)
        OffLine_menu.append(tempo)
        tempo = TextEntry(self.read_offline, 8)
        self.table.attach(tempo, 2, 3, 11, 12)
        OffLine_menu.append(tempo)
        tempo = TextEntry(self.read_offline, 9)
        self.table.attach(tempo, 2, 3, 12, 13)
        OffLine_menu.append(tempo)
        tempo = TextEntry(self.read_offline, 7)
        self.table.attach(tempo, 2, 3, 13, 14)
        OffLine_menu.append(tempo)
        ## -- OnLine selection
        tempo = TextEntry(self.read_online, 1)
        self.table.attach(tempo, 5, 6, 4, 5)
        OnLine_menu.append(tempo)
        tempo = TextEntry(self.read_online, 10)
        self.table.attach(tempo, 5, 6, 5, 6)
        OnLine_menu.append(tempo)
        tempo = TextEntry(self.read_online, 2)
        self.table.attach(tempo, 5, 6, 6, 7)
        OnLine_menu.append(tempo)
        tempo = TextEntry(self.read_online, 3)
        self.table.attach(tempo, 5, 6, 7, 8)
        OnLine_menu.append(tempo)
        tempo = TextEntry(self.read_online, 4)
        self.table.attach(tempo, 5, 6, 8, 9)
        OnLine_menu.append(tempo)
        tempo = TextEntry(self.read_online, 8)
        self.table.attach(tempo, 5, 6, 9, 10)
        OnLine_menu.append(tempo)
        tempo = TextEntry(self.read_online, 9)
        self.table.attach(tempo, 5, 6, 10, 11)
        OnLine_menu.append(tempo)
        tempo = TextEntry(self.read_online, 6)
        self.table.attach(tempo, 5, 6, 11, 12)
        OnLine_menu.append(tempo)
        tempo = TextEntry(self.read_online, 7)
        self.table.attach(tempo, 5, 6, 12, 13)
        OnLine_menu.append(tempo)
        tempo = TextEntry(self.read_online, 5)
        self.table.attach(tempo, 5, 6, 13, 14)
        OnLine_menu.append(tempo)

        # (7) EVENT-IMAGE: IAF Online selection
        ## -- online radio button
        option2, label = Radio_Button(option1, ' ONLINE BCI SYSTEM',
                                      large_font, lblue)
        RadioLabel.append(label)
        option2.connect("toggled", self.OnLine, OnLine_menu, RadioLabel)
        self.table.attach(option2, 3, 5, 2, 4)
        ## -- online image
        icon = Image('Images\\online.png')
        icon.set_alignment(xalign=0.75, yalign=0.5)
        self.table.attach(icon, 4, 5, 2, 4)
        ## -- IAF eventbox
        IAF, img_IAF = Event_Image('Images\\IAF.png', 1, 0.5, tab_bg)
        IAF.connect("button_press_event", self.AlphaPeak)
        self.table.attach(IAF, 5, 6, 2, 4)
        OnLine_menu.append(IAF)

        # (8) BUTTONS: tools to load a matrix
        browse, label = Button_Label('LOAD', blue, font)
        label.modify_fg(gtk.STATE_NORMAL, gtk.gdk.color_parse(lblue))
        label.modify_font(pango.FontDescription('Neuropol 14'))
        self.table.attach(browse, 2, 3, 4, 5)
        browse.connect('clicked', self.Load, OffLine_menu)

        self.table.show()

        # (9) Preset Interface
        OffLine_menu.append(browse)
        ## -- OffLine is "ON"
        for item in OnLine_menu:
            item.hide()
        ## -- OnLine is "OFF"
        for item in OffLine_menu:
            item.show()
Пример #3
0
    def __init__(self):        
        'Initial method to generate the "FeaExt_interface" menu'

        # ============== Variable Declaration ==============
        blue = '#466289'
        lblue = '#A0AEC1'
        tab_bg = '#DCDCDC'
        orange = '#FA6121'
        large_font = 'Trebuchet 16'
        font = "Trebuchet 14"
        small_font = "Trebuchet 12"
        BP_menu, FeaSel_menu, CheckBoxLabel, RadioLabel = [], [], [], []
        ##-- Out data from FeaExt_menu class
        self.feaext_output = ['absolute_bb', 'off', ['off', 'off'], ['off', 'off'], ['off', 'off'], ['off', 'off'], \
                             ['off', 'off'], ['off', 'off'], ['off', 'off'], ['off', 'off'], ['off', 'off'], ['off', 'off']]
        self.location = [0, 0, 0, 0, 0]
        ##-- Out data from FeaSel_menu class
        self.feasel_output = ['off', ['off', 'FDA'], ['off', 'off'], ['off', 'off']]
        ##-- Out data from Class_menu class
        self.class_output = ['FDA', '', 'off','off']
        
        # ========== Feature Extractor Interface ===========        
        # (1) TABLE: Widget container
        ## --14 x 6 table creation
        self.table = gtk.Table(14, 6, True)
        self.table.show()

        # (2) LABEL: Window title
        titulo = Label(' BCI System - Feature Extractor, Selector & Classifier', 'Neuropol 20', blue, 0, 0.5)
        self.table.attach(titulo, 0, 5, 0, 1)
        subtitulo = Label(' A VE Plataform for Simulated BCI-Enabled Independent Living', \
                          'Neuropol 18', orange, 0, 0.5)
        self.table.attach(subtitulo, 0, 5, 1, 2)

        # (3) IMAGES: General menu images
        url = 'Images\\minilogo.jpg'
        logo = Image(url)
        logo.set_alignment(xalign=0.5, yalign=0.5)
        self.table.attach(logo, 5, 6, 0, 2)
 
        # (4) LABEL & RADIO BUTTONS: Type of BP Selection
        ## -- Title
        tempo = Label('FEATURE\nEXTRACTOR ', large_font, 'black', 1, 0.5)
        self.table.attach(tempo, 0, 1, 2, 4)
        icon = Image('Images\\features.png') 
        icon.set_alignment(xalign=0.2, yalign=0.5)
        self.table.attach(icon, 1, 2, 2, 4)      
        ## -- label
        tempo = Label('1|  Power measurement', font, 'black', 0.1, 0.5)
        self.table.attach(tempo, 0, 2, 4, 5) 
        ## -- BP selection
        option1, label = Radio_Button(None, ' Band power including broadband', font, 'black')
        RadioLabel.append(label)
        option1.connect("toggled", self.BP_opt1, BP_menu, RadioLabel, 1)
        self.table.attach(option1, 0, 2, 5, 6)        
        option2, label = Radio_Button(option1, ' Band power', font, lblue)
        RadioLabel.append(label)
        option2.connect("toggled", self.BP_opt1, BP_menu, RadioLabel, 2)
        self.table.attach(option2, 0, 2, 6, 7)       
        option3, label = Radio_Button(option1, ' Relative power', font, lblue)
        RadioLabel.append(label)
        option3.connect("toggled", self.BP_opt2, BP_menu, RadioLabel)
        self.table.attach(option3, 0, 2, 7, 8)
        option4, label = Radio_Button(option1, ' ERD-ERS values:', font, lblue)
        RadioLabel.append(label)
        option4.connect("toggled", self.BP_opt3, BP_menu, RadioLabel)
        self.table.attach(option4, 0, 1, 8, 9)

        # (5) EventBoxes & LABEL: bandwidth submenu selection
        ## -- label
        tempo = Label('2|  Frequency band selection', font, 'black', 0.1, 0.5)
        self.table.attach(tempo, 0, 2, 9, 10)
        ##-- theta band
        event, label = Event_Label('theta: ', font, lblue, 1, 0.5, tab_bg)
        event.set_events(gtk.gdk.BUTTON_PRESS_MASK)
        event.connect("button_press_event", self.BP_Theta, BP_menu)
        self.table.attach(event, 0, 1, 10, 11)
        BP_menu.append(label)
        ##-- alpha band
        event, label = Event_Label('alpha: ', font, lblue, 1, 0.5, tab_bg)
        event.set_events(gtk.gdk.BUTTON_PRESS_MASK)
        event.connect("button_press_event", self.BP_Alpha, BP_menu)
        self.table.attach(event, 0, 1, 11, 12)
        BP_menu.append(label)        
        ##-- beta band
        event, label = Event_Label('beta: ', font, lblue, 1, 0.5, tab_bg)
        event.set_events(gtk.gdk.BUTTON_PRESS_MASK)
        event.connect("button_press_event", self.BP_Beta, BP_menu)
        self.table.attach(event, 0, 1, 12, 13)
        BP_menu.append(label)        
        ##-- gamma band
        event, label = Event_Label('gamma: ', font, lblue, 1, 0.5, tab_bg)
        event.set_events(gtk.gdk.BUTTON_PRESS_MASK)
        event.connect("button_press_event", self.BP_Gamma, BP_menu)
        self.table.attach(event, 0, 1, 13, 14)
        BP_menu.append(label)
        
        # (6) TEXT-ENTRIES: BP submenu selection 
        ## -- ERD/ERS power       
        tempo = TextEntry(self.read_BP, 0)
        tempo.set_editable(False)
        self.table.attach(tempo, 1, 2, 8, 9)
        BP_menu.append(tempo)
        ## -- theta band
        tempo = TextEntry(self.read_BP, 1)
        tempo.set_editable(False)
        self.table.attach(tempo, 1, 2, 10, 11)
        BP_menu.append(tempo)
        ##-- alpha band
        tempo = TextEntry(self.read_BP, 2)
        tempo.set_editable(False)
        self.table.attach(tempo, 1, 2, 11, 12)
        BP_menu.append(tempo)        
        ## -- beta band
        tempo = TextEntry(self.read_BP, 3)
        tempo.set_editable(False)
        self.table.attach(tempo, 1, 2, 12, 13)
        BP_menu.append(tempo)        
        ## -- gamma band
        tempo = TextEntry(self.read_BP, 4)
        tempo.set_editable(False)
        self.table.attach(tempo, 1, 2, 13, 14)
        BP_menu.append(tempo)       
        
        
        # =========== Feature Selector Interface ===========
        # (1) LABELS: classifier menu selection
        ## -- Title 
        tempo = Label('FEATURE\nSELECTOR', large_font, 'black', 1, 0.5)
        self.table.attach(tempo, 2, 3, 2, 4)
        icon = Image('Images\\selection.png') 
        icon.set_alignment(xalign=0.2, yalign=0.5)
        self.table.attach(icon, 3, 4, 2, 4)
        
        # (2) CHECK BUTTON & LABEL: DBI menu
        ## -- label
        tempo = Label('1|  Cluster validity techniques', font, 'black', 0.1, 0.5)
        self.table.attach(tempo, 2, 4, 4, 5)
        ## -- check button
        button, label = Check_Button(' DBI', font, lblue)
        button.connect("toggled", self.DBI, CheckBoxLabel)
        self.table.attach(button, 2, 4, 5, 6)
        CheckBoxLabel.append(label)
                
        # (3) CHECK BUTTON & RADIO BUTTONS: RFE menu
        ## -- label
        tempo = Label('2|  Feature ranking (offline system)', font, 'black', 0.1, 0.5)
        self.table.attach(tempo, 2, 4, 6, 7)
        ## -- check button
        button, label = Check_Button(' RFE', font, lblue)
        button.connect("toggled", self.RFE, FeaSel_menu, CheckBoxLabel)
        self.table.attach(button, 2, 4, 7, 8)
        CheckBoxLabel.append(label)
        ## -- radio buttons
        option1, label = Radio_Button(None, ' FDA', font, 'black')
        RadioLabel.append(label)
        option1.connect('toggled', self.Classifier, 'FDA', 'selection', RadioLabel, 2)
        self.table.attach(option1, 2, 4, 8, 9)
        FeaSel_menu.append(option1)
        option2, label = Radio_Button(option1, ' Linear SVM', font, lblue)
        RadioLabel.append(label)
        option2.connect('toggled', self.Classifier, 'Linear_SVM', 'selection', RadioLabel, 3)
        self.table.attach(option2, 2, 3, 9, 10)    
        FeaSel_menu.append(option2)    
        option3, label = Radio_Button(option2, ' Gaussian SVM', font, lblue)
        RadioLabel.append(label)
        option3.connect('toggled', self.Classifier, 'RBF_SVM', 'selection', RadioLabel, 4)
        self.table.attach(option3, 3, 4, 9, 10)
        FeaSel_menu.append(option3)
        for item in FeaSel_menu[:3]: item.hide()
        
        # (4) CHECK BUTTON, LABEL & TEXT-ENTRY: Feature Selection
        ## -- label
        tempo = Label('3|  Feature selection', font, 'black', 0.1, 0.5)
        self.table.attach(tempo, 2, 4, 10, 11)
        ## -- check button
        button, label = Check_Button(' Feature indexes', font, lblue)
        button.connect("toggled", self.IndexRange, FeaSel_menu, CheckBoxLabel)
        self.table.attach(button, 2, 4, 11, 12)
        CheckBoxLabel.append(label)        
        ##-- radio button 1
        option4, label = Radio_Button(None, ' DBI features: ', font, 'black')
        RadioLabel.append(label)
        option4.connect("toggled", self.DBIFeatures, FeaSel_menu, RadioLabel)
        self.table.attach(option4, 2, 3, 12, 13)
        FeaSel_menu.append(option4)           
        ##-- radio button 2
        option5, label = Radio_Button(option4, ' RFE features: ', font, lblue)
        RadioLabel.append(label)
        option5.connect("toggled", self.RFEFeatures, FeaSel_menu, RadioLabel)
        self.table.attach(option5, 2, 3, 13, 14)
        FeaSel_menu.append(option5)     
        ## -- text-entry 1
        tempo = TextEntry(self.read_FeaSel, [2, 1])
        tempo.set_editable(False)
        self.table.attach(tempo, 3, 4, 12, 13)
        FeaSel_menu.append(tempo)  
        ## -- text-entry 2
        tempo = TextEntry(self.read_FeaSel, [3, 1])
        tempo.set_editable(False)
        self.table.attach(tempo, 3, 4, 13, 14)
        FeaSel_menu.append(tempo)
        for item in FeaSel_menu[3:]: item.hide()
        
               
        # ========== Feature Classifier Interface ==========
        # (1) LABELS: classifier menu selection
        ## -- Title 
        tempo = Label('CLASSIFIER', large_font, 'black', 1, 0.5)
        self.table.attach(tempo, 4, 5, 2, 4)
        icon = Image('Images\\classifier.png') 
        icon.set_alignment(xalign=0.2, yalign=0.5)
        self.table.attach(icon, 5, 6, 2, 4)
        ## -- SubTitle 1
        tempo = Label('1|  Class labels ', font, 'black', 0, 0.5)
        self.table.attach(tempo, 4, 6, 4, 5) 
        ## -- Left/Right/NonControl commands
        tempo = Label('Left / right / idle: ', font, 'black', 1, 0.5)
        self.table.attach(tempo, 4, 5, 5, 6) 
        ## -- SubTitle 2
        tempo = Label('2|  Feature vector scaling', font, 'black', 0, 0.5)
        self.table.attach(tempo, 4, 6, 6, 7)
        ## -- SubTitle 3
        tempo = Label('3|  Classifier type', font, 'black', 0, 0.5)
        self.table.attach(tempo, 4, 6, 8, 9)        
        ## -- SubTitle 4
        tempo = Label('4|  Classifier calibration (online system)', font, 'black', 0, 0.5)
        self.table.attach(tempo, 4, 6, 12, 13)        
        
         # (2) RADIO BUTTONS: classifier selection
        option1, label = Radio_Button(None, ' FDA', font, 'black')
        RadioLabel.append(label)
        option1.connect('toggled', self.Classifier, 'FDA', 'classification', RadioLabel, 7)
        self.table.attach(option1, 4, 6, 9, 10)
        option2, label = Radio_Button(option1, ' Linear SVM', font, lblue)
        RadioLabel.append(label)
        option2.connect('toggled', self.Classifier, 'Linear_SVM', 'classification', RadioLabel, 8)
        self.table.attach(option2, 4, 6, 10, 11)        
        option3, label = Radio_Button(option2, ' Radial basis function SVM', font, lblue)
        RadioLabel.append(label)
        option3.connect('toggled', self.Classifier, 'RBF_SVM', 'classification', RadioLabel, 9)
        self.table.attach(option3, 4, 6, 11, 12)         
        
        # (3) LABEL: Classifier Calibration
        class_label = Label('Trials per class: ', font, 'black', 1, 0.5)
        self.table.attach(class_label, 4, 5, 13, 14)        
        
        # (4) TEXT-ENTRY:  Class labels and calibration
        ## -- Class Labels
        tempo = TextEntry(self.read_Class, [1])
        tempo.set_editable(True)
        self.table.attach(tempo, 5, 6, 5, 6)
        ## -- Classifier Calibration
        tempo = TextEntry(self.read_Class, [2])
        tempo.set_editable(True)
        self.table.attach(tempo, 5, 6, 13, 14)
        
        ## (5) CHECKBOX: Feature Vector Scaling
        button, label = Check_Button(' Standardization', font, lblue)
        button.connect("toggled", self.StandardScore, CheckBoxLabel)
        self.table.attach(button, 4, 6, 7, 8)
        CheckBoxLabel.append(label)
Пример #4
0
    def __init__(self):        
        'Initial method to generate the "DAQ_interface" menu'

        # ============== Variable Declaration ==============
        tab_bg = '#DCDCDC'
        small_font = "Trebuchet 12"
        large_font = 'Trebuchet 16'
        font = "Trebuchet 14"
        OffLine_menu, OnLine_menu, RadioLabel = [], [], []
        ##-- Out data from DAQ_menu class
        self.daq_output = ['offline', [], '', 'off', '', '', '', '', '', '', '']
        
        # ========== DAQ_interface tab creation ============        
        # (1) TABLE: Widget container
        ## --14 x 6 table creation
        self.table = gtk.Table(14, 6, True)

        # (2) LABEL: Window title
        titulo = Label(' BCI System - Data Acquisition', 'Neuropol 20', blue, 0, 0.5)
        self.table.attach(titulo, 0, 5, 0, 1)
        subtitulo = Label(' A VE Plataform for Simulated BCI-Enabled Independent Living', \
                          'Neuropol 18', orange, 0, 0.5)
        self.table.attach(subtitulo, 0, 5, 1, 2)

        # (3) IMAGES: General menu images
        url = 'Images\\minilogo.jpg'
        logo = Image(url)
        logo.set_alignment(xalign=0.5, yalign=0.5)
        self.table.attach(logo, 5, 6, 0, 2)
 
        # (4) RADIO-BUTTONS: Offline & Online Selection
        ## -- Offline selection
        option1, label = Radio_Button(None, ' OFFLINE BCI SYSTEM', large_font, 'black')
        RadioLabel.append(label)
        self.mnum = 0
        option1.connect("toggled", self.OffLine, OffLine_menu, RadioLabel)
        self.table.attach(option1, 0, 2, 2, 4)
        icon = Image('Images\\offline.png') 
        icon.set_alignment(xalign = 0.75, yalign = 0.5)
        self.table.attach(icon, 1, 2, 2, 4)
        

        # (5) LABELS: offline & online submenu selection
        ## -- OffLine selection
        tempo = Label('', font, lblue, 0.5, 0.5)
        self.table.attach(tempo, 0, 1, 4, 5)
        OffLine_menu.append(tempo)
        tempo = Label('', font, lblue, 0.5, 0.5)
        self.table.attach(tempo, 1, 2, 4, 5)
        OffLine_menu.append(tempo)
        tempo = Label('Biosemi cap electrodes: ', font, 'black', 1, 0.5)
        self.table.attach(tempo, 0, 2, 5, 6)
        OffLine_menu.append(tempo)
        tempo = Label('External electrodes: ', font, 'black', 1, 0.5)
        self.table.attach(tempo, 0, 2, 6, 7)
        OffLine_menu.append(tempo)        
        tempo = Label('Bad electrodes: ', font, 'black', 1, 0.5)
        self.table.attach(tempo, 0, 2, 7, 8)
        OffLine_menu.append(tempo)        
        tempo = Label('Training trials (BS1;BS2;...): ', font, 'black', 1, 0.5)
        self.table.attach(tempo, 0, 2, 8, 9)
        OffLine_menu.append(tempo)
        tempo = Label('Testing trials (BS1;BS2;...): ', font, 'black', 1, 0.5)
        self.table.attach(tempo, 0, 2, 9, 10)
        OffLine_menu.append(tempo)
        tempo = Label('Samples per trial (BS1;BS2;...): ', font, 'black', 1, 0.5)
        self.table.attach(tempo, 0, 2, 10, 11)
        OffLine_menu.append(tempo)
        tempo = Label('Segmentation length (BS1;BS2;...): ', font, 'black', 1, 0.5)
        self.table.attach(tempo, 0, 2, 11, 12)
        OffLine_menu.append(tempo)
        tempo = Label('Overlapping rate [%]: ', font, 'black', 1, 0.5)
        self.table.attach(tempo, 0, 2, 12, 13)
        OffLine_menu.append(tempo)
        tempo = Label('Sample rate [Hz]: ', font, 'black', 1, 0.5)
        self.table.attach(tempo, 0, 2, 13, 14)
        OffLine_menu.append(tempo)
        ## -- OnLine selection
        tempo = Label('ActiveTwo hostname: ', font, 'black', 1, 0.5)
        self.table.attach(tempo, 3, 5, 4, 5)
        OnLine_menu.append(tempo)
        tempo = Label('Assistive-software hostname: ', font, 'black', 1, 0.5)
        self.table.attach(tempo, 3, 5, 5, 6)
        OnLine_menu.append(tempo)
        tempo = Label('Bytes in TCP array: ', font, 'black', 1, 0.5)
        self.table.attach(tempo, 3, 5, 6, 7)
        OnLine_menu.append(tempo)
        tempo = Label('Biosemi cap electrodes: ', font, 'black', 1, 0.5)
        self.table.attach(tempo, 3, 5, 7, 8)
        OnLine_menu.append(tempo)        
        tempo = Label('External electrodes: ', font, 'black', 1, 0.5)
        self.table.attach(tempo, 3, 5, 8, 9)
        OnLine_menu.append(tempo)        
        tempo = Label('Samples for controlling: ', font, 'black', 1, 0.5)
        self.table.attach(tempo, 3, 5, 9, 10)
        OnLine_menu.append(tempo)
        tempo = Label('Samples for referencing: ', font, 'black', 1, 0.5)
        self.table.attach(tempo, 3, 5, 10, 11)
        OnLine_menu.append(tempo)        
        tempo = Label('Segmentation length [s]: ', font, 'black', 1, 0.5)
        self.table.attach(tempo, 3, 5, 11, 12)
        OnLine_menu.append(tempo)
        tempo = Label('Overlapping rate [%]: ', font, 'black', 1, 0.5)
        self.table.attach(tempo, 3, 5, 12, 13)
        OnLine_menu.append(tempo)
        tempo = Label('Sample rate [Hz]: ', font, 'black', 1, 0.5)
        self.table.attach(tempo, 3, 5, 13, 14)
        OnLine_menu.append(tempo)

        # (6) TEXT-ENTRY BOXES: selection panel for previous submenus
        ## -- OffLine selection
        tempo = TextEntry( self.read_offline, 2)
        self.table.attach(tempo, 2, 3, 5, 6)
        OffLine_menu.append(tempo)        
        tempo = TextEntry( self.read_offline, 3)
        self.table.attach(tempo, 2, 3, 6, 7)
        OffLine_menu.append(tempo)        
        tempo = TextEntry( self.read_offline, 10)
        self.table.attach(tempo, 2, 3, 7, 8)
        OffLine_menu.append(tempo)        
        tempo = TextEntry( self.read_offline, 5)
        self.table.attach(tempo, 2, 3, 8, 9)
        OffLine_menu.append(tempo)        
        tempo = TextEntry( self.read_offline, 6)
        self.table.attach(tempo, 2, 3, 9, 10)
        OffLine_menu.append(tempo)        
        tempo = TextEntry( self.read_offline, 4)
        self.table.attach(tempo, 2, 3, 10, 11)
        OffLine_menu.append(tempo)
        tempo = TextEntry( self.read_offline, 8)
        self.table.attach(tempo, 2, 3, 11, 12)
        OffLine_menu.append(tempo)
        tempo = TextEntry( self.read_offline, 9)
        self.table.attach(tempo, 2, 3, 12, 13)
        OffLine_menu.append(tempo)
        tempo = TextEntry( self.read_offline, 7)
        self.table.attach(tempo, 2, 3, 13, 14)
        OffLine_menu.append(tempo)
        ## -- OnLine selection
        tempo = TextEntry( self.read_online, 1)
        self.table.attach(tempo, 5, 6, 4, 5)
        OnLine_menu.append(tempo)
        tempo = TextEntry( self.read_online, 10)
        self.table.attach(tempo, 5, 6, 5, 6)
        OnLine_menu.append(tempo)
        tempo = TextEntry( self.read_online, 2)
        self.table.attach(tempo, 5, 6, 6, 7)
        OnLine_menu.append(tempo)
        tempo = TextEntry( self.read_online, 3)
        self.table.attach(tempo, 5, 6, 7, 8)
        OnLine_menu.append(tempo)
        tempo = TextEntry( self.read_online, 4)
        self.table.attach(tempo, 5, 6, 8, 9)
        OnLine_menu.append(tempo)        
        tempo = TextEntry( self.read_online, 8)
        self.table.attach(tempo, 5, 6, 9, 10)
        OnLine_menu.append(tempo)
        tempo = TextEntry( self.read_online, 9)
        self.table.attach(tempo, 5, 6, 10, 11)
        OnLine_menu.append(tempo)        
        tempo = TextEntry( self.read_online, 6)
        self.table.attach(tempo, 5, 6, 11, 12)
        OnLine_menu.append(tempo)
        tempo = TextEntry( self.read_online, 7)
        self.table.attach(tempo, 5, 6, 12, 13)
        OnLine_menu.append(tempo)
        tempo = TextEntry( self.read_online, 5)
        self.table.attach(tempo, 5, 6, 13, 14)
        OnLine_menu.append(tempo)
        
        # (7) EVENT-IMAGE: IAF Online selection
        ## -- online radio button
        option2, label = Radio_Button(option1, ' ONLINE BCI SYSTEM', large_font, lblue)
        RadioLabel.append(label)
        option2.connect("toggled", self.OnLine, OnLine_menu, RadioLabel)
        self.table.attach(option2, 3, 5, 2, 4)
        ## -- online image
        icon = Image('Images\\online.png') 
        icon.set_alignment(xalign = 0.75, yalign = 0.5)
        self.table.attach(icon, 4, 5, 2, 4)
        ## -- IAF eventbox
        IAF, img_IAF = Event_Image('Images\\IAF.png', 1, 0.5, tab_bg)
        IAF.connect("button_press_event", self.AlphaPeak)
        self.table.attach(IAF, 5, 6, 2, 4)
        OnLine_menu.append(IAF)

        # (8) BUTTONS: tools to load a matrix
        browse, label = Button_Label('LOAD', blue, font)
        label.modify_fg(gtk.STATE_NORMAL, gtk.gdk.color_parse(lblue))
        label.modify_font(pango.FontDescription('Neuropol 14'))
        self.table.attach(browse, 2, 3, 4, 5)
        browse.connect('clicked', self.Load, OffLine_menu)
      
        self.table.show()
        
        # (9) Preset Interface
        OffLine_menu.append(browse)
        ## -- OffLine is "ON"
        for item in OnLine_menu: item.hide()
        ## -- OnLine is "OFF"
        for item in OffLine_menu: item.show()