gwforge.GWForge.population._smoothed_mass

Numpy/SciPy reimplementations of the gwpopulation smoothed mass models.

GWForge only ever used a thin slice of gwpopulation for its mass models: the SinglePeak/MultiPeak/BrokenPowerLaw SmoothedMassDistribution classes, and only their m1s/qs grids plus p_m1/p_q evaluations. These are the standard Talbot & Thrane (2018) analytic forms with a Planck-taper low-mass smoothing window (see the GWTC-3 population paper, arXiv:2111.03634).

Reimplementing them here removes the runtime dependency on gwpopulation (and its heavy transitive stack). The classes intentionally mirror the gwpopulation API (same constructor signature, m1s/qs attributes, p_m1/p_q methods, same keyword names) so they are drop-in replacements and can be validated directly against gwpopulation – see tests/test_population_smoothed_mass.py.

The functional forms match gwpopulation exactly:

  • powerlaw / truncnorm – normalised power-law and truncated-normal pdfs.

  • smoothing – one-sided Planck-taper window on (mmin, mmin + delta_m] (Talbot & Thrane 2018, Eqs. 7-8; note the sign fix documented there).

  • two_component_single / three_component_single / double_power_law_primary_mass – the primary-mass models.

  • p_m1 normalises by the trapezoidal integral over the m1s grid; p_q normalises via linear interpolation of the per-m1 mass-ratio norm.

Classes

BaseSmoothedMassDistribution

Shared machinery for the smoothed primary-mass + power-law mass-ratio models.

SinglePeakSmoothedMassDistribution

Shared machinery for the smoothed primary-mass + power-law mass-ratio models.

MultiPeakSmoothedMassDistribution

Shared machinery for the smoothed primary-mass + power-law mass-ratio models.

BrokenPowerLawSmoothedMassDistribution

Shared machinery for the smoothed primary-mass + power-law mass-ratio models.

BrokenPowerLawTwoPeakSmoothedMassDistribution

BGP model: broken power law + two peaks, with low-mass Planck taper and a

Functions

powerlaw(xx, alpha, high, low)

Normalised power-law pdf p(x) x**alpha on [low, high].

truncnorm(xx, mu, sigma, high, low)

Truncated-normal pdf on [low, high].

smoothing(masses, mmin, mmax, delta_m)

One-sided Planck-taper window applied to a mass pdf.

two_component_single(mass, alpha, mmin, mmax, lam, ...)

Power law + single Gaussian peak primary-mass model (unsmoothed).

three_component_single(mass, alpha, mmin, mmax, lam, ...)

Power law + two Gaussian peaks primary-mass model (unsmoothed).

double_power_law_primary_mass(mass, alpha_1, alpha_2, ...)

Broken power-law primary-mass model (unsmoothed).

left_truncated_normal(mass, mu, sigma, low)

Normal pdf truncated below at low and unbounded above (N_lt).

broken_power_law(mass, alpha_1, alpha_2, m_break, ...)

Broken power law of GWTC-5.0 Eq. B10, normalised via Eq. B11.

broken_power_law_two_peak(mass, alpha_1, alpha_2, ...)

Broken power law + two left-truncated Gaussian peaks (GWTC-5.0 Eq. B12).

Module Contents

gwforge.GWForge.population._smoothed_mass.powerlaw(xx, alpha, high, low)[source]

Normalised power-law pdf p(x) x**alpha on [low, high].

Matches gwpopulation.utils.powerlaw. alpha is the spectral index (alpha == -1 uses the logarithmic normalisation).

gwforge.GWForge.population._smoothed_mass.truncnorm(xx, mu, sigma, high, low)[source]

Truncated-normal pdf on [low, high].

Matches gwpopulation.utils.truncnorm (which reproduces scipy’s truncated normal normalisation via the error function).

gwforge.GWForge.population._smoothed_mass.smoothing(masses, mmin, mmax, delta_m)[source]

One-sided Planck-taper window applied to a mass pdf.

S rises smoothly from 0 to 1 over (mmin, mmin + delta_m] and is a hard step at mmax. Reproduces gwpopulation’s BaseSmoothedMassDistribution .smoothing (Talbot & Thrane 2018, Eqs. 7-8). delta_m == 0 -> no taper.

gwforge.GWForge.population._smoothed_mass.two_component_single(mass, alpha, mmin, mmax, lam, mpp, sigpp, gaussian_mass_maximum=100)[source]

Power law + single Gaussian peak primary-mass model (unsmoothed).

gwforge.GWForge.population._smoothed_mass.three_component_single(mass, alpha, mmin, mmax, lam, lam_1, mpp_1, sigpp_1, mpp_2, sigpp_2, gaussian_mass_maximum=100)[source]

Power law + two Gaussian peaks primary-mass model (unsmoothed).

gwforge.GWForge.population._smoothed_mass.double_power_law_primary_mass(mass, alpha_1, alpha_2, mmin, mmax, break_fraction)[source]

Broken power-law primary-mass model (unsmoothed).

gwforge.GWForge.population._smoothed_mass.left_truncated_normal(mass, mu, sigma, low)[source]

Normal pdf truncated below at low and unbounded above (N_lt).

Used by the BGP mass model (GWTC-5.0 Eq. B12). Implemented as the truncated normal with an infinite upper bound.

gwforge.GWForge.population._smoothed_mass.broken_power_law(mass, alpha_1, alpha_2, m_break, mmin, m_high)[source]

Broken power law of GWTC-5.0 Eq. B10, normalised via Eq. B11.

\[\begin{split}p_{BP}(m) = \frac{1}{N} \begin{cases} (m/m_{break})^{-\alpha_1} & m_{min} \le m < m_{break} \\ (m/m_{break})^{-\alpha_2} & m_{break} \le m < m_{high} \end{cases}\end{split}\]

with normalisation \(N = m_{break}\left[ \frac{1 - (m_{min}/m_{break})^{1-\alpha_1}}{1-\alpha_1} + \frac{(m_{high}/m_{break})^{1-\alpha_2} - 1}{1-\alpha_2}\right]\).

gwforge.GWForge.population._smoothed_mass.broken_power_law_two_peak(mass, alpha_1, alpha_2, m_break, mmin, m_high, lam_0, lam_1, mpp_1, sigpp_1, mpp_2, sigpp_2)[source]

Broken power law + two left-truncated Gaussian peaks (GWTC-5.0 Eq. B12).

The mixture (before the low-mass Planck taper, which the base class applies):

\[\pi(m) \propto \lambda_0\, p_{BP}(m) + \lambda_1\, N_{lt}(m | \mu_1, \sigma_1) + (1 - \lambda_0 - \lambda_1)\, N_{lt}(m | \mu_2, \sigma_2).\]

This is the “BGP” (Broken power law + Gaussian Peaks) fiducial BBH mass model used in the GWTC-4.0/5.0 population analyses.

class gwforge.GWForge.population._smoothed_mass.BaseSmoothedMassDistribution(mmin=2, mmax=100, normalization_shape=(1000, 500))[source]

Shared machinery for the smoothed primary-mass + power-law mass-ratio models.

Mirrors gwpopulation.models.mass.BaseSmoothedMassDistribution closely enough to be a drop-in replacement for GWForge’s usage: it exposes m1s/qs grids and p_m1/p_q with identical keyword names and normalisation conventions.

primary_model = None[source]
mmin = 2[source]
mmax = 100[source]
m1s[source]
qs[source]
p_m1(dataset, **kwargs)[source]
norm_p_m1(delta_m, **kwargs)[source]
p_q(dataset, beta, mmin, delta_m)[source]
_norm_p_q(beta, mmin, delta_m, masses)[source]

Per-m1 mass-ratio norm, linearly interpolated onto masses.

class gwforge.GWForge.population._smoothed_mass.SinglePeakSmoothedMassDistribution(mmin=2, mmax=100, normalization_shape=(1000, 500))[source]

Bases: BaseSmoothedMassDistribution

Shared machinery for the smoothed primary-mass + power-law mass-ratio models.

Mirrors gwpopulation.models.mass.BaseSmoothedMassDistribution closely enough to be a drop-in replacement for GWForge’s usage: it exposes m1s/qs grids and p_m1/p_q with identical keyword names and normalisation conventions.

primary_model[source]
class gwforge.GWForge.population._smoothed_mass.MultiPeakSmoothedMassDistribution(mmin=2, mmax=100, normalization_shape=(1000, 500))[source]

Bases: BaseSmoothedMassDistribution

Shared machinery for the smoothed primary-mass + power-law mass-ratio models.

Mirrors gwpopulation.models.mass.BaseSmoothedMassDistribution closely enough to be a drop-in replacement for GWForge’s usage: it exposes m1s/qs grids and p_m1/p_q with identical keyword names and normalisation conventions.

primary_model[source]
class gwforge.GWForge.population._smoothed_mass.BrokenPowerLawSmoothedMassDistribution(mmin=2, mmax=100, normalization_shape=(1000, 500))[source]

Bases: BaseSmoothedMassDistribution

Shared machinery for the smoothed primary-mass + power-law mass-ratio models.

Mirrors gwpopulation.models.mass.BaseSmoothedMassDistribution closely enough to be a drop-in replacement for GWForge’s usage: it exposes m1s/qs grids and p_m1/p_q with identical keyword names and normalisation conventions.

primary_model[source]
class gwforge.GWForge.population._smoothed_mass.BrokenPowerLawTwoPeakSmoothedMassDistribution(mmin=2, mmax=100, normalization_shape=(1000, 500))[source]

Bases: BaseSmoothedMassDistribution

BGP model: broken power law + two peaks, with low-mass Planck taper and a power-law mass ratio (GWTC-5.0 App. B.4, Eqs. B10-B14).

primary_model[source]