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_m1normalises by the trapezoidal integral over them1sgrid;p_qnormalises via linear interpolation of the per-m1mass-ratio norm.
Classes¶
Shared machinery for the smoothed primary-mass + power-law mass-ratio models. |
|
Shared machinery for the smoothed primary-mass + power-law mass-ratio models. |
|
Shared machinery for the smoothed primary-mass + power-law mass-ratio models. |
|
Shared machinery for the smoothed primary-mass + power-law mass-ratio models. |
|
BGP model: broken power law + two peaks, with low-mass Planck taper and a |
Functions¶
|
Normalised power-law pdf |
|
Truncated-normal pdf on |
|
One-sided Planck-taper window applied to a mass pdf. |
|
Power law + single Gaussian peak primary-mass model (unsmoothed). |
|
Power law + two Gaussian peaks primary-mass model (unsmoothed). |
|
Broken power-law primary-mass model (unsmoothed). |
|
Normal pdf truncated below at |
|
Broken power law of GWTC-5.0 Eq. B10, normalised via Eq. B11. |
|
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**alphaon[low, high].Matches
gwpopulation.utils.powerlaw.alphais the spectral index (alpha == -1uses 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.
Srises smoothly from 0 to 1 over(mmin, mmin + delta_m]and is a hard step atmmax. Reproducesgwpopulation’sBaseSmoothedMassDistribution .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
lowand 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.BaseSmoothedMassDistributionclosely enough to be a drop-in replacement for GWForge’s usage: it exposesm1s/qsgrids andp_m1/p_qwith identical keyword names and normalisation conventions.
- class gwforge.GWForge.population._smoothed_mass.SinglePeakSmoothedMassDistribution(mmin=2, mmax=100, normalization_shape=(1000, 500))[source]¶
Bases:
BaseSmoothedMassDistributionShared machinery for the smoothed primary-mass + power-law mass-ratio models.
Mirrors
gwpopulation.models.mass.BaseSmoothedMassDistributionclosely enough to be a drop-in replacement for GWForge’s usage: it exposesm1s/qsgrids andp_m1/p_qwith identical keyword names and normalisation conventions.
- class gwforge.GWForge.population._smoothed_mass.MultiPeakSmoothedMassDistribution(mmin=2, mmax=100, normalization_shape=(1000, 500))[source]¶
Bases:
BaseSmoothedMassDistributionShared machinery for the smoothed primary-mass + power-law mass-ratio models.
Mirrors
gwpopulation.models.mass.BaseSmoothedMassDistributionclosely enough to be a drop-in replacement for GWForge’s usage: it exposesm1s/qsgrids andp_m1/p_qwith identical keyword names and normalisation conventions.
- class gwforge.GWForge.population._smoothed_mass.BrokenPowerLawSmoothedMassDistribution(mmin=2, mmax=100, normalization_shape=(1000, 500))[source]¶
Bases:
BaseSmoothedMassDistributionShared machinery for the smoothed primary-mass + power-law mass-ratio models.
Mirrors
gwpopulation.models.mass.BaseSmoothedMassDistributionclosely enough to be a drop-in replacement for GWForge’s usage: it exposesm1s/qsgrids andp_m1/p_qwith identical keyword names and normalisation conventions.
- class gwforge.GWForge.population._smoothed_mass.BrokenPowerLawTwoPeakSmoothedMassDistribution(mmin=2, mmax=100, normalization_shape=(1000, 500))[source]¶
Bases:
BaseSmoothedMassDistributionBGP 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).