Skip to content

Commit 7fa51b7

Browse files
larsonersnwnde
authored andcommitted
MAINT: Speed up doc build (mne-tools#12040)
1 parent 8dfc167 commit 7fa51b7

File tree

3 files changed

+18
-41
lines changed

3 files changed

+18
-41
lines changed

examples/inverse/dics_epochs.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
events = mne.find_events(raw)
4646
epochs = mne.Epochs(
4747
raw,
48-
events,
48+
events[:22], # just for execution speed of the tutorial
4949
event_id=1,
5050
tmin=-1,
5151
tmax=2.5,
@@ -56,7 +56,6 @@
5656
),
5757
preload=True,
5858
)
59-
epochs = epochs[:10] # just for speed of execution for the tutorial
6059

6160
# We are mostly interested in the beta band since it has been shown to be
6261
# active for somatosensory stimulation
@@ -121,7 +120,7 @@
121120
subjects_dir=subjects_dir,
122121
hemi="both",
123122
views="dorsal",
124-
initial_time=0.55,
123+
initial_time=1.2,
125124
brain_kwargs=dict(show=False),
126125
add_data_kwargs=dict(
127126
fmin=fmax / 10,
@@ -131,7 +130,3 @@
131130
colorbar_kwargs=dict(label_font_size=10),
132131
),
133132
)
134-
135-
# You can save a movie like the one on our documentation website with:
136-
# brain.save_movie(tmin=0.55, tmax=1.5, interpolation='linear',
137-
# time_viewer=True)

tutorials/intro/70_report.py

Lines changed: 14 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -203,12 +203,9 @@
203203
# ignored; instead, only the explicitly passed projectors will be plotted.
204204

205205
ecg_proj_path = sample_dir / "sample_audvis_ecg-proj.fif"
206-
eog_proj_path = sample_dir / "sample_audvis_eog-proj.fif"
207-
208206
report = mne.Report(title="Projectors example")
209207
report.add_projs(info=raw_path, title="Projs from info")
210208
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")
212209
report.save("report_projs.html", overwrite=True)
213210

214211
# %%
@@ -289,7 +286,11 @@
289286

290287
report = mne.Report(title="BEM example")
291288
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,
293294
)
294295
report.save("report_mri_and_bem.html", overwrite=True)
295296

@@ -452,7 +453,7 @@
452453

453454
mne_logo_path = Path(mne.__file__).parent / "icons" / "mne_icon-cropped.png"
454455
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)
456457

457458
figs = []
458459
captions = []
@@ -462,25 +463,19 @@
462463
fig_array_rotated = fig_array_rotated.clip(min=0, max=1)
463464

464465
# Create the figure
465-
fig, ax = plt.subplots()
466+
fig, ax = plt.subplots(figsize=(3, 3), constrained_layout=True)
466467
ax.imshow(fig_array_rotated)
467468
ax.set_axis_off()
468469

469470
# Store figure and caption
470471
figs.append(fig)
471472
captions.append(f"Rotation angle: {round(angle, 1)}°")
472473

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-
478474
report = mne.Report(title="Multiple figures example")
479475
report.add_figure(fig=figs, title="Fun with figures! 🥳", caption=captions)
480476
report.save("report_custom_figures.html", overwrite=True)
481-
for fig in figs[:-1]:
477+
for fig in figs:
482478
plt.close(fig)
483-
figs[-1].close()
484479
del figs
485480

486481
# %%
@@ -517,7 +512,9 @@
517512

518513
report = mne.Report(title="Tags example")
519514
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"),
521518
)
522519
report.save("report_tags.html", overwrite=True)
523520

@@ -611,7 +608,7 @@
611608
report = mne.Report(
612609
title="parse_folder example 3", subject="sample", subjects_dir=subjects_dir
613610
)
614-
report.parse_folder(data_path=data_path, pattern="", mri_decim=25)
611+
report.parse_folder(data_path=data_path, pattern="", mri_decim=40)
615612
report.save("report_parse_folder_mri_bem.html", overwrite=True)
616613

617614
# %%
@@ -638,8 +635,8 @@
638635

639636
baseline = (None, 0)
640637
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)
643640
report = mne.Report(
644641
title="parse_folder example 4", baseline=baseline, cov_fname=cov_fname
645642
)
@@ -650,22 +647,6 @@
650647
)
651648
report.save("report_parse_folder_evoked.html", overwrite=True)
652649

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-
669650
# %%
670651
#
671652
# Adding custom HTML (e.g., a description text)

tutorials/stats-sensor-space/75_cluster_ftest_spatiotemporal.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858

5959
# Setup for reading the raw data
6060
raw = mne.io.read_raw_fif(raw_fname, preload=True)
61-
raw.filter(1, 30)
61+
raw.filter(1, 25)
6262
events = mne.read_events(event_fname)
6363

6464
# %%
@@ -75,6 +75,7 @@
7575
tmin,
7676
tmax,
7777
picks=picks,
78+
decim=2, # just for speed!
7879
baseline=None,
7980
reject=reject,
8081
preload=True,

0 commit comments

Comments
 (0)