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

Module dqTriggerUtils

source code


Author: Duncan Macleod <duncan.macleod@astro.cf.ac.uk>

Classes [hide private]
  KWCacheEntry
Functions [hide private]
 
SnglTriggerTable(etg, columns=None)
Handy function to return the correct type of ligolw table for the given ETG.
source code
 
SnglTrigger(etg)
Handy function to return the correct type of ligolw table row object for the given ETG
source code
 
def_get_time(tableName, ifo=None)
Define the get_time() function for given table
source code
 
trigger(data, etg, ifo=None, channel=None, loadcolumns=None)
Reads the list object data and returns a Sngl{Burst,Inspiral} object with the correct columns seeded, based on the given string object etg.
source code
 
totrigxml(file, table, program=None, params=[])
Write the given lsctables compatible table object to the file object file in xml format.
source code
 
totrigfile(file, table, etg, header=True, columns=None)
Write the lsctables.table to the given file object file, in the standard format for the given etg.
source code
 
fromtrigxml(file, tablename='sngl_inspiral:table', start=None, end=None, columns=None)
Reads a trigger table from the given table from the xml file object file
source code
 
fromtrigfile(file, etg, start=None, end=None, ifo=None, channel=None, tabletype=None, columns=None, virgo=False)
Reads the file object file containing standard columns for the given etg and returns either a corresponding lsctable.
source code
 
fromLALCache(cache, etg, start=None, end=None, columns=None, virgo=False, verbose=False, snr=False)
Extract triggers froa given ETG from all files in a glue.lal.Cache object.
source code
 
daily_ihope_cache(start, end, ifo, cluster=None, filetype='xml', cat=0)
Generates glue.lal.Cache containing CacheEntires for all daily ihope INSPIRAL files for given ifo and clustering between start and end time.
source code
 
omega_online_cache(start, end, channel, mask='DOWNSELECT', check_files_exist=False, **kwargs)
Returns a glue.lal.Cache contatining CacheEntires for all omega online trigger files between the given start and end time for the given ifo.
source code
 
omega_spectrum_online_cache(start, end, ifo, **kwargs)
Returns a glue.lal.Cache contatining CacheEntires for all omega online trigger files between the given start and end time for the given ifo.
source code
 
omega_dq_cache(start, end, ifo)
Arguments:
source code
 
kw_cache(start, end, channel='H1:LSC-DARM_ERR', frequency=None)
Returns a list of KW trigger files between the given start and end time for the given ifo.
source code
 
gps_day_list(start, end)
This script will construct a list of LIGOTimeGPS days encompassing the start and end GPS times.
source code
 
cluster(triggers, params=[('time',1)], rank='snr')
Cluster the lsctable triggers in the each of the pairs (column,width), using the rank column.
source code
 
autocorr(triggers, column='time', timeStep=0.02, timeRange=60)
Compute autocorrelation of lsctable triggers in the each of the pairs (column,width), using the rank column.
source code
 
get_coincs(table1, table2, dt=1, returnsegs=False, timeshift=0)
Returns the table of those entries in table1 whose time is within +-dt of an entry in table2.
source code
 
get_number_coincs(table1, table2, dt=1, timeshift=0, tabletype='trigger')
Returns the numbers of entries in table1 whose time is within +-dt of an entry in table2.
source code
 
coinc_significance_times(gwtrigtime, auxtrigtime, window=1, livetime=None) source code
 
coinc_significance(gwtriggers, auxtriggers, window=1, livetime=None, returnsegs=False) source code
 
get_column(lsctable, column)
Extract column from the given glue.ligolw.table lsctable as numpy array.
source code
 
get(self, parameter)
Extract parameter from given ligolw table row object.
source code
 
veto(self, seglist, inverse=False)
Returns a ligolw table of those triggers outwith the given seglist.
source code
 
vetoed(self, seglist)
Returns the opposite of veto, i.e.
source code
 
fromomegafile(fname, start=None, end=None, ifo=None, channel=None, columns=None, virgo=False)
Load triggers from an Omega format text file into a SnglBurstTable object.
source code
 
fromkwfile(fname, start=None, end=None, ifo=None, channel=None, columns=None)
Load triggers from a KW format text file into a SnglBurstTable object.
source code
 
fromomegaspectrumfile(fname, start=None, end=None, ifo=None, channel=None, columns=None)
Load triggers from an OmegaSpectrum format text file into a SnglBurstTable object.
source code
 
fromomegadqfile(fname, start=None, end=None, ifo=None, channel=None, columns=None)
Load triggers from an OmegaDQ format text file into a SnglBurstTable object.
source code
 
fromhacrfile(fname, start=None, end=None, ifo=None, channel=None, columns=None)
Load triggers from a HACR format text file into a SnglBurstTable object.
source code
 
fromihopefile(fname, start=None, end=None, ifo=None, channel=None, columns=None)
Load triggers from an iHope format CSV file into a SnglInspiralTable object.
source code
 
time_shift(lsctable, dt=1)
Time shift lsctable by time dt.
source code
 
loadtxt(fh, usecols=None)
Stripped down version of numpy.loadtxt to work with empty files.
source code
Variables [hide private]
  __date__ = git_version.date
This module provides a bank of useful functions for manipulating triggers and trigger files for data quality investigations.
  trigsep = re.compile('[\t\s,]+')
  _cchar_regex = re.compile('[-#%<!()_\[\]-{}:;\'\"\ ]')
  _trig_regex = re.compile('(burst|inspiral|ring)', re.I)
  _burst_regex = re.compile('(burst|omega|kleine|kw|cwb|hacr)', ...
  _cbc_regex = re.compile('(ihope|inspiral|cbc)', re.I)
  _ring_regex = re.compile('(ring)', re.I)
Function Details [hide private]

trigger(data, etg, ifo=None, channel=None, loadcolumns=None)

source code 

Reads the list object data and returns a Sngl{Burst,Inspiral} object
with the correct columns seeded, based on the given string object etg.

Arguments:

  data : [ string | list ]
    string or list object containing the data to be parsed.

  etg : [ "ihope" | "kw" | "omega" | "omegadq" ]
    Defines how the data list is understood and parsed, based on the
    standard column layouts (comma-, space-, or tab-delimited) for each ETG.
    "ihope" is read as per the .csv files from ihope_daily. "omegadq"
    is read as per the .txt or .clst produced by the detchar scripts used to
    plot omega online events.

totrigxml(file, table, program=None, params=[])

source code 

Write the given lsctables compatible table object to the file object file
in xml format.

Arguments:

  file: file object
    file object describing output file

  table: lsctable
    glue.ligolw.lsctables compatible table

Keyword Arguments:

  program: string
    name of generating executable, defaults to self
  params: list
    list of (param,type,value) tuples to append to process_params:table

totrigfile(file, table, etg, header=True, columns=None)

source code 

Write the lsctables.table to the given file object file, in the standard format for the given etg.

If columns is given as a list, the standard format will be overwritten and only the given columns will be processed.

fromtrigxml(file, tablename='sngl_inspiral:table', start=None, end=None, columns=None)

source code 

Reads a trigger table from the given table from the xml
file object file

Arguments:

  file : file object

Keyword arguments:

  start : [ float | int | LIGOTimeGPS ]
    GPS start time of requested period
  end : [ float | int | LIGOTimeGPS ]
    GPS end time of requested period
  tablename : string
    name of requested trigger table in xml file, defaults to
    'sngl_inspiral:table'

fromtrigfile(file, etg, start=None, end=None, ifo=None, channel=None, tabletype=None, columns=None, virgo=False)

source code 

Reads the file object file containing standard columns for the given etg and
returns either a corresponding lsctable.

Arguments:

  file : file object
  etg : [ "ihope" | "kw" | "omega" | "omegadq" ]
    string defining how to read text file.
    "ihope" is read as per the .csv files from ihope_daily. "omegadq"
    is read as per the .txt or .clst produced by the detchar scripts used to
    plot omega online events.

Keyword arguments:

  start : [ float | int | LIGOTimeGPS ]
    GPS start time of requested period
  end : [ float | int | LIGOTimeGPS ]
    GPS end time of requested period
  tabletype : type
    Specific ligolw table type for output. By default tables will be
    SnglInspiralTable or SnglBurstTable type depending on ETG

fromLALCache(cache, etg, start=None, end=None, columns=None, virgo=False, verbose=False, snr=False)

source code 

Extract triggers froa given ETG from all files in a glue.lal.Cache object. Returns a glue.ligolw.Table relevant to the given trigger generator etg.

daily_ihope_cache(start, end, ifo, cluster=None, filetype='xml', cat=0)

source code 

Generates glue.lal.Cache containing CacheEntires for all daily ihope
INSPIRAL files for given ifo and clustering between start and end time.

Arguments:

  start : [ float | int | LIGOTimeGPS ]
    GPS start time of requested period
  end : [ float | int | LIGOTimeGPS ]
    GPS end time of requested period
  ifo : [ "H1" | "L1" | "V1" ]
    IFO

Keyword arguments:
  cluster : [ "unclustered" | "100ms" | "30ms" | "16s" ]
    clustering time in human format
  filetype : [ "xml" | "csv" ]
    file format of desired cache contents
  cat : [ 0 | 1 | 2 | 3 | 4 ]
    int veto category of trigger files requested

omega_online_cache(start, end, channel, mask='DOWNSELECT', check_files_exist=False, **kwargs)

source code 

Returns a glue.lal.Cache contatining CacheEntires for all omega online
trigger files between the given start and end time for the given ifo.
For S6 triggers are only available for each IFO on it's own site cluster.

Arguments:

  start : [ float | int | LIGOTimeGPS ]
    GPS start time of requested period
  end : [ float | int | LIGOTimeGPS ]
    GPS end time of requested period
  channel name or ifo : [ "H1" | "L1" | "V1" | "G1:SEI_TCC_STS2x" | ... ]
    IFO

omega_spectrum_online_cache(start, end, ifo, **kwargs)

source code 

Returns a glue.lal.Cache contatining CacheEntires for all omega online
trigger files between the given start and end time for the given ifo.
For S6 triggers are only available for each IFO on it's own site cluster.

Arguments:

  start : [ float | int | LIGOTimeGPS ]
    GPS start time of requested period
  end : [ float | int | LIGOTimeGPS ]
    GPS end time of requested period
  ifo : [ "H1" | "L1" | "V1" ]
    IFO

omega_dq_cache(start, end, ifo)

source code 

Arguments:

  start : [ float | int | LIGOTimeGPS ]
    GPS start time of requested period
  end : [ float | int | LIGOTimeGPS ]
    GPS end time of requested period
  ifo : [ "H1" | "L1" | "V1" ]
    IFO

kw_cache(start, end, channel='H1:LSC-DARM_ERR', frequency=None)

source code 

Returns a list of KW trigger files between the given start and end
time for the given ifo. For S6 triggers are only available for each IFO on
it's own site cluster.

Arguments:

  start : [ float | int | LIGOTimeGPS ]
    GPS start time of requested period
  end : [ float | int | LIGOTimeGPS ]
    GPS end time of requested period
  ifo : [ "H1" | "L1" | "V1" ]
    IFO

cluster(triggers, params=[('time',1)], rank='snr')

source code 

Cluster the lsctable triggers in the each of the pairs (column,width),
using the rank column.

Arguments:

  triggers: glue.ligowl.Table
    Table containing trigger columns for clustering

  params : list
    List object containing (column,width) pairs. Clustering is nested in
    order

  rank: string
    Column by which to rank clusters
  test

autocorr(triggers, column='time', timeStep=0.02, timeRange=60)

source code 

Compute autocorrelation of lsctable triggers in the each of the pairs
(column,width), using the rank column.

Arguments:

  triggers: glue.ligowl.Table
    Table containing trigger columns for clustering

  column:
    On which trigger column to auto-correlate, almost always time

  timeStep:
    Step (bin width) for the autocorrelation

  timeRange:
    Longest time to consider for autocorrelation
    

get_column(lsctable, column)

source code 

Extract column from the given glue.ligolw.table lsctable as numpy array. Tries to use a 'get_col() function if available, otherwise uses getColumnByName(), treating 'time' as a special case for the known Burst/Inspiral/Ringdown tables.

veto(self, seglist, inverse=False)

source code 

Returns a ligolw table of those triggers outwith the given seglist. If inverse=True is given, the opposite is returned, i.e. those triggers within the given seglist.

vetoed(self, seglist)

source code 

Returns the opposite of veto, i.e. those triggers that lie within the given seglist.

fromomegafile(fname, start=None, end=None, ifo=None, channel=None, columns=None, virgo=False)

source code 

Load triggers from an Omega format text file into a SnglBurstTable object.
Use start and end to restrict the returned triggers, and give ifo and
channel to fill those columns in the table.

If columns is given as a list, only those columns in the table will be
filled. This is advisable to speed up future operations on this table.

Arguments :

  fname : file or str
    file object or filename path to read with numpy.loadtext

Keyword arguments :

  start : float
    minimum peak time for returned triggers
  end : float
    maximum peak time for returned triggers
  ifo : str
    name of IFO to fill in table
  channel : str
    name of channel to fill in table
  columns : iterable
    list of columnnames to populate in table

fromkwfile(fname, start=None, end=None, ifo=None, channel=None, columns=None)

source code 

Load triggers from a KW format text file into a SnglBurstTable object.
Use start and end to restrict the returned triggers, and give ifo and
channel to fill those columns in the table.

If columns is given as a list, only those columns in the table will be
filled. This is advisable to speed up future operations on this table.

Arguments :

  fname : file or str
    file object or filename path to read with numpy.loadtext

Keyword arguments :

  start : float
    minimum peak time for returned triggers
  end : float
    maximum peak time for returned triggers
  ifo : str
    name of IFO to fill in table
  channel : str
    name of channel to fill in table
  columns : iterable
    list of columnnames to populate in table

fromomegaspectrumfile(fname, start=None, end=None, ifo=None, channel=None, columns=None)

source code 

Load triggers from an OmegaSpectrum format text file into a SnglBurstTable
object.
Use start and end to restrict the returned triggers, and give ifo and
channel to fill those columns in the table.

If columns is given as a list, only those columns in the table will be
filled. This is advisable to speed up future operations on this table.

Arguments :

  fname : file or str
    file object or filename path to read with numpy.loadtext

Keyword arguments :

  start : float
    minimum peak time for returned triggers
  end : float
    maximum peak time for returned triggers
  ifo : str
    name of IFO to fill in table
  channel : str
    name of channel to fill in table
  columns : iterable
    list of columnnames to populate in table

fromomegadqfile(fname, start=None, end=None, ifo=None, channel=None, columns=None)

source code 

Load triggers from an OmegaDQ format text file into a SnglBurstTable object.
Use start and end to restrict the returned triggers, and give ifo and
channel to fill those columns in the table.

If columns is given as a list, only those columns in the table will be
filled. This is advisable to speed up future operations on this table.

Arguments :

  fname : file or str
    file object or filename path to read with numpy.loadtext

Keyword arguments :

  start : float
    minimum peak time for returned triggers
  end : float
    maximum peak time for returned triggers
  ifo : str
    name of IFO to fill in table
  channel : str
    name of channel to fill in table
  columns : iterable
    list of columnnames to populate in table

fromhacrfile(fname, start=None, end=None, ifo=None, channel=None, columns=None)

source code 

Load triggers from a HACR format text file into a SnglBurstTable object.
Use start and end to restrict the returned triggers, and give ifo and
channel to fill those columns in the table.

If columns is given as a list, only those columns in the table will be
filled. This is advisable to speed up future operations on this table.

Arguments :

  fname : file or str
    file object or filename path to read with numpy.loadtext

Keyword arguments :

  start : float
    minimum peak time for returned triggers
  end : float
    maximum peak time for returned triggers
  ifo : str
    name of IFO to fill in table
  channel : str
    name of channel to fill in table
  columns : iterable
    list of columnnames to populate in table

fromihopefile(fname, start=None, end=None, ifo=None, channel=None, columns=None)

source code 

Load triggers from an iHope format CSV file into a SnglInspiralTable object.
Use start and end to restrict the returned triggers, and give ifo and
channel to fill those columns in the table.

If columns is given as a list, only those columns in the table will be
filled. This is advisable to speed up future operations on this table.

Arguments :

  fname : file or str
    file object or filename path to read with numpy.loadtext

Keyword arguments :

  start : float
    minimum peak time for returned triggers
  end : float
    maximum peak time for returned triggers
  ifo : str
    name of IFO to fill in table
  channel : str
    name of channel to fill in table
  columns : iterable
    list of columnnames to populate in table


Variables Details [hide private]

_burst_regex

Value:
re.compile('(burst|omega|kleine|kw|cwb|hacr)', re.I)