Package pylal :: Package dq :: Module dqSegmentUtils
[hide private]
[frames] | no frames]

Module dqSegmentUtils

source code


Author: Andrew P Lundgren <andrew.lundgren@ligo.org>, Duncan Macleod <duncan.macleod@ligo.org>

Functions [hide private]
 
fromsegmentxml(file, dict=False, id=None)
Read a glue.segments.segmentlist from the file object file containing an xml segment table.
source code
 
tosegmentxml(file, segs)
Write the glue.segments.segmentlist object segs to file object file in xml format with appropriate tables.
source code
 
fromsegmentcsv(csvfile)
Read a glue.segments.segmentlist object from the file object file containin a comma separated list of segments.
source code
 
CBCAnalyzableSegs(seglist)
Remove any segments shorter than 2064 seconds from seglist because ihope won't analyze them.
source code
 
pad_segmentlist(seglist, start_pad, end_pad=None)
Given a veto segmentlist, start pad, and end pad, pads and coalesces the segments.
source code
 
crop_segmentlist(seglist, end_chop=30)
Given a segmentlist and time to chop, removes time from the end of each segment (defaults to 30 seconds).
source code
 
grab_segments(start, end, flag, segment_url='https://segdb.ligo.caltech.edu', segment_summary=False)
Returns a segmentlist containing the segments during which the given flag was active in the given period.
source code
 
dump_flags(ifos=None, segment_url=None, match=None, unmatch=None, latest=False)
Returns the list of all flags defined in the database.
source code
 
poisson_safety(segs, injTable, livetime)
Return a tuple containing the number of vetoed injections, the number expected, and the Poisson safety probability based on the number of injections vetoed relative to random chance according to Poisson statistics.
source code
 
_bits(i, n=8)
Convert integer bit mask into binary bits.
source code
 
DQSegments(time, data, dq_key)
Returns a glue.segments.segmentlistdict of active segments for each bit in a dq_key.
source code
Variables [hide private]
  LIGOTimeGPS = lsctables.LIGOTimeGPS
  __date__ = git_version.date
This module provides useful segment and veto tools for data quality investigations.
Function Details [hide private]

fromsegmentxml(file, dict=False, id=None)

source code 

Read a glue.segments.segmentlist from the file object file containing an
xml segment table.

Arguments:

  file : file object
    file object for segment xml file

Keyword Arguments:

  dict : [ True | False ]
    returns a glue.segments.segmentlistdict containing coalesced
    glue.segments.segmentlists keyed by seg_def.name for each entry in the
    contained segment_def_table. Default False
  id : int
    returns a glue.segments.segmentlist object containing only those
    segments matching the given segment_def_id integer
    

pad_segmentlist(seglist, start_pad, end_pad=None)

source code 

Given a veto segmentlist, start pad, and end pad, pads and coalesces the segments. Convention is to expand segments with positive padding, contract with negative. Any segments that are not big enough to be contracted appropriately are removed.

grab_segments(start, end, flag, segment_url='https://segdb.ligo.caltech.edu', segment_summary=False)

source code 

Returns a segmentlist containing the segments during which the given flag
was active in the given period.

Arguments:

  start : int
    GPS start time
  end : int
    GPS end time
  flag : string
    'IFO:NAME:VERSION' format string

Keyword arguments:

  segment_url : string
    url of segment database to query, default https://segdb.ligo.caltech.edu
  segment_summary : [ True | False ]
    also return the glue.segments.segmentlist defining the valid span of the
    returned segments

dump_flags(ifos=None, segment_url=None, match=None, unmatch=None, latest=False)

source code 

Returns the list of all flags defined in the database.

Keyword rguments:
  ifo : [ str | list ]
    list of ifos to query, or str for single ifo
  segment_url : str 
    url of segment database, defaults to contents of S6_SEGMENT_SERVER
    environment variable
  match : [ str | regular pattern ]
    regular expression to search against returned flag names, e.g, 'UPV'
  unmatch : [ str | regular pattern ]
    regular expression to negatively search against returned flag names

poisson_safety(segs, injTable, livetime)

source code 

Return a tuple containing the number of vetoed injections, the number
expected, and the Poisson safety probability based on the number of
injections vetoed relative to random chance according to Poisson statistics.

Arguments:

  segs : glue.segments.segmentlist
    list of segments to be tested
  injTable : glue.ligolw.table.Table
    table of injections
  livetime : [ float ]
    livetime of search

_bits(i, n=8)

source code 

Convert integer bit mask into binary bits. Returns a list of 0s or 1s from 2^0 up to 2^n.

Example:

>>> _bits(295, n=8)
[1, 1, 1, 0, 0, 1, 0, 0]