pycbc.frame package

Submodules

pycbc.frame.frame module

This modules contains functions for reading in data from frame files or caches

pycbc.frame.frame.datafind_connection(server=None)[source]

Return a connection to the datafind server

Parameters

server ({SERVER:PORT, string}, optional) – A string representation of the server and port. The port may be ommitted.

Returns

The open connection to the datafind server.

Return type

connection

pycbc.frame.frame.frame_paths(frame_type, start_time, end_time, server=None, url_type='file')[source]

Return the paths to a span of frame files

Parameters
  • frame_type (string) – The string representation of the frame type (ex. ‘H1_ER_C00_L1’)

  • start_time (int) – The start time that we need the frames to span.

  • end_time (int) – The end time that we need the frames to span.

  • server ({None, SERVER:PORT string}, optional) – Optional string to specify the datafind server to use. By default an attempt is made to use a local datafind server.

  • url_type (string) – Returns only frame URLs with a particular scheme or head such as “file” or “gsiftp”. Default is “file”, which queries locally stored frames. Option can be disabled if set to None.

Returns

paths – The list of paths to the frame files.

Return type

list of paths

Examples

>>> paths = frame_paths('H1_LDAS_C02_L2', 968995968, 968995968+2048)
pycbc.frame.frame.query_and_read_frame(frame_type, channels, start_time, end_time, sieve=None, check_integrity=False)[source]

Read time series from frame data.

Query for the locatin of physical frames matching the frame type. Return a time series containing the channel between the given start and end times.

Parameters
  • frame_type (string) – The type of frame file that we are looking for.

  • channels (string or list of strings) – Either a string that contains the channel name or a list of channel name strings.

  • start_time (LIGOTimeGPS or int) – The gps start time of the time series. Defaults to reading from the beginning of the available frame(s).

  • end_time (LIGOTimeGPS or int) – The gps end time of the time series. Defaults to the end of the frame.

  • sieve (string, optional) – Selects only frames where the frame URL matches the regular expression sieve

  • check_integrity (boolean) – Do an expensive checksum of the file before returning.

Returns

Frame Data – A TimeSeries or a list of TimeSeries, corresponding to the data from the frame file/cache for a given channel or channels.

Return type

TimeSeries or list of TimeSeries

Examples

>>> ts = query_and_read_frame('H1_LDAS_C02_L2', 'H1:LDAS-STRAIN',
>>>                               968995968, 968995968+2048)
pycbc.frame.frame.read_frame(location, channels, start_time=None, end_time=None, duration=None, check_integrity=False, sieve=None)[source]

Read time series from frame data.

Using the location, which can either be a frame file “.gwf” or a frame cache “.gwf”, read in the data for the given channel(s) and output as a TimeSeries or list of TimeSeries.

Parameters
  • location (string) – A source of gravitational wave frames. Either a frame filename (can include pattern), a list of frame files, or frame cache file.

  • channels (string or list of strings) – Either a string that contains the channel name or a list of channel name strings.

  • start_time ({None, LIGOTimeGPS}, optional) – The gps start time of the time series. Defaults to reading from the beginning of the available frame(s).

  • end_time ({None, LIGOTimeGPS}, optional) – The gps end time of the time series. Defaults to the end of the frame. Note, this argument is incompatible with duration.

  • duration ({None, float}, optional) – The amount of data to read in seconds. Note, this argument is incompatible with end.

  • check_integrity ({True, bool}, optional) – Test the frame files for internal integrity.

  • sieve (string, optional) – Selects only frames where the frame URL matches the regular expression sieve

Returns

Frame Data – A TimeSeries or a list of TimeSeries, corresponding to the data from the frame file/cache for a given channel or channels.

Return type

TimeSeries or list of TimeSeries

pycbc.frame.losc module

This modules contains functions for getting data from the LOSC

pycbc.frame.losc.get_run(time, ifo=None)[source]

Return the run name for a given time

Parameters
  • time (int) – The gps time

  • ifo (str) – The ifo prefix string. Optional and normally unused, except for some special times where data releases were made for a single detector under unusual circumstances. For example, to get the data around GW170608 in the Hanford detector.

pycbc.frame.losc.losc_frame_json(ifo, start_time, end_time)[source]

Get the information about the public data files in a duration of time

Parameters
  • ifo (str) – The name of the IFO to find the information about.

  • start_time (int) – The gps time in GPS seconds

  • end_time (int) – The end time in GPS seconds

Returns

info – A dictionary containing information about the files that span the requested times.

Return type

dict

pycbc.frame.losc.losc_frame_urls(ifo, start_time, end_time)[source]

Get a list of urls to losc frame files

Parameters
  • ifo (str) – The name of the IFO to find the information about.

  • start_time (int) – The gps time in GPS seconds

  • end_time (int) – The end time in GPS seconds

Returns

frame_files – A dictionary containing information about the files that span the requested times.

Return type

list

pycbc.frame.losc.read_frame_losc(channels, start_time, end_time)[source]

Read channels from losc data

Parameters
  • channels (str or list) – The channel name to read or list of channel names.

  • start_time (int) – The gps time in GPS seconds

  • end_time (int) – The end time in GPS seconds

Returns

ts – Returns a timeseries or list of timeseries with the requested data.

Return type

TimeSeries

pycbc.frame.losc.read_strain_losc(ifo, start_time, end_time)[source]

Get the strain data from the LOSC data

Parameters
  • ifo (str) – The name of the IFO to read data for. Ex. ‘H1’, ‘L1’, ‘V1’

  • start_time (int) – The gps time in GPS seconds

  • end_time (int) – The end time in GPS seconds

Returns

ts – Returns a timeseries with the strain data.

Return type

TimeSeries

pycbc.frame.store module

This modules contains functions for reading in data from hdf stores

pycbc.frame.store.read_store(fname, channel, start_time, end_time)[source]

Read time series data from hdf store

Parameters
  • fname (str) – Name of hdf store file

  • channel (str) – Channel name to read

  • start_time (int) – GPS time to start reading from

  • end_time (int) – GPS time to end time series

Returns

ts – Time series containing the requested data

Return type

pycbc.types.TimeSeries

Module contents

pycbc.frame.flag_names_to_bitmask(flags)[source]

Takes a list of flag names corresponding to bits in a status channel and returns the corresponding bit mask.