Combine a tuple of annotations.
(
one, two, one_n_samples, one_first_samp, two_first_samp, sfreq
)
| 1604 | |
| 1605 | |
| 1606 | def _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 | |
| 1622 | def _handle_meas_date(meas_date): |