gwkokab.models.spinΒΆ

ClassesΒΆ

GWTC4EffectiveSpinSkewNormalModel

GWTC-4 effective spin skew normal model.

FunctionsΒΆ

BetaFromMeanVar(β†’ numpyro.distributions.Beta)

Beta distribution parameterized by the expected value and variance.

GaussianSpinModel(...)

Bivariate normal distribution for the effective and precessing spins.

GenericTiltModel(β†’ numpyro.distributions.MixtureGeneral)

A mixture model of spin orientations with isotropic and normally distributed

Package ContentsΒΆ

class gwkokab.models.spin.GWTC4EffectiveSpinSkewNormalModel(loc: jaxtyping.ArrayLike, scale: jaxtyping.ArrayLike, epsilon: jaxtyping.ArrayLike, *, validate_args: bool | None = None)[source]ΒΆ

Bases: numpyro.distributions.Distribution

GWTC-4 effective spin skew normal model.

This class implements effective spin skew normal model introduced in equation (B37) GWTC-4.0: Population Properties of Merging Compact Binaries.

\[\begin{split}p(\chi_\mathrm{eff} | \mu, \sigma, \epsilon) \propto \begin{cases} (1 + \epsilon) \mathcal{N}_{[-1,1]}(\chi_\mathrm{eff} | \mu, \sigma (1 + \epsilon)), & \chi_\mathrm{eff} \leq \mu \\ (1 - \epsilon) \mathcal{N}_{[-1,1]}(\chi_\mathrm{eff} | \mu, \sigma (1 - \epsilon)), & \chi_\mathrm{eff} > \mu \end{cases}\end{split}\]

where \(\mathcal{N}_{[-1,1]}(x | \mu, \sigma)\) is the truncated normal distribution with mean \(\mu\) and standard deviation \(\sigma\), truncated to the interval \([-1, 1]\).

The normalization constant is expressed as:

\[\mathcal{Z} = \frac{1 - \epsilon}{2} \left[\frac{\mathrm{erf}\left( \displaystyle -\frac{1 + \mu}{\sqrt{2}\sigma (1 - \epsilon)} \right)}{\Phi\left( \displaystyle\frac{1 - \mu}{\sigma (1 - \epsilon)} \right) - \Phi\left( \displaystyle\frac{-1 - \mu}{\sigma (1 - \epsilon)} \right)} \right] -\frac{1 + \epsilon}{2} \left[ \frac{\mathrm{erf}\left( \displaystyle -\frac{1 + \mu}{\sqrt{2}\sigma (1 + \epsilon)} \right)}{\Phi\left( \displaystyle\frac{1 - \mu}{\sigma (1 + \epsilon)} \right) - \Phi\left( \displaystyle\frac{-1 - \mu}{\sigma (1 + \epsilon)} \right)} \right]\]

where, \(\Phi(x)\) is the cumulative distribution function of the standard normal distribution.

log_prob(value: jaxtyping.ArrayLike) jaxtyping.ArrayLike[source]ΒΆ

Evaluates the log probability density for a batch of samples given by value.

Parameters:

value – A batch of samples from the distribution.

Returns:

an array with shape value.shape[:-self.event_shape]

Return type:

ArrayLike

supportΒΆ

The support of this distribution. Subclasses can override this as a class attribute or as a property.

gwkokab.models.spin.BetaFromMeanVar(mean: jaxtyping.ArrayLike, variance: jaxtyping.ArrayLike, *, validate_args: bool | None = None) numpyro.distributions.Beta[source]ΒΆ

Beta distribution parameterized by the expected value and variance.

Parameters:
  • mean (ArrayLike) – Expected value of the beta distribution.

  • variance (ArrayLike) – Variance of the beta distribution.

  • loc (ArrayLike) – lower bound of the beta distribution, defaults to 0.0

  • scale (ArrayLike) – width of the beta distribution, defaults to 1.0

Returns:

Beta distribution with the specified mean and variance.

Return type:

Beta

gwkokab.models.spin.GaussianSpinModel(mu_eff: jaxtyping.ArrayLike, sigma_eff: jaxtyping.ArrayLike, mu_p: jaxtyping.ArrayLike, sigma_p: jaxtyping.ArrayLike, rho: jaxtyping.ArrayLike, *, validate_args: bool | None = None) numpyro.distributions.MultivariateNormal[source]ΒΆ

Bivariate normal distribution for the effective and precessing spins. See Eq. (D3) and (D4) in Population Properties of Compact Objects from the Second LIGO-Virgo Gravitational-Wave Transient Catalog.

\[\begin{split}\left(\chi_{\text{eff}}, \chi_{p}\right) \sim \mathcal{N}\left( \begin{bmatrix} \mu_{\text{eff}} \\ \mu_{p} \end{bmatrix}, \begin{bmatrix} \sigma_{\text{eff}}^2 & \rho \sigma_{\text{eff}} \sigma_{p} \\ \rho \sigma_{\text{eff}} \sigma_{p} & \sigma_{p}^2 \end{bmatrix} \right)\end{split}\]

where \(\chi_{\text{eff}}\) is the effective spin and \(\chi_{\text{eff}}\in[-1,1]\) and \(\chi_{p}\) is the precessing spin and \(\chi_{p}\in[0,1]\).

Parameters:
  • mu_eff (ArrayLike) – mean of the effective spin

  • sigma_eff (ArrayLike) – standard deviation of the effective spin

  • mu_p (ArrayLike) – mean of the precessing spin

  • sigma_p (ArrayLike) – standard deviation of the precessing spin

  • rho (ArrayLike) – correlation coefficient between the effective and precessing spins

Returns:

Multivariate normal distribution for the effective and precessing spins

Return type:

MultivariateNormal

gwkokab.models.spin.GenericTiltModel(zeta: jaxtyping.ArrayLike, loc1: jaxtyping.ArrayLike, loc2: jaxtyping.ArrayLike, scale1: jaxtyping.ArrayLike, scale2: jaxtyping.ArrayLike, low1: jaxtyping.ArrayLike = -1.0, low2: jaxtyping.ArrayLike = -1.0, high1: jaxtyping.ArrayLike = 1.0, high2: jaxtyping.ArrayLike = 1.0, *, validate_args: bool | None = None) numpyro.distributions.MixtureGeneral[source]ΒΆ

A mixture model of spin orientations with isotropic and normally distributed components, with a minimum and maximum tilt constraint for each spin.

Parameters:
  • zeta (ArrayLike) – Weight of the Gaussian component.

  • loc1 (ArrayLike) – Location parameter of the first Gaussian component.

  • loc2 (ArrayLike) – Location parameter of the second Gaussian component.

  • scale1 (ArrayLike) – Scale parameter of the first Gaussian component.

  • scale2 (ArrayLike) – Scale parameter of the second Gaussian component.

  • low1 (ArrayLike, optional) – Minimum cosine tilt angle of the first component, by default -1.0

  • low2 (ArrayLike, optional) – Minimum cosine tilt angle of the second component, by default -1.0

  • high1 (ArrayLike, optional) – Maximum cosine tilt angle of the first component, by default 1.0

  • high2 (ArrayLike, optional) – Maximum cosine tilt angle of the second component, by default 1.0

  • validate_args (Optional[bool], optional) – Whether to validate the arguments, by default None

Returns:

Mixture model of spin orientations with minimum and maximum tilt constraints for each spin.

Return type:

MixtureGeneral