def report_erps(self, evoked: mne.Evoked, erp_name: str): # set report and condition name name_info = erp_name.split('_') report_name = name_info[-1] report_name = self.folder_tracker(['erp', self.header], f'report_{report_name}.h5') cnd_name = '_'.join(map(str, name_info[:-1])) # check whether report exists if os.path.isfile(report_name): with mne.open_report(report_name) as report: # if section exists delete it first report.remove(title=cnd_name) report.add_evokeds(evokeds=evoked, titles=cnd_name, n_time_points=21) report.save(report_name.rsplit(".", 1)[0] + '.html', overwrite=True) else: report = mne.Report(title='Single subject evoked overview') report.add_evokeds(evokeds=evoked, titles=cnd_name, n_time_points=21) report.save(report_name) report.save(report_name.rsplit(".", 1)[0] + '.html')
ics = len(fig_numbers) - 5 for fig in range(1, 1 + ics): globals()['ic' + str(fig)] = pyplot.figure(fig + 3) # because we have 3 other plots before ICA plots freq_after = pyplot.figure(len(fig_numbers)) all_comps = pyplot.figure(len(fig_numbers) - 1) path_report = data_deriv_dir / os.path.join('sub-' + str(subjects[i]) + '/', 'ses-' + str(sessions[i]) + '/', 'meg/') report = mne.Report(verbose=True) report.parse_folder(path_report, pattern='*.fif', render_bem=False) report.save(str(os.path.join(path_report, 'report.h5')), overwrite=True, open_browser=False) with mne.open_report(str(os.path.join(path_report, 'report.h5'))) as report: report.add_figs_to_section(freq_before, section='Power Spectrum Density', captions='Before filtering', replace=True) report.save(str(os.path.join(path_report, 'report.h5')), overwrite=True) with mne.open_report(str(os.path.join(path_report, 'report.h5'))) as report: report.add_figs_to_section(freq_after, section='Power Spectrum Density', captions='After filtering', replace=True) report.save(str(os.path.join(path_report, 'report.h5')), overwrite=True) with mne.open_report(str(os.path.join(path_report, 'report.h5'))) as report: report.add_figs_to_section(bad_ch,