GWForge.population.pdb_mass_sampler

Sampling function for NotchFilterBinnedPairingMassDistribution model.

This module provides a function to sample binary masses according to the NotchFilterBinnedPairingMassDistribution population model.

Functions

importance_sampling_m1_m2_prop(n_samples, A, A2, ...)

Sample binary masses from the NotchFilterBinnedPairingMassDistribution model

importance_sampling_m1_q_prop(n_samples, A, A2, NSmin, ...)

Importance sampling using near-optimal proposal:

lintsampling(n_samples, A, A2, NSmin, NSmax, BHmin, ...)

Sample binary masses using LintSampler.

Module Contents

GWForge.population.pdb_mass_sampler.importance_sampling_m1_m2_prop(n_samples, A, A2, NSmin, NSmax, BHmin, BHmax, UPPERmin, UPPERmax, n0, n1, n2, n3, n4, n5, alpha_1, alpha_2, alpha_dip, mu1, sig1, mix1, mu2, sig2, mix2, beta_pair_1, beta_pair_2, mbreak, mmin=0.5, mmax=350.0, oversample_factor=5, verbose=False)[source]

Sample binary masses from the NotchFilterBinnedPairingMassDistribution model using importance sampling with a proposal distribution.

This function draws oversample_factor * n_samples points from an internal proposal distribution over (m1, m2) and assigns an importance weight to each point proportional to the target population density divided by the proposal density. The weights are then used to approximate draws from the target distribution, typically via weighted resampling with replacement.

The quality of the resulting (approximately) unweighted sample depends on the variability of the importance weights. Internally, the effective sample size (ESS) can be estimated from the weights; a low ESS (relative to n_samples) indicates that the proposal is poorly matched to the target, in which case callers may wish to increase oversample_factor or otherwise interpret the samples with caution. When verbose is True, diagnostic information about the weights and ESS may be printed.

Parameters:
  • n_samples (int) – Number of samples to draw (after any internal resampling)

  • A (float) – Depth of the lower mass gap dip

  • A2 (float) – Depth of the upper mass gap dip

  • NSmin (float) – Minimum mass (lower cutoff)

  • NSmax (float) – Start of lower mass gap

  • BHmin (float) – End of lower mass gap

  • BHmax (float) – Maximum mass in power-law component

  • UPPERmin (float) – Start of upper mass gap

  • UPPERmax (float) – End of upper mass gap

  • n0 (float) – Sharpness of low mass cutoff

  • n1 (float) – Sharpness of lower edge of lower mass gap

  • n2 (float) – Sharpness of upper edge of lower mass gap

  • n3 (float) – Sharpness of lower edge of upper mass gap

  • n4 (float) – Sharpness of upper edge of upper mass gap

  • n5 (float) – Sharpness of high mass cutoff

  • alpha_1 (float) – Power-law exponent for m < NSmax

  • alpha_2 (float) – Power-law exponent for m > BHmin

  • alpha_dip (float) – Power-law exponent between NSmax and BHmin

  • mu1 (float) – Mean of first Gaussian peak

  • sig1 (float) – Width of first Gaussian peak

  • mix1 (float) – Mixing fraction of first Gaussian peak

  • mu2 (float) – Mean of second Gaussian peak

  • sig2 (float) – Width of second Gaussian peak

  • mix2 (float) – Mixing fraction of second Gaussian peak

  • beta_pair_1 (float) – Mass ratio exponent for m2 < mbreak

  • beta_pair_2 (float) – Mass ratio exponent for m2 >= mbreak

  • mbreak (float) – Mass breakpoint for pairing function transition

  • mmin (float, optional) – Minimum mass (default: 0.5)

  • mmax (float, optional) – Maximum mass (default: 350.0)

  • oversample_factor (int, optional) – n_proposals/n_samples (default: 5)

  • verbose (bool, optional) – Print progress information (default: False)

Returns:

  • m1_samples (ndarray) – Sampled primary masses

  • m2_samples (ndarray) – Sampled secondary masses

  • ess (float) – Effective sample size

GWForge.population.pdb_mass_sampler.importance_sampling_m1_q_prop(n_samples, A, A2, NSmin, NSmax, BHmin, BHmax, UPPERmin, UPPERmax, n0, n1, n2, n3, n4, n5, alpha_1, alpha_2, alpha_dip, mu1, sig1, mix1, mu2, sig2, mix2, beta_pair_1, beta_pair_2, mbreak, mmin=0.5, mmax=350.0, oversample_factor=3, verbose=False)[source]
Importance sampling using near-optimal proposal:

m1 ~ p_m(m) q ~ pairing power-law m2 = q * m1

GWForge.population.pdb_mass_sampler.lintsampling(n_samples, A, A2, NSmin, NSmax, BHmin, BHmax, UPPERmin, UPPERmax, n0, n1, n2, n3, n4, n5, alpha_1, alpha_2, alpha_dip, mu1, sig1, mix1, mu2, sig2, mix2, beta_pair_1, beta_pair_2, mbreak, mmin=0.5, mmax=350.0, grid_size=256, verbose=False)[source]

Sample binary masses using LintSampler.