Population API

Contents

Population API#

Popuplation Wrapper#

CHIMERA.population.pop_wrapper.N_cbc_1yr(pop_lambdas: population)#

Computes the total number of expected CBC sources in 1 year.

CHIMERA.population.pop_wrapper.compute_z_grids(cosmo: Module, theta_det: theta_pe_det, cosmo_prior: Dict[str, List[Number]] | None = None, z_int_res: int = 300, z_conf_range: Number | list | None = None)#

Computes the redshift grids on which GW events have support, given some cosmological priors.

Parameters:
  • cosmo (eqx.Module) – a CHIMERA.cosmo object describing cosmological params.

  • events_dL (jnp.ndarray) – GW events luminosity distance samples

  • cosmo_prior (optional, Dict[str, List[Numbers]]) – dict containing tuple of parameters, describing the priors over cosmological parameters.

  • z_int_res (int) – number fo points of the redshift grid.

  • z_conf_range (Number or List) – sigma or quantiles defining the redshift grid extenstion.

Returns:

the redshift grids.

Return type:

jnp.ndarray

CHIMERA.population.pop_wrapper.get_theta_src_and_weights(pop_lambdas: population, theta_det: theta_pe_det)#
CHIMERA.population.pop_wrapper.p_cbc(pop_lambdas: population, z: Array)#

Computes redshift prior

CHIMERA.population.pop_wrapper.pop_rate_det(pop_lambdas: population, th_det: theta_pe_det)#
CHIMERA.population.pop_wrapper.pop_rate_det(pop_lambdas: CHIMERA.population.pop_wrapper.population, th_det: CHIMERA.data.theta_inj_det)

Computes the population rate in detector frame for injections.

CHIMERA.population.pop_wrapper.pop_rate_det(pop_lambdas: CHIMERA.population.pop_wrapper.population, th_src: CHIMERA.data.theta_src)

Computes the population rate in detector frame for mock data.

class CHIMERA.population.pop_wrapper.population(cosmo: equinox._module._module.Module, mass: equinox._module._module.Module, rate: equinox._module._module.Module, R0: numbers.Number = 1.0, gal_cat: object = None, Tobs: numbers.Number = 1, scale_free: bool = True)#

Bases: Module

R0: Number = 1.0#
Tobs: Number#
cosmo: Module#
gal_cat: object#
mass: Module#
rate: Module#
scale_free: bool#
update(**hyper_lambdas)#
CHIMERA.population.pop_wrapper.theta_det2src(cosmo_lambdas, theta_det, include_original_distances=False)#

Cosmology#

CHIMERA.population.cosmo.E_at_z(cosmo: flrw | mg_flrw, z: Array)#

Computes the dimensionless Hubble parameter E(z).

CHIMERA.population.cosmo.Vc_at_z(cosmo: flrw | mg_flrw, z: Array, distances: Array | None = None)#

Computes the comoving volume at z.

CHIMERA.population.cosmo.Vc_at_z(cosmo: CHIMERA.population.cosmo.flrw | CHIMERA.population.cosmo.mg_flrw, theta: CHIMERA.data.theta_src)
CHIMERA.population.cosmo.Xi_at_z(cosmo: mg_flrw, z: Array)#

Computes the MG factor \(\Xi(z)\)

class CHIMERA.population.cosmo.base_cosmology_struct(**kwargs)#

Bases: Module

property as_dict#
default = {'z_grid_res': 1000, 'z_max': 10.0}#
integral_invE_interp: Array#
keys: List[str]#
name = 'base_cosmology_struct'#
update(**kwargs)#
z_grid_interp: Array#
z_grid_res: int#
z_max: float#
CHIMERA.population.cosmo.dA_at_z(cosmo: flrw | mg_flrw, z: Array, distances: Array | None = None)#

Computes the angular distance at z.

CHIMERA.population.cosmo.dCr_at_z(cosmo: flrw | mg_flrw, z: Array)#

Computes the radial comoving distance at z.

CHIMERA.population.cosmo.dCt_at_z(cosmo: flrw | mg_flrw, z: Array)#

Computes the transverse comoving distance at z.

CHIMERA.population.cosmo.dL_at_z(cosmo: flrw, z: Array)#

Computes the luminosity distance at z.

CHIMERA.population.cosmo.dL_at_z(cosmo: CHIMERA.population.cosmo.mg_flrw, z: jax.Array)

Computes the luminosity distance at z.

CHIMERA.population.cosmo.dVcdz_at_z(cosmo: flrw | mg_flrw, z: Array, distances: Array | None = None)#

Computes the differential comoving volume at z.

CHIMERA.population.cosmo.dVcdz_at_z(cosmo: CHIMERA.population.cosmo.flrw | CHIMERA.population.cosmo.mg_flrw, theta: CHIMERA.data.theta_src)
CHIMERA.population.cosmo.ddLdz_at_z(cosmo: flrw, z: Array, distances: Array | None = None)#

Computes the differential luminosity distance at z.

CHIMERA.population.cosmo.ddLdz_at_z(cosmo: CHIMERA.population.cosmo.mg_flrw, z: jax.Array, distances: jax.Array | None = None)

Computes the differential luminosity distance at z.

CHIMERA.population.cosmo.ddLdz_at_z(cosmo: CHIMERA.population.cosmo.flrw | CHIMERA.population.cosmo.mg_flrw, theta: CHIMERA.data.theta_src)
class CHIMERA.population.cosmo.flrw(**kwargs)#

Bases: base_cosmology_struct

Parameters describing a cosmological FLRW model implemented as an Equinox module. :param H0: The Hubble constant in km/s/Mpc. Default is 70. :type H0: float, optional :param Om0: The matter density parameter. Default is 0.25. :type Om0: float, optional :param Ok0: The curvature density parameter. Default is 0. :type Ok0: float, optional :param Or0: The radiation density parameter. Default is 0. :type Or0: float, optional :param w0: The present value of the dark energy equation of state parameter. Default is -1. :type w0: float, optional :param wa: The rate of change of the dark energy equation of state parameter. Default is 0 :type wa: float, optional

Class Attributes:
  • name (str): The name of the model.

  • keys (List[str]): A list of parameter names used in the model.

Properties:
  • as_dict (Dict[str, float]): Returns the current model parameters as a dictionary.

  • Ode0 (float): The dark energy density parameter, calculated as 1 - Om0 - Or0 - Ok0.

  • dH (float): The Hubble distance in units of Mpc, calculated as 299792.458e-3 / H0.

- update(**kwargs) (flrw)

Creates a new instance of the model, updating any parameters provided in kwargs. Parameters are automatically broadcasted to the same shape as the largest parameter.

H0: float#
property Ode0#
Ok0: float#
Om0: float#
Or0: float#
property dH#
default = {'H0': 70.0, 'Ok0': 0.0, 'Om0': 0.25, 'Or0': 0.0, 'w0': -1.0, 'wa': 0.0, 'z_grid_res': 1500, 'z_max': 10.0}#
name = 'flrw'#
w0: float#
wa: float#
CHIMERA.population.cosmo.int_invE_at_z(cosmo: flrw | mg_flrw, z: Array)#
class CHIMERA.population.cosmo.mg_flrw(**kwargs)#

Bases: flrw

Parameters describing a cosmological FLRW model with Modified Gravity propagation implemented as an Equinox module.

Parameters:
  • H0 (float, optional) – The Hubble constant in km/s/Mpc. Default is 70.

  • Om0 (float, optional) – The matter density parameter. Default is 0.25.

  • Ok0 (float, optional) – The curvature density parameter. Default is 0.

  • Or0 (float, optional) – The radiation density parameter. Default is 0.

  • w0 (float, optional) – The present value of the dark energy equation of state parameter. Default is -1.

  • wa (float, optional) – The rate of change of the dark energy equation of state parameter. Default is 0.

  • Xi0 (float, optional) – The MG (modified gravity) parameter Xi0. Default is 1.

  • n (float, optional) – The MG parameter n. Default is 0.

Class Attributes:
  • name (str): The name of the model.

  • keys (List[str]): A list of parameter names used in the model.

Properties:
  • as_dict (Dict[str, float]): Returns the current model parameters as a dictionary.

  • Ode0 (float): The dark energy density parameter, calculated as 1 - Om0 - Or0 - Ok0.

  • dH (float): The Hubble distance in units of Mpc, calculated as 299792.458e-3 / H0.

- update(**kwargs) (mg_flrw)

Creates a new instance of the model, updating any parameters provided in kwargs. Parameters are automatically broadcasted to the same shape as the largest parameter.

Xi0: float#
default = {'H0': 70.0, 'Ok0': 0.0, 'Om0': 0.25, 'Or0': 0.0, 'Xi0': 1.0, 'n': 0.0, 'w0': -1.0, 'wa': 0.0, 'z_grid_res': 1500, 'z_max': 10.0}#
n: float#
name = 'mg_flrw'#
CHIMERA.population.cosmo.setup_interp(cosmo: base_cosmology_struct)#
CHIMERA.population.cosmo.z_from_dGW(cosmo: flrw | mg_flrw, dGWs: Array)#

Computes the redshifts correspoding to the given the GW distances.

Mass Models#

class CHIMERA.population.mass.base_mass_paired_struct(**kwargs)#

Bases: Module

property as_dict#
cdf_m2_conditioned: Array#
default = {'grid_res': 1000, 'm_high': 87.0, 'm_low': 5.1}#
grid_res: int#
keys: List[str]#
m_grid: Array#
m_high: float#
m_low: float#
name = 'base_mass_paired_struct'#
norm_p_m1: float#
update(**kwargs)#
class CHIMERA.population.mass.bpl(**kwargs)#

Bases: base_mass_paired_struct

A class to describe a broken power law mass model implemented as an Equinox module.

Parameters:
  • alpha_1 (float, optional) – The slope of the power law for masses below the break. Default is 1.6.

  • alpha_2 (float, optional) – The slope of the power law for masses above the break. Default is 5.6.

  • beta (float, optional) – The slope of the power law at intermediate masses. Default is 1.1.

  • delta_m (float, optional) – The characteristic mass difference that influences the break. Default is 4.8.

  • m_low (float, optional) – The lower truncation mass. Default is 5.1.

  • m_high (float, optional) – The upper truncation mass. Default is 87.

  • break_fraction (float, optional) – The fraction of the mass function where the break occurs. Default is 0.43.

Class Attributes:
  • name (str): The name of the model, set to ‘broken_power_law’.

  • keys (List[str]): A list of parameter names used in the model, specifically [‘alpha_1’, ‘alpha_2’, ‘beta’, ‘delta_m’, ‘m_low’, ‘m_high’, ‘break_fraction’].

Properties:
  • as_dict (Dict[str, float]): Returns the current model parameters as a dictionary, where keys are parameter names and values are their corresponding float values.

- update(**kwargs) (bpl)

Creates a new instance of the model, updating any parameters provided in kwargs. Parameters are automatically broadcasted to the same shape as the largest parameter provided in the input.

alpha_1: float#
alpha_2: float#
beta: float#
break_fraction: float#
default = {'alpha_1': 1.6, 'alpha_2': 5.6, 'beta': 1.1, 'break_fraction': 0.43, 'delta_m': 4.8, 'grid_res': 1000, 'm_high': 87.0, 'm_low': 5.1}#
delta_m: float#
name = 'broken_power_law'#
CHIMERA.population.mass.gaussian(x, mu, sigma)#
CHIMERA.population.mass.get_normalizations(mass: base_mass_paired_struct)#
CHIMERA.population.mass.p_m1m2(mass: base_mass_paired_struct, m1: Array, m2: Array)#
CHIMERA.population.mass.p_m1m2(mass: CHIMERA.population.mass.base_mass_paired_struct, theta: CHIMERA.data.theta_src)#
Noindex:

CHIMERA.population.mass.pdf_joint_and_marg(mass, res=(5000, 2500))#
class CHIMERA.population.mass.pl2p(**kwargs)#

Bases: base_mass_paired_struct

A class to describe a power law mass model with two Gaussian peaks, implemented as an Equinox module.

Parameters:
  • lambda_peak (float, optional) – The strength of the first Gaussian peak. Default is 0.05.

  • lambda1 (float, optional) – The strength of the second Gaussian peak. Default is 0.5.

  • alpha (float, optional) – The slope of the power law for masses below the break. Default is 2.9.

  • beta (float, optional) – The slope of the power law for masses above the break. Default is 0.9.

  • delta_m (float, optional) – The characteristic mass difference that influences the break. Default is 4.8.

  • m_low (float, optional) – The lower truncation mass. Default is 4.6.

  • m_high (float, optional) – The upper truncation mass. Default is 87.

  • mu1_g (float, optional) – The mean of the first Gaussian peak. Default is 33.

  • sigma1_g (float, optional) – The standard deviation of the first Gaussian peak. Default is 3.

  • mu2_g (float, optional) – The mean of the second Gaussian peak. Default is 68.

  • sigma2_g (float, optional) – The standard deviation of the second Gaussian peak. Default is 3.

Class Attributes:
  • name (str): The name of the model, set to ‘power_law_plus_double_peak’.

  • keys (List[str]): A list of parameter names used in the model, specifically [‘lambda_peak’, ‘lambda1’, ‘alpha’, ‘beta’, ‘delta_m’, ‘m_low’, ‘m_high’, ‘mu1_g’, ‘sigma1_g’, ‘mu2_g’, ‘sigma2_g’].

Properties:
  • as_dict (Dict[str, float]): Returns the current model parameters as a dictionary, where keys are parameter names and values are their corresponding float values.

- update(**kwargs) (pl2p)

Creates a new instance of the model, updating any parameters provided in kwargs. Parameters are automatically broadcasted to the same shape as the largest parameter provided in the input.

alpha: float#
beta: float#
default = {'alpha': 3.4, 'beta': 1.1, 'delta_m': 4.8, 'grid_res': 1000, 'lambda1': 0.5, 'lambda_peak': 0.05, 'm_high': 87.0, 'm_low': 5.1, 'mu1_g': 34.0, 'mu2_g': 68, 'sigma1_g': 3.6, 'sigma2_g': 3}#
delta_m: float#
lambda1: float#
lambda_peak: float#
mu1_g: float#
mu2_g: float#
name = 'power_law_plus_double_peak'#
sigma1_g: float#
sigma2_g: float#
class CHIMERA.population.mass.plp(**kwargs)#

Bases: base_mass_paired_struct

A class to describe a power law mass model plus Gaussian peak, implemented as an Equinox module.

Parameters:
  • lambda_peak (float, optional) – The strength of the Gaussian peak. Default is 0.039.

  • alpha (float, optional) – The slope of the power law for masses below the break. Default is 3.4.

  • beta (float, optional) – The slope of the power law for masses above the break. Default is 1.1.

  • delta_m (float, optional) – The characteristic mass difference that influences the break. Default is 4.8.

  • m_low (float, optional) – The lower truncation mass. Default is 5.1.

  • m_high (float, optional) – The upper truncation mass. Default is 87.

  • mu_g (float, optional) – The mean of the Gaussian peak. Default is 34.

  • sigma_g (float, optional) – The standard deviation of the Gaussian peak. Default is 3.6.

Class Attributes:
  • name (str): The name of the model, set to ‘power_law_plus_peak’.

  • keys (List[str]): A list of parameter names used in the model, specifically [‘lambda_peak’, ‘alpha’, ‘beta’, ‘delta_m’, ‘m_low’, ‘m_high’, ‘mu_g’, ‘sigma_g’].

Properties:
  • as_dict (Dict[str, float]): Returns the current model parameters as a dictionary, where keys are parameter names and values are their corresponding float values.

- update(**kwargs) (plp)

Creates a new instance of the model, updating any parameters provided in kwargs. Parameters are automatically broadcasted to the same shape as the largest parameter provided in the input.

alpha: float#
beta: float#
default = {'alpha': 3.4, 'beta': 1.1, 'delta_m': 4.8, 'grid_res': 1000, 'lambda_peak': 0.039, 'm_high': 87.0, 'm_low': 5.1, 'mu_g': 34.0, 'sigma_g': 3.6}#
delta_m: float#
lambda_peak: float#
mu_g: float#
name = 'power_law_plus_peak'#
sigma_g: float#
class CHIMERA.population.mass.pls(**kwargs)#

Bases: Module

alpha: float#
beta: float#
default = {'alpha': 3.4, 'beta': 1.1, 'delta_m': 4.8, 'm_high': 87.0, 'm_low': 5.0}#
delta_m: float#
keys: List[str]#
m_high: float#
m_low: float#
name = 'powerlaw_plus_spline'#
num_knots: int#
spline_basis: Array#
spline_coeffs: Array#
update(**kwargs)#
CHIMERA.population.mass.primary_mass_pdf_notnorm(mass: tpl, m: Array)#
CHIMERA.population.mass.primary_mass_pdf_notnorm(mass: CHIMERA.population.mass.bpl, m: jax.Array)
CHIMERA.population.mass.primary_mass_pdf_notnorm(mass: CHIMERA.population.mass.plp, m: jax.Array)
CHIMERA.population.mass.primary_mass_pdf_notnorm(mass: CHIMERA.population.mass.pl2p, m: jax.Array)
CHIMERA.population.mass.secondary_mass_conditioned_pdf_notnorm(mass: tpl, m2: Array, m1: Number | Array)#
CHIMERA.population.mass.secondary_mass_conditioned_pdf_notnorm(mass: CHIMERA.population.mass.bpl | CHIMERA.population.mass.plp | CHIMERA.population.mass.pl2p, m2: jax.Array, m1: numbers.Number | jax.Array)#
Noindex:

CHIMERA.population.mass.smoothing(m, delta_m, m_low)#
class CHIMERA.population.mass.tpl(**kwargs)#

Bases: base_mass_paired_struct

A class to describe a truncated power law mass model implemented as an Equinox module.

Parameters:
  • alpha (float, optional) – The slope of the power law at high masses. Default is 3.4.

  • beta (float, optional) – The slope of the power law at low masses. Default is 1.1.

  • m_low (float, optional) – The lower truncation mass. Default is 5.1.

  • m_high (float, optional) – The upper truncation mass. Default is 87.

Class Attributes:
  • name (str): The name of the model, set to ‘truncated_power_law’.

  • keys (List[str]): A list of parameter names used in the model, specifically [‘alpha’, ‘beta’, ‘m_low’, ‘m_high’].

Properties:
  • as_dict (Dict[str, float]): Returns the current model parameters as a dictionary.

- update(**kwargs) (tpl)

Creates a new instance of the model, updating any parameters provided in kwargs. Parameters are automatically broadcasted to the same shape as the largest parameter.

alpha: float#
beta: float#
default = {'alpha': 2.5, 'beta': 1.1, 'grid_res': 1000, 'm_high': 87.0, 'm_low': 5.1}#
name = 'truncated_power_law'#
CHIMERA.population.mass.tpl_cdf(alpha, m_low, m)#
CHIMERA.population.mass.tpl_notnorm(m, alpha, m_low, m_high)#
CHIMERA.population.mass.truncated_gaussian(x, mu, sigma, x_min, x_max)#

Merge Rate Models#

class CHIMERA.population.rate.base_rate_struct(**kwargs)#

Bases: Module

property as_dict#
default = {}#
keys = []#
name = 'base_rate_struct'#
update(**kwargs)#
class CHIMERA.population.rate.madau_dickinson(**kwargs)#

Bases: base_rate_struct

A normalized Madau-Dickinson merger rate model implemented as an Equinox module.

Parameters:
  • gamma (float) – Primary power-law exponent.

  • kappa (float) – Secondary power-law exponent.

  • zp (float) – Pivot redshift scale.

Class Attributes:
  • name (str): The name of the model.

  • keys (List[str]): A list of parameter names used in the model.

Properties:
  • as_dict (Dict[str, float]): Returns the current model parameters as a dictionary.

- update(**kwargs) (madau_dickisnon)

Creates a new instance of the model, updating any parameters provided in kwargs. Parameters are automatically broadcasted to the same shape as the largest parameter.

default = {'gamma': 2.7, 'kappa': 3.0, 'zp': 2.0}#
gamma: float#
kappa: float#
keys = ['gamma', 'kappa', 'zp']#
name = 'madau_dickinson'#
zp: float#
CHIMERA.population.rate.merger_rate(rate: power_law, z: Array)#

Computes the merger rate.

CHIMERA.population.rate.merger_rate(rate: CHIMERA.population.rate.trunc_power_law, z: jax.Array)

Computes the merger rate.

CHIMERA.population.rate.merger_rate(rate: CHIMERA.population.rate.madau_dickinson, z: jax.Array)

Computes the merger rate.

CHIMERA.population.rate.merger_rate(rate: CHIMERA.population.rate.trunc_madau_dickinson, z: jax.Array)

Computes the merger rate.

CHIMERA.population.rate.merger_rate(rate: CHIMERA.population.rate.base_rate_struct, theta: CHIMERA.data.theta_src)
class CHIMERA.population.rate.power_law(**kwargs)#

Bases: base_rate_struct

A normalized Madau-Dickinson merger rate model implemented as an Equinox module.

Parameters:

gamma (float) – power-law exponent.

Class Attributes:
  • name (str): The name of the model.

  • keys (List[str]): A list of parameter names used in the model.

Properties:
  • as_dict (Dict[str, float]): Returns the current model parameters as a dictionary.

- update(**kwargs) (power_law)

Creates a new instance of the model, updating any parameters provided in kwargs. Parameters are automatically broadcasted to the same shape as the largest parameter.

default = {'gamma': 1.7}#
gamma: float#
keys = ['gamma']#
name = 'power_law'#
class CHIMERA.population.rate.trunc_madau_dickinson(**kwargs)#

Bases: base_rate_struct

default = {'gamma': 2.7, 'kappa': 3.0, 'zmax': 1.3, 'zp': 2.0}#
gamma: float#
kappa: float#
keys = ['gamma', 'kappa', 'zp', 'zmax']#
name = 'trunc_madau_dickinson'#
zmax: float#
zp: float#
class CHIMERA.population.rate.trunc_power_law(**kwargs)#

Bases: base_rate_struct

default = {'gamma': 1.9, 'zmax': 1.3}#
gamma: float#
keys = ['gamma', 'zmax']#
name = 'trunc_power_law'#
zmax: float#