sleap.rangelist¶
Module with RangeList class for manipulating a list of range intervals.
This is used to cache the track occupancy so we can keep cache updating when user manipulates tracks for a range of instances.
-
class
sleap.rangelist.
RangeList
(range_list: List[Tuple[int]] = None)[source]¶ Class for manipulating a list of range intervals. Each range interval in the list is a [start, end)-tuple.
-
static
cut_
(range_list: List[Tuple[int]], cut: int)[source]¶ Return a pair of lists with everything before/after cut. :param range_list: the list to cut :param cut: the value at which to cut list
- Returns
(pre-cut list, post-cut list)-tuple
-
property
end
¶ Returns the end value of range (or None if empty).
-
insert
(new_range: tuple)[source]¶ Add a new range, merging to adjacent/overlapping ranges as appropriate.
-
property
is_empty
¶ Returns True if the list is empty.
-
classmethod
join_
(list_list: List[List[Tuple[int]]])[source]¶ Return a single list that includes all lists in input list.
- Parameters
list_list – a list of range lists
- Returns
range list that joins all of the lists in list_list
-
static
join_pair_
(list_a: List[Tuple[int]], list_b: List[Tuple[int]])[source]¶ Return a single pair of lists that joins two input lists.
-
property
list
¶ Returns the list of ranges.
-
property
start
¶ Return the start value of range (or None if empty).
-
static