API reference

dingo.asimov.asimov

asimov.asimov.Dingo The Dingo Pipeline.

dingo.core.dataset

core.dataset.DingoDataset This is a generic dataset class with save / load methods.
core.dataset.recursive_hdf5_load This is a generic helper function to recursively load data from an HDF5 file.
core.dataset.recursive_hdf5_save

dingo.core.density

core.density.interpolation.interpolated_log_prob Given a distribution discretized on a grid, return a sample and the log prob from an
core.density.interpolation.interpolated_log_prob_multi Given a distribution discretized on a grid, the log prob at a specific point
core.density.interpolation.interpolated_sample_and_log_prob Given a distribution discretized on a grid, return a sample and the log prob from an
core.density.interpolation.interpolated_sample_and_log_prob_multi Given a distribution discretized on a grid, return a sample and the log prob from an
core.density.nde_settings.get_default_nde_settings_3d
core.density.unconditional_density_estimation.SampleDataset Dataset class for unconditional density estimation.
core.density.unconditional_density_estimation.parse_args
core.density.unconditional_density_estimation.train_unconditional_density_estimator Train unconditional density estimator for a given set of samples.

dingo.core.likelihood

core.likelihood.Likelihood

dingo.core.multiprocessing

core.multiprocessing.apply_func_with_multiprocessing Call func(theta.iloc[idx].to_dict()) with multiprocessing.

dingo.core.nn

core.nn.cfnets.ContinuousFlow A continuous normalizing flow network. It defines a time-dependent vector field on
core.nn.cfnets.PositionalEncoding Implements positional encoding as commonly used in transformer architectures.
core.nn.cfnets.create_cf Build a continuous flow based on settings dictionaries.
core.nn.cfnets.get_dim_positional_embedding
core.nn.cfnets.get_theta_embedding_net
core.nn.enets.DenseResidualNet A nn.Module consisting of a sequence of dense residual blocks. This is
core.nn.enets.LinearProjectionRB A compression layer that reduces the input dimensionality via projection
core.nn.enets.ModuleMerger This is a wrapper used to process multiple different kinds of context
core.nn.enets.create_enet_with_projection_layer_and_dense_resnet Builder function for 2-stage embedding network for 1D data with multiple
core.nn.nsf.FlowWrapper This class wraps the neural spline flow. It is required for multiple
core.nn.nsf.create_base_transform Build a base NSF transform of y, conditioned on x.
core.nn.nsf.create_linear_transform Create the composite linear transform PLU.
core.nn.nsf.create_nsf_model Build NSF model. This models the posterior distribution p(y|x).
core.nn.nsf.create_nsf_with_rb_projection_embedding_net Builds a neural spline flow with an embedding network that consists of a
core.nn.nsf.create_nsf_wrapped Wraps the NSF model in a FlowWrapper. This is required for parallel
core.nn.nsf.create_transform Build a sequence of NSF transforms, which maps parameters y into the

dingo.core.posterior_models

core.posterior_models.base_model.BasePosteriorModel Abstract base class for PosteriorModels. This is intended to construct and hold a
core.posterior_models.base_model.test_epoch
core.posterior_models.base_model.train_epoch
core.posterior_models.build_model.autocomplete_model_kwargs Autocomplete the model kwargs from train_settings and data_sample from the dataloader:
core.posterior_models.build_model.build_model_from_kwargs Returns a PosteriorModel based on a saved network or settings dict.
core.posterior_models.cflow_base.ContinuousFlowPosteriorModel Class for posterior models based on continuous normalizing flows (CNFs).
core.posterior_models.cflow_base.compute_divergence
core.posterior_models.cflow_base.compute_hutchinson_divergence
core.posterior_models.cflow_base.compute_log_prior
core.posterior_models.cflow_base.norm_without_divergence_component
core.posterior_models.flow_matching.FlowMatchingPosteriorModel
core.posterior_models.flow_matching.ot_conditional_flow
core.posterior_models.normalizing_flow.NormalizingFlowPosteriorModel Posterior model based on a (discrete) normalizing flow.
core.posterior_models.score_matching.ScoreDiffusionPosteriorModel

dingo.core.result

core.result.Result A dataset class to hold a collection of samples, implementing I/O, importance
core.result.check_equal_dict_of_arrays
core.result.freeze
core.result.make_pp_plot Make a P-P plot for a set of runs with injected signals.

dingo.core.samplers

core.samplers.GNPESampler Base class for GNPE sampler. It wraps a PosteriorModel and a standard Sampler for
core.samplers.Sampler Sampler class that wraps a PosteriorModel. Allows for conditional and unconditional

dingo.core.transforms

core.transforms.GetItem
core.transforms.RenameKey

dingo.core.utils

core.utils.backward_compatibility.check_minimum_version Check that the version string is greater than a certain minimum value.
core.utils.backward_compatibility.torch_available_devices Returns a list of all available PyTorch devices,
core.utils.backward_compatibility.torch_load_with_fallback Loads a PyTorch file with fallback behavior:
core.utils.backward_compatibility.update_model_config Update the model settings to ensure backwards compatibility with networks
core.utils.condor_utils.copy_logfiles
core.utils.condor_utils.copyfile
core.utils.condor_utils.create_submission_file TODO: documentation
core.utils.condor_utils.create_submission_file_and_submit_job TODO: documentation
core.utils.condor_utils.resubmit_condor_job TODO: documentation
core.utils.gnpeutils.IterationTracker
core.utils.logging_utils.check_directory_exists_and_if_not_mkdir Checks if the given directory exists and creates it if it does not exist
core.utils.logging_utils.setup_logger Setup logging output: call at the start of the script to use
core.utils.misc.call_func_strict_output_dim Repeatedly calls a function until the output shape is the
core.utils.misc.get_version
core.utils.misc.recursive_check_dicts_are_equal
core.utils.plotting.get_latex_labels Get the latex labels for prior parameters. If no latex label exists within the
core.utils.plotting.plot_corner_multi Generate a corner plot for multiple posteriors.
core.utils.pt_to_hdf5.main
core.utils.pt_to_hdf5.parse_args
core.utils.torchutils.build_train_and_test_loaders Split the dataset into train and test sets, and build corresponding DataLoaders.
core.utils.torchutils.fix_random_seeds Utility function to set random seeds when using multiple workers for DataLoader.
core.utils.torchutils.get_activation_function_from_string Returns an activation function, based on the name provided.
core.utils.torchutils.get_lr Returns a list with the learning rates of the optimizer.
core.utils.torchutils.get_number_of_model_parameters Counts parameters of the module. The list requires_grad_flag can be used
core.utils.torchutils.get_optimizer_from_kwargs Builds and returns an optimizer for model_parameters. The type of the
core.utils.torchutils.get_scheduler_from_kwargs Builds and returns an scheduler for optimizer. The type of the
core.utils.torchutils.perform_scheduler_step Wrapper for scheduler.step(). If scheduler is ReduceLROnPlateau,
core.utils.torchutils.set_requires_grad_flag Set param.requires_grad of all model parameters with a name starting with
core.utils.torchutils.split_dataset_into_train_and_test Splits dataset into a trainset of size int(train_fraction * len(dataset)),
core.utils.torchutils.torch_detach_to_cpu
core.utils.trainutils.AvgTracker
core.utils.trainutils.EarlyStopping Implement early stopping during training, once the validation loss stops decreasing
core.utils.trainutils.LossInfo
core.utils.trainutils.RuntimeLimits Keeps track of the runtime limits (time limit, epoch limit, max. number
core.utils.trainutils.copyfile copy src to dst.
core.utils.trainutils.save_model Save model to _latest.pt in log_dir. Additionally,
core.utils.trainutils.write_history Writes losses and learning rate history to csv file.

dingo.gw.SVD

gw.SVD.ApplySVD Transform operator for applying an SVD compression / decompression.
gw.SVD.SVDBasis

dingo.gw.conversion

gw.conversion.spin_conversion.cartesian_spins Transform PE spins to cartesian spins.
gw.conversion.spin_conversion.change_spin_conversion_phase Change the phase used to convert cartesian spins to PE spins. The cartesian spins
gw.conversion.spin_conversion.component_masses
gw.conversion.spin_conversion.pe_spins Transform cartesian spins to PE spins.

dingo.gw.data

gw.data.data_download.download_psd Download strain data and generate a PSD based on these. Use num_segments of length
gw.data.data_download.download_raw_data
gw.data.data_preparation.data_to_domain
gw.data.data_preparation.get_event_data_and_domain
gw.data.data_preparation.load_raw_data Load raw event data.
gw.data.data_preparation.parse_settings_for_raw_data
gw.data.event_dataset.EventDataset Dataset class for storing single event.

dingo.gw.dataset

gw.dataset.evaluate_multibanded_domain.main
gw.dataset.evaluate_multibanded_domain.parse_args
gw.dataset.generate_dataset.generate_dataset Generate a waveform dataset.
gw.dataset.generate_dataset.generate_parameters_and_polarizations Generate a dataset of waveforms based on parameters drawn from the prior.
gw.dataset.generate_dataset.main
gw.dataset.generate_dataset.parse_args
gw.dataset.generate_dataset.train_svd_basis Train (and optionally validate) an SVD basis.
gw.dataset.generate_dataset_dag.configure_runs Prepare and save settings .yaml files for generating subsets of the dataset.
gw.dataset.generate_dataset_dag.create_args_string Generate argument string from dictionary of argument names and arguments.
gw.dataset.generate_dataset_dag.create_dag Create a Condor DAG from command line arguments to carry out the five steps in the
gw.dataset.generate_dataset_dag.main
gw.dataset.generate_dataset_dag.modulus_check Raise error if a % b != 0.
gw.dataset.generate_dataset_dag.parse_args
gw.dataset.utils.build_svd_cli Command-line function to build an SVD based on an uncompressed dataset file.
gw.dataset.utils.merge_datasets Merge a collection of datasets into one.
gw.dataset.utils.merge_datasets_cli Command-line function to combine a collection of datasets into one. Used for
gw.dataset.waveform_dataset.WaveformDataset This class stores a dataset of waveforms (polarizations) and corresponding

dingo.gw.domains

gw.domains.base.Domain Defines the physical domain on which the data of interest live.
gw.domains.base_frequency_domain.BaseFrequencyDomain
gw.domains.build_domain.build_domain Instantiate a domain class from settings.
gw.domains.build_domain.build_domain_from_model_metadata Instantiate a domain class from settings of model.
gw.domains.multibanded_frequency_domain.MultibandedFrequencyDomain Defines a non-uniform frequency domain that is made up of a sequence of
gw.domains.multibanded_frequency_domain.decimate_uniform Reduce dimension of data by decimation_factor along last axis, by uniformly
gw.domains.time_domain.TimeDomain Defines the physical time domain on which the data of interest live.
gw.domains.uniform_frequency_domain.UniformFrequencyDomain Defines the physical domain on which the data of interest live.

dingo.gw.download_strain_data

gw.download_strain_data.download_event_data_in_FD Download event data in frequency domain. This includes strain data for the event at
gw.download_strain_data.download_strain_data_in_FD Download strain data for a GW event at GPS time time_event. The segment is
gw.download_strain_data.estimate_single_psd Download strain data and generate a PSD based on these. Use num_segments of length

dingo.gw.gwutils

gw.gwutils.get_extrinsic_prior_dict Build dict for extrinsic prior by starting with
gw.gwutils.get_mismatch Mistmatch is 1 - overlap, where overlap is defined by
gw.gwutils.get_standardization_dict Calculates the mean and standard deviation of parameters. This is needed for
gw.gwutils.get_window Compute window from window_kwargs.

dingo.gw.importance_sampling

gw.importance_sampling.diagnostics.plot_diagnostics
gw.importance_sampling.diagnostics.plot_posterior_slice
gw.importance_sampling.diagnostics.plot_posterior_slice2d
gw.importance_sampling.importance_weights.main
gw.importance_sampling.importance_weights.parse_args

dingo.gw.inference

gw.inference.gw_samplers.GWSampler Sampler for gravitational-wave inference using neural posterior estimation.
gw.inference.gw_samplers.GWSamplerGNPE Gravitational-wave GNPE sampler. It wraps a PosteriorModel and a standard Sampler for
gw.inference.gw_samplers.GWSamplerMixin Mixin class designed to add gravitational wave functionality to Sampler classes:
gw.inference.gw_samplers.SamplerProtocol
gw.inference.gw_samplers.check_frequency_updates Validate and apply optional minimum and maximum frequency constraints
gw.inference.inference_utils.prepare_log_prob Prepare gnpe sampling with log_prob. This is required, since in its vanilla
gw.inference.visualization.generate_cornerplot
gw.inference.visualization.load_ref_samples

dingo.gw.injection

gw.injection.GWSignal Base class for generating gravitational wave signals in interferometers. Generates
gw.injection.Injection Produces injections of signals (with random or specified parameters) into stationary

dingo.gw.likelihood

gw.likelihood.StationaryGaussianGWLikelihood Implements GW likelihood for stationary, Gaussian noise.
gw.likelihood.build_stationary_gaussian_likelihood Build a StationaryGaussianLikelihoodBBH object from the metadata.
gw.likelihood.get_wfg Set up waveform generator from wfg_kwargs. The domain of the wfg is primarily
gw.likelihood.inner_product Compute the inner product between two complex arrays. There are two modes: either,
gw.likelihood.inner_product_complex Same as inner product, but without taking the real part. Retaining phase
gw.likelihood.main

dingo.gw.ls_cli

gw.ls_cli.determine_dataset_type
gw.ls_cli.ls

dingo.gw.noise

gw.noise.asd_dataset.ASDDataset Dataset of amplitude spectral densities (ASDs). The ASDs are typically
gw.noise.asd_dataset.check_domain_compatibility
gw.noise.asd_estimation.download_and_estimate_cli Command-line function to download strain data and estimate PSDs based on the data. Used for
gw.noise.asd_estimation.download_and_estimate_psds Downloads strain data for the specified time segments and estimates PSDs based on these
gw.noise.generate_dataset.generate_dataset Creates and saves an ASD dataset
gw.noise.generate_dataset.parse_args
gw.noise.generate_dataset_dag.create_args_string Generate argument string from dictionary of argument names and arguments.
gw.noise.generate_dataset_dag.create_dag Create a Condor DAG to (a) download, estimate,
gw.noise.generate_dataset_dag.split_time_segments Split up all time segments used for estimating PSDs into num_jobs-many
gw.noise.synthetic.asd_parameterization.curve_fit Fit a Lorentzian to the PSD.
gw.noise.synthetic.asd_parameterization.fit_broadband_noise Fit a spline to the broadband noise of a PSD.
gw.noise.synthetic.asd_parameterization.fit_spectral Fit Lorentzians to the spectral features of a PSD.
gw.noise.synthetic.asd_parameterization.parameterize_asd_dataset Parameterize a dataset of ASDs using a spline fit to the broadband noise and Lorentzians for the spectral features.
gw.noise.synthetic.asd_parameterization.parameterize_asds_parallel Helper function to be called for parallel ASD parameterization.
gw.noise.synthetic.asd_parameterization.parameterize_single_psd Parameterize a single ASD using a spline fit to the broadband noise and Lorentzians for the spectral features.
gw.noise.synthetic.asd_sampling.KDE Kernel Density Estimation (KDE) class for sampling ASDs.
gw.noise.synthetic.asd_sampling.get_rescaling_params Get the parameters of the ASDs that are used for rescaling.
gw.noise.synthetic.generate_dataset.generate_dataset Generate a synthetic ASD dataset from an existing dataset of real ASDs.
gw.noise.synthetic.generate_dataset.main
gw.noise.synthetic.generate_dataset.parse_args
gw.noise.synthetic.utils.get_index_for_elem
gw.noise.synthetic.utils.lorentzian_eval Evaluates a Lorentzian function at the given frequencies.
gw.noise.synthetic.utils.reconstruct_psds_from_parameters Reconstructs the PSDs from the parameters.
gw.noise.utils.get_event_gps_times
gw.noise.utils.get_time_segments Creates a dictionary storing time segments used for estimating PSDs
gw.noise.utils.merge_datasets Merges a list of asd datasets into ont
gw.noise.utils.merge_datasets_cli Command-line function to combine a collection of datasets into one. Used for
gw.noise.utils.psd_data_path Return the directory where the PSD data is to be stored

dingo.gw.prior

gw.prior.BBHExtrinsicPriorDict This class is the same as BBHPriorDict except that it does not require mass parameters.
gw.prior.build_prior_with_defaults Generate BBHPriorDict based on dictionary of prior settings,
gw.prior.split_off_extrinsic_parameters Split theta into intrinsic and extrinsic parameters.

dingo.gw.result

gw.result.Result A dataset class to hold a collection of gravitational-wave parameter samples and

dingo.gw.temporary_debug_utils

gw.temporary_debug_utils.save_training_injection For debugging: extract a training injection. To be used inside train or test loop.

dingo.gw.training

gw.training.train_builders.build_dataset Build a dataset based on a settings dictionary. This should contain the path of
gw.training.train_builders.build_svd_for_embedding_network Construct SVD matrices V based on clean waveforms in each interferometer. These
gw.training.train_builders.set_train_transforms Set the transform attribute of a waveform dataset based on a settings dictionary.
gw.training.train_pipeline.copy_files_to_local Copy files to local node if local_dir is provided to minimize network traffic during training.
gw.training.train_pipeline.initialize_stage Initializes training based on PosteriorModel metadata and current stage:
gw.training.train_pipeline.parse_args
gw.training.train_pipeline.prepare_training_new Based on a settings dictionary, initialize a WaveformDataset and PosteriorModel.
gw.training.train_pipeline.prepare_training_resume Loads a PosteriorModel from a checkpoint, as well as the corresponding
gw.training.train_pipeline.train_local
gw.training.train_pipeline.train_stages Train the network, iterating through the sequence of stages. Stages can change
gw.training.train_pipeline_condor.copy_logfiles
gw.training.train_pipeline_condor.copyfile
gw.training.train_pipeline_condor.create_submission_file Creates submission file and writes it to filename.
gw.training.train_pipeline_condor.train_condor
gw.training.utils.append_stage

dingo.gw.transforms

gw.transforms.detector_transforms.ApplyCalibrationToWaveform Apply calibration correction to the waveform based on calibration parameters
gw.transforms.detector_transforms.GetDetectorTimes Compute the time shifts in the individual detectors based on the sky
gw.transforms.detector_transforms.ProjectOntoDetectors Project the GW polarizations onto the detectors in ifo_list. This does
gw.transforms.detector_transforms.SampleCalibrationParameters Expand out a waveform using several detector calibration draws. These multiple
gw.transforms.detector_transforms.TimeShiftStrain Time shift the strains in the individual detectors according to the
gw.transforms.detector_transforms.time_delay_from_geocenter Calculate time delay between ifo and geocenter. Identical to method
gw.transforms.general_transforms.UnpackDict Unpacks the dictionary to prepare it for final output of the dataloader.
gw.transforms.gnpe_transforms.GNPEBase A base class for Group Equivariant Neural Posterior Estimation [1].
gw.transforms.gnpe_transforms.GNPECoalescenceTimes GNPE [1] Transformation for detector coalescence times.
gw.transforms.inference_transforms.CopyToExtrinsicParameters Copy parameters specified in self.parameter_list from sample[“parameters”] to
gw.transforms.inference_transforms.ExpandStrain Expand the waveform of sample by adding a batch axis and copying the waveform
gw.transforms.inference_transforms.PostCorrectGeocentTime Post correction for geocent time: add GNPE proxy (only necessary if exact
gw.transforms.inference_transforms.ResetSample Resets sample:
gw.transforms.inference_transforms.ToTorch Convert all numpy arrays sample to torch tensors and push them to the specified
gw.transforms.noise_transforms.AddWhiteNoiseComplex Adds white noise with a standard deviation determined by self.scale to the
gw.transforms.noise_transforms.RepackageStrainsAndASDS Repackage the strains and the asds into an [num_ifos, 3, num_bins]
gw.transforms.noise_transforms.SampleNoiseASD Sample a batch of random ASDs for each detector and place them in sample[‘asds’].
gw.transforms.noise_transforms.WhitenAndScaleStrain Whiten the strain data by dividing w.r.t. the corresponding asds,
gw.transforms.noise_transforms.WhitenFixedASD Whiten frequency-series data according to an ASD specified in a file. This uses the
gw.transforms.noise_transforms.WhitenStrain Whiten the strain data by dividing w.r.t. the corresponding asds.
gw.transforms.parameter_transforms.SampleExtrinsicParameters Sample extrinsic parameters and add them to sample in a separate dictionary.
gw.transforms.parameter_transforms.SelectStandardizeRepackageParameters This transformation selects the parameters in standardization_dict,
gw.transforms.parameter_transforms.StandardizeParameters Standardize parameters according to the transform (x - mu) / std.
gw.transforms.utils.get_batch_size_of_input_sample
gw.transforms.waveform_transforms.CropMaskStrainRandom Apply random cropping of strain, by masking waveform and ASD outside the crop.
gw.transforms.waveform_transforms.DecimateAll Transform operator for decimation to multibanded frequency domain.
gw.transforms.waveform_transforms.DecimateWaveformsAndASDS Transform operator for decimation of unwhitened waveforms and corresponding ASDS
gw.transforms.waveform_transforms.MaskDataForFrequencyRangeUpdate Set waveform to zero and ASD to one according to minimum_frequency and maximum_frequency.
gw.transforms.waveform_transforms.check_sample_in_domain
gw.transforms.waveform_transforms.create_mask_based_on_frequency_update Creates a mask for each detector containing True for sample_frequencies not affected by the frequency updates
gw.transforms.waveform_transforms.decimate_recursive In-place decimation of nested dicts of arrays.

dingo.gw.waveform_generator

gw.waveform_generator.frame_utils.convert_J_to_L0_frame
gw.waveform_generator.frame_utils.get_JL0_euler_angles
gw.waveform_generator.frame_utils.rotate_y
gw.waveform_generator.frame_utils.rotate_z
gw.waveform_generator.waveform_generator.NewInterfaceWaveformGenerator Generate polarizations using GWSignal routines in the specified domain for a
gw.waveform_generator.waveform_generator.SEOBNRv4PHM_maximum_starting_frequency Given a total mass return the largest possible starting frequency allowed
gw.waveform_generator.waveform_generator.WaveformGenerator Generate polarizations using LALSimulation routines in the specified domain for a
gw.waveform_generator.waveform_generator.generate_waveforms_parallel Generate a waveform dataset, optionally in parallel.
gw.waveform_generator.waveform_generator.generate_waveforms_task_func Picklable wrapper function for parallel waveform generation.
gw.waveform_generator.waveform_generator.sum_contributions_m Sum the contributions over m-components, optionally introducing a phase shift.
gw.waveform_generator.wfg_utils.get_polarizations_from_fd_modes_m
gw.waveform_generator.wfg_utils.get_starting_frequency_for_SEOBRNRv5_conditioning Compute starting frequency needed for having 3 extra cycles for tapering the TD modes.
gw.waveform_generator.wfg_utils.get_tapering_window_for_complex_time_series Get window for tapering of a complex time series from the lal backend. This is done
gw.waveform_generator.wfg_utils.linked_list_modes_to_dict_modes Convert linked list of modes into dictionary with keys (l,m).
gw.waveform_generator.wfg_utils.taper_td_modes_for_SEOBRNRv5_extra_time Apply standard tapering procedure mimicking LALSimulation routine (https://lscsoft.docs.ligo.org/lalsuite/lalsimulation/_l_a_l_sim_inspiral_generator_conditioning_8c.html#ac78b5fcdabf8922a3ac479da20185c85)
gw.waveform_generator.wfg_utils.taper_td_modes_in_place Taper the time domain modes in place.
gw.waveform_generator.wfg_utils.td_modes_to_fd_modes Transform dict of td modes to dict of fd modes via FFT. The td modes are expected