TimeRange¶
- class gdt.core.data_primitives.TimeRange(tstart, tstop)[source]¶
Bases:
RangeA primitive class defining a time range
- Parameters:
tstart (float) – The start time of the range
tstop (float) – The end time of the range
Attributes Summary
The center of the range
The duration of the time range.
The start time of the range
The end time of the range
The width of the range
Methods Summary
as_tuple()Return the range as a tuple.
contains(value[, inclusive])Determine if the range contains a value.
intersection(range1, range2)Return a new Range that is the intersection of two input Ranges.
translate(value)Returns a new Range that is the translated (shifted) by the given value
union(range1, range2)Return a new Range that is the union of two input Ranges
Attributes Documentation
- center¶
The center of the range
- Type:
(float)
- duration¶
The duration of the time range. Alias for
width.- Type:
(float)
- tstart¶
The start time of the range
- Type:
(float)
- tstop¶
The end time of the range
- Type:
(float)
- width¶
The width of the range
- Type:
(float)
Methods Documentation
- as_tuple()¶
Return the range as a tuple.
- Returns:
(float, float)
- contains(value, inclusive=True)¶
Determine if the range 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 range, False otherwise
- classmethod intersection(range1, range2)¶
Return a new Range that is the intersection of two input Ranges. If the input Ranges do not intersect, then None is returned.