# How to delete annotations

**URL:** <https://mne.discourse.group/t/how-to-delete-annotations/8183>\
**Category:** Support & Discussions\
**Tags:** eeg\
**Created:** [January 21, 2024, 1:56am UTC](https://mne.discourse.group/t/how-to-delete-annotations/8183 "2024-01-21T01:56:03Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![camellia](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/camellia/32/3347_2.png) [@camellia](https://mne.discourse.group/u/camellia)\
**Post date:** [January 21, 2024, 1:56am UTC](https://mne.discourse.group/t/how-to-delete-annotations/8183/1 "2024-01-21T01:56:03Z")

</div>

In MNE:`raws[0]` is modified in-place to achieve the concatenation. Boundaries of the raw files are annotated bad. If you wish to use the data as continuous recording, you can remove the boundary annotations after concatenation (see[`mne.Annotations.delete()`]

I learned about the delete function, but when I run it, it will tell me that I am missing a parameter ‘self’. What does this mean? How to apply this function?Thank you.

---

<div class="post-metadata">

**Author:** ![scott-huberty](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/scott-huberty/32/2715_2.png) [@scott-huberty](https://mne.discourse.group/u/scott-huberty)\
**Post date:** [January 21, 2024, 6:29am UTC](https://mne.discourse.group/t/how-to-delete-annotations/8183/2 "2024-01-21T06:29:43Z")

</div>

Hi @camellia - mne `Raw` objects have an `annotations` attribute, i.e. `raw.annotations`. This is where you will want to call the `delete` method. So in your case, `raws[0].annotations.delete()` should work.

Scott

---

<div class="post-metadata">

**Author:** ![camellia](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/camellia/32/3347_2.png) [@camellia](https://mne.discourse.group/u/camellia)\
**Post date:** [January 21, 2024, 7:40am UTC](https://mne.discourse.group/t/how-to-delete-annotations/8183/3 "2024-01-21T07:40:57Z")

</div>

Thank you for your answer, but after I made the corrections, the following issues arose:AttributeError: ‘tuple’ object has no attribute ‘Annotations’  
May I ask what the reason is?

---

<div class="post-metadata">

**Author:** ![scott-huberty](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/scott-huberty/32/2715_2.png) [@scott-huberty](https://mne.discourse.group/u/scott-huberty)\
**Post date:** [January 21, 2024, 7:56pm UTC](https://mne.discourse.group/t/how-to-delete-annotations/8183/4 "2024-01-21T19:56:57Z")

</div>

I see, I was guessing that your `raw` object is in your `raws` list, but it’s hard to tell without seeing your code. The error you are seeing is suggesting that `raws[0]` is a `tuple` object. You’ll need to identify the variable that you are storing your `Raw` object in, and then call the `.annotations` attribute of it.

---

<div class="post-metadata">

**Author:** ![camellia](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/camellia/32/3347_2.png) [@camellia](https://mne.discourse.group/u/camellia)\
**Post date:** [January 22, 2024, 3:17am UTC](https://mne.discourse.group/t/how-to-delete-annotations/8183/5 "2024-01-22T03:17:31Z")

</div>

Yes, because I used a function: mne.io.concatenate\_ Raws(). I want to connect multiple pieces of my data together. When I learned this function, I saw this sentence: If you wish to use the data as continuous recording, you can remove the boundary annotations after concatenation (see[`mne.Annotations.delete()`].So I don’t know how to use this deletion function.

---

<div class="post-metadata">

**Author:** ![scott-huberty](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/scott-huberty/32/2715_2.png) [@scott-huberty](https://mne.discourse.group/u/scott-huberty)\
**Post date:** [January 22, 2024, 5:43am UTC](https://mne.discourse.group/t/how-to-delete-annotations/8183/6 "2024-01-22T05:43:19Z")

</div>

> [@camellia](#):
>
> I don’t know how to use this deletion function.

`mne.Annotations.delete()` is a _method_ of the `Annotations` class, meaning it operates specifically on an _existing_ `Annotations` object. It’s not a standalone function you call directly with `mne.Annotations.delete(...)`. That’s whay you got the error you described.

> [@camellia](#):
>
> I used a function: mne.io.concatenate\_ Raws().

Right, so what is the first `raw` object that you passed to this function? You need to access the `annotations` attribute of that `raw` object. For example:

```python
raws_list = [raw1, raw2, raw3]
mne.io.concatenate_raws(raws_list)
indices_to_remove = [1 , 5]
raw1.annotations.delete(indices_to_remove)

```

---

<div class="post-metadata">

**Author:** ![camellia](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/camellia/32/3347_2.png) [@camellia](https://mne.discourse.group/u/camellia)\
**Post date:** [January 22, 2024, 7:29am UTC](https://mne.discourse.group/t/how-to-delete-annotations/8183/7 "2024-01-22T07:29:03Z")

</div>

> [@scott-huberty](#):
>
> `indices_to_remove = [1 , 5]`

I want to ask what the parameters here mean?

---

<div class="post-metadata">

**Author:** ![richard](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/richard/32/15_2.png) [@richard](https://mne.discourse.group/u/richard)\
**Post date:** [January 22, 2024, 4:13pm UTC](https://mne.discourse.group/t/how-to-delete-annotations/8183/8 "2024-01-22T16:13:54Z")

</div>

This would select the 2nd and 6th annotation for removal.
