-
Notifications
You must be signed in to change notification settings - Fork 70
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
XDF reading: merging streams via resampling impacts channels that contain NaN #471
Comments
Maybe some domain-specific preprocessing could be an option? Would using the last value instead of NaN make sense? I think some sort of interpolation will be necessary before resampling. |
Yes, a current solution is to read each stream separately into mne Raw objects (via mnelab), then do the processing, then resample and crop the raw objects, and finally call Perhaps this is the only sensible way to avoid unnecessarily blowing up the reading code here with an edge case 🤔 |
I mean, if this is a common operation for eyetracking streams it might be worth including it as an option. If it's really an edge case, not so much. Can you provide more details on how you actually "do the processing" for these kinds of signals? How do you get rid of the NaNs? |
Yes, unlike in EEG or other time series, NaN values are to be expected in eye tracking, because when the tracker loses the eyes (e.g., due to a blink), a NaN value gets assigned.
I thought the edge case here is probably having two separate eye-tracking streams that need to be merged. Most people will only have one eye-tracking stream, and will thus only have to resample if they want to combine it with another stream. But then again, many users MIGHT want to combine their eye-tracking and EEG streams. So perhaps this is all just a valid case.
For now, I want to keep the NaNs in my mne raw object, because I eventually want to interpolate these values with dedicated functions, see also: I am currently:
☝️ I am not happy with this and will need to revise this in the future. |
mnelab.io.xdf.read_raw_xdf
I suspect this is due to the resampling done here:
mnelab/src/mnelab/io/xdf.py
Line 149 in 4bbadaa
See this proof of principle:
I don't really have an idea how to prevent this. Would masking NaNs with "placeholder values" prior to resampling be an option? and then converting them back to NaN after resampling?
The text was updated successfully, but these errors were encountered: