Implement segment masking for TimeSeries objects
Created by: alurban
It would be reasonably straightforward to let users mask out unwanted segments (e.g., non-observing-mode data) from their TimeSeries
, something like:
import numpy
from gwpy.segments import DataQualityFlag
from gwpy.timeseries import TimeSeries
# retrieve segment and timeseries data
flag = DataQualityFlag.query(...).active
data = TimeSeries.read(...)
# mask out non-observing time
indices = numpy.nonzero([x not in flag for x in data.times.value])
data.value[indices] = numpy.nan
(Of course the actual method should be more careful than to call data.times
, but this is just an example.)