def cb_Options(self, widget): if widget == self.bOpt["showCA"]: self.x = self.varChIn.get_var() if self.fTypeW["PCA"].get_active(): self.x2 = pcafilt.unmix(self.x) elif self.fTypeW["ICA"].get_active(): self.x2 = icafilt.unmix(self.x) if self.compCh == None: self.compCh = ComponentChooser(self.x2) else: self.compCh.show_all()
def cb_Options(self, widget): if widget == self.bOpt["showCA"]: self.x = self.varChIn.get_var() if self.fTypeW["PCA"].get_active(): self.x2 = pcafilt.unmix(self.x) elif self.fTypeW["ICA"].get_active(): self.x2 = icafilt.unmix(self.x) if self.compCh==None: self.compCh = ComponentChooser(self.x2) else: self.compCh.show_all()
class PCAFiltWin(EegpyWin): programName = "eegpy: PCA-Filtering" x=None x2 = None #For PCA y=None compCh = None # Konstruktor def __init__(self, x_in=123456, x_out=123456): gobject.threads_init() EegpyWin.__init__(self, x_in, x_out) self.setupOptions() self.show_all() def delete_event(self, widget, event, data=None): if self.compCh != None: self.compCh.destroy() EegpyWin.delete_event(self, widget, event, data) return False def cb_Buttons(self, widget): if widget == self.varChIn: #try: self.log("Working on array with shape"+str(self.varChIn.get_var().shape)) self.showFilter() #except AttributeError: # self.log("Given Variable is not an array!!!") elif widget == self.varChOut: try: if self.y!=None: self.log("Saving results...") self.varChOut.set_var(self.y) self.compCh.hide() self.cb_quit(widget) except AttributeError: self.log("Given Variable is not an array!!!") pass def cb_Options(self, widget): if widget == self.bOpt["showCA"]: self.x = self.varChIn.get_var() if self.fTypeW["PCA"].get_active(): self.x2 = pcafilt.unmix(self.x) elif self.fTypeW["ICA"].get_active(): self.x2 = icafilt.unmix(self.x) if self.compCh==None: self.compCh = ComponentChooser(self.x2) else: self.compCh.show_all() def setupOptions(self): self.bTable = gtk.Table(2, 2, True) #SpinBoxes for Frequencies and order self.bOpt = {} self.bOpt["showCA"] = gtk.Button("Analyze") self.bTable.attach(self.bOpt["showCA"],0,2,0,1) self.bOpt["showCA"].connect("clicked",self.cb_Options) #Radio-Buttons self.fTypeW = {} self.fTypeW["PCA"] = gtk.RadioButton(None,"PCA") self.bTable.attach(self.fTypeW["PCA"],0,1,1,2) self.fTypeW["ICA"] = gtk.RadioButton(self.fTypeW["PCA"],"ICA") self.bTable.attach(self.fTypeW["ICA"],1,2,1,2) self.upper_hbox.pack_start(self.bTable, expand=False, padding=1) #self.bTable2 = gtk.Table(1, 1, True) #self.btAnal = gtk.Button("Show/Hide Analysis") #self.btAnal.connect("clicked", self.cb_showAnalysis) #self.bTable2.attach(self.btAnal,0,1,0,1) #self.hbox.pack_start(self.bTable2, False, padding=50) def setupSubplots(self): self.f.clear() self.a = self.f.add_subplot(MultichannelSubplot(self.f,1,1,1)) def showFilter(self): if self.compCh != None: if self.fTypeW["PCA"].get_active(): self.y = pcafilt.mix(self.x2,self.compCh.choose_mask) elif self.fTypeW["ICA"].get_active(): self.y = icafilt.mix(self.x2,self.compCh.choose_mask) self.a.cla() self.a.plotChannels(self.x,"k") self.a.plotChannels(self.y,"r") #for i in range(17): # self.a.plot(self.x[:,i]) self.canvas.draw()
class PCAFiltWin(EegpyWin): programName = "eegpy: PCA-Filtering" x = None x2 = None #For PCA y = None compCh = None # Konstruktor def __init__(self, x_in=123456, x_out=123456): gobject.threads_init() EegpyWin.__init__(self, x_in, x_out) self.setupOptions() self.show_all() def delete_event(self, widget, event, data=None): if self.compCh != None: self.compCh.destroy() EegpyWin.delete_event(self, widget, event, data) return False def cb_Buttons(self, widget): if widget == self.varChIn: #try: self.log("Working on array with shape" + str(self.varChIn.get_var().shape)) self.showFilter() #except AttributeError: # self.log("Given Variable is not an array!!!") elif widget == self.varChOut: try: if self.y != None: self.log("Saving results...") self.varChOut.set_var(self.y) self.compCh.hide() self.cb_quit(widget) except AttributeError: self.log("Given Variable is not an array!!!") pass def cb_Options(self, widget): if widget == self.bOpt["showCA"]: self.x = self.varChIn.get_var() if self.fTypeW["PCA"].get_active(): self.x2 = pcafilt.unmix(self.x) elif self.fTypeW["ICA"].get_active(): self.x2 = icafilt.unmix(self.x) if self.compCh == None: self.compCh = ComponentChooser(self.x2) else: self.compCh.show_all() def setupOptions(self): self.bTable = gtk.Table(2, 2, True) #SpinBoxes for Frequencies and order self.bOpt = {} self.bOpt["showCA"] = gtk.Button("Analyze") self.bTable.attach(self.bOpt["showCA"], 0, 2, 0, 1) self.bOpt["showCA"].connect("clicked", self.cb_Options) #Radio-Buttons self.fTypeW = {} self.fTypeW["PCA"] = gtk.RadioButton(None, "PCA") self.bTable.attach(self.fTypeW["PCA"], 0, 1, 1, 2) self.fTypeW["ICA"] = gtk.RadioButton(self.fTypeW["PCA"], "ICA") self.bTable.attach(self.fTypeW["ICA"], 1, 2, 1, 2) self.upper_hbox.pack_start(self.bTable, expand=False, padding=1) #self.bTable2 = gtk.Table(1, 1, True) #self.btAnal = gtk.Button("Show/Hide Analysis") #self.btAnal.connect("clicked", self.cb_showAnalysis) #self.bTable2.attach(self.btAnal,0,1,0,1) #self.hbox.pack_start(self.bTable2, False, padding=50) def setupSubplots(self): self.f.clear() self.a = self.f.add_subplot(MultichannelSubplot(self.f, 1, 1, 1)) def showFilter(self): if self.compCh != None: if self.fTypeW["PCA"].get_active(): self.y = pcafilt.mix(self.x2, self.compCh.choose_mask) elif self.fTypeW["ICA"].get_active(): self.y = icafilt.mix(self.x2, self.compCh.choose_mask) self.a.cla() self.a.plotChannels(self.x, "k") self.a.plotChannels(self.y, "r") #for i in range(17): # self.a.plot(self.x[:,i]) self.canvas.draw()