GWForge.population.spin

Attributes

Classes

Functions

truncated_normal(value, mu, sigma, low, high)

Truncated-normal density and its log-derivatives in mu and sigma.

default_spin_magnitude_density(magnitude, mu_chi, ...)

p(chi) for the Default BBH model: Eq. B15 of arXiv:2605.27226.

default_spin_tilt_density(cosine, mu_t, sigma_t, xi_spin)

The marginal p(cos t) of one component: Eq. B16, one tilt at a time.

Module Contents

GWForge.population.spin.choices = ['Non-spinning', 'Aligned', 'Aligned-Bilby', 'Aligned-Uniform', 'Beta-Aligned',...[source]
GWForge.population.spin.DEFAULT_BBH_SPIN_PARAMETERS[source]
GWForge.population.spin.truncated_normal(value, mu, sigma, low, high)[source]

Truncated-normal density and its log-derivatives in mu and sigma.

The kernel both halves of the Default BBH spin model are built from: the magnitudes are one of these on \([0, a_{\max}]\), and the cos-tilt mixture’s Gaussian component is one on \([t_{\min}, 1]\).

With \(z = (x-\mu)/\sigma\), \(a = (\text{low}-\mu)/\sigma\), \(b = (\text{high}-\mu)/\sigma\) and \(D = \Phi(b) - \Phi(a)\),

\[\frac{\partial \ln N}{\partial \mu} = \frac{z}{\sigma} - \frac{\phi(a) - \phi(b)}{\sigma D}, \qquad \frac{\partial \ln N}{\partial \sigma} = \frac{z^2 - 1}{\sigma} - \frac{a\phi(a) - b\phi(b)}{\sigma D}.\]
Parameters:
  • value (array_like)

  • mu (float)

  • sigma (float)

  • low (float)

  • high (float)

Returns:

{"density": ..., "mu": ..., "sigma": ...}, the latter two being d ln N / d mu and d ln N / d sigma. density is zero outside [low, high].

Return type:

dict

GWForge.population.spin.default_spin_magnitude_density(magnitude, mu_chi, sigma_chi, amax=1.0)[source]

p(chi) for the Default BBH model: Eq. B15 of arXiv:2605.27226.

A truncated Gaussian \(N_{[0, a_{\max}]}(\mu_\chi, \sigma_\chi)\), the same for both components. sigma_chi is a standard deviation; the Beta models take a variance and are a different model.

GWForge.population.spin.default_spin_tilt_density(cosine, mu_t, sigma_t, xi_spin, t_min=-1.0)[source]

The marginal p(cos t) of one component: Eq. B16, one tilt at a time.

\[p(\cos t) = \xi\, N_{[t_{\min}, 1]}(\mu_t, \sigma_t) + \frac{1 - \xi}{1 - t_{\min}}.\]

Careful: the model is joint over the binary – one draw decides whether both tilts come from the Gaussian or both from the isotropic component – so the density of the pair is not the product of two of these. It is

\[p(\cos t_1, \cos t_2) = \xi\, N(\cos t_1) N(\cos t_2) + \frac{1 - \xi}{(1 - t_{\min})^2},\]

which is what GWForge.population_fisher.DefaultSpin evaluates and what makes corr(cos t_1, cos t_2) non-zero. This marginal is the right thing to compare a one-dimensional histogram against, and nothing else.

GWForge.population.spin.DEFAULT_PARAMETERS[source]
class GWForge.population.spin.Spin(spin_model, number_of_samples, parameters=None)[source]
spin_model = ''[source]
number_of_samples[source]
parameters[source]
sample()[source]

Generate spin distribution samples based on the chosen parameterised model and its parameters.

Returns:

dict

Return type:

A dictionary containing spin distribution samples.