Segment

class igwn_ligolw.lsctables.Segment(*args, **kwargs)

Bases: RowType

Example:

>>> x = Segment()
>>> x.start = LIGOTimeGPS(0)
>>> x.end = LIGOTimeGPS(10)
>>> x.segment
segment(LIGOTimeGPS(0, 0), LIGOTimeGPS(10, 0))
>>> x.segment = None
>>> print(x.segment)
None
>>> print(x.start)
None
>>> # non-LIGOTimeGPS times are converted to LIGOTimeGPS
>>> x.segment = (20, 30.125)
>>> x.end
LIGOTimeGPS(30, 125000000)
>>> # initialization from a tuple or with arguments
>>> Segment((20, 30)).segment
segment(LIGOTimeGPS(20, 0), LIGOTimeGPS(30, 0))
>>> Segment(20, 30).segment
segment(LIGOTimeGPS(20, 0), LIGOTimeGPS(30, 0))
>>> # use as a segment object in segmentlist operations
>>> import igwn_segments as segments
>>> x = segments.segmentlist([Segment(0, 10), Segment(20, 30)])
>>> abs(x)
LIGOTimeGPS(20, 0)
>>> y = segments.segmentlist([Segment(5, 15), Segment(25, 35)])
>>> abs(x & y)
LIGOTimeGPS(10, 0)
>>> abs(x | y)
LIGOTimeGPS(30, 0)
>>> 8.0 in x
True
>>> 12 in x
False
>>> Segment(2, 3) in x
True
>>> Segment(2, 12) in x
False
>>> segments.segment(2, 3) in x
True
>>> segments.segment(2, 12) in x
False
>>> # make sure results are segment table row objects
>>> segments.segmentlist(map(Segment, x & y))
[<igwn_ligolw.lsctables.Segment object at 0x...>, <igwn_ligolw.lsctables.Segment object at 0x...>]

Unbounded intervals are permitted. See gpsproperty for information on the encoding scheme used internally, and its limitations.

Example:

>>> x = Segment()
>>> # OK
>>> x.start = -segments.infinity()
>>> # also OK
>>> x.start = float("-inf")
>>> # infinite boundaries always returned as segments.infinity
>>> # instances
>>> x.start
-infinity
>>> x.end = float("+inf")
>>> x.segment
segment(-infinity, infinity)

Attributes Summary

Attributes Documentation

creator_db
end
end_time
end_time_ns
process_id
segment
segment_def_cdb
segment_def_id
segment_id
start
start_time
start_time_ns