torch_ecg.utils.generalized_intervals_union¶
- torch_ecg.utils.generalized_intervals_union(interval_list: List[Sequence[Sequence[Real] | list] | list] | Tuple[Sequence[Sequence[Real] | list] | list], join_book_endeds: bool = True) Sequence[Sequence[Real] | list] | list [source]¶
Calculate the union of a list (or tuple) of
GeneralizedInterval
.- Parameters:
- Returns:
The union of interval_list.
- Return type:
GeneralizedInterval
Examples
>>> generalized_intervals_union(([[1, 2], [3, 7]], [[40,90], [-30, -10]])) [[-30, -10], [1, 2], [3, 7], [40, 90]] >>> generalized_intervals_union(([[1, 2], [3, 7]], [[4,9], [-3, 1]])) [[-3, 2], [3, 9]] >>> generalized_intervals_union(([[1, 2], [3, 7]], [[4,9], [-3, 1]]), join_book_endeds=False) [[-3, 1], [1, 2], [3, 9]]