gwkokab.analysis.n_pls_m_gs.common¶

Shared definitions for the n_pls_m_gs analysis family.

NPowerlawMGaussianCore is the family half of the analysis matrix: it names the event coordinates the data must supply (parameters) and the flat list of population hyper-parameters to be inferred (model_parameters). Both are derived from the use_* flags, so switching a physical parameter on at the command line extends the parameter list automatically.

The model is NPowerlawMGaussian(), built from N_pl power-law and N_g Gaussian mass components. Hyper-parameter names carry the component tags pl (power law) and g (Gaussian), giving forms like alpha_pl_0.

This module is mixed with a data-representation base and a sampler mixin to form a complete analysis; see the discrete and analytical_gwalk modules alongside it.

Classes¶

NPowerlawMGaussianCore

Family half of the n_pls_m_gs analysis.

Functions¶

model_arg_parser(→ argparse.ArgumentParser)

Populate the command line argument parser with this family's model arguments.

where_fns_list(→ Optional[List[Callable[..., ...)

Build the extra validity predicates this configuration needs.

Module Contents¶

class gwkokab.analysis.n_pls_m_gs.common.NPowerlawMGaussianCore(N_pl: int, N_g: int, use_beta_spin_magnitude: bool, use_spin_magnitude_mixture: bool, use_truncated_normal_spin_x: bool, use_truncated_normal_spin_y: bool, use_truncated_normal_spin_z: bool, use_chi_eff_mixture: bool, use_skew_normal_chi_eff: bool, use_truncated_normal_chi_p: bool, use_tilt: bool, use_eccentricity_mixture: bool, use_eccentricity_powerlaw: bool, use_powerlaw_redshift: bool, use_madau_dickinson_redshift: bool, use_cos_iota: bool, use_phi_12: bool, use_polarization_angle: bool, use_right_ascension: bool, use_sin_declination: bool, use_detection_time: bool, use_phi_1: bool, use_phi_2: bool, use_phi_orb: bool, use_mean_anomaly: bool)¶

Family half of the n_pls_m_gs analysis.

Mixed with a data-representation base – DiscreteBase or AnalyticalGWalkBase – and a sampler mixin, to form a complete analysis.

See __init__() for the constructor arguments.

Record which components and physical parameters this analysis uses.

The use_* flags decide both what the model contains and, through parameters and model_parameters, what the data must supply and what will be inferred.

Parameters:
  • N_pl (int) – Number of power-law mass components.

  • N_g (int) – Number of Gaussian mass components.

  • use_beta_spin_magnitude (bool) – Model both spin magnitudes with beta distributions.

  • use_spin_magnitude_mixture (bool) – Model both spin magnitudes jointly with a two-truncated-normal mixture.

  • use_truncated_normal_spin_x (bool) – Model both Cartesian x spin components with truncated normals.

  • use_truncated_normal_spin_y (bool) – Model both Cartesian y spin components with truncated normals.

  • use_truncated_normal_spin_z (bool) – Model both aligned spin components with truncated normals.

  • use_chi_eff_mixture (bool) – Model the effective spin with a two-truncated-normal mixture.

  • use_skew_normal_chi_eff (bool) – Model the effective spin with the GWTC-4 skew normal.

  • use_truncated_normal_chi_p (bool) – Model the precessing spin with a truncated normal.

  • use_tilt (bool) – Model both tilt cosines jointly with the generic tilt model.

  • use_eccentricity_mixture (bool) – Model eccentricity with a two-truncated-normal mixture.

  • use_eccentricity_powerlaw (bool) – Model eccentricity with a truncated power law.

  • use_mean_anomaly (bool) – Model the mean anomaly with a uniform distribution.

  • use_powerlaw_redshift (bool) – Model redshift with a power law rate evolution.

  • use_madau_dickinson_redshift (bool) – Model redshift with the Madau-Dickinson rate evolution.

  • use_cos_iota (bool) – Model the inclination cosine with a uniform distribution.

  • use_polarization_angle (bool) – Model the polarization angle with a uniform distribution.

  • use_right_ascension (bool) – Model the right ascension with a uniform distribution.

  • use_sin_declination (bool) – Model the declination sine with a uniform distribution.

  • use_detection_time (bool) – Model the detection time with a uniform distribution.

  • use_phi_1 (bool) – Model the primary spin azimuth with a uniform distribution.

  • use_phi_2 (bool) – Model the secondary spin azimuth with a uniform distribution.

  • use_phi_12 (bool) – Model the relative spin azimuth with a uniform distribution.

  • use_phi_orb (bool) – Model the orbital phase with a uniform distribution.

modify_model_params(params: dict) → dict¶

Inject the component counts and use_* flags into the model parameters.

The prior configuration supplies only the hyper-parameters to be inferred; the model factory also needs to know how many components of each kind to build and which physical parameters were switched on. This hook adds them.

Parameters:

params (dict) – The processed priors, keyed by hyper-parameter name.

Returns:

params, with the counts and flags added.

Return type:

dict

N_g¶
N_pl¶
model_fn¶

The population model factory, NPowerlawMGaussian().

property model_parameters: list[str]¶

The flat list of population hyper-parameters to be inferred.

Each entry is a per-component name of the form <role>_<component tag>_<index>, expanded from the enabled use_* flags by expand_arguments(). These names are what the regex keys of prior_cfg.json are matched against.

Returns:

Hyper-parameter names.

Return type:

list[str]

property parameters: tuple[str, ...]¶

The event coordinates this analysis reads from the data.

Always the two component masses, plus whichever spin, tilt, eccentricity, redshift and extrinsic coordinates the use_* flags switched on.

Returns:

Parameter names, in the order the model’s event axis expects them.

Return type:

tuple[str, …]

use_beta_spin_magnitude¶
use_chi_eff_mixture¶
use_cos_iota¶
use_detection_time¶
use_eccentricity_mixture¶
use_eccentricity_powerlaw¶
use_madau_dickinson_redshift¶
use_mean_anomaly¶
use_phi_1¶
use_phi_12¶
use_phi_2¶
use_phi_orb¶
use_polarization_angle¶
use_powerlaw_redshift¶
use_right_ascension¶
use_sin_declination¶
use_skew_normal_chi_eff¶
use_spin_magnitude_mixture¶
use_tilt¶
use_truncated_normal_chi_p¶
use_truncated_normal_spin_x¶
use_truncated_normal_spin_y¶
use_truncated_normal_spin_z¶
gwkokab.analysis.n_pls_m_gs.common.model_arg_parser(parser: argparse.ArgumentParser) → argparse.ArgumentParser¶

Populate the command line argument parser with this family’s model arguments.

Adds the component counts and one --add-* flag per optional physical parameter.

Parameters:

parser (ArgumentParser) – Parser to add the arguments to.

Returns:

The same parser, with the arguments added.

Return type:

ArgumentParser

gwkokab.analysis.n_pls_m_gs.common.where_fns_list(use_beta_spin_magnitude: bool) → List[Callable[..., jaxtyping.Array]] | None¶

Build the extra validity predicates this configuration needs.

These are applied on top of the prior support: a point failing any of them is assigned \(-\infty\) without the model ever being built.

Parameters:

use_beta_spin_magnitude (bool) – Whether spin magnitudes are modelled with beta distributions, which need their mean/variance pairs checked for validity.

Returns:

The predicates, or None when none are needed.

Return type:

Optional[List[Callable[…, Array]]]