dingo.gw.noise.synthetic package

Submodules

dingo.gw.noise.synthetic.asd_parameterization module

dingo.gw.noise.synthetic.asd_parameterization.curve_fit(data, std, delta_f=None)

Fit a Lorentzian to the PSD.

Parameters:
  • data (dict) – Dictionary containing the PSD, broadband noise, and frequency grid.

  • std (float) – Standard deviation of the Gaussian noise.

  • delta_f (float) – Truncation parameter for Lorentzians. Set to None if non-positive value is passed.

dingo.gw.noise.synthetic.asd_parameterization.fit_broadband_noise(domain, psd, num_spline_positions, sigma, f_min=20)

Fit a spline to the broadband noise of a PSD.

Parameters:
  • domain (Domain) – Domain object containing the frequency grid.

  • psd (array_like) – PSD to be parameterized.

  • num_spline_positions (int) – Number of spline positions.

  • sigma (float) – Standard deviation of the Gaussian noise used for the spline fit.

  • f_min (float, optional) – position of the first node for the spline fi

dingo.gw.noise.synthetic.asd_parameterization.fit_spectral(frequencies, psd, broadband_noise, num_spectral_segments, sigma, delta_f)

Fit Lorentzians to the spectral features of a PSD.

Parameters:
  • frequencies (array_like) – Frequency grid.

  • psd (array_like) – PSD to be parameterized.

  • broadband_noise (array_like) – Broadband noise of the PSD.

  • num_spectral_segments (int) – Number of spectral segments.

  • sigma (float) – Standard deviation of the Gaussian noise used for the spline fit.

  • delta_f (float) – Truncation parameter for Lorentzians. Set to None if non-positive value is passed.

dingo.gw.noise.synthetic.asd_parameterization.parameterize_asd_dataset(real_dataset, parameterization_settings, num_processes, verbose)

Parameterize a dataset of ASDs using a spline fit to the broadband noise and Lorentzians for the spectral features.

Parameters:
  • real_dataset (ASDDataset) – Dataset containing the ASDs to be parameterized.

  • parameterization_settings (dict) – Dictionary containing the settings for the parameterization.

  • num_processes (int) – Number of processes to use for parallelization.

  • verbose (bool) – If True, print progress bars.

dingo.gw.noise.synthetic.asd_parameterization.parameterize_asds_parallel(asds, domain, parameterization_settings, pool=None, verbose=False)

Helper function to be called for parallel ASD parameterization.

Parameters:
  • asds (array_like) – Array containing the ASDs to be parameterized.

  • domain (Domain) – Domain object containing the frequency grid.

  • parameterization_settings (dict) – Dictionary containing the settings for the parameterization.

  • pool (Pool, optional) – Pool object for parallelization. If None, the function is not parallelized.

  • verbose (bool) – If True, print progress bars.

dingo.gw.noise.synthetic.asd_parameterization.parameterize_single_psd(real_psd, domain, parameterization_settings)

Parameterize a single ASD using a spline fit to the broadband noise and Lorentzians for the spectral features.

Parameters:
  • real_psd (array_like) – PSD to be parameterized.

  • domain (Domain) – Domain object containing the frequency grid.

  • parameterization_settings (dict) – Dictionary containing the settings for the parameterization.

dingo.gw.noise.synthetic.asd_sampling module

class dingo.gw.noise.synthetic.asd_sampling.KDE(parameter_dict, sampling_settings)

Bases: object

Kernel Density Estimation (KDE) class for sampling ASDs.

Parameters:
  • parameter_dict (dict) – Dictionary containing the parameters of the ASDs used for fitting the synthetic distribution.

  • sampling_settings (dict) – Dictionary containing the settings for the sampling.

fit(weights=None)

Fit the KDEs to the parameters saved in ‘self.parameter_dict’. :param weights: Weights for the KDEs. If None, all weights are set to 1. :type weights: array_like, optional

sample(num_samples, rescaling_ys=None)

Sample a synthetic ASD dataset from the fitted KDEs

Parameters: num_samples (int): Number of samples to draw. rescaling_ys (dict): Optional dictionary of spline y-values used for rescaling the base noise.

dingo.gw.noise.synthetic.asd_sampling.get_rescaling_params(filenames, parameterization_settings)

Get the parameters of the ASDs that are used for rescaling. :param filenames: Dictionary containing the paths to the ASD files. :type filenames: dict :param parameterization_settings: Dictionary containing the settings for the parameterization. :type parameterization_settings: dict

dingo.gw.noise.synthetic.generate_dataset module

dingo.gw.noise.synthetic.generate_dataset.generate_dataset(real_dataset, settings: Dict, num_samples, num_processes: int, verbose: bool)

Generate a synthetic ASD dataset from an existing dataset of real ASDs.

Parameters:
  • real_dataset (ASDDataset) – Existing dataset of real ASDs.

  • settings (dict) – Dictionary containing the settings for the parameterization and sampling.

  • num_processes (int) – Number of processes to use in pool for parallel parameterization.

  • verbose (bool) – Whether to print progress information.

dingo.gw.noise.synthetic.generate_dataset.main()
dingo.gw.noise.synthetic.generate_dataset.parse_args()

dingo.gw.noise.synthetic.utils module

dingo.gw.noise.synthetic.utils.get_index_for_elem(arr, elem)
dingo.gw.noise.synthetic.utils.lorentzian_eval(x, f0, A, Q, delta_f=None)

Evaluates a Lorentzian function at the given frequencies. :param x: Frequencies at which the Lorentzian is evaluated. :type x: array_like :param f0: Center frequency of the Lorentzian. :type f0: float :param A: Amplitude of the Lorentzian. :type A: float :param Q: Parameter determining the width of the Lorentzian :type Q: float :param delta_f: If given, the Lorentzian is truncated :type delta_f: float, optional

Return type:

array_like

dingo.gw.noise.synthetic.utils.reconstruct_psds_from_parameters(parameters_dict, domain, parameterization_settings)

Reconstructs the PSDs from the parameters. :param parameters_dict: Dictionary containing the parameters of the PSDs. :type parameters_dict: dict :param domain: Domain object containing the frequencies at which the PSDs are evaluated. :type domain: dingo.gw.noise.domain.Domain :param parameterization_settings: Dictionary containing the settings for the parameterization. :type parameterization_settings: dict

Return type:

array_like

Module contents