-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
MRG: Omit annotations in raw butterfly plots in Report #10114
Conversation
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)
mne/report/report.py
Outdated
self, *, raw: BaseRaw, image_format, tags | ||
): | ||
orig_annotations = raw.annotations.copy() | ||
raw.set_annotations(None) |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.)
There was a problem hiding this comment.
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....
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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 :))
thx @hoechenberger merge when green @hoechenberger 🙏 |
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:
cc @agramfort