Gti¶
- class gdt.core.data_primitives.Gti(interval=None)[source]¶
Bases:
IntervalsA primitive class defining a set of Good Time Intervals (GTIs).
An interval may be accessed by using indices.
- Parameters:
interval (
TimeRange, optional) – An interval to initialize with
Attributes Summary
The list of intervals
The number of intervals
The full range spanned by the intervals
Methods Summary
as_list()Return the intervals as a list of tuples.
contains(value[, inclusive])Determine if the intervals contains a value.
from_boolean_mask(times, mask)Create a new GTI object from a list of times and a Boolean mask Splits the boolean mask into segments of contiguous values and applies to array of times to create a GTI object.
from_bounds(low_bounds, high_bounds)Create a new Intervals object from a list of lower and upper bounds.
from_list(interval_list)Create a new Intervals object from a list of tuples.
Return a list of the high edges.
index(value)Return the index of the interval that contains the value.
insert(interval)Insert a new interval
intersection(intervals1, intervals2)Return a new Intervals object that is the intersection of two existing Intervals objects.
Return a list of the low edges.
merge(intervals1, intervals2)Return a new Intervals object that is a merge of two existing Intervals objects.
Attributes Documentation
- intervals¶
The list of intervals
- Type:
(list)
- num_intervals¶
The number of intervals
- Type:
(int)
- range¶
The full range spanned by the intervals
- Type:
(float, float)
Methods Documentation
- as_list()¶
Return the intervals as a list of tuples.
- Returns:
[(float, float), …]
- contains(value, inclusive=True)¶
Determine if the intervals contains a value.
- Parameters:
value (float) – The input value to check
inclusive (bool, optional) – If True, then includes the edges of the range for the check, otherwise it is edge-exclusive. Default is True.
- Returns:
bool – True if the value is in the intervals, False otherwise
- classmethod from_boolean_mask(times, mask)[source]¶
Create a new GTI object from a list of times and a Boolean mask Splits the boolean mask into segments of contiguous values and applies to array of times to create a GTI object.
- Parameters:
times (np.array) – An array of times
mask (np.array(dtype=bool)) – The boolean array. Must be the same size as times.
- Returns:
Gti– The new GTI object
- classmethod from_bounds(low_bounds, high_bounds)¶
Create a new Intervals object from a list of lower and upper bounds.
- Parameters:
low_bounds (list) – The lower bounds of the intervals
high_bounds (list) – The upper bounds of the intervals
- Returns:
- classmethod from_list(interval_list)¶
Create a new Intervals object from a list of tuples.
- Parameters:
interval_list ([(float, float), ...]) – A list of interval tuples
- Returns:
- high_edges()¶
Return a list of the high edges.
- Returns:
(list)
- index(value)¶
Return the index of the interval that contains the value.
- Note :
If the value is precisely on the boundary of two intervals, the first interval index will be returned.
- Parameters:
value (float) – The input value
- Returns:
(int)
- classmethod intersection(intervals1, intervals2)¶
Return a new Intervals object that is the intersection of two existing Intervals objects.
- low_edges()¶
Return a list of the low edges.
- Returns:
(list)