gwcelery.tasks.detchar module

Flow Chart

The flow chart below shows the decision process for the application of DQOK and DQV labels.

digraph detchar { compound = true nodesep = 0.3 ranksep = 0.5 node [ fillcolor = white shape = box style = filled target = "_top" ] graph [ labeljust = "left" style = filled target = "_top" ] superevent [ label = "Superevent created/updated" style = rounded ] external [ label = "External trigger" style = rounded ] subgraph cluster_check { href = "../gwcelery.tasks.detchar.html#gwcelery.tasks.detchar.check_vectors" label = <<B><FONT face="monospace">detchar check_vectors</FONT></B>> padding [ label = "Apply padding before/after start/end time" ] { rank = same check_dq_inj [ label = "Check DQ and INJ\nstates at all detectors" ] check_idq [ label = "Check iDQ\nat H1 and L1" ] } post_gracedb [ label = "Post results to\nGraceDB log" ] dq_bits_ok [ label = "DQ bits ok \nat active detectors?" shape = diamond ] inj_found [ label = "Injection(s) found \nat active detectors?" shape = diamond ] idq_threshold [ label = "iDQ P(glitch)\nabove threshold?" shape = diamond ] dqok [ label = "DQOK" style = filled fillcolor = "green" ] dqv [ label = "DQV" style = filled fillcolor = "red" ] inj [ label = "INJ" style = filled fillcolor = "lightblue" ] } superevent -> padding external -> padding padding -> check_dq_inj padding -> check_idq check_dq_inj -> dq_bits_ok check_dq_inj -> inj_found check_dq_inj -> post_gracedb check_idq -> post_gracedb check_idq -> idq_threshold dq_bits_ok -> dqok [label = " Yes "] dq_bits_ok -> dqv [label = " No "] inj_found -> inj [label = " Yes "] idq_threshold -> dqv [label = " Yes "] }

Data quality and detector characterization tasks.

These tasks are mostly focused on checking interferometer state vectors. By design, the [LIGO] and [Virgo] state vectors share the same definitions for the first 8 fields.

LIGO also has a [DMT] DQ vector that provides some additional instrumental checks.

References

gwcelery.tasks.detchar.create_cache(ifo, start, end)[source]

Find .gwf files and create cache. Will first look in the llhoft, and if the frames have expired from llhoft, will call gwdatafind.

Parameters:
  • ifo (str) – Interferometer name (e.g. H1).

  • start (int or float) – GPS start and end times desired.

  • end (int or float) – GPS start and end times desired.

Return type:

glue.lal.Cache

Example

>>> create_cache('H1', 1198800018, 1198800618)
[<glue.lal.CacheEntry at 0x7fbae6b71278>,
  <glue.lal.CacheEntry at 0x7fbae6ae5b38>,
  <glue.lal.CacheEntry at 0x7fbae6ae5c50>,
 ...
  <glue.lal.CacheEntry at 0x7fbae6b15080>,
  <glue.lal.CacheEntry at 0x7fbae6b15828>]
(task)gwcelery.tasks.detchar.make_omegascan(ifo, t0, durs)[source]

Helper function to create a single omegascan image, with multiple durations.

Parameters:
  • ifo (str) – ‘H1’, ‘L1’, or ‘V1’

  • t0 (int or float) – Central time of the omegascan.

  • durs (list of tuples) – List of three tuples, with time before and time after t0 in seconds. Example: [(0.75, 0.25), (1.5, 0.5), (7.5, 2.5)]

Returns:

bytes of png of the omegascan, or None if no omegascan created.

Return type:

bytes or None

(task)gwcelery.tasks.detchar.omegascan(t0, graceid)[source]

Create omegascan for a certain event.

Parameters:
  • t0 (float) – Central event time.

  • graceid (str) – GraceDB ID to which to upload the omegascan.

gwcelery.tasks.detchar.generate_table(title, high_bit_list, low_bit_list, unknown_bit_list)[source]

Make a nice table which shows the status of the bits checked.

Parameters:
  • title (str) – Title of the table.

  • high_bit_list (list) – List of bit names which are high.

  • low_bit_list (list) – List of bit names which are low.

  • unknown_bit_list (list) – List of bit names which are unknown.

Returns:

HTML string of the table.

Return type:

str

gwcelery.tasks.detchar.dqr_json(state, summary)[source]

Generate DQR-compatible json-ready dictionary from process results, as described in data-quality-report.design.

Parameters:
  • state ({'pass', 'fail'}) – State of the detchar checks.

  • summary (str) – Summary of results from the process.

Returns:

Ready to be converted into json.

Return type:

dict

gwcelery.tasks.detchar.ifo_from_channel(channel)[source]

Get detector prefix from a channel.

Parameters:

channel (str) – Channel, e.g., H1:GDS-CALIB_STRAIN.

Returns:

Detector prefix, e.g., H1.

Return type:

str

gwcelery.tasks.detchar.check_idq(cache, channel, start, end)[source]

Looks for iDQ frame and reads them.

Parameters:
  • cache (glue.lal.Cache) – Cache from which to check.

  • channel (str) – which idq channel (FAP)

  • start (int or float) – GPS start and end times desired.

  • end (int or float) – GPS start and end times desired.

Returns:

Tuple mapping iDQ channel to its minimum FAP.

Return type:

tuple

Example

>>> check_idq(cache, 'H1:IDQ-FAP_OVL_100_1000',
              1216496260, 1216496262)
('H1:IDQ-FAP_OVL_100_1000', 0.003)
gwcelery.tasks.detchar.check_vector(cache, channel, start, end, bits, logic_type='all')[source]

Check timeseries of decimals against a bitmask. This is inclusive of the start time and exclusive of the end time, i.e. [start, …, end).

Parameters:
  • cache (glue.lal.Cache) – Cache from which to check.

  • channel (str) – Channel to look at, e.g. H1:DMT-DQ_VECTOR.

  • start (int or float) – GPS start and end times desired.

  • end (int or float) – GPS start and end times desired.

  • bits (gwpy.TimeSeries.Bits) – Definitions of the bits in the channel.

  • logic_type (str, optional) – Type of logic to apply for vetoing. If all, then all samples in the window must pass the bitmask. If any, then one or more samples in the window must pass.

Returns:

Maps each bit in channel to its state.

Return type:

dict

Example

>>> check_vector(cache, 'H1:GDS-CALIB_STATE_VECTOR', 1216496260,
                 1216496262, ligo_state_vector_bits)
{'H1:HOFT_OK': True,
 'H1:OBSERVATION_INTENT': True,
 'H1:NO_STOCH_HW_INJ': True,
 'H1:NO_CBC_HW_INJ': True,
 'H1:NO_BURST_HW_INJ': True,
 'H1:NO_DETCHAR_HW_INJ': True}
(task)gwcelery.tasks.detchar.check_vectors(event, graceid, start, end)[source]

Perform data quality checks for an event and labels/logs results to GraceDB.

Depending on the pipeline, a certain amount of time (specified in check_vector_prepost) is appended to either side of the superevent start and end time. This is to catch DQ issues slightly before and after the event, such as that appearing in L1 just before GW170817.

A cache is then created for H1, L1, and V1, regardless of the detectors involved in the event. Then, the bits and channels specified in the configuration file (llhoft_channels) are checked. If an injection is found in the active detectors, ‘INJ’ is labeled to GraceDB. If an injection is found in any detector, a message with the injection found is logged to GraceDB. If no injections are found across all detectors, this is logged to GraceDB.

A similar task is performed for the DQ states described in the DMT-DQ_VECTOR, LIGO GDS-CALIB_STATE_VECTOR, and Virgo DQ_ANALYSIS_STATE_VECTOR. If no DQ issues are found in active detectors, ‘DQOK’ is labeled to GraceDB. Otherwise, ‘DQV’ is labeled. In all cases, the DQ states of all the state vectors checked are logged to GraceDB.

This skips MDC events.

Parameters:
  • event (dict) – Details of event.

  • graceid (str) – GraceID of event to which to log.

  • start (int or float) – GPS start and end times desired.

  • end (int or float) – GPS start and end times desired.

Returns:

event – Details of the event, reflecting any labels that were added.

Return type:

dict