gwpy.segments.DataQualityFlag(name=None, active=None, known=None, label=None, category=None, description=None, isgood=True, padding=None, valid=None)[source]¶Bases: object
A representation of a named set of segments.
| Parameters: | name : str, optional
active :
known :
label :
category :
description :
isgood :
|
|---|
Methods Summary
coalesce() |
Coalesce the segments for this flag. |
contract(x) |
Contract each of the active Segments by x seconds. |
copy() |
Build an exact copy of this flag. |
fetch_open_data(flag, start, end, **kwargs) |
Fetch Open Data timeline segments into a flag. |
from_veto_def(veto) |
Define a DataQualityFlag from a VetoDef |
pad(*args, **kwargs) |
Apply a padding to each segment in this DataQualityFlag |
plot(**kwargs) |
Plot this flag. |
populate([source, segments, pad]) |
Query the segment database for this flag’s active segments. |
protract(x) |
Protract each of the active Segments by x seconds. |
query(flag, *args, **kwargs) |
Query for segments of a given flag |
query_dqsegdb(flag, *args, **kwargs) |
Query the advanced LIGO DQSegDB for the given flag |
query_segdb(flag, *args, **kwargs) |
Query the initial LIGO segment database for the given flag |
read(source, *args, **kwargs) |
Read segments from file into a DataQualityFlag. |
round() |
Round this flag to integer segments. |
write(target, *args, **kwargs) |
Write this DataQualityFlag to file |
Methods Documentation
coalesce()[source]¶Coalesce the segments for this flag.
This method does two things:
coalesces the known and
active segment listsactive segments to be a proper subset of the known
segmentsNote
this operations is performed in-place.
| Returns: | self
|
|---|
contract(x)[source]¶Contract each of the active Segments by x seconds.
This method adds x to each segment’s lower bound, and subtracts
x from the upper bound.
The active SegmentList is modified
in place.
| Parameters: | x :
|
|---|
copy()[source]¶Build an exact copy of this flag.
| Returns: | flag2 :
|
|---|
fetch_open_data(flag, start, end, **kwargs)[source]¶Fetch Open Data timeline segments into a flag.
strint, strint, strbool, optionalFalseint, optionalstr, optional'losc.ligo.org'| Returns: | flag :
|
|---|
Examples
>>> from gwpy.segments import DataQualityFlag
>>> print(DataQualityFlag.fetch_open_data('H1_DATA', 'Jan 1 2010',
... 'Jan 2 2010'))"
<DataQualityFlag('H1:DATA',
known=[[946339215 ... 946425615)],
active=[[946340946 ... 946351800)
[946356479 ... 946360620)
[946362652 ... 946369150)
[946372854 ... 946382630)
[946395595 ... 946396751)
[946400173 ... 946404977)
[946412312 ... 946413577)
[946415770 ... 946422986)],
description=None)>
from_veto_def(veto)[source]¶Define a DataQualityFlag from a VetoDef
| Parameters: | veto :
|
|---|
pad(*args, **kwargs)[source]¶Apply a padding to each segment in this DataQualityFlag
This method either takes no arguments, in which case the value of
the padding attribute will be used,
or two values representing the padding for the start and end of
each segment.
For both the start and end paddings, a positive value means
pad forward in time, so that a positive start pad or negative
end padding will contract a segment at one or both ends,
and vice-versa.
This method will apply the same padding to both the
known and active lists,
but will not coalesce() the result.
| Parameters: | start :
end :
inplace :
|
|---|---|
| Returns: | paddedflag :
|
plot(**kwargs)[source]¶Plot this flag.
| Parameters: | **kwargs
|
|---|---|
| Returns: | plot :
|
populate(source='http://segments.ldas.cit', segments=None, pad=True, **kwargs)[source]¶Query the segment database for this flag’s active segments.
This method assumes all of the metadata for each flag have been filled. Minimally, the following attributes must be filled
name |
The name associated with this flag. |
known |
The set of segments during which this flag was known, and its state was well defined. |
Segments will be fetched from the database, with any
padding added on-the-fly.
This DataQualityFlag will be modified in-place.
| Parameters: | source :
segments :
pad : **kwargs
|
|---|---|
| Returns: | self :
|
protract(x)[source]¶Protract each of the active Segments by x seconds.
This method subtracts x from each segment’s lower bound,
and adds x to the upper bound, while maintaining that each
Segment stays within the known bounds.
The active SegmentList is modified
in place.
| Parameters: | x :
|
|---|
query(flag, *args, **kwargs)[source]¶Query for segments of a given flag
This method intelligently selects the query_segdb
or the query_dqsegdb methods based on the
url kwarg given.
| Parameters: | flag :
*args
url :
|
|---|---|
| Returns: | flag :
|
See also
DataQualityFlag.query_dqsegdbquery_dqsegdb(flag, *args, **kwargs)[source]¶Query the advanced LIGO DQSegDB for the given flag
| Parameters: | flag :
*args
url :
|
|---|---|
| Returns: | flag :
|
query_segdb(flag, *args, **kwargs)[source]¶Query the initial LIGO segment database for the given flag
| Parameters: | flag :
*args
url :
|
|---|---|
| Returns: | flag :
|
read(source, *args, **kwargs)[source]¶Read segments from file into a DataQualityFlag.
| Parameters: | filename :
flag :
format :
coltype :
strict :
nproc :
verbose :
|
|---|---|
| Returns: | dqflag :
|
Notes
The available built-in formats are:
| Format | Read | Write | Auto-identify |
|---|---|---|---|
| hdf5 | Yes | Yes | Yes |
| json | Yes | No | No |
| ligolw | Yes | Yes | Yes |
| segwizard | Yes | Yes | Yes |
round()[source]¶Round this flag to integer segments.
| Returns: | roundedflag : |
|---|
write(target, *args, **kwargs)[source]¶Write this DataQualityFlag to file
Notes
The available built-in formats are:
| Format | Read | Write | Auto-identify |
|---|---|---|---|
| hdf5 | Yes | Yes | Yes |
| json | Yes | Yes | No |
| ligolw | Yes | Yes | Yes |
| segwizard | Yes | Yes | Yes |
active¶The set of segments during which this flag was active.
coalesce()[source]Coalesce the segments for this flag.
This method does two things:
coalesces the known and
active segment listsactive segments to be a proper subset of the known
segmentsNote
this operations is performed in-place.
| Returns: | self
|
|---|
contract(x)[source]Contract each of the active Segments by x seconds.
This method adds x to each segment’s lower bound, and subtracts
x from the upper bound.
The active SegmentList is modified
in place.
| Parameters: | x :
|
|---|
copy()[source]Build an exact copy of this flag.
| Returns: | flag2 :
|
|---|
extent¶The single GPS [start, stop) enclosing segment of this
DataQualityFlag.
| Type: | Segment |
|---|
fetch_open_data(flag, start, end, **kwargs)[source]Fetch Open Data timeline segments into a flag.
strint, strint, strbool, optionalFalseint, optionalstr, optional'losc.ligo.org'| Returns: | flag :
|
|---|
Examples
>>> from gwpy.segments import DataQualityFlag
>>> print(DataQualityFlag.fetch_open_data('H1_DATA', 'Jan 1 2010',
... 'Jan 2 2010'))"
<DataQualityFlag('H1:DATA',
known=[[946339215 ... 946425615)],
active=[[946340946 ... 946351800)
[946356479 ... 946360620)
[946362652 ... 946369150)
[946372854 ... 946382630)
[946395595 ... 946396751)
[946400173 ... 946404977)
[946412312 ... 946413577)
[946415770 ... 946422986)],
description=None)>
from_veto_def(veto)[source]Define a DataQualityFlag from a VetoDef
| Parameters: | veto :
|
|---|
ifo¶The interferometer associated with this flag.
This should be a single uppercase letter and a single number,
e.g. 'H1'.
| Type: | str |
|---|
known¶The set of segments during which this flag was known, and its state was well defined.
name¶The name associated with this flag.
This normally takes the form {ifo}:{tag}:{version}. If found, each component is stored separately the associated attributes.
| Type: | str |
|---|
pad(*args, **kwargs)[source]Apply a padding to each segment in this DataQualityFlag
This method either takes no arguments, in which case the value of
the padding attribute will be used,
or two values representing the padding for the start and end of
each segment.
For both the start and end paddings, a positive value means
pad forward in time, so that a positive start pad or negative
end padding will contract a segment at one or both ends,
and vice-versa.
This method will apply the same padding to both the
known and active lists,
but will not coalesce() the result.
| Parameters: | start :
end :
inplace :
|
|---|---|
| Returns: | paddedflag :
|
padding¶[start, end) padding for this flag’s active segments.
plot(**kwargs)[source]Plot this flag.
| Parameters: | **kwargs
|
|---|---|
| Returns: | plot :
|
populate(source='http://segments.ldas.cit', segments=None, pad=True, **kwargs)[source]Query the segment database for this flag’s active segments.
This method assumes all of the metadata for each flag have been filled. Minimally, the following attributes must be filled
name |
The name associated with this flag. |
known |
The set of segments during which this flag was known, and its state was well defined. |
Segments will be fetched from the database, with any
padding added on-the-fly.
This DataQualityFlag will be modified in-place.
| Parameters: | source :
segments :
pad : **kwargs
|
|---|---|
| Returns: | self :
|
protract(x)[source]Protract each of the active Segments by x seconds.
This method subtracts x from each segment’s lower bound,
and adds x to the upper bound, while maintaining that each
Segment stays within the known bounds.
The active SegmentList is modified
in place.
| Parameters: | x :
|
|---|
query(flag, *args, **kwargs)[source]Query for segments of a given flag
This method intelligently selects the query_segdb
or the query_dqsegdb methods based on the
url kwarg given.
| Parameters: | flag :
*args
url :
|
|---|---|
| Returns: | flag :
|
See also
DataQualityFlag.query_dqsegdbquery_dqsegdb(flag, *args, **kwargs)[source]Query the advanced LIGO DQSegDB for the given flag
| Parameters: | flag :
*args
url :
|
|---|---|
| Returns: | flag :
|
query_segdb(flag, *args, **kwargs)[source]Query the initial LIGO segment database for the given flag
| Parameters: | flag :
*args
url :
|
|---|---|
| Returns: | flag :
|
read(source, *args, **kwargs)[source]Read segments from file into a DataQualityFlag.
| Parameters: | filename :
flag :
format :
coltype :
strict :
nproc :
verbose :
|
|---|---|
| Returns: | dqflag :
|
Notes
The available built-in formats are:
| Format | Read | Write | Auto-identify |
|---|---|---|---|
| hdf5 | Yes | Yes | Yes |
| json | Yes | No | No |
| ligolw | Yes | Yes | Yes |
| segwizard | Yes | Yes | Yes |
round()[source]Round this flag to integer segments.
| Returns: | roundedflag : |
|---|
tag¶The tag (name) associated with this flag.
This should take the form 'AAA-BBB_CCC_DDD', i.e. where
each component is an uppercase acronym of alphanumeric
characters only, e.g. 'DCH-IMC_BAD_CALIBRATION' or
'DMT-SCIENCE'.
| Type: | str |
|---|
texname¶Name of this flag in LaTeX printable format.
valid¶The set of segments during which this flag was known, and its state was well defined.
version¶The version number of this flag.
Each flag in the segment database is stored with a version integer, with each successive version representing a more accurate dataset for its known segments than any previous.
| Type: | int |
|---|
write(target, *args, **kwargs)[source]Write this DataQualityFlag to file
Notes
The available built-in formats are:
| Format | Read | Write | Auto-identify |
|---|---|---|---|
| hdf5 | Yes | Yes | Yes |
| json | Yes | Yes | No |
| ligolw | Yes | Yes | Yes |
| segwizard | Yes | Yes | Yes |