torch_ecg.utils.generalized_interval_len¶
- torch_ecg.utils.generalized_interval_len(generalized_interval: Sequence[Sequence[Real] | list] | list) Real [source]¶
Compute the length of an interval.
- Parameters:
generalized_interval (GeneralizedInterval) – The generalized interval to compute the length of.
- Returns:
The “length” of generalized_interval, 0 for the empty interval [].
- Return type:
Examples
>>> generalized_interval_len([[0, 10], [20, 30]]) 20 >>> generalized_interval_len([[10, 10], [20, 30]]) 10 >>> generalized_interval_len([[10, 0], [20, 30]]) 20 >>> generalized_interval_len([[0, 20], [10, 30]]) 30 >>> generalized_interval_len([]) 0