bilby_pipe.data_generation
Script to perform data generation steps
Classes
Handles user-input for the data generation script |
Functions
Data generation parser creation |
|
|
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)
- 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()
- 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
- 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
- _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 the PSD if specified in the psd_dict. If the value is None leave the PSD as is.
- _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.
- __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
- 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-processingthe calibration model is
Precomputed