# cannot read annotations . edf files

**URL:** <https://mne.discourse.group/t/cannot-read-annotations-edf-files/8451>\
**Category:** Support & Discussions\
**Created:** [March 7, 2024, 10:40pm UTC](https://mne.discourse.group/t/cannot-read-annotations-edf-files/8451 "2024-03-07T22:40:18Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![isabelceo](https://avatars.discourse-cdn.com/v4/letter/i/3e96dc/32.png) [@isabelceo](https://mne.discourse.group/u/isabelceo)\
**Post date:** [March 7, 2024, 10:40pm UTC](https://mne.discourse.group/t/cannot-read-annotations-edf-files/8451/1 "2024-03-07T22:40:18Z")

</div>

Hello, I am traying to get the annotations form my signals, the eeg device export .edf, we set four annotations as [1, 2, 3, 4]. In the moment to get the annotatons by code, nothing get, raw\_data\_.duration array(, dtype=float64)

```python
edf_dir = '/content/drive/MyDrive/Semillero EEG/Senales-prueba-piloto'
edf_files = [f for f in os.listdir(edf_dir) if f.endswith('.edf')]

for i in edf_files:
    #raw_data = mne.io.read_raw_edf(os.path.join(edf_dir, i), preload=True)
    raw_data_ = mne.read_annotations(os.path.join(edf_dir, i))
    raw_data.set_annotations(raw_data_, emit_warning=False)

```

---

<div class="post-metadata">

**Author:** ![wmvanvliet](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/wmvanvliet/32/100_2.png) [@wmvanvliet](https://mne.discourse.group/u/wmvanvliet)\
**Post date:** [March 11, 2024, 7:55am UTC](https://mne.discourse.group/t/cannot-read-annotations-edf-files/8451/2 "2024-03-11T07:55:52Z")

</div>

Are you sure this is an EDF+ file where events are marked as annotations? Or could this be an old-style EDF file where there is a STATUS channel encoding the events? In the latter case, use `mne.find_events(raw_data)` to get them.

---

<div class="post-metadata">

**Author:** ![isabelceo](https://avatars.discourse-cdn.com/v4/letter/i/3e96dc/32.png) [@isabelceo](https://mne.discourse.group/u/isabelceo)\
**Post date:** [March 11, 2024, 1:07pm UTC](https://mne.discourse.group/t/cannot-read-annotations-edf-files/8451/3 "2024-03-11T13:07:04Z")

</div>

Dear,

I took the signal and made the annotations by myself while performing the test, we don’t use any other channel. However, this equipment is easy cadwell III, an old one, in this case I will use your suggestion and then let you know.  
Thank you in advance.

---

<div class="post-metadata">

**Author:** ![isabelceo](https://avatars.discourse-cdn.com/v4/letter/i/3e96dc/32.png) [@isabelceo](https://mne.discourse.group/u/isabelceo)\
**Post date:** [March 12, 2024, 8:55pm UTC](https://mne.discourse.group/t/cannot-read-annotations-edf-files/8451/4 "2024-03-12T20:55:57Z")

</div>

Dear Marijin,

As I told you those signals do not have the stimulus channel, I used you suggestion, I have an error.

```python
Extracting EDF parameters from /content/drive/MyDrive/Semillero EEG/Senales-prueba-piloto/1.edf...
EDF file detected
Setting channel info structure...
Creating raw.info structure...
Reading 0 ... 52499 = 0.000 ... 209.996 secs...
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-7-ec6ed46bdd2b> in <cell line: 6>()
      6 for i in edf_files:
      7 raw_data = mne.io.read_raw_edf(os.path.join(edf_dir, i), preload=True)
----> 8 raw_data_= mne.find_events(raw_data)
      9 #raw_data_ = mne.read_annotations(os.path.join(edf_dir, i))
     10 #raw_data.set_annotations(raw_data_, emit_warning=False)

<decorator-gen-131> in find_events(raw, stim_channel, output, consecutive, min_duration, shortest_event, mask, uint_cast, mask_type, initial_event, verbose)

1 frames
/usr/local/lib/python3.10/dist-packages/mne/utils/config.py in _get_stim_channel(stim_channel, info, raise_error)
    529 stim_channel = pick_types(info, meg=False, ref_meg=False, stim=True)
    530 if len(stim_channel) == 0 and raise_error:
--> 531 raise ValueError(
    532 "No stim channels found. Consider specifying them "
    533 "manually using the 'stim_channel' parameter."

ValueError: No stim channels found. Consider specifying them manually using the 'stim_channel' parameter.

```
