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

Module dqFrameUtils

source code


Author: Duncan Macleod <duncan.macleod@ligo.org>

Classes [hide private]
  Channel
The Channel class defines objects to represent LIGO data channels.
  ChannelList
Wrapper for a list of Channel objects, with helper functions.
  FrameCacheEntry
An object representing one line in a frame cache file.
  FrameCache
An object representing a frame cache file.
Functions [hide private]
 
fromframefile(filename, channel, start=None, end=None)
Extract 1D data for given channel from the GWF format frame filename.
source code
 
toframefile(filename, channel, data, start, dx, **frargs)
Write numpy array data to GWF frame file using the given arguments.
source code
 
fromLALCache(cache, channel, start=None, end=None, verbose=False)
Extract data for given channel from glue.lal.Cache object cache.
source code
 
grab_data(start, end, channel, type, nds=False, dmt=False, verbose=False)
This function will return the frame data for the given channel of the given type in the given [start,end] time range and will construct a gps time vector to go with it.
source code
 
get_cache(start, end, ifo, ftype, framecache=False, server=None, verbose=False)
Queries the LSC datafind server and returns a glue.lal.Cache object containing the frame file paths in the given GPS (start, end) interval for the given ifo and type (can be lists).
source code
 
get_latest_frame(ifo, ftype)
Returns the latest frame available in the LSC datafind server for the given ifo and frame type.
source code
 
find_ifos()
Query the LSC datafind server and return a list of sites for which data is available.
source code
 
find_types(ifo=[], ftype=[], search='standard')
This function will return a valid list of LIGO frame types given the list of type strings.
source code
 
get_channels(framefile)
Extract the channels held in a frame file.
source code
 
find_channels(name=[], ftype=[], ifo=[], not_name=[], not_ftype=[], exact_match=False, time=None, unique=False)
Returns a ChannelList containing Channels for all data channels matching the given attributes from frames matching the given GPS time (defaults to now).
source code
 
dmt_cache(start, end, ifo, type, framecache=False)
This function will return a list of frame files in the given start and stop time interval for the give IFO using the given DMT frame type.
source code
 
FrameCachetoLALCache(fcache) source code
 
LALCachetoFrameCache(lcache) source code
 
query_datafind_server(url, server=None) source code
 
_get_grid_proxy()
Returns paths for X509 certificate and proxy if available.
source code
 
_verify_response(HTTPresponse)
Test response of the server to the query and raise the relevant exception if necessary.
source code
 
_find_datafind_server()
Find the LSC datafind server from the LIGO_DATAFIND_SERVER environment variable and raise exception if not found
source code
 
parse_composite_channels(superchannel, ifo='G1', frame_type='R')
Seperate GEO superchannels into seperate channel names.
source code
 
separate_composite_data(data, N=1)
Seperate GEO superchannels data into array of data for each of the composite channels.
source code
 
get_control_channel(cache, superchannel, channel, start=None, end=None, ifo='G1', frame_type='R')
Get GEO control channel data for a single channel from a given superchannel, control channels are sampled at 1Hz.
source code
Variables [hide private]
  __date__ = git_version.date
This module provides frame manipulation routines for use in data quality investigations, and cache manipulation routines.
Function Details [hide private]

fromframefile(filename, channel, start=None, end=None)

source code 

Extract 1D data for given channel from the GWF format frame filename.
Returns (x, data) pair of numpy arrays (x is array of times or frequencies.

Arguments:

  filename : string
    path to GWF frame file
  channel : string
    channel name to extract

Keyword arguments:

  start : float
    GPS start time (s) or minimum frequency (Hz) to return
  end : float
    GPS end time (s) or maximum frequency (Hz) to return

toframefile(filename, channel, data, start, dx, **frargs)

source code 

Write numpy array data to GWF frame file using the given arguments.

Arguments:

  filename : string
    name of file to write
  channel : string
    name of channel to write
  data : numpy.array
    array of data to write
  start : float
    GPS start time (s) or minimum frequency (Hz)
  dx : float
    GPS time step (s) or frequency step (Hz)

Unnamed arguments are held in frargs. For usage, see documentation for
pylal.Fr.frputvect.

fromLALCache(cache, channel, start=None, end=None, verbose=False)

source code 

Extract data for given channel from glue.lal.Cache object cache. Returns 
(time, data) pair of numpy arrays.

Arguments:

  cache : glue.lal.Cache
    Cache list of frame files to read
  channel : string
    channel name to extract

Keyword arguments:

  start : float
    GPS start time (s) or minimum frequency (Hz) to return
  end : float
    GPS end time (s) or maximum frequency (Hz) to return

grab_data(start, end, channel, type, nds=False, dmt=False, verbose=False)

source code 

This function will return the frame data for the given channel of the given
type in the given [start,end] time range and will construct a gps time
vector to go with it. The nds option is not yet supported, and the dmt
option will return data for dmt channels in frames not available on the
datafind server.

>>> grab_data(997315215, 997315225, 'G1:DER_DATA_QUALITY', 'G1_RDS_C01_L3')
(array([  9.97315215e+08,   9.97315216e+08,   9.97315217e+08,
         9.97315218e+08,   9.97315219e+08,   9.97315220e+08,
         9.97315221e+08,   9.97315222e+08,   9.97315223e+08,
         9.97315224e+08]),
 array([ 256.,  256.,  256.,  256.,  256.,  256.,  256.,  256.,  256.,
         256.]))

Arguments:

  start : float
    GPS start time (s).
  end : float
    GPS end time (s).
  channel : string
    channel name to extract, e.g. 'G1:DER_DATA_H'.
  type : string
    frame data type to use, e.g. 'G1_RDS_C01_L3'.

Keyword arguments:

  nds : [ True | False ]
    use NDS connection to data server (UNSUPPORTED).
  dmt : [ True | False ]
    frame type is DMT product (DMT data not found by datafind server).

get_cache(start, end, ifo, ftype, framecache=False, server=None, verbose=False)

source code 

Queries the LSC datafind server and returns a glue.lal.Cache object
containing the frame file paths in the given GPS (start, end) interval
for the given ifo and type (can be lists).

framecache=True returns a pylal.dq.dqFrameUTils.FrameCache object in stead.

Arguments:

  start : float
    GPS start time (s).
  end : float
    GPS end time (s).
  ifo : [ string | list ]
    ifo (or list of) to find, e.g. 'G1'.
  ftype : [ string | list ]
    frame data type (or list of) to find, e.g. 'G1_RDS_C01_L3'.

get_latest_frame(ifo, ftype)

source code 

Returns the latest frame available in the LSC datafind server for the given
ifo and frame type.

Arguments:

  ifo : string
    observatory to find
  ftype : string
    frame data type to find

find_ifos()

source code 

Query the LSC datafind server and return a list of sites for which data is available. Does not differentiate between H1 and H2.

Example:

>>> find_ifos()
['G', 'H', 'L', 'V']

find_types(ifo=[], ftype=[], search='standard')

source code 

This function will return a valid list of LIGO frame types given the list of
type strings. The search option defines the breadth of the search, to speed
up the search, the following search options are supported:
'standard','short','full'. 

The 'R', 'T', and 'M' (raw, raw second trends, and raw minute trends) are 
treated as special cases, so as not to return all types containing those 
letters. 

Example:

>>>find_types(ftype='H1_RDS')
['H1_RDS_C01_LX',
 'H1_RDS_C02_LX',
 'H1_RDS_C03_L1',
 'H1_RDS_C03_L2',
 'H1_RDS_C03_L2_ET',
 'H1_RDS_C03_L2_ET2',
 'H1_RDS_C03_L2_ET30',
 'H1_RDS_C04_LX',
 'H1_RDS_R_L1',
 'H1_RDS_R_L3',
 'H1_RDS_R_L4']

>>>find_types(ftype=['H1_RDS','R'],search='short')
['H1_RDS_R_L1', 'H1_RDS_R_L3', 'H1_RDS_R_L4', 'R']

Keyword arguments:

  ifo : [ string | list ]
    ifo (or list of) to find, e.g. 'G1'.
  ftype : [ string | list ]
    frame data type (or list of) to find, e.g. 'G1_RDS_C01_L3'.
  search : string
    descriptor of how deep to search for frame type.

find_channels(name=[], ftype=[], ifo=[], not_name=[], not_ftype=[], exact_match=False, time=None, unique=False)

source code 

Returns a ChannelList containing Channels for all data channels matching
the given attributes from frames matching the given GPS time (defaults to
now).

Keyword arguments:

  name : [ string | list ]
    channel name (or list of) to match in search. Can be part of name,
    e.g. ['STRAIN', 'DARM_ERR']
  ftype : [ string | list ]
    frame data type (or list of) to find, e.g. 'G1_RDS_C01_L3'.
  ifo : [ string | list ]
    ifo (or list of) to find, e.g. 'G1'.
  not_name : [ string | list ]
    channel name (or list of) to negatively match in search. Can be part of
    name, e.g. 'ETMY_EXC_DAQ'
  not_ftype : [ string | list ]
    frame data type (or list of) to remove from search.
  exact_match : [ True | False]
    require complete match with given name list, not just partial match.
  time : float
    GPS time to which to restrict search. Data transfer latency means that
    the very latest data is not always available, best to give a 'recent'
    time.
  unique : [ True | False ]
    return unique list of channels from different types (since the same
    channel can exist in multiple types).

dmt_cache(start, end, ifo, type, framecache=False)

source code 

This function will return a list of frame files in the given start and stop 
time interval for the give IFO using the given DMT frame type. This is
required if ligo_data_find will not return the dmt frames.

Example:

>>>dmt_cache(960000000,960010000,'H1','LockLoss_H1')
['/archive/frames/dmt/LHO/LockLoss_H1/H-M-960/H-LockLoss_H1_M-960001200-3600.gwf',
 '/archive/frames/dmt/LHO/LockLoss_H1/H-M-960/H-LockLoss_H1_M-960004800-3600.gwf']