|
203 | 203 | # ignored; instead, only the explicitly passed projectors will be plotted. |
204 | 204 |
|
205 | 205 | ecg_proj_path = sample_dir / "sample_audvis_ecg-proj.fif" |
206 | | -eog_proj_path = sample_dir / "sample_audvis_eog-proj.fif" |
207 | | - |
208 | 206 | report = mne.Report(title="Projectors example") |
209 | 207 | report.add_projs(info=raw_path, title="Projs from info") |
210 | 208 | report.add_projs(info=raw_path, projs=ecg_proj_path, title="ECG projs from path") |
211 | | -report.add_projs(info=raw_path, projs=eog_proj_path, title="EOG projs from path") |
212 | 209 | report.save("report_projs.html", overwrite=True) |
213 | 210 |
|
214 | 211 | # %% |
|
289 | 286 |
|
290 | 287 | report = mne.Report(title="BEM example") |
291 | 288 | report.add_bem( |
292 | | - subject="sample", subjects_dir=subjects_dir, title="MRI & BEM", decim=20, width=256 |
| 289 | + subject="sample", |
| 290 | + subjects_dir=subjects_dir, |
| 291 | + title="MRI & BEM", |
| 292 | + decim=40, |
| 293 | + width=256, |
293 | 294 | ) |
294 | 295 | report.save("report_mri_and_bem.html", overwrite=True) |
295 | 296 |
|
|
452 | 453 |
|
453 | 454 | mne_logo_path = Path(mne.__file__).parent / "icons" / "mne_icon-cropped.png" |
454 | 455 | fig_array = plt.imread(mne_logo_path) |
455 | | -rotation_angles = np.linspace(start=0, stop=360, num=17) |
| 456 | +rotation_angles = np.linspace(start=0, stop=360, num=8, endpoint=False) |
456 | 457 |
|
457 | 458 | figs = [] |
458 | 459 | captions = [] |
|
462 | 463 | fig_array_rotated = fig_array_rotated.clip(min=0, max=1) |
463 | 464 |
|
464 | 465 | # Create the figure |
465 | | - fig, ax = plt.subplots() |
| 466 | + fig, ax = plt.subplots(figsize=(3, 3), constrained_layout=True) |
466 | 467 | ax.imshow(fig_array_rotated) |
467 | 468 | ax.set_axis_off() |
468 | 469 |
|
469 | 470 | # Store figure and caption |
470 | 471 | figs.append(fig) |
471 | 472 | captions.append(f"Rotation angle: {round(angle, 1)}°") |
472 | 473 |
|
473 | | -# can also be a MNEQtBrowser instance |
474 | | -with mne.viz.use_browser_backend("qt"): |
475 | | - figs.append(raw.plot()) |
476 | | -captions.append("... plus a raw data plot") |
477 | | - |
478 | 474 | report = mne.Report(title="Multiple figures example") |
479 | 475 | report.add_figure(fig=figs, title="Fun with figures! 🥳", caption=captions) |
480 | 476 | report.save("report_custom_figures.html", overwrite=True) |
481 | | -for fig in figs[:-1]: |
| 477 | +for fig in figs: |
482 | 478 | plt.close(fig) |
483 | | -figs[-1].close() |
484 | 479 | del figs |
485 | 480 |
|
486 | 481 | # %% |
|
517 | 512 |
|
518 | 513 | report = mne.Report(title="Tags example") |
519 | 514 | report.add_image( |
520 | | - image=mne_logo_path, title="MNE Logo", tags=("image", "mne", "logo", "open-source") |
| 515 | + image=mne_logo_path, |
| 516 | + title="MNE Logo", |
| 517 | + tags=("image", "mne", "logo", "open-source"), |
521 | 518 | ) |
522 | 519 | report.save("report_tags.html", overwrite=True) |
523 | 520 |
|
|
611 | 608 | report = mne.Report( |
612 | 609 | title="parse_folder example 3", subject="sample", subjects_dir=subjects_dir |
613 | 610 | ) |
614 | | -report.parse_folder(data_path=data_path, pattern="", mri_decim=25) |
| 611 | +report.parse_folder(data_path=data_path, pattern="", mri_decim=40) |
615 | 612 | report.save("report_parse_folder_mri_bem.html", overwrite=True) |
616 | 613 |
|
617 | 614 | # %% |
|
638 | 635 |
|
639 | 636 | baseline = (None, 0) |
640 | 637 | cov_fname = sample_dir / "sample_audvis-cov.fif" |
641 | | -pattern = "sample_audvis-no-filter-ave.fif" |
642 | | -evoked = mne.read_evokeds(sample_dir / pattern)[0] |
| 638 | +pattern = "sample_audvis-ave.fif" |
| 639 | +evoked = mne.read_evokeds(sample_dir / pattern)[0].pick("eeg").decimate(4) |
643 | 640 | report = mne.Report( |
644 | 641 | title="parse_folder example 4", baseline=baseline, cov_fname=cov_fname |
645 | 642 | ) |
|
650 | 647 | ) |
651 | 648 | report.save("report_parse_folder_evoked.html", overwrite=True) |
652 | 649 |
|
653 | | -# %% |
654 | | -# If you want to actually *view* the noise covariance in the report, make sure |
655 | | -# it is captured by the pattern passed to :meth:`~mne.Report.parse_folder`, and |
656 | | -# also include a source for an :class:`~mne.Info` object (any of the |
657 | | -# :class:`~mne.io.Raw`, :class:`~mne.Epochs` or :class:`~mne.Evoked` |
658 | | -# :file:`.fif` files that contain subject data also contain the measurement |
659 | | -# information and should work): |
660 | | - |
661 | | -pattern = "sample_audvis-cov.fif" |
662 | | -info_fname = sample_dir / "sample_audvis-ave.fif" |
663 | | -report = mne.Report(title="parse_folder example 5", info_fname=info_fname) |
664 | | -report.parse_folder( |
665 | | - data_path, pattern=pattern, render_bem=False, n_time_points_evokeds=5 |
666 | | -) |
667 | | -report.save("report_parse_folder_cov.html", overwrite=True) |
668 | | - |
669 | 650 | # %% |
670 | 651 | # |
671 | 652 | # Adding custom HTML (e.g., a description text) |
|
0 commit comments