def plot(self, data): self.subplot.clear() self.last_plots = data wmin = self.parent.min_slider.get() wmax = self.parent.max_slider.get() for datum in data: datum.min = VEPdata.min_from_window(datum.signal, lower=wmin, upper=wmax) datum.max = VEPdata.max_from_window(datum.signal, lower=datum.min[0], upper=wmax) datum.amplitude = datum.max[1] - datum.min[1] #plt.plot(stim.signal) self.subplot.plot(datum.min[0], datum.min[1], marker='+', mew=5, ms=20, color='green') self.subplot.plot(datum.max[0], datum.max[1], marker='+', mew=5, ms=20, color='red') self.subplot.plot(datum.signal) self.canvas.draw()
def add_files(self, files): for fn in files: if fn[-4:] == ".csv": VEPdata.open_file(fn, int(self.parent.trigger_type_var.get())) self.file_list.delete(0, tk.END) for key in VEPdata.experiments: self.file_list.insert(tk.END, key)
def on_save(self): fn = tkFileDialog.asksaveasfilename(filetypes = [('pickle','.p')]) if fn is not None: to_save = {VEPdata.experiments[exp].short_name:{"raw signal":VEPdata.experiments[exp].signal, "bin timestamps":VEPdata.experiments[exp].bin_timestamps, "csv timestamps":VEPdata.experiments[exp].csv_timestamps, "timestamp signal":VEPdata.experiments[exp].timing, "stims":VEPdata.get_amplitude_data(VEPdata.experiments[exp].root)} for exp in VEPdata.experiments} VEPdata.save(fn, to_save)
def add_files(self, files): for fn in files: if fn[-4:] == ".csv": if int(self.parent.use_manual_length.get()) == 1: VEPdata.open_file(fn, int(self.parent.trigger_type_var.get()),int(self.parent.stim_length_slider.get())) else: VEPdata.open_file(fn, int(self.parent.trigger_type_var.get())) self.file_list.delete(0, tk.END) for key in VEPdata.experiments: self.file_list.insert(tk.END, key)
def combine_selected(self): w = self.windows["Experiments"] if self.view == "file": return elif self.view == "type": highlight = w.get_selection(w.type_list) elif self.view == "stim": highlight = w.get_selection(w.stim_list) else: return combined = VEPdata.combine([VEPdata.names[name] for name in highlight]) self.windows["Graph"].plot([combined])
def on_save(self): fn = tkFileDialog.asksaveasfilename(filetypes=[('pickle', '.p')]) if fn is not None: VEPdata.save(fn, VEPdata.experiments)