def save(experiment, data, window): """ Saves averages or channels to csv from selected item from all subjects """ try: selected_name = data['outputs']['evoked'][0] except IndexError as exc: return # validate times time_arrays = [] for subject in experiment.subjects.values(): evoked = subject.evoked.get(selected_name) if not evoked: continue for mne_evoked in evoked.content.values(): time_arrays.append(mne_evoked.times) assert_arrays_same(time_arrays) def handler(selected_option): try: if selected_option == 'channel_averages': save_channel_averages(experiment, selected_name) else: save_all_channels(experiment, selected_name) except Exception as exc: exc_messagebox(window, exc) dialog = OutputOptions(window, handler=handler) dialog.show()
def run(self): try: selected_name = self.data['outputs']['spectrum'][0] except IndexError as exc: return # validate freqs freq_arrays = [] for subject in self.experiment.subjects.values(): spectrum = subject.spectrum.get(selected_name) if not spectrum: continue freq_arrays.append(spectrum.freqs) assert_arrays_same(freq_arrays, 'Freqs do not match') def option_handler(selected_option): params = { 'name': selected_name, 'output_option': selected_option, 'channel_groups': self.experiment.channel_groups } try: self.handler(self.experiment.active_subject, params) except Exception as exc: exc_messagebox(self.window, exc) dialog = OutputOptions(self.window, handler=option_handler) dialog.show()
def run(self): try: selected_name = self.data['outputs']['evoked'][0] except IndexError as exc: return # validate times time_arrays = [] for subject in self.experiment.subjects.values(): evoked = subject.evoked.get(selected_name) if not evoked: continue for mne_evoked in evoked.content.values(): time_arrays.append(mne_evoked.times) assert_arrays_same(time_arrays, 'Times do not match') def option_handler(selected_option): params = { 'name': selected_name, 'output_option': selected_option, 'channel_groups': self.experiment.channel_groups } try: self.handler(self.experiment.active_subject, params) except Exception as exc: exc_messagebox(self.window, exc) dialog = OutputOptions(self.window, handler=option_handler) dialog.show()
def save(experiment, data, window): """ Saves all channels or averages to csv from selected item from all subjects """ try: selected_name = data['outputs']['spectrum'][0] except IndexError as exc: return # validate freqs freq_arrays = [] for subject in experiment.subjects.values(): spectrum = subject.spectrum.get(selected_name) if not spectrum: continue freq_arrays.append(spectrum.freqs) assert_arrays_same(freq_arrays, 'Freqs do not match') def handler(selected_option): try: if selected_option == 'channel_averages': save_channel_averages(experiment, selected_name) else: save_all_channels(experiment, selected_name) except Exception as exc: exc_messagebox(window, exc) dialog = OutputOptions(window, handler=handler) dialog.show()
def run(self): try: selected_name = self.data['outputs']['evoked'][0] except IndexError as exc: return def option_handler(selected_option): params = {'name': selected_name, 'output_option': selected_option, 'channel_groups': self.experiment.channel_groups} try: self.handler(self.experiment.active_subject, params) except Exception as exc: exc_messagebox(self.window, exc) dialog = OutputOptions(self.window, handler=option_handler) dialog.show()
def plot_spectrum(experiment, data, window): """ Plots spectrum topography or averages of selected item """ try: selected_name = data['outputs']['spectrum'][0] except IndexError as exc: return def handler(selected_option): try: if selected_option == 'channel_averages': plot_spectrum_averages(experiment, selected_name) else: plot_spectrum_topo(experiment, selected_name) except Exception as exc: exc_messagebox(window, exc) dialog = OutputOptions(window, handler=handler) dialog.show()
def plot_evoked(experiment, data, window): """ Plots topo or averages of selected item """ try: selected_name = data['outputs']['evoked'][0] except IndexError as exc: return subject = experiment.active_subject evoked = subject.evoked.get(selected_name) def handler(selected_option): try: if selected_option == 'channel_averages': _plot_evoked_averages(experiment, evoked) else: _plot_evoked_topo(experiment, evoked) except Exception as exc: exc_messagebox(window, exc) dialog = OutputOptions(window, handler=handler) dialog.show()