Could not find any of the events you specified.

Hello, I have continuous data in which there are no events in my EEG data, but after the process of filtering and cleaning I have some annotations called: ‘Bad_muscle’. now I can not add these annotations as events. and I think it interrupts my visualization and time-frequency analysis.
Thank you in advance.

  • MNE version: 1.2.2
  • operating system: Windows 10
print(raw.annotations)
print(set(raw.annotations.duration))
print(set(raw.annotations.description))
print(raw.annotations.onset[0])

The result of this cell is:

<Annotations | 39 segments: BAD_muscle (39)>
{0.09666633605957031, 0.026666641235351562, 0.08333206176757812, 0.10333442687988281, 0.043331146240234375, 0.0500030517578125, 0.09666824340820312, 0.1699981689453125, 0.12000274658203125, 0.11333465576171875, 0.08333587646484375, 0.18999481201171875, 0.15332794189453125, 0.086669921875, 0.15000152587890625, 0.10666656494140625, 0.0666656494140625, 0.0699920654296875, 0.2733306884765625, 0.160003662109375, 0.3166656494140625, 0.1300048828125, 0.0966644287109375, 0.1199951171875, 0.2066802978515625, 0.126678466796875, 0.22333526611328125, 0.06667327880859375, 0.21666717529296875, 0.14333343505859375, 0.15999603271484375, 0.14666748046875, 0.05999755859375, 0.35666656494140625, 0.2700042724609375, 0.1866607666015625, 0.07000732421875}
{'BAD_muscle'}
20.29

In the next cell I run:
mne.events_from_annotations(raw)
and the result is the error:
ValueError: Could not find any of the events you specified.

By default, the annotations starting with BAD are ignored. Have a look at the regexp argument of mne.events_from_annotations.

2 Likes

Thank you for replying!
As you said, I change my code to:
events, event_id = mne.events_from_annotations(raw, regexp = None)
and it worked. Is it ok to use?

Sounds good to me. None probably disables the filtering by name entirely. You could also just change the regex pattern to match 'BAD_muscle' if that’s the event you want to capture.

2 Likes