Add an annotated segment. Operates inplace. Parameters ---------- onset : float | array-like Annotation time onset from the beginning of the recording in seconds. duration : float | array-like Duration of the annotation in seconds.
(self, onset, duration, description, ch_names=None, *, extras=None)
| 538 | |
| 539 | @fill_doc |
| 540 | def append(self, onset, duration, description, ch_names=None, *, extras=None): |
| 541 | """Add an annotated segment. Operates inplace. |
| 542 | |
| 543 | Parameters |
| 544 | ---------- |
| 545 | onset : float | array-like |
| 546 | Annotation time onset from the beginning of the recording in |
| 547 | seconds. |
| 548 | duration : float | array-like |
| 549 | Duration of the annotation in seconds. |
| 550 | description : str | array-like |
| 551 | Description for the annotation. To reject epochs, use description |
| 552 | starting with keyword 'bad'. |
| 553 | %(ch_names_annot)s |
| 554 | |
| 555 | .. versionadded:: 0.23 |
| 556 | extras : list[dict[str, int | float | str | None] | None] | None |
| 557 | Optional list of dicts containing extras fields for each annotation. |
| 558 | The number of items must match the number of annotations. |
| 559 | |
| 560 | .. versionadded:: 1.10 |
| 561 | |
| 562 | Returns |
| 563 | ------- |
| 564 | self : mne.Annotations |
| 565 | The modified Annotations object. |
| 566 | |
| 567 | Notes |
| 568 | ----- |
| 569 | The array-like support for arguments allows this to be used similarly |
| 570 | to not only ``list.append``, but also |
| 571 | `list.extend <https://docs.python.org/3/library/stdtypes.html#mutable-sequence-types>`__. |
| 572 | """ # noqa: E501 |
| 573 | onset, duration, description, ch_names, extras = _check_o_d_s_c_e( |
| 574 | onset, duration, description, ch_names, extras |
| 575 | ) |
| 576 | self.onset = np.append(self.onset, onset) |
| 577 | self.duration = np.append(self.duration, duration) |
| 578 | self.description = np.append(self.description, description) |
| 579 | self.ch_names = np.append(self.ch_names, ch_names) |
| 580 | self.extras.extend(extras) |
| 581 | self._sort() |
| 582 | return self |
| 583 | |
| 584 | def copy(self): |
| 585 | """Return a copy of the Annotations. |