-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
ENH: adds annotation filtering to raw and ica source figures #13460
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
Conversation
6838c27 to
fe96e58
Compare
|
It looks like my attempts at referencing functions in the doc change is what is causing the build to fail: /home/circleci/project/doc/<rst_prolog>:55: WARNING: py:obj reference target not found: annotation_regex [ref.obj]
/home/circleci/project/doc/<rst_prolog>:55: WARNING: py:func reference target not found: mne.viz.raw.plot_raw [ref.func]
/home/circleci/project/doc/<rst_prolog>:55: WARNING: py:func reference target not found: mne.viz.ica.plot_sources [ref.func]
Exited with code exit status 1any suggestion on how to fix this would be greatly appreciated. Thank you again for your patience! |
doc/changes/dev/13460.newfeature.rst
Outdated
| @@ -0,0 +1 @@ | |||
| Added `annotation_regex` parameter to :func:`mne.viz.raw.plot_raw` and :func:`mne.viz.ica.plot_sources`, automatically hiding annotations not matching the regex, by `Johannes Herforth`_. | |||
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.
@DerAndereJohannes To fix the docs failing to build:
- Double ticks `` should be used to render
annotation_regexas code. With single ticks, sphinx will treat this as an object it needs to find a link for. - The function names you want to link to are
mne.viz.plot_rawandmne.viz.plot_ica_sources.
It might also be worth adding a link to the methods mne.io.Raw.plot and mne.preprocessing.ICA.plot_sources where the new parameter is also supported. Just keep in mind that these require the :meth: tag.
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.
Thank you for the help and explaining the functionality around sphinx! I really appreciate it. I have made the changes and added your recommendation to the file.
fe96e58 to
e0af307
Compare
larsoner
left a comment
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.
@tsbinns feel free to merge if you're happy
The changelog entry CI is failing for unrelated reasons, something with our TOML being problematic now
|
@larsoner I don't have those permissions for the main repo, just mne-connectivity. |
Now you should! |
|
Forgot to say earlier, but thanks @DerAndereJohannes! |
* upstream/main: (230 commits) FIX: Fix ICA.apply when fitted including marked bad channels (mne-tools#13478) FIX: Correctly set the calibration factor in Nihon Kohden reader (mne-tools#13468) [pre-commit.ci] pre-commit autoupdate (mne-tools#13479) MAINT: Update code credit (mne-tools#13477) Fix `versionadded` directive formatting (mne-tools#13471) typo in mailmap (mne-tools#13475) FIX: Fix _plot_topomap channel names plotting when using a mask (mne-tools#13470) FIX: Handle an Eyelink File with blank lines injected throughout file (mne-tools#13469) ENH: adds annotation filtering to raw and ica source figures (mne-tools#13460) MAINT: Restore VTK nightly wheel on Linux and bump changelog checker (mne-tools#13436) [pre-commit.ci] pre-commit autoupdate (mne-tools#13465) FIX: Fix add_reference_channels for passing two channels names (mne-tools#13466) ENH: Add on_missing for combine_channels (mne-tools#13463) Bump the actions group with 2 updates (mne-tools#13464) Move development dependencies into a dependency group (no more extra) (mne-tools#13452) ENH: add on_missing for rename_channels (mne-tools#13456) add advisory board to website (mne-tools#13462) ENH: Support Nihon Kohden EEG-1200A V01.00 (mne-tools#13448) MAINT: Update dependency specifiers (mne-tools#13459) ENH: Add encoding parameter to Nihon Kohden reader (mne-tools#13458) ...
* upstream/main: (85 commits) FIX: Fix ICA.apply when fitted including marked bad channels (mne-tools#13478) FIX: Correctly set the calibration factor in Nihon Kohden reader (mne-tools#13468) [pre-commit.ci] pre-commit autoupdate (mne-tools#13479) MAINT: Update code credit (mne-tools#13477) Fix `versionadded` directive formatting (mne-tools#13471) typo in mailmap (mne-tools#13475) FIX: Fix _plot_topomap channel names plotting when using a mask (mne-tools#13470) FIX: Handle an Eyelink File with blank lines injected throughout file (mne-tools#13469) ENH: adds annotation filtering to raw and ica source figures (mne-tools#13460) MAINT: Restore VTK nightly wheel on Linux and bump changelog checker (mne-tools#13436) [pre-commit.ci] pre-commit autoupdate (mne-tools#13465) FIX: Fix add_reference_channels for passing two channels names (mne-tools#13466) ENH: Add on_missing for combine_channels (mne-tools#13463) Bump the actions group with 2 updates (mne-tools#13464) Move development dependencies into a dependency group (no more extra) (mne-tools#13452) ENH: add on_missing for rename_channels (mne-tools#13456) add advisory board to website (mne-tools#13462) ENH: Support Nihon Kohden EEG-1200A V01.00 (mne-tools#13448) MAINT: Update dependency specifiers (mne-tools#13459) ENH: Add encoding parameter to Nihon Kohden reader (mne-tools#13458) ...
This pull request is a correction to the pull request #13425 where I accidently messed up the merge. I felt it was more simple to just open a new one.
Below is the copy/paste of the initial description that I had:
Reference issue
Looking to solve issue #13325. Thank you to @larsoner for allowing me to go ahead with this enhancement.
What does this implement/fix?
This feature looks to add a convenience parameter in the plot function to automatically hide annotation labels that we are currently not interested in. For example, if we have a dataset that uses the ECG R peak as a response, this might make the stimulus triggers more difficult to see and slows down moving around the dataset due to additional computational cost.
To mitigate this, this pull request looks at adding a
annotation_regexparameter which takes a regex as input and includes any matching annotation label in the view and hides the rest (default.*for all annotations).The current version of this feature changes the current
fig.mne.visible_annotationsvariable from setting True to everything, to setting True to only those annotation labels that fit theannotation_regexparameter.This was the most logical place to put it as it deals with the initialization of
fig.mne.visible_annotations, works with both qt and matplotlib backends and does not change the behaviour of the actual browser when you use it.Additional information
I have set this pull request to be a draft, as I have just implemented the bare minimum to create the feature to see if where I am editing the code is implemented well. There is currently no documentation (Though this would be a quick add).
Example Code using the new feature
Example Images
All Triggers in a Matplotlib Browser
Triggers with Parameter
annotation_regex="^Stimulus"in a Matplotlib BrowserTriggers with Parameter
annotation_regex="^Stimulus"in a QT BrowserLet me know if I can supply anything else or if I am ok to add the documentation regarding the current code and change this to an actual pull request.
Thanks in advance!
closes #13325