gwsumm.data.timeseries module

Utilities for data handling and display

gwsumm.data.timeseries.add_timeseries(timeseries, key=None, coalesce=True)[source]

Add a TimeSeries to the global memory cache

Parameters:
timeseriesTimeSeries or StateVector

the data series to add

keystr, optional

the key with which to store these data, defaults to the ~gwpy.timeseries.TimeSeries.name of the series

coalescebool, optional

coalesce contiguous series after adding, defaults to True

gwsumm.data.timeseries.all_adc(cache)[source]

Returns True if all cache entries point to GWF file known to contain only ADC channels

This is useful to set type=’adc’ when reading with frameCPP, which can greatly speed things up.

gwsumm.data.timeseries.exclude_short_trend_segments(segments, ifo, frametype)[source]

Remove segments from a list shorter than 1 trend sample

gwsumm.data.timeseries.filter_timeseries(ts, filt)[source]

Filter a TimeSeris using a function or a ZPK definition.

gwsumm.data.timeseries.find_best_frames(ifo, frametype, start, end, **kwargs)[source]

Find frames for the given type, replacing with a better type if needed

gwsumm.data.timeseries.find_frame_type(channel)[source]

Find the frametype associated with the given channel

If the input channel has a frametype attribute, that will be used, otherwise the frametype will be guessed based on the channel name and any trend options given

gwsumm.data.timeseries.find_frames(ifo, frametype, gpsstart, gpsend, config=<GWSummConfigParser()>, urltype='file', gaps='warn', onerror='raise')[source]

Query the datafind server for GWF files for the given type

Parameters:
ifostr

prefix for the IFO of interest (either one or two characters)

frametypestr

name of the frametype to find

gpsstartint

GPS start time of the query

gpsendint

GPS end time of the query

config~ConfigParser.ConfigParser, optional

configuration with [datafind] section containing server specification, otherwise taken from the environment

urltypestr, optional

what type of file paths to return, default: file

gapsstr, optional

what to do when gaps are detected, one of

  • ignore : do nothing

  • warn : display the existence of gaps but carry on

  • raise : raise an exception

onerrorstr, optional

what to do when the gwdatafind query itself fails, same options as for gaps

Returns:
cachelist of str

a list of file paths pointing at GWF files matching the request

gwsumm.data.timeseries.frame_trend_type(ifo, frametype)[source]

Returns the trend type of based on the given frametype

gwsumm.data.timeseries.get_channel_type(name)[source]

Returns the probable type of this channel, based on the name

Parameters:
namestr

the name of the channel

Returns:
typestr

one of 'adc', 'proc', or 'sim'

gwsumm.data.timeseries.get_timeseries(channel, segments, config=None, cache=None, query=True, nds=None, nproc=1, frametype=None, statevector=False, return_=True, datafind_error='raise', **ioargs)[source]

Retrieve data for channel

Parameters:
channelstr or ~gwpy.detector.Channel

the name of the channel you want

segments~gwpy.segments.SegmentList

the data segments of interest

config~gwsumm.config.GWSummConfigParser

the configuration for this analysis

cache~glue.lal.Cache or list of str

a cache of data files from which to read

querybool, optional

whether you want to retrieve new data from the source if it hasn’t been loaded already

ndsbool, optional

whether to try and use NDS2 for data access, default is to guess based on other arguments and the environment

nprocint, optional

number of parallel cores to use for file reading, default: 1

frametypestr, optional`

the frametype of the target channels, if not given, this will be guessed based on the channel name(s)

statevectorbool, optional

whether you want to load ~gwpy.timeseries.StateVector rather than ~gwpy.timeseries.TimeSeries data

datafind_errorstr, optional

what to do in the event of a datafind error, one of

  • ‘raise’ : stop immediately upon error

  • ‘warn’ : print warning and continue as if no frames had been found

  • ‘ignore’ : print nothing and continue with no frames

return_bool, optional

whether you actually want anything returned to you, or you are just calling this function to load data for use later

**ioargs

all other keyword arguments are passed to the relevant data reading method (either ~gwpy.timeseries.TimeSeries.read or ~gwpy.timeseries.TimeSeries.fetch or state-vector equivalents)

Returns:
data~gwpy.timeseries.TimeSeriesList

a list of TimeSeries

gwsumm.data.timeseries.get_timeseries_dict(channels, segments, config=<GWSummConfigParser()>, cache=None, query=True, nds=None, nproc=1, frametype=None, statevector=False, return_=True, datafind_error='raise', **ioargs)[source]

Retrieve the data for a set of channels

Parameters:
channelslist of str or ~gwpy.detector.Channel

the channels you want to get

segments~gwpy.segments.SegmentList

the data segments of interest

config~gwsumm.config.GWSummConfigParser

the configuration for this analysis

querybool, optional

whether you want to retrieve new data from the source if it hasn’t been loaded already

ndsbool, optional

whether to try and use NDS2 for data access, default is to guess based on other arguments and the environment

nprocint, optional

number of parallel cores to use for file reading, default: 1

frametypestr, optional`

the frametype of the target channels, if not given, this will be guessed based on the channel name(s)

statevectorbool, optional

whether you want to load ~gwpy.timeseries.StateVector rather than ~gwpy.timeseries.TimeSeries data

datafind_errorstr, optional

what to do in the event of a datafind error, one of

  • ‘raise’ : stop immediately upon error

  • ‘warn’ : print warning and continue as if no frames had been found

  • ‘ignore’ : print nothing and continue with no frames

return_bool, optional

whether you actually want anything returned to you, or you are just calling this function to load data for use later

**ioargs

all other keyword arguments are passed to the relevant data reading method (either ~gwpy.timeseries.TimeSeriesDict.read or ~gwpy.timeseries.TimeSeriesDict.fetch or state-vector equivalents)

Returns:
datalistdict of ~gwpy.timeseries.TimeSeriesList

a set of (channel, TimeSeriesList) pairs

gwsumm.data.timeseries.locate_data(channels, segments, list_class=<class 'gwpy.timeseries.timeseries.TimeSeriesList'>)[source]

Find and return available (already loaded) data

gwsumm.data.timeseries.resample_timeseries_dict(tsd, nproc=1, **sampling_dict)[source]

Resample a TimeSeriesDict

Parameters:
tsd~gwpy.timeseries.TimeSeriesDict

the input dict to resample

nprocint, optional

the number of parallel processes to use

**sampling_dict

<name>=<sampling frequency> pairs defining new sampling frequencies for keys of tsd

Returns:
resampled~gwpy.timeseries.TimeSeriesDict

a new dict with the keys from tsd and resampled values, if that key was included in sampling_dict, or the original value

gwsumm.data.timeseries.sieve_cache(cache, ifo=None, tag=None, segment=None)[source]