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:
flagstr

state flag to check

gpstimefloat

GPS time of required data

durationfloat

duration (in seconds) of required data

padfloat

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

Returns:
checkbool

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:
channelstr or list

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

startfloat

GPS start time of requested data

endfloat

GPS end time of requested data

frametypestr, optional

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

sourcestr, list, optional

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

nprocint, optional

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

verbosebool, optional

print verbose output about NDS progress, default: False

**kwargsdict, optional

additional keyword arguments to read, get, or find_urls

Returns:
dataTimeSeries 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:
channelslist of str

list of requested channels

gwfcachelist of str

list of paths to .gwf files

Returns:
keeplist 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.