gwpy.segments.Segment[source]¶Bases: ligo.segments.__segments.segment
A tuple defining a semi-open interval [start, end)
Each Segment represents the range of values in a given interval, with
general arithmetic supported for combining/comparing overlapping segments.
Examples
>>> Segment(0, 10) & Segment(5, 15)
Segment(5, 10)
>>> Segment(0, 10) | Segment(5, 15)
Segment(0, 15)
>>> Segment(0, 10) - Segment(5, 15)
Segment(0, 5)
>>> Segment(0, 10) < Segment(5, 15)
True
>>> Segment(1, 2) in Segment(0, 10)
True
>>> Segment(1, 11) in Segment(0, 10)
False
>>> Segment(0, 1)
Segment(0, 1)
>>> Segment(1, 0)
Segment(0, 1)
>>> bool(Segment(0, 1))
True
Attributes Summary
The GPS end time of this segment |
|
The GPS start time of this segment |
Methods Summary
|
Return True if self connects exactly onto other. |
|
Return a new segment whose bounds are given by adding x to the segment’s lower bound and subtracting x from the segment’s upper bound. |
|
Return number of occurrences of value. |
|
Returns >0 if self covers an interval above other’s interval, <0 if self covers an interval below other’s, or 0 if the two intervals are not disjoint (intersect or touch). |
|
Return first index of value. |
Return True if the intersection of self and other is not a null segment. |
|
|
Return a new segment whose bounds are given by subtracting x from the segment’s lower bound and adding x to the segment’s upper bound. |
|
Return a new segment whose bounds are given by adding x to the segment’s upper and lower bounds. |
Attributes Documentation
end¶The GPS end time of this segment
start¶The GPS start time of this segment
Methods Documentation
connects()¶Return True if self connects exactly onto other.
contract()¶Return a new segment whose bounds are given by adding x to the segment’s lower bound and subtracting x from the segment’s upper bound.
count(self, value, /)¶Return number of occurrences of value.
disjoint()¶Returns >0 if self covers an interval above other’s interval, <0 if self covers an interval below other’s, or 0 if the two intervals are not disjoint (intersect or touch). A return value of 0 indicates the two segments would coalesce.
index(self, value, start=0, stop=9223372036854775807, /)¶Return first index of value.
Raises ValueError if the value is not present.
intersects()¶Return True if the intersection of self and other is not a null segment.
protract()¶Return a new segment whose bounds are given by subtracting x from the segment’s lower bound and adding x to the segment’s upper bound.
shift()¶Return a new segment whose bounds are given by adding x to the segment’s upper and lower bounds.
endThe GPS end time of this segment
startThe GPS start time of this segment