bilby_pipe.data_generation

Script to perform data generation steps

Classes

DataGenerationInput

Handles user-input for the data generation script

Functions

create_generation_parser()

Data generation parser creation

main()

Data generation main logic

Module Contents

class bilby_pipe.data_generation.DataGenerationInput(args, unknown_args, create_data=True)[source]

Bases: bilby_pipe.input.Input

Handles user-input for the data generation script

Parameters:
parser: configargparse.ArgParser, optional

The parser containing the command line / ini file inputs

args_list: list, optional

A list of the arguments to parse. Defaults to sys.argv[1:]

create_data: bool

If false, no data is generated (used for testing)

meta_data[source]
property injection_parameters[source]
ini[source]
idx[source]

The level A job index

property generation_seed[source]
trigger_time[source]
outdir[source]

The path to the directory where output will be stored

label[source]
reference_frame[source]
time_reference[source]
phase_marginalization[source]
prior_file[source]
prior_dict[source]

The input prior_dict from the ini (if given)

Note, this is not the bilby prior (see self.priors for that), this is a key-val dictionary where the val’s are strings which are converting into bilby priors in _get_priors()

deltaT[source]
default_prior[source]
ignore_gwpy_data_quality_check[source]
detectors[source]

A list of the detectors to include, e.g., [‘H1’, ‘L1’]

property channel_dict[source]
property data_dict[source]
data_format[source]
allow_tape[source]
tukey_roll_off[source]
zero_noise[source]
resampling_method[source]
duration[source]
post_trigger_duration[source]
property sampling_frequency[source]
minimum_frequency[source]

The minimum frequency

If a per-detector dictionary is given, this will return the minimum frequency value. To access the dictionary, see self.minimum_frequency_dict

maximum_frequency[source]

The maximum frequency

If a per-detector dictionary is given, this will return the maximum frequency value. To access the dictionary, see self.maximum_frequency_dict

reference_frequency[source]
waveform_generator_class[source]
waveform_approximant[source]
catch_waveform_errors[source]
pn_spin_order[source]
pn_tidal_order[source]
pn_phase_order[source]
pn_amplitude_order[source]
mode_array[source]
waveform_arguments_dict[source]
numerical_relativity_file[source]
injection_waveform_approximant[source]
frequency_domain_source_model[source]

String of which frequency domain source model to use

conversion_function[source]
generation_function[source]
likelihood_type[source]
extra_likelihood_kwargs[source]
enforce_signal_duration[source]
psd_maximum_duration[source]
psd_dict[source]
calibration_model[source]
spline_calibration_envelope_dict[source]
spline_calibration_amplitude_uncertainty_dict[source]
spline_calibration_phase_uncertainty_dict[source]
spline_calibration_nodes[source]
calibration_prior_boundary[source]
roq_folder[source]
roq_linear_matrix[source]
roq_quadratic_matrix[source]
roq_weights[source]
roq_weight_format[source]
roq_scale_factor[source]
update_fiducial_parameters[source]
epsilon[source]
distance_marginalization[source]
distance_marginalization_lookup_table[source]
time_marginalization[source]
calibration_marginalization[source]
calibration_lookup_table[source]
number_of_response_curves[source]
jitter_time[source]
plot_data[source]
plot_spectrogram[source]
plot_injection[source]
reweighting_configuration[source]
create_data(args)[source]

Function to iterate through data generation method

Note, the data methods are mutually exclusive and only one can be given to the parser.

Parameters:
args: Namespace

Input arguments

Raises:
BilbyPipeError:

If no data is generated

property psd_length[source]

Integer number of durations to use for generating the PSD

property psd_duration[source]
property psd_start_time[source]

The PSD start time relative to segment start time

property parameter_conversion[source]
get_channel_type(det)[source]

Help method to read the channel_dict and print useful messages

_set_interferometers_from_gaussian_noise()[source]

Method to generate the interferometers data from Gaussian noise

_set_interferometers_from_injection_in_gaussian_noise()[source]

Method to generate the interferometers data from an injection in Gaussian noise

inject_signal_into_time_domain_data(data, ifo)[source]

Method to inject a signal into time-domain interferometer data

Parameters of the injection are obtained from the injection_parameters or the injection file (if injection_parameters has not been set).

The geocent_time of the injection is set to be trigger_time +/- deltaT/2 if the geocent_time is not provided in the injection parameters.

Parameters:
data: gwpy.timeseries.TimeSeries

The data into which to inject the signal

ifo: bilby.gw.detector.Interferometer

The interferometer for which the data relates to

Returns:
data_and_signal: gwpy.timeseries.TimeSeries

The data with the signal added

_set_psd_from_file(ifo)[source]
_set_interferometers_from_data()[source]

Method to generate the interferometers data from data

This sets the PSD before the analysis data so that the SNR of injected signals is correct.

__get_psd_data(det)[source]
__generate_psd(psd_data, roll_off)[source]

Create the psd from strain data.

__plot_ifo_spectrogram(det, strain_data, psd_strain_data=None)[source]

Method to plot an IFO’s data.

Parameters:
det: str

The detector name corresponding to the key in data-dict

strain_data, psd_strain_data: gwpy.TimeSeries

The timeseries strain data of a detector.

Returns:
None
File by the name <outdir>/data/<det>_<Label>_D{duration}_data.png
is saved
_get_data(det, channel_type, start_time, end_time, resample=True)[source]

Read in data using gwpy

If the channel_type is “GWOSC”, open data is obtained. Otherwise, we try to read in the data first using “read” if a data_dict exists and then using “get”.

Parameters:
channel_type: str

The full channel name is formed from <det>:<channel_type>, see bilby_pipe –help for more information.

start_time, end_time: float

GPS start and end time of segment

Returns:
data: gwpy.timeseries.TimeSeries

The loaded data

Raises:
BilbyPipeError:

If there is an issue obtaining the data or with the data itself

static _is_gwpy_data_good(start_time, end_time, det)[source]

Check if start-end time is a period when the IFO has quality data.

Check passes if the IFO has quality data during the time period provided.

Note: we are using the ITF_SCIENCE channel to check the quality for V1, and DMT-SCIENCE for other detectors. https://labcit.ligo.caltech.edu/~jzweizig/talks/LSC-2009-06-03/DMT-DQ_Stat-2009-06-03.pdf

This method is slow as it queries GWpy.

Parameters:
start_time, end_time: float

GPS start and end time of required data.

det: str

The string key that represents the detector (“H1”, “L1”, etc)

Returns:
True: if data is good (IFO has quality data during entire duration).
False: if data is bad (IFO does not have quality data during entire duration).
None: if the data quality check failed
_gwpy_read(det, channel, start_time, end_time, dtype='float64')[source]

Wrapper function to gwpy.timeseries.TimeSeries.read()

Parameters:
det: str

The detector name corresponding to the key in data-dict

channel: str

The name of the channel to read, e.g. ‘L1:GDS-CALIB_STRAIN’

start_time, end_time: float

GPS start and end time of required data

dtype: str or np.dtype

Data type requested

Returns:
data: TimeSeries

If successful, the data, otherwise None is returned

_gwpy_get(channel, start_time, end_time, dtype='float64')[source]

Wrapper function to gwpy.timeseries.TimeSeries.get()

Parameters:
channel: str

The name of the channel to read, e.g. ‘L1:GDS-CALIB_STRAIN’

start_time, end_time: float

GPS start and end time of required data

dtype: str or np.dtype

Data type requested

Returns:
data: TimeSeries

If successful, the data, otherwise None is returned

_gwpy_fetch_open_data(det, start_time, end_time)[source]

Wrapper function to gwpy.timeseries.TimeSeries.fetch_open_data()

Parameters:
det: str

The detector name, e.g ‘H1’

start_time, end_time: float

GPS start and end time of required data

Returns:
data: TimeSeries

If successful, the data, otherwise None is returned

property interferometers[source]

A bilby.gw.detector.InterferometerList

add_calibration_model_to_interferometers(ifo)[source]
build_calibration_lookups_if_needed()[source]

Build lookup files that are needed for incorporating calibration uncertainty. These are needed if:

  • calibration_marginalization is used either during sampling or post-processing

  • the calibration model is Precomputed

save_data_dump()[source]

Method to dump the saved data to disk for later analysis

save_roq_weights()[source]
save_multiband_weights()[source]
bilby_pipe.data_generation.create_generation_parser()[source]

Data generation parser creation

bilby_pipe.data_generation.main()[source]

Data generation main logic