torch_ecg.utils.generalized_interval_complement

torch_ecg.utils.generalized_interval_complement(total_interval: Sequence[Real] | list, generalized_interval: Sequence[Sequence[Real] | list] | list) Sequence[Sequence[Real] | list] | list[source]

Calculate the complement of an interval in another interval.

Parameters:
  • total_interval (Interval) – The total interval.

  • generalized_interval (GeneralizedInterval) – The interval to be complemented.

Returns:

  • cpl (GeneralizedInterval) – The complement of generalized_interval in total_interval.

  • TODO (the case total_interval is a GeneralizedInterval.)

Examples

>>> generalized_interval_complement([1, 100], [[5, 33], [40, 50], [60, 140]])
[[1, 5], [33, 40], [50, 60]]
>>> generalized_interval_complement([1, 10], [[40, 66], [111, 300]])
[[1, 10]]
>>> generalized_interval_complement([150, 200], [[40, 66], [111, 300]])
[]