Improve drawing of annotations with matplotlib#11855
Improve drawing of annotations with matplotlib#11855larsoner merged 19 commits intomne-tools:mainfrom
Conversation
| Let's not bother in figuring out on which sample the _fake_click actually | ||
| dropped the annotation, especially with the 600.614 Hz weird sampling rate. | ||
| -> atol = 10 / raw.info["sfreq"] |
There was a problem hiding this comment.
If you have a better idea to get that test working, I'm listening. In mne-tools/mne-qt-browser#178, it failed the Ubuntu and Windows CIs (link) with atol = 2 / raw.info["sfreq"]. Locally, on an ubuntu-based distro it was passing..
It looks to me like the _fake_click location is not very precise. I tried changing the onset/duration/click locations with values corresponding to an exact sample, without luck. For instance, I tried to click on the right edge of an annotation and it was working.. within +/- 15 samples of the actual edge location.
There was a problem hiding this comment.
It looks to me like the _fake_click location is not very precise
Yes it's possible and I think it's okay to have a loose tolerance. As long as it's strict enough to catch if we broke things it should be fine. We can always improve the tolerance later
|
In this PR:
I did not add a "Draggable" behavior for annotations to the MPL backend. It looks to me like a lot of work and would require something similar to the I will re-raise the 2 other bugs (traceback yielded when adding labels + wrapping around when exiting the main ax area) in other issues. I don't know how to fix them at this time, and neither is blocking for this PR. |
|
And CIs should be failing here due to the added test which can not pass without mne-tools/mne-qt-browser#178 |
larsoner
left a comment
There was a problem hiding this comment.
@drammock I'll let you merge if happy
@mscheltienne just double-checking -- the top comment has this un-checked box:
Fix wrapping of annotations around when you exit the view/plot area. The issue is present both with or without blitting, but it's emphasized with blitting.
Should we wait to merge or is it good to go from your end?
|
I have no clue how to fix it for now, so I will re-raise it in a separate issue to keep track. But it's not blocking at the moment. Good to merge on my end. |
|
the macOS ARM failure looks vaguely related (to other recent PRs at least): is it an issue of the CI config not using the right version of mne-qt-browser? |
|
Yes, it's not running We could mark the test as xfail for qt-browser version below 0.5.3. |
let's do that... I don't know how long it will take for #11859 to resolve and I don't want Cirrus failure on every PR between now and then. |
That PR is very close to done... but even then it would be good to have that |
|
@drammock should come back green now 🤞 |
|
Thank you @larsoner for the CIs fixes! |
drammock
left a comment
There was a problem hiding this comment.
the test is not very DRY but I'm not sure it would actually be easier to follow if it were DRY. +1 for merge after 1 tiny wording change to the xfail message
|
Will commit suggestion and merge |
Co-authored-by: Daniel McCloy <dan@mccloy.info>
* upstream/main: Refactor test_epochs.py::test_split_saving (1 out of 2) (mne-tools#11880) FIX: Missing Saccade information in Eyelink File (mne-tools#11877) Improve drawing of annotations with matplotlib (mne-tools#11855) MAINT: Work around NumPy deprecation (mne-tools#11878)
* upstream/main: [pre-commit.ci] pre-commit autoupdate (mne-tools#11911) [BUG, MRG] Remove check on `mne.viz.Brain.add_volume_labels` (mne-tools#11889) Small splits fix (mne-tools#11905) adds niseq package to "Related software" (mne-tools#11909) Minor fixes for ERDS maps example (mne-tools#11904) FIX: Fix pyvista rendering (mne-tools#11896) BUG: Fix epoch splits naming (mne-tools#11876) ENH: Use section-title for HTML anchors in Report (mne-tools#11890) CI: Deploy [circle deploy] MAINT: Clean up whats_new and doc versions (mne-tools#11888) Refactor test_epochs.py::test_split_saving (2 out of 2) (mne-tools#11884) Cross-figure event passing system (mne-tools#11685) MAINT: Post-release deprecations, updates [circle deploy] (mne-tools#11887) MAINT: Release 1.5.0 (mne-tools#11886) [pre-commit.ci] pre-commit autoupdate (mne-tools#11883) Refactor test_epochs.py::test_split_saving (1 out of 2) (mne-tools#11880) FIX: Missing Saccade information in Eyelink File (mne-tools#11877) Improve drawing of annotations with matplotlib (mne-tools#11855) MAINT: Work around NumPy deprecation (mne-tools#11878)
Looks like I'm going again for an intertwined PR with mne-tools/mne-qt-browser#178 😟
Changes:
useblit=Falseanymore. Maybe fixed upstream? The improvement is drastic.On the screencast, I move my mouse on the channel scrollbar on the right, which yields this bug.
Screencast.from.08-02-2023.11.20.31.AM.webm
mne.inst.annotationsand doesn't support changing both boundaries at once.buttonswas set to None, and thus it doesn't have the attributelabels.EDIT:
Might be related to matplotlib/matplotlib#21569
Screencast.from.08-02-2023.01.13.29.PM.webm