-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Description
I have a couple of issues here but bunching them together as they seem related.
1. EDF reader should work with preload=False
If I do:
import mne
from mne.datasets import eegbci
edf_path = eegbci.load_data(subject=1, runs=2)[0]
raw = mne.io.read_raw_edf(edf_path, preload=False)I get
RuntimeError: EDF+ Annotations (TAL) channel needs to be parsed completely on loading. You must set preload parameter to True.However, I can actually do:
import mne
from mne.datasets import eegbci
from mne.io.edf.edf import read_annotations_edf
edf_path = eegbci.load_data(subject=1, runs=2)[0]
raw = mne.io.read_raw_edf(edf_path, preload=False, stim_channel=None)
annot = read_annotations_edf(edf_path)
raw.set_annotations(annot)and it gives me the same result as:
raw2 = mne.io.read_raw_edf(edf_path, preload=True)
assert raw.annotations.duration[0] == raw2.annotations.duration[0]So, it seems to me that it should already be possible to load EDF files with preload=False as all the necessary components already exist.
2. find_edf_events and mne.events_from_annotations don't give same results
Here is the code to reproduce (continuing from code above):
events, event_id = mne.events_from_annotations(raw)
events2 = raw.find_edf_events()
print(events)
print(events2)3. namespaces of read_annotations_xxx
I have to do:
from mne import read_annotations # for fif files
from mne.io import read_annotations_brainvision # for brainvision
from mne.io import read_annotations_eeglab # for eeglab
from mne.io.edf.edf import read_annotations_edf # for edfThis is quite confusing. In fact, I don't see a good rational for having different functions as all these different file formats (debatable) since all you need is a filename for most of these readers. So you should be able to triage based on the extension. In any case, having them in the same namespace would already be a start ! (and maybe read_annotations -> read_annotations_fif ?)
4. documentation issues
read_annotations_edf says I need a .vmrk file. This looks incorrect, right?
Happy to help out with these after the mne-bids release. If someone else has time to work before (@massich ?), I am happy to review the code :)