gwdetchar.io.datafind module

Data discovery utilities

gwdetchar.io.datafind.check_flag(flag, gpstime, duration, pad)[source]

Check that a state flag is active during an entire analysis segment

Parameters:

flag : str

state flag to check

gpstime : float

GPS time of required data

duration : float

duration (in seconds) of required data

pad : float

amount of extra data to read in at the start and end for filtering

Returns:

check : bool

Boolean switch to pass (True) or fail (False) depending on whether the given flag is active

gwdetchar.io.datafind.get_data(channel, start, end, frametype=None, source=None, nproc=1, verbose=False, **kwargs)[source]

Retrieve data for given channels within a certain time range

Parameters:

channel : str or list

either a single channel name, or a list of channel names

start : float

GPS start time of requested data

end : float

GPS end time of requested data

frametype : str, optional

name of frametype in which channel(s) are stored, default: None

source : str, list, optional

path(s) of a LAL-format cache file or individual data file, default: None

nproc : int, optional

number of parallel processes to use, uses serial process by default

verbose : bool, optional

print verbose output about NDS progress, default: False

**kwargs : dict, optional

additional keyword arguments to read or get

Returns:

data : TimeSeries or TimeSeriesDict

collection of data for the requested channels in the requested time range

See also

remove_missing_channels
a utility that removes channels missing from the frame archive
gwpy.timeseries.TimeSeries.get
the underlying method to read data over an NDS server
gwpy.timeseries.TimeSeries.read
the underlying method to read data from local files

Notes

If channel is a str, then a TimeSeries object will be returned, else the result is a TimeSeriesDict.

The frametype argument should be used to read from archived frame files, while source should be used to read from a local cache or specific data file. If either fails, or if neither is passed, this function will attempt to get data over an NDS server.

If frametype is used to read from the archive, any channels missing from the first or last frame file in the requested time range will be ignored.

gwdetchar.io.datafind.remove_missing_channels(channels, gwfcache)[source]

Find and remove channels from a given list that are not available in a given cache of frame files

Parameters:

channels : list of str

list of requested channels

gwfcache : list of str

list of paths to .gwf files

Returns:

keep : list of str

list of common channels found in the first and last files in the cache

See also

gwpy.io.gwf.iter_channel_names
for the utility used to identify frame contents

Notes

As a shorthand, this utility checks channels against only the first and last frame files in gwfcache. This saves time and memory by not loading tables of contents for large numbers of very long data files.

For every channel requested that is not available in gwfcache, a UserWarning will be raised.