torch_ecg.utils.intervals_intersection¶
- torch_ecg.utils.intervals_intersection(interval_list: Sequence[Sequence[Real] | list] | list, drop_degenerate: bool = True) Sequence[Real] | list [source]¶
Calculate the intersection of all intervals in interval_list.
- Parameters:
interval_list (GeneralizedInterval) – The list of intervals to yield intersection.
drop_degenerate (bool, default True) – Whether or not drop the degenerate intervals, i.e. intervals with length 0.
- Returns:
The intersection of all intervals in interval_list.
- Return type:
Interval
Examples
>>> intervals_intersection([[1, 2], [3, 4]]) [] >>> intervals_intersection([[1, 2], [2, 3]]) [] >>> intervals_intersection([[1, 2], [2, 3]], drop_degenerate=False) [[2, 2]] >>> intervals_intersection([[1, 2.1], [1.6, 4], [3.1, 10.9]]) [] >>> intervals_intersection([[1, 2.1], [1.6, 4], [0.7, 1.9]]) [1.6, 1.9]