# Read edf and exclude annotations

**URL:** <https://mne.discourse.group/t/read-edf-and-exclude-annotations/3192>\
**Category:** Support & Discussions\
**Tags:** eeg\
**Created:** [May 31, 2021, 7:07pm UTC](https://mne.discourse.group/t/read-edf-and-exclude-annotations/3192 "2021-05-31T19:07:27Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![sportnoah14](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/sportnoah14/32/542_2.png) [@sportnoah14](https://mne.discourse.group/u/sportnoah14)\
**Post date:** [May 31, 2021, 7:07pm UTC](https://mne.discourse.group/t/read-edf-and-exclude-annotations/3192/1 "2021-05-31T19:07:27Z")

</div>

Hi all,

I’m reading in a large edf file that contains many annotations (a 24hr clinical recording). Unfortunately parsing the annotations takes a long long time (about 1.5hrs). I’ve tried excluding annotations from being read by using `read_raw_edf('my_edf_file.edf',exclude=['EDF Annotations'])` but that doesn’t work. This makes it very time-consuming to just open a file. Is there any way I can stop the EDF+ annotations from being parsed? Any help is greatly appreciated.

Noah

---

<div class="post-metadata">

**Author:** ![agramfort](https://avatars.discourse-cdn.com/v4/letter/a/7c8e57/32.png) [@agramfort](https://mne.discourse.group/u/agramfort)\
**Post date:** [May 31, 2021, 7:24pm UTC](https://mne.discourse.group/t/read-edf-and-exclude-annotations/3192/2 "2021-05-31T19:24:11Z")

</div>

so it’s this line

[https://github.com/mne-tools/mne-python/blob/main/mne/io/edf/edf.py#L134](https://github.com/mne-tools/mne-python/blob/main/mne/io/edf/edf.py#L134)

that takes ages?

can you try to call

mne.read\_annotations on this file? is it also slow?

Alex

---

<div class="post-metadata">

**Author:** ![sportnoah14](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/sportnoah14/32/542_2.png) [@sportnoah14](https://mne.discourse.group/u/sportnoah14)\
**Post date:** [June 1, 2021, 12:22am UTC](https://mne.discourse.group/t/read-edf-and-exclude-annotations/3192/3 "2021-06-01T00:22:36Z")

</div>

I ran that and yes it’s slow. It actually crashed because it was too much memory. Before when I read the edf with `read_raw_edf()` it omitted 4 annotations possibly due to the size but it still loaded them. But `read_annotations()` just crashed and didn’t return anything. Any thoughts?

Thanks for the help,

Noah

---

<div class="post-metadata">

**Author:** ![agramfort](https://avatars.discourse-cdn.com/v4/letter/a/7c8e57/32.png) [@agramfort](https://mne.discourse.group/u/agramfort)\
**Post date:** [June 1, 2021, 6:32am UTC](https://mne.discourse.group/t/read-edf-and-exclude-annotations/3192/4 "2021-06-01T06:32:03Z")

</div>

here the relevant function

[https://github.com/mne-tools/mne-python/blob/main/mne/io/edf/edf.py#L1371:5](https://github.com/mne-tools/mne-python/blob/main/mne/io/edf/edf.py#L1371:5)

I fear you’ll have to debug this yourself or share a file with us.

Alex
