dingo.gw.noise package

Subpackages

Submodules

dingo.gw.noise.asd_dataset module

class dingo.gw.noise.asd_dataset.ASDDataset(file_name=None, dictionary=None, ifos=None, precision=None, domain_update=None)

Bases: DingoDataset

Dataset of amplitude spectral densities (ASDs). The ASDs are typically used for whitening strain data, and additionally passed as context to the neural density estimator.

Parameters:
  • file_name (str) – HDF5 file containing a dataset

  • dictionary (dict) – Contains settings and data entries. The dictionary keys should be ‘settings’, ‘asds’, and ‘gps_times’.

  • ifos (List[str]) – List of detectors used for dataset, e.g. [‘H1’, ‘L1’]. If not set, all available ones in the dataset are used.

  • precision (str ('single', 'double')) – If provided, changes precision of loaded dataset.

  • domain_update (dict) – If provided, update domain from existing domain using new settings.

dataset_type = 'asd_dataset'
property gps_info

Min/Max GPS time for each detector.

property length_info

The number of asd samples per detector.

sample_random_asds(n: int | None = None) dict[str, ndarray]

Sample n random ASDs for each detector.

Parameters:

n (int) – Number of asds to sample

Returns:

Where the keys correspond to the detectors and the values are arrays of shape (n, D) where D is the number of frequency bins and n is the number of ASDs requested. If n=None, then the function returns a single ASD for each detector, so the array is flattened to be shape D

Return type:

dict[str, np.ndarray]

save_psd(directory, ifo_name, idx: int | None = None, rng=None)
update_domain(domain_update)

Update the domain based on new configuration. Also adjust data arrays to match the new domain.

The ASD dataset provides ASDs in a particular domain. In Frequency domain, this is [0, domain.f_max]. In practice one may want to train a network based on slightly different domain settings, which corresponds to truncating the likelihood integral.

This method provides functionality for that. It truncates the data below a new f_max, and sets the ASD below f_min to a large but finite value.

Parameters:

domain_update (dict) – Settings dictionary. Must contain a subset of the keys contained in domain_dict.

dingo.gw.noise.asd_dataset.check_domain_compatibility(data: dict, domain: BaseFrequencyDomain) bool

dingo.gw.noise.asd_estimation module

dingo.gw.noise.asd_estimation.download_and_estimate_cli()

Command-line function to download strain data and estimate PSDs based on the data. Used for parallelized ASD dataset generation.

dingo.gw.noise.asd_estimation.download_and_estimate_psds(data_dir: str, settings: dict, time_segments: dict, verbose=False)

Downloads strain data for the specified time segments and estimates PSDs based on these

Parameters:
  • data_dir (str) – Path to the directory where the PSD dataset will be stored

  • settings (dict) – Settings that determine the segments

  • time_segments (dict) – specifying the time segments used for downloading the data

  • verbose (bool) – optional parameter determining if progress should be printed

Return type:

A dictionary containing the paths to the dataset files

dingo.gw.noise.generate_dataset module

dingo.gw.noise.generate_dataset.generate_dataset()

Creates and saves an ASD dataset

dingo.gw.noise.generate_dataset.parse_args()

dingo.gw.noise.generate_dataset_dag module

dingo.gw.noise.generate_dataset_dag.create_args_string(args_dict: Dict)

Generate argument string from dictionary of argument names and arguments.

dingo.gw.noise.generate_dataset_dag.create_dag(data_dir, settings_file, time_segments, out_name)

Create a Condor DAG to (a) download, estimate, individual PSDs and (b) merge them into one dataset

Parameters:
  • data_dir (str) – Path to the directory where the PSD dataset will be stored

  • settings_file (str) – Settings : Path to settings file relevant for PSD generation

  • time_segments (dict) – contains all time segments used for estimating PSDs

  • out_name (str) – path where the resulting ASD dataset should be stored

Return type:

Condor DAG

dingo.gw.noise.generate_dataset_dag.split_time_segments(time_segments, condor_dir, num_jobs)

Split up all time segments used for estimating PSDs into num_jobs-many segments and save them into a condor directory

Parameters:
  • time_segments (dict) – contains all time segments used for estimating PSDs

  • condor_dir (str) – path to a directory where condr-related files are stored

  • num_jobs (int) – number of jobs that should be used per detector to parallelize the PSD estimation

Return type:

List of paths where the files including the subsets of all time segments are stored

dingo.gw.noise.utils module

dingo.gw.noise.utils.CATALOGS = ['GWTC-1-confident', 'GWTC-2.1-confident', 'GWTC-3-confident']

Contains links for PSD segment lists with quality label BURST_CAT2 from the Gravitational Wave Open Science Center. Some events are split up into multiple chunks such that there are multiple URLs for one observing run

dingo.gw.noise.utils.get_event_gps_times()
dingo.gw.noise.utils.get_time_segments(settings)

Creates a dictionary storing time segments used for estimating PSDs :param settings: Settings that determine the segments :type settings: dict

Return type:

Dictionary containing the time segments for each detector

dingo.gw.noise.utils.merge_datasets(asd_dataset_list)

Merges a list of asd datasets into ont :param asd_dataset_list: :type asd_dataset_list: List of ASDDatasets to be merged

Return type:

A single combined ASDDataset object

dingo.gw.noise.utils.merge_datasets_cli()

Command-line function to combine a collection of datasets into one. Used for parallelized ASD dataset generation.

dingo.gw.noise.utils.psd_data_path(data_dir, run, detector)

Return the directory where the PSD data is to be stored :param data_dir: Path to the directory where the PSD dataset will be stored :type data_dir: str :param run: Observing run that is used for the PSD dataset generation :type run: str :param detector: Detector that is used for the PSD dataset generation :type detector: str

Return type:

the path where the data is stored

Module contents