MCPcopy Index your code
hub / github.com/mne-tools/mne-python / __iadd__

Method __iadd__

mne/annotations.py:480–501  ·  view source on GitHub ↗

Add (concatencate) two Annotation objects in-place. Both annotations must have the same orig_time

(self, other)

Source from the content-addressed store, hash-verified

478 return out
479
480 def __iadd__(self, other):
481 """Add (concatencate) two Annotation objects in-place.
482
483 Both annotations must have the same orig_time
484 """
485 if len(self) == 0:
486 self._orig_time = other.orig_time
487 if self.orig_time != other.orig_time:
488 raise ValueError(
489 "orig_time should be the same to add/concatenate 2 annotations (got "
490 f"{self.orig_time} != {other.orig_time})"
491 )
492 extras = other.extras
493 if hasattr(other, "hed_string"):
494 extras = _hed_extras_from_hed_annotations(other)
495 return self.append(
496 other.onset,
497 other.duration,
498 other.description,
499 other.ch_names,
500 extras=extras,
501 )
502
503 def __iter__(self):
504 """Iterate over the annotations."""

Callers 1

__iadd__Method · 0.45

Calls 2

appendMethod · 0.95

Tested by

no test coverage detected