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

Function _combine_annotations

mne/annotations.py:1606–1619  ·  view source on GitHub ↗

Combine a tuple of annotations.

(
    one, two, one_n_samples, one_first_samp, two_first_samp, sfreq
)

Source from the content-addressed store, hash-verified

1604
1605
1606def _combine_annotations(
1607 one, two, one_n_samples, one_first_samp, two_first_samp, sfreq
1608):
1609 """Combine a tuple of annotations."""
1610 assert one is not None
1611 assert two is not None
1612 shift = one_n_samples / sfreq # to the right by the number of samples
1613 shift += one_first_samp / sfreq # to the right by the offset
1614 shift -= two_first_samp / sfreq # undo its offset
1615 onset = np.concatenate([one.onset, two.onset + shift])
1616 duration = np.concatenate([one.duration, two.duration])
1617 description = np.concatenate([one.description, two.description])
1618 ch_names = np.concatenate([one.ch_names, two.ch_names])
1619 return Annotations(onset, duration, description, one.orig_time, ch_names)
1620
1621
1622def _handle_meas_date(meas_date):

Callers 1

appendMethod · 0.85

Calls 1

AnnotationsClass · 0.85

Tested by

no test coverage detected