Loading [MathJax]/extensions/TeX/AMSsymbols.js
LALFrame 3.0.7.1-8a6b96f
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
lalframe.frread Namespace Reference

Functions

def read_timeseries (source, channel, start=None, duration=None, datatype=None, verbose=False)
 Read a TimeSeries of channel data from a source. More...
 
def read_channel_from_stream (stream, channel, start, duration, datatype=None)
 Read the TimeSeries of a single channel from an open stream. More...
 
def get_stream_length (stream, channel)
 Find the number of samples represented in a frame stream. More...
 
def get_stream_duration (stream)
 Find the duration of time stored in a frame stream. More...
 

Function Documentation

◆ read_timeseries()

def lalframe.frread.read_timeseries (   source,
  channel,
  start = None,
  duration = None,
  datatype = None,
  verbose = False 
)

Read a TimeSeries of channel data from a source.

Acceptable sources are:

  • a .gwf-format framefile (string ending in '.gwf')
  • a LAL-format cache file (string ending in '.lcf' or '.cache')
  • a lal.Cache object (either from SWIG-LAL or GLUE)
Parameters
sourceinput source, see above for details
channelstring name of channel, e.g. 'L1:LDAS-STRAIN', or a list of channel names
startLIGOTimeGPS start time for output TimeSeries
durationfloat duration (seconds) for output TimeSeries
datatypedatatype, either an integer from the LALTYPECODE, a string matchine the corresponding type, or a numpy dtype
verboseprint verbose output, default: False
Returns
a TimeSeries of the imported data

Example 1, reading from a frame file:

>>> out = read_timeseries('L-R-1061499968-32.gwf', 'L1:PSL-ISS_PDB_OUT_DQ')
>>> print(type(out))
<type 'REAL4TimeSeries'>
>>> print(out.name, float(out.epoch), out.deltaT)
('L1:PSL-ISS_PDB_OUT_DQ', 1061499968.0, 3.0517578125e-05)
def read_timeseries(source, channel, start=None, duration=None, datatype=None, verbose=False)
Read a TimeSeries of channel data from a source.
Definition: frread.py:121

Example 2, reading from a cache:

>>> import lal
>>> cache = lal.CacheGlob('/scratch/ER4/L0/L1/L-R-10614', 'L-R-1061499968*')
>>> out = frread.read_timeseries(cache, 'L1:PSL-ISS_PDB_OUT_DQ')
>>> print(out.name, float(out.epoch), out.deltaT)
('L1:PSL-ISS_PDB_OUT_DQ', 1061499968.0, 3.0517578125e-05)

Example 3, restricting data input:

>>> out = read_timeseries('L-R-1061499968-32.gwf', 'L1:PSL-ISS_PDB_OUT_DQ',
start=1061499970, duration=10)
>>> print(out.name, float(out.epoch), out.data.length)
('L1:PSL-ISS_PDB_OUT_DQ', 1061499970.0, 327680)

Example 4, specifying data type:

>>> out = read_timeseries('L-R-1061499968-32.gwf',
'L1:PSL-ODC_CHANNEL_OUT_DQ')
>>> print(type(out), out.data.data[:4])
(<type 'REAL4TimeSeries'>,
array([ 4259839., 4259839., 4259839., 4259839.], dtype=float32))
>>> out = read_timeseries('L-R-1061499968-32.gwf',
'L1:PSL-ODC_CHANNEL_OUT_DQ', datatype='int8')
>>> print(type(out), out.data.data[:4])
(<type 'INT8TimeSeries'>, array([4259839, 4259839, 4259839, 4259839]))

Definition at line 120 of file frread.py.

◆ read_channel_from_stream()

def lalframe.frread.read_channel_from_stream (   stream,
  channel,
  start,
  duration,
  datatype = None 
)

Read the TimeSeries of a single channel from an open stream.

Definition at line 255 of file frread.py.

◆ get_stream_length()

def lalframe.frread.get_stream_length (   stream,
  channel 
)

Find the number of samples represented in a frame stream.

Parameters
streamXLALFrStream() of data to measure
channelstring name of channel to measure
Returns
the integer length of the data for this channel

Definition at line 289 of file frread.py.

◆ get_stream_duration()

def lalframe.frread.get_stream_duration (   stream)

Find the duration of time stored in a frame stream.

Parameters
streamXLALFrStream() of data to measure
Returns
the float duration (seconds) of the data for this channel

Definition at line 312 of file frread.py.