gwforge.GWForge.population._smoothed_mass

Numpy/SciPy reimplementations of the gwpopulation smoothed mass models.

Classes

BaseSmoothedMassDistribution

Mirrors gwpopulation.models.mass.BaseSmoothedMassDistribution closely enough

SinglePeakSmoothedMassDistribution

Mirrors gwpopulation.models.mass.BaseSmoothedMassDistribution closely enough

MultiPeakSmoothedMassDistribution

Mirrors gwpopulation.models.mass.BaseSmoothedMassDistribution closely enough

BrokenPowerLawSmoothedMassDistribution

Mirrors gwpopulation.models.mass.BaseSmoothedMassDistribution closely enough

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]

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, mmin_2=None, delta_m_2=None)[source]

Mass-ratio distribution \(p(q \mid m_1) \propto q^\beta S(m_2)\).

Parameters:
  • dataset (dict) – mass_1 and mass_ratio.

  • beta (float) – Power-law index \(\beta_q\).

  • mmin (float) – The primary taper, \((m_{1,\rm low}, \delta_{m,1})\).

  • delta_m (float) – The primary taper, \((m_{1,\rm low}, \delta_{m,1})\).

  • mmin_2 (float or None) – The secondary taper, \((m_{2,\rm low}, \delta_{m,2})\) (the posterior’s mlow_2/delta_m_2). Each defaults to its primary counterpart, which is the single-taper behaviour the models without a separate secondary edge – PowerLaw+Peak, MultiPeak, BrokenPowerLaw – keep.

  • delta_m_2 (float or None) – The secondary taper, \((m_{2,\rm low}, \delta_{m,2})\) (the posterior’s mlow_2/delta_m_2). Each defaults to its primary counterpart, which is the single-taper behaviour the models without a separate secondary edge – PowerLaw+Peak, MultiPeak, BrokenPowerLaw – keep.

Return type:

numpy.ndarray

_norm_p_q(beta, mmin, delta_m, masses, mmin_2=None, delta_m_2=None)[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

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

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

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]