concat_intervals#
- pypillometry.concat_intervals(*args, label='combined')[source]#
Put the intervals of several Intervals objects into one.
The same as
a + b + c(seeIntervals.__add__()), for any number of objects or a list or dict of them (e.g., the blinks of all channels fromget_blinks()). The intervals are concatenated, with their labels, onsets and metadata; overlapping intervals are kept as they are (Intervals.merge()merges them). The units of the first object are used (the others are converted).- Parameters:
- Return type:
- Returns:
all intervals of all objects, in the given order
- Raises:
ValueError – if no Intervals are given, or if time units and sample indices are mixed
TypeError – if an argument is not an Intervals object
Examples
>>> a = Intervals([(0, 100), (200, 300)], units="ms", event_labels=["a", "b"]) >>> b = Intervals([(50, 150), (400, 500)], units="ms", event_labels=["c", "d"]) >>> both = concat_intervals(a, b) >>> both.event_labels ['a', 'b', 'c', 'd'] >>> len(both), len(both.merge()) # merge() merges the overlaps (4, 3) >>> both = concat_intervals({"left_pupil": a, "right_pupil": b})