MCPcopy
hub / github.com/mne-tools/mne-python / append

Method append

mne/annotations.py:540–582  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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.

Callers 15

__iadd__Method · 0.95
__init__Method · 0.95
test_sortingFunction · 0.95
appendMethod · 0.45
_prune_ch_namesMethod · 0.45
cropMethod · 0.45
appendMethod · 0.45
appendMethod · 0.45
cropMethod · 0.45
_write_annotations_txtFunction · 0.45

Calls 3

_sortMethod · 0.95
_check_o_d_s_c_eFunction · 0.85
extendMethod · 0.45

Tested by 1

test_sortingFunction · 0.76