bnicenboim / eeguana

A package for manipulating EEG data in R.
https://bnicenboim.github.io/eeguana/
Other
21 stars 9 forks source link

Allow manually choosing the event channel to use (experimental) #144

Closed a-hurst closed 2 years ago

a-hurst commented 3 years ago

Okay, rebased my previous PR on the experimental branch! Thankfully there weren't any merge conflicts.

bnicenboim commented 3 years ago

Continuing the conversation here.

a-hurst commented 3 years ago

1) Cool, I'll give it a shot!

2) Kind of, I had to hack together a pure-Python EDF+ exporter based on pyedf because the C-based pyEDFlib wouldn't export my data from MNE properly. I should be able to generate you a small test file for eeguana using it!

3) The big thing here I can't do yet in R is the PREP pipeline, which automatically and reproducibly a) removes line noise without applying a notch filter, using a sliding-window algorithm, b) performs robust average re-referencing on the data using a RANSAC-based algorithm to detect and ignore noisy/otherwise "bad" channels while calculating an average reference, and c) optionally reinterpolates channels still flagged as "bad" after referencing using data from the non-bad electrodes and a 3D spatial model of the good electrode locations. There's a WIP Python-based version by one of the MNE mantainers here which is what I'm using.

Theoretically all of 3) is possible in R, but I don't understand the inner workings of the pipeline well enough that I could imagine re-implementing any of it in R in any reasonable timeframe myself so I'm running it in Python and that passing it over to R using EDF as a go-between.

bnicenboim commented 3 years ago

ok, I'm adding the PREP pipeline as an issue. I'll have an intern next year that might be able to give it a shot.

Regarding 2, if you do the MNE pipeline in a shared environment using reticulate, you might be able to transform the object into eeglist by using as_eeg_lst(python_obj). I have tried it after opening a file with brain vision in MNE, and it works. It might work also for EDF+, but I'm not sure to which extent.