torch_ecg.utils.interval_len

torch_ecg.utils.interval_len(interval: Sequence[Real] | list) Real[source]

Compute the length of an interval.

Parameters:

interval (Interval) – The interval to compute the length of.

Returns:

The “length” of interval, 0 for the empty interval [].

Return type:

numbers.Real

Examples

>>> interval_len([0, 10])
10
>>> interval_len([10, 10])
0
>>> interval_len([10, 0])
10
>>> interval_len([])
0