bilby.gw.detector.strain_data.InterferometerStrainData

class bilby.gw.detector.strain_data.InterferometerStrainData(minimum_frequency=0, maximum_frequency=inf, roll_off=0.2, notch_list=None)[source]

Bases: object

Strain data for an interferometer

__init__(minimum_frequency=0, maximum_frequency=inf, roll_off=0.2, notch_list=None)[source]

Initiate an InterferometerStrainData object

The initialised object contains no data, this should be added using one of the set_from.. methods.

Parameters:
minimum_frequency: float

Minimum frequency to analyse for detector. Default is 0.

maximum_frequency: float

Maximum frequency to analyse for detector. Default is infinity.

roll_off: float

The roll-off (in seconds) used in the Tukey window, default=0.2s. This corresponds to alpha * duration / 2 for scipy tukey window.

notch_list: bilby.gw.detector.strain_data.NotchList

A list of notches

__call__(*args, **kwargs)

Call self as a function.

Methods

__init__([minimum_frequency, ...])

Initiate an InterferometerStrainData object

create_power_spectral_density(fft_length[, ...])

Use the time domain strain to generate a power spectral density

low_pass_filter([filter_freq])

Low pass filter the data

set_from_channel_name(channel, duration, ...)

Set the frequency_domain_strain by fetching from given channel using gwpy.TimesSeries.get(), which dynamically accesses either frames on disk, or a remote NDS2 server to find and return data.

set_from_csv(filename)

Set the strain data from a csv file

set_from_frame_file(frame_file, ...[, ...])

Set the frequency_domain_strain from a frame fiile

set_from_frequency_domain_strain(...[, ...])

Set the frequency_domain_strain from a numpy array

set_from_gwpy_timeseries(time_series)

Set the strain data from a gwpy TimeSeries

set_from_open_data(name, start_time[, ...])

Set the strain data from open LOSC data

set_from_power_spectral_density(...[, ...])

Set the frequency_domain_strain by generating a noise realisation

set_from_time_domain_strain(time_domain_strain)

Set the strain data from a time domain strain array

set_from_zero_noise(sampling_frequency, duration)

Set the frequency_domain_strain to zero noise

time_domain_window([roll_off, alpha])

Window function to apply to time domain data before FFTing.

time_within_data(time)

Check if time is within the data span

to_gwpy_frequencyseries()

Output the frequency series strain data as a gwpy.frequencyseries.FrequencySeries.

to_gwpy_timeseries()

Output the time series strain data as a gwpy.timeseries.TimeSeries.

to_lal_frequencyseries()

Output the frequency series strain data as a LAL FrequencySeries object.

to_lal_timeseries()

Output the time series strain data as a LAL TimeSeries object.

to_pycbc_frequencyseries()

Output the frequency series strain data as a pycbc.types.frequencyseries.FrequencySeries.

to_pycbc_timeseries()

Output the time series strain data as a pycbc.types.timeseries.TimeSeries.

Attributes

alpha

channel

frequency_domain_strain

Returns the frequency domain strain

frequency_mask

Masking array for limiting the frequency band.

maximum_frequency

Force the maximum frequency be less than the Nyquist frequency

minimum_frequency

notch_list

time_domain_strain

The time domain strain, in units of strain

create_power_spectral_density(fft_length, overlap=0, name='unknown', outdir=None, analysis_segment_start_time=None)[source]

Use the time domain strain to generate a power spectral density

This create a Tukey-windowed power spectral density and writes it to a PSD file.

Parameters:
fft_length: float

Duration of the analysis segment.

overlap: float

Number of seconds of overlap between FFTs.

name: str

The name of the detector, used in storing the PSD. Defaults to “unknown”.

outdir: str

The output directory to write the PSD file too. If not given, the PSD will not be written to file.

analysis_segment_start_time: float

The start time of the analysis segment, if given, this data will be removed before creating the PSD.

Returns:
frequency_array, psdarray_like

The frequencies and power spectral density array

property frequency_domain_strain

Returns the frequency domain strain

This is the frequency domain strain normalised to units of strain / Hz, obtained by a one-sided Fourier transform of the time domain data, divided by the sampling frequency.

property frequency_mask

Masking array for limiting the frequency band.

Returns:
mask: np.ndarray

An array of boolean values

low_pass_filter(filter_freq=None)[source]

Low pass filter the data

property maximum_frequency

Force the maximum frequency be less than the Nyquist frequency

set_from_channel_name(channel, duration, start_time, sampling_frequency)[source]

Set the frequency_domain_strain by fetching from given channel using gwpy.TimesSeries.get(), which dynamically accesses either frames on disk, or a remote NDS2 server to find and return data. This function also verifies that the specified channel is given in the correct format.

Parameters:
channel: str

Channel to look for using gwpy in the format IFO:Channel

duration: float

The data duration (in s)

start_time: float

The GPS start-time of the data

sampling_frequency: float

The sampling frequency (in Hz)

set_from_csv(filename)[source]

Set the strain data from a csv file

Parameters:
filename: str

The path to the file to read in

set_from_frame_file(frame_file, sampling_frequency, duration, start_time=0, channel=None, buffer_time=1)[source]

Set the frequency_domain_strain from a frame fiile

Parameters:
frame_file: str

File from which to load data.

channel: str

Channel to read from frame.

sampling_frequency: float

The sampling frequency (in Hz)

duration: float

The data duration (in s)

start_time: float

The GPS start-time of the data

buffer_time: float

Read in data with start_time-buffer_time and start_time+duration+buffer_time

set_from_frequency_domain_strain(frequency_domain_strain, sampling_frequency=None, duration=None, start_time=0, frequency_array=None)[source]

Set the frequency_domain_strain from a numpy array

Parameters:
frequency_domain_strain: array_like

The data to set.

sampling_frequency: float

The sampling frequency (in Hz).

duration: float

The data duration (in s).

start_time: float

The GPS start-time of the data.

frequency_array: array_like

The array of frequencies, if sampling_frequency and duration not given.

set_from_gwpy_timeseries(time_series)[source]

Set the strain data from a gwpy TimeSeries

This sets the time_domain_strain attribute, the frequency_domain_strain is automatically calculated after a low-pass filter and Tukey window is applied.

Parameters:
time_series: gwpy.timeseries.timeseries.TimeSeries

The data to use

set_from_open_data(name, start_time, duration=4, outdir='outdir', cache=True, **kwargs)[source]

Set the strain data from open LOSC data

This sets the time_domain_strain attribute, the frequency_domain_strain is automatically calculated after a low-pass filter and Tukey window is applied.

Parameters:
name: str

Detector name, e.g., ‘H1’.

start_time: float

Start GPS time of segment.

duration: float, optional

The total time (in seconds) to analyse. Defaults to 4s.

outdir: str

Directory where the psd files are saved

cache: bool, optional

Whether or not to store/use the acquired data.

**kwargs:

All keyword arguments are passed to gwpy.timeseries.TimeSeries.fetch_open_data().

set_from_power_spectral_density(power_spectral_density, sampling_frequency, duration, start_time=0)[source]

Set the frequency_domain_strain by generating a noise realisation

Parameters:
power_spectral_density: bilby.gw.detector.PowerSpectralDensity

A PowerSpectralDensity object used to generate the data

sampling_frequency: float

The sampling frequency (in Hz)

duration: float

The data duration (in s)

start_time: float

The GPS start-time of the data

set_from_time_domain_strain(time_domain_strain, sampling_frequency=None, duration=None, start_time=0, time_array=None)[source]

Set the strain data from a time domain strain array

This sets the time_domain_strain attribute, the frequency_domain_strain is automatically calculated after a low-pass filter and Tukey window is applied.

Parameters:
time_domain_strain: array_like

An array of the time domain strain.

sampling_frequency: float

The sampling frequency (in Hz).

duration: float

The data duration (in s).

start_time: float

The GPS start-time of the data.

time_array: array_like

The array of times, if sampling_frequency and duration not given.

set_from_zero_noise(sampling_frequency, duration, start_time=0)[source]

Set the frequency_domain_strain to zero noise

Parameters:
sampling_frequency: float

The sampling frequency (in Hz)

duration: float

The data duration (in s)

start_time: float

The GPS start-time of the data

property time_domain_strain

The time domain strain, in units of strain

time_domain_window(roll_off=None, alpha=None)[source]

Window function to apply to time domain data before FFTing.

This defines self.window_factor as the power loss due to the windowing. See https://dcc.ligo.org/DocDB/0027/T040089/000/T040089-00.pdf

Parameters:
roll_off: float

Rise time of window in seconds

alpha: float

Parameter to pass to tukey window, how much of segment falls into windowed part

Returns:
window: array

Window function over time array

time_within_data(time)[source]

Check if time is within the data span

Parameters:
time: float

The time to check

Returns:
bool:

A boolean stating whether the time is inside or outside the span

to_gwpy_frequencyseries()[source]

Output the frequency series strain data as a gwpy.frequencyseries.FrequencySeries.

to_gwpy_timeseries()[source]

Output the time series strain data as a gwpy.timeseries.TimeSeries.

to_lal_frequencyseries()[source]

Output the frequency series strain data as a LAL FrequencySeries object.

to_lal_timeseries()[source]

Output the time series strain data as a LAL TimeSeries object.

to_pycbc_frequencyseries()[source]

Output the frequency series strain data as a pycbc.types.frequencyseries.FrequencySeries.

to_pycbc_timeseries()[source]

Output the time series strain data as a pycbc.types.timeseries.TimeSeries.