Skip to content

Implement a TimeSeries.mask method

Duncan Macleod requested to merge github/fork/alurban/mask into master

Created by: alurban

This PR implements a new method, TimeSeries.mask, that masks away portions of a given timeseries which fall within of a user-defined deadtime. This can be given as either:

  • A SegmentList custom-defining the deadtime
  • The name of a data-quality flag to be queried for

The former will supersede the latter if both are given, and in the second case, the DataQualityFlag.isgood attribute is used to determine whether the given flag defines livetime or deadtime.

This method also optionally tapers away data at segment boundaries, with the taper length controlled by the user. The following corner cases are explicitly handled:

  • The edges of the original TimeSeries will not be tapered
  • Any livetime shorter than twice the taper length will get a subset of the tapering window, chosen so that (1) the taper length remains fixed by the user and (2) the ramp-up-ramp-down across that segment is still continuous. This reproduces the existing behavior of TimeSeries.gate

Lastly, because this PR effectively refactors some of the functionality in TimeSeries.gate, I have also simplified that method so that it invokes TimeSeries.mask.

This fixes #1237 (closed).

cc @duncanmmacleod, @siddharth101

Merge request reports