def add(self, fn): iter = self.tree.append(None) self.tree.set(iter, 0, os.path.split(fn)[1]) self.tree.set(iter, 1, 0) self.tree.set_sort_column_id(0, gtk.SORT_ASCENDING) self.etDict[os.path.split(fn)[1]] = EventTable(fn) print self.etDict for k in self.etDict.keys(): print "Keys: ", self.etDict[k].keys()
def set_filename(self, fn): print fn, "selected for opening" #success = False try: if not os.path.exists(fn): raise ValueError("File doesn't exist") self._et = EventTable(fn) if len(self._et.keys()) == 0: print self._et.keys() raise ValueError("EventTable empty!") self._fn = fn except ValueError, e: print "Error opening EventTable", e self._et = None self._fn = None return False
def simple_erp_like_data(t_max=5000, Fs=2., peek_width=300): model = NRoessler(3) data = model.integrate(np.arange(0, t_max, 1. / Fs)) events = EventTable({ "before peeks": np.arange(500, t_max * Fs - 1000, 1000), "on peeks": np.arange(500 + peek_width / 2, t_max * Fs - 1000, 1000) }) peek_data = np.hanning(peek_width) for e in events["before peeks"]: data[e:e + peek_width, 0] += peek_data * 20 data[e:e + peek_width, 3] += peek_data * 6 data[e:e + peek_width, 6] += peek_data * -14 return data[:, 0::3], events
def __init__(self, label=""): gtk.Frame.__init__(self, label) self.vbox = gtk.VBox() self.tb_box = gtk.HBox() self.add(self.vbox) self.vbox.pack_start(self.tb_box, expand=False) self.tb = gtk.Toolbar() self.tooltips = gtk.Tooltips() self.tb.set_style(gtk.TOOLBAR_ICONS) self.add_toolbutton_from_stock(gtk.STOCK_OPEN, 'Load', 'Load an EventTable from a file', 'Private', self.load_et) self.add_toolbutton_from_stock( gtk.STOCK_SAVE, 'Save', 'Save the EventTable back to the original file', 'Private', self.save_et, False) self.add_toolbutton_from_stock( gtk.STOCK_SAVE_AS, 'Save to', 'Save the EventTable to a file, choose new file', 'Private', self.save_et, True) self.tb.insert(gtk.SeparatorToolItem(), -1) self.add_toolbutton_eegpy("add_trigger_type", "Add type", "Add a new trigger type", 'Private', self.cb_add_trigger_type, None) self.add_toolbutton_eegpy("add_trigger", "Add trigger", "Add a new trigger", 'Private', self.cb_add_trigger, None) self.tb_box.pack_start(self.tb, expand=True) self.lb_fn = gtk.Label("New EventTable...") self.lb_fn.set_max_width_chars(50) self.lb_fn.set_justify(gtk.JUSTIFY_RIGHT) self.tb_box.pack_end(self.lb_fn, expand=False) #HBox für _keylist/triggerlist self.pane_kl = gtk.HPaned() self.vbox.pack_end(self.pane_kl) self.setup_trees() self._et = EventTable()