I can reproduce this plot. HOWEVER when I start scrolling left and right in the viz browser, the traces for xpos_right and ypos_right disappear around annotation events. Even when scrolling back to exact same position as before, the traces are gone.
Thanks for looking at the tutorial and for raising this! It makes me feel better having more devs look at the eye-tracking stuff we’ve built so far.
As @mscheltienne mentioned, For me, the issue where the NaN’s cause the traces to disappear only occurs when using mne-qt-browser. If I use the matplotlib browser, I can’ replicate the issue:
I wonder if this has something to do with a filter being applied to the plotted data (and the Nans causing issues with the filter)?
More generally, I was speaking with @drammock and @britta-wstnr on Friday about the issue of NaN’s in eye-tracking data. Correct me if I’m wrong but it seems to me that up until now, MNE has been able to expect that incoming data is dense (no missing values). Having NaN’s in the data causes issues in a number of MNE functions (filtering, resamping, etc).
I was tasked with opening a ticket about this (which I still need to do!), so that the devs can weigh in on the best path forward. I was also hoping to share an example file with this issue during the next MNE office hours, to demonstrate the issue.
In the end barely had time to look for now, but if you do raw.plot(scalings=custom_scalings, precompute=False) it works. That should already narrow down the issue.
I wonder if we should eventually add some code to prevent the DC-offset adjustment from being applied to eye-track channels? I don’t think it applies here. If you all agree I can open a ticket and take a look into it.
I was thinking about it yesterday, should we actually remove DC-offset from non voltage-based channels (extending beyong eye-tracking)? I convinced myself that it was safe to do in all cases since it would not alter the waveform shape.
But I’m questionning this again as eye-tracking position, if e.g. in pixels, should retain the orignal values; else DC removal is synonym of silently changing the origin location. And I wonder if the same logic applies to other channels types which should not have their mean removed prior to plotting.
On the otherhand, I would not be surprised if the y-range defined for plotting is centered around 0 and that plotting non centered data would end up creating issues, e.g. clipping or data outside the y-range.
I don’t think eye tracking data like gaze should be “DC offset corrected”.
BTW, should we move this conversation over to a GitHub issue so we can more easily find it in the future in case we want to look back at some point?