Glitch handling

Glitch interface

Module with interface for glitch data source

This provides the glitch information needed in Instrument class. It does not support chunked data processing directly, but the interface is written to suit the needs of higher level framworks for this purpose. The main interface is called GlitchSource. For each glitch injection point, it provides a method that returns the glitch data for a given link as a function of time based on numpy arrays.

There are two implementations. The main one glitch_source_interp.GlitchSourceSplines, interpolates sampled data from glitch files using spline interpolation. The GlitchSourceZero in this module implementation provides all-zero glitch data, i.e. represents the case without any glitches.

The functions providing glitches are of type FuncOfTimeTypes, which allows representing constant (here: zero) functions as well. See also sigpro package.

class lisainstrument.glitches.glitch_source.GlitchSource[source]

Abstract interface for obtaining glitch data

abstract lasers(mosa: MosaID) FuncOfTime | ConstFuncOfTime[source]

Glitch function for lasers at given MOSA

abstract readout_ref_carriers(mosa: MosaID) FuncOfTime | ConstFuncOfTime[source]

Glitch function for readout_ref_carriers at given MOSA

abstract readout_ref_usbs(mosa: MosaID) FuncOfTime | ConstFuncOfTime[source]

Glitch function for readout_ref_usbs at given MOSA

abstract readout_sci_carrier(mosa: MosaID) FuncOfTime | ConstFuncOfTime[source]

Glitch function for readout_sci_carrier at given MOSA

abstract readout_sci_usbs(mosa: MosaID) FuncOfTime | ConstFuncOfTime[source]

Glitch function for readout_sci_usbs at given MOSA

abstract readout_tmi_carriers(mosa: MosaID) FuncOfTime | ConstFuncOfTime[source]

Glitch function for readout_tmi_carriers at given MOSA

abstract readout_tmi_usbs(mosa: MosaID) FuncOfTime | ConstFuncOfTime[source]

Glitch function for readout_tmi_usbs at given MOSA

abstract test_mass(mosa: MosaID) FuncOfTime | ConstFuncOfTime[source]

Glitch function for test mass (tm) at given MOSA

class lisainstrument.glitches.glitch_source.GlitchSourceZero[source]

Implementation of GlitchSource interface representing zero glitches

lasers(_: MosaID) FuncOfTime | ConstFuncOfTime[source]

Glitch function for lasers at given MOSA

readout_ref_carriers(_: MosaID) FuncOfTime | ConstFuncOfTime[source]

Glitch function for readout_ref_carriers at given MOSA

readout_ref_usbs(_: MosaID) FuncOfTime | ConstFuncOfTime[source]

Glitch function for readout_ref_usbs at given MOSA

readout_sci_carrier(_: MosaID) FuncOfTime | ConstFuncOfTime[source]

Glitch function for readout_sci_carrier at given MOSA

readout_sci_usbs(_: MosaID) FuncOfTime | ConstFuncOfTime[source]

Glitch function for readout_sci_usbs at given MOSA

readout_tmi_carriers(_: MosaID) FuncOfTime | ConstFuncOfTime[source]

Glitch function for readout_tmi_carriers at given MOSA

readout_tmi_usbs(_: MosaID) FuncOfTime | ConstFuncOfTime[source]

Glitch function for readout_tmi_usbs at given MOSA

test_mass(_: MosaID) FuncOfTime | ConstFuncOfTime[source]

Glitch function for test mass (tm) at given MOSA

Interpolated glitches

Module with an implementation of GlitchSource interpolating data from GlitchFile

GlitchSourceSplines interpolates sampled data from glitch files using spline interpolation. The files are not read directly, but provided as via the glitch_file.GlitchFile interface.

GlitchSourceSplines has an option to construct interpolators on the fly for the time range it is evaluated on. This is to support chunked evaluation without the need to read all glitch data at once, allowing to be used with chunked data processing. The GlitchSourceSplines implementation is used by the Instrument class to set up the glitch data from glitch files.

class lisainstrument.glitches.glitch_source_interp.GlitchSourceSplines(glfile: GlitchFile, tmin: float, tmax: float, margin_size: int = 100, spline_order: int = 5, chunked: bool = True)[source]

Implementation of GlitchSource interface based on spline interpolation

This implementation extracts glitch data samples from a GlitchFile instance, and sets up interpolation functions to provide the GlitchSource interface. The interpolation can be done globally or in a chunked fashion, using splines. The interpolation order can be chosen.

lasers(mosa: MosaID) FuncOfTime | ConstFuncOfTime[source]

Glitch function for lasers at given MOSA

readout_ref_carriers(mosa: MosaID) FuncOfTime | ConstFuncOfTime[source]

Glitch function for readout_ref_carriers at given MOSA

readout_ref_usbs(mosa: MosaID) FuncOfTime | ConstFuncOfTime[source]

Glitch function for readout_ref_usbs at given MOSA

readout_sci_carrier(mosa: MosaID) FuncOfTime | ConstFuncOfTime[source]

Glitch function for readout_sci_carrier at given MOSA

readout_sci_usbs(mosa: MosaID) FuncOfTime | ConstFuncOfTime[source]

Glitch function for readout_sci_usbs at given MOSA

readout_tmi_carriers(mosa: MosaID) FuncOfTime | ConstFuncOfTime[source]

Glitch function for readout_tmi_carriers at given MOSA

readout_tmi_usbs(mosa: MosaID) FuncOfTime | ConstFuncOfTime[source]

Glitch function for readout_tmi_usbs at given MOSA

test_mass(mosa: MosaID) FuncOfTime | ConstFuncOfTime[source]

Glitch function for test mass (tm) at given MOSA

Glitch files

Module with interface and implementations for reading Glitch files

The main interface is named GlitchFile. It provides glitch data as time series represented by the TimeSeriesNumpy class. The interface only returns time series covering a specified time interval, to allow reading large data sets chunk by chunk. Implementations should be optimized for the case that all data is read sequentially in chunks.

For each injection point, there is a method to load data segments for a given MOSA. Data may be unavailable for any combination of injection point and MOSA, and there are methods to query availability.

The GlitchFile interface can be directly used by the glitch_source_interp.GlitchSourceSplines class, turning the low level file reader interface GlitchFile into a high level GlitchSource interface suitable for sampling.

There is an GlitchFile implementation for each supported file format. The function glitch_file returns the appropriate implementation for a file with any supported format. Currently, only format version 1.4.dev is supported. The corresponding implementation is GlitchFileV14.

class lisainstrument.glitches.glitch_file.GlitchFile[source]

Abstract interface for reading glitch files.

Thie GlitchFile interface is a low-level numpy-based representation of the glitch files. It allows reading subsets of the data directly from file, where the subsets are specified as time intervals.

The purpose is for use in chunked processing of glitch data. In particular, the methods provided by GlitchFile are suitable for usage together with interpolation functions in sigpro.chunked_splines module.

classmethod check_file_version(path: str | Path) tuple[bool, Version][source]

Test if file version is compatible with file reader class

abstract property end_time: float

End time of available data [s]

abstract static format_specifier() SpecifierSet[source]

Version specifier set compatible with file reader

abstract property format_version: Version

Version number of the file format

abstract has_lasers(mosa: MosaID) bool[source]

Whether the file has lasers datasets for given MOSA

Parameters:

mosa – which MOSA dataset to query

abstract has_readout_ref_carriers(mosa: MosaID) bool[source]

Whether the file has readout_ref_carriers datasets for given MOSA

Parameters:

mosa – which MOSA dataset to query

abstract has_readout_ref_usbs(mosa: MosaID) bool[source]

Whether the file has readout_ref_usbs datasets for given MOSA

Parameters:

mosa – which MOSA dataset to query

abstract has_readout_sci_carrier(mosa: MosaID) bool[source]

Whether the file has readout_sci_carrier datasets for given MOSA

Parameters:

mosa – which MOSA dataset to query

abstract has_readout_sci_usbs(mosa: MosaID) bool[source]

Whether the file has readout_sci_usbs datasets for given MOSA

Parameters:

mosa – which MOSA dataset to query

abstract has_readout_tmi_carriers(mosa: MosaID) bool[source]

Whether the file has readout_tmi_carriers datasets for given MOSA

Parameters:

mosa – which MOSA dataset to query

abstract has_readout_tmi_usbs(mosa: MosaID) bool[source]

Whether the file has readout_tmi_usbs datasets for given MOSA

Parameters:

mosa – which MOSA dataset to query

abstract has_test_mass(mosa: MosaID) bool[source]

Whether the file has test mass (tm) datasets for given MOSA

Parameters:

mosa – which MOSA dataset to query

abstract load_segment_lasers(tbegin: float, tend: float, mosa: MosaID, margin_points: int) TimeSeriesNumpy | None[source]

Load a segment of lasers glitch data covering a given time interval

Arguments and behavior are as described for load_segment_readout_sci_carrier.

abstract load_segment_readout_ref_carriers(tbegin: float, tend: float, mosa: MosaID, margin_points: int) TimeSeriesNumpy | None[source]

Load a segment of readout_ref_carriers glitch data covering a given time interval

Arguments and behavior are as described for load_segment_readout_sci_carrier.

abstract load_segment_readout_ref_usbs(tbegin: float, tend: float, mosa: MosaID, margin_points: int) TimeSeriesNumpy | None[source]

Load a segment of readout_ref_usbs glitch data covering a given time interval

Arguments and behavior are as described for load_segment_readout_sci_carrier.

abstract load_segment_readout_sci_carrier(tbegin: float, tend: float, mosa: MosaID, margin_points: int) TimeSeriesNumpy | None[source]

Load a segment of readout_sci_carrier glitch data covering a given time interval

If the dataset is unavailable, an exception is raised.

The data to be read is selected using a time interval, including the minimum range of samples such that the time interval is fully covered. One can optionally ask to include additional data points left and right of the specified interval. The margin size is specified in terms of the number of samples.

If the requested time interval (not including the margins) has no overlap with the available data, None is returned.

If the requested time interval has some overlap, at least the available data points are returned. In addition, as many of the margin points as available are also included. If the total number of available points is less than the margin size, an exception is raised.

Parameters:
  • tbegin – Start of interval to be covered [s]

  • tend – End of interval to be covered [s]

  • mosa – For which link to obtain response

  • margin_points – How many additional margin points to provide

Returns:

Time series that covers entire requested interval or None

abstract load_segment_readout_sci_usbs(tbegin: float, tend: float, mosa: MosaID, margin_points: int) TimeSeriesNumpy | None[source]

Load a segment of readout_sci_usbs glitch data covering a given time interval

Arguments and behavior are as described for load_segment_readout_sci_carrier.

abstract load_segment_readout_tmi_carriers(tbegin: float, tend: float, mosa: MosaID, margin_points: int) TimeSeriesNumpy | None[source]

Load a segment of readout_tmi_carriers glitch data covering a given time interval

Arguments and behavior are as described for load_segment_readout_sci_carrier.

abstract load_segment_readout_tmi_usbs(tbegin: float, tend: float, mosa: MosaID, margin_points: int) TimeSeriesNumpy | None[source]

Load a segment of readout_tmi_usbs glitch data covering a given time interval

Arguments and behavior are as described for load_segment_readout_sci_carrier.

abstract load_segment_test_mass(tbegin: float, tend: float, mosa: MosaID, margin_points: int) TimeSeriesNumpy | None[source]

Load a segment of test mass (tm) glitch data covering a given time interval

Arguments and behavior are as described for load_segment_readout_sci_carrier.

abstract property start_time: float

Start time of available data [s]

class lisainstrument.glitches.glitch_file.GlitchFileV14(path: str | Path, chunk_size=None)[source]

Implements GlitchFile interface for file format versions 1.4

property end_time: float

See GlitchFile interface description

static format_specifier() SpecifierSet[source]

Version specifier set compatible with file reader

property format_version: Version

Version number of the file format

has_lasers(mosa: MosaID) bool[source]

See GlitchFile interface description

has_readout_ref_carriers(mosa: MosaID) bool[source]

See GlitchFile interface description

has_readout_ref_usbs(mosa: MosaID) bool[source]

Whether the file has readout_ref_usbs datasets

has_readout_sci_carrier(mosa: MosaID) bool[source]

See GlitchFile interface description

has_readout_sci_usbs(mosa: MosaID) bool[source]

See GlitchFile interface description

has_readout_tmi_carriers(mosa: MosaID) bool[source]

See GlitchFile interface description

has_readout_tmi_usbs(mosa: MosaID) bool[source]

See GlitchFile interface description

has_test_mass(mosa: MosaID) bool[source]

See GlitchFile interface description

load_segment_lasers(tbegin: float, tend: float, mosa: MosaID, margin_points: int) TimeSeriesNumpy | None[source]

See GlitchFile interface description

load_segment_readout_ref_carriers(tbegin: float, tend: float, mosa: MosaID, margin_points: int) TimeSeriesNumpy | None[source]

See GlitchFile interface description

load_segment_readout_ref_usbs(tbegin: float, tend: float, mosa: MosaID, margin_points: int) TimeSeriesNumpy | None[source]

See GlitchFile interface description

load_segment_readout_sci_carrier(tbegin: float, tend: float, mosa: MosaID, margin_points: int) TimeSeriesNumpy | None[source]

See GlitchFile interface description

load_segment_readout_sci_usbs(tbegin: float, tend: float, mosa: MosaID, margin_points: int) TimeSeriesNumpy | None[source]

See GlitchFile interface description

load_segment_readout_tmi_carriers(tbegin: float, tend: float, mosa: MosaID, margin_points: int) TimeSeriesNumpy | None[source]

See GlitchFile interface description

load_segment_readout_tmi_usbs(tbegin: float, tend: float, mosa: MosaID, margin_points: int) TimeSeriesNumpy | None[source]

See GlitchFile interface description

load_segment_test_mass(tbegin: float, tend: float, mosa: MosaID, margin_points: int) TimeSeriesNumpy | None[source]

See GlitchFile interface description

property start_time: float

See GlitchFile interface description

class lisainstrument.glitches.glitch_file.GlitchFileV20(path: str | Path, chunk_size=None)[source]

Implements GlitchFile interface for file format versions 2.0

This format is identical to 1.4, differing only in implicit conventions.

static format_specifier() SpecifierSet[source]

Version specifier set compatible with file reader

lisainstrument.glitches.glitch_file.glitch_file(path: str | Path) GlitchFile[source]

Open Glitch file of any supported version

Parameters:

path – Path of the file

Returns:

Instance providing GlitchFile interface