pygwb.detector

The detector module is a subclass of bilby’s Interferometer class (more details here) which is charged with handling, storing and saving all relevant interferometer data. It handles all data analysis parts relating to the individual detectors in a baseline of a network. For example, it loads the data from a certain channel and computes the power spectral density (PSD) of the detector.

Examples

In this example, we load in data from the publicly available GWOSC servers using the detector module. We gate the data, compute the PSD and the average PSD of the detector object. This example gives a brief overview of the most important features of the pygwb.detector module. We start by importing the Interferometer class from pygwb.

>>> from pygwb.detector import Interferometer

To load in the data, an empty detector object is first created, for which, based on the name of the object, the module will make an Interferometer object without data. The name can be any one of the detectors supported in bilby.gw.detector, the parent class of our Interferometer class (more details here).

>>> ifo_1 = Interferometer.get_empty_interferometer("H1")

Then, we load the data using the set_timeseries_from methods, and pass a start and end time, t0 and tf, respectively. We are obtaining data from the GWOSC servers, i.e., public data, and indicate this by marking the data_type tag to public. We use the channel “H1:GWOSC-4KHZ_R1_STRAIN”, for illustrative purposes. All the other parameters are set to their default value.

>>> ifo_1.set_timeseries_from_channel_name(
    "H1:GWOSC-4KHZ_R1_STRAIN",
    t0=1247644138,
    tf=1247648138,
    data_type="public",
    local_data_path = "",
    new_sample_rate=4096,
    input_sample_rate=4096,
    cutoff_frequency=11,
    segment_duration=192,
    number_cropped_seconds=2,
    window_downsampling="hamming",
    ftype="fir",
    time_shift=0,
    )

To illustrate one of the features of the module, we gate the detector data. This procedure applies a window to stretches of data to get rid of glitches and other artefacts. More information on the gating procedure can be found in this technical note.

>>> ifo_1.gate_data_apply(
    gate_tzero=1.0,
    gate_tpad=0.5,
    gate_threshold=50.0,
    cluster_window=0.5,
    gate_whiten=True,
    )

The module also allows to compute the PSD spectrogram of the detector. A spectrogram shows the PSD both per time and per frequency. After specifying the desired frequency resolution, one can call the set_psd_spectrogram method.

>>> frequency_resolution = 1/32.
>>> ifo_1.set_psd_spectrogram(
        frequency_resolution,
        overlap_factor=0.5,
        window_fftgram_dict_welch_psd={"window_fftgram": "hann"},
        overlap_factor_welch_psd=0.5,
        )

Finally, the average PSD of the detector can also be computed, by invoking set_average_psd.

>>> ifo_1.set_average_psd(N_average_segments_welch_psd=2)

This highlights some of the features of the detector module. For more details, we refer the reader to the remainder of the detector API documentation.

Classes

Interferometer(*args, **kwargs)