Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MRG: Omit annotations in raw butterfly plots in Report #10114

Merged
merged 4 commits into from
Dec 9, 2021

Conversation

hoechenberger
Copy link
Member

@hoechenberger hoechenberger commented Dec 8, 2021

This drastically reduced butterfly plotting for me locally with a test dataset (8 runs of MEG), by more than 35%
(145 seconds instead of 227)

Should only go in after #10109 has been merged.

x-ref #10107

Todo:

  • Add changelog entry

cc @agramfort

This drastically reduced butterfly plotting for me locally with a
test dataset (8 runs of MEG), by more than 35%
(145 seconds instead of 227)
self, *, raw: BaseRaw, image_format, tags
):
orig_annotations = raw.annotations.copy()
raw.set_annotations(None)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since raw can be passed directly rather than via filename, this should really be wrapped in a try/finally (or equivalently, a @contextmanager) that ensures that, no matter what, raw.set_annotations(orig_annotations gets called

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(like if there is an error with plotting, or the user presses ctrl-C during plotting, etc.)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the cleanest approach would be to add a new kwarg to plot_raw, but the signature is already so massive....

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be tricky there because of interactive plotting mode. I would assume YAGNI on that

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've decided to go with try/except for now. LMK if you'd prefer a context manager instead (I felt it was a bit overkill but I'm open to revise this judgment :))

@hoechenberger hoechenberger marked this pull request as ready for review December 9, 2021 09:48
@hoechenberger hoechenberger changed the title Omit annotations in raw butterfly plots in Report MRG: Omit annotations in raw butterfly plots in Report Dec 9, 2021
@agramfort
Copy link
Member

thx @hoechenberger

merge when green @hoechenberger

🙏

@hoechenberger hoechenberger merged commit 4faf87f into mne-tools:main Dec 9, 2021
@hoechenberger hoechenberger deleted the report-butterfly-speed branch December 9, 2021 10:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants