Cosmo

cosmo

mejiro.cosmo.cosmo.einstein_radius_to_mass(einstein_radius, d_l, d_s, d_ls)[source]
mejiro.cosmo.cosmo.einstein_radius_to_velocity_dispersion(einstein_radius, z_lens, z_source, cosmo)[source]
mejiro.cosmo.cosmo.mass_to_einstein_radius(m, d_l, d_s, d_ls)[source]
mejiro.cosmo.cosmo.redshift_to_comoving_distance(redshift, cosmo)[source]

Convert redshift to comoving distance.

Parameters:
  • redshift (float) – The redshift.

  • cosmo (astropy.cosmology.Cosmology) – The Astropy Cosmology instance.

Returns:

The comoving distance in gigaparsecs (Gpc).

Return type:

astropy.units.Quantity

mejiro.cosmo.cosmo.stellar_to_main_halo_mass(stellar_mass, z, sample=True)[source]

Converts stellar mass to main halo mass.

The model is based on Equation 14 from Lagattuta et al. 2010: https://iopscience.iop.org/article/10.1088/0004-637X/716/2/1579. Note that it is an empirical relation derived from systems z < 1.

Parameters:
  • stellar_mass (float) – The stellar mass in solar masses.

  • z (float) – The redshift.

  • sample (bool, optional) – If True, introduces stochasticity in the scaling factor and exponent using truncated normal distributions. If False, uses fixed values for alpha (51) and beta (0.9). Default is True.

Returns:

The main halo mass in solar masses.

Return type:

float

Notes

  • When sample is False:
    • The scaling factor (alpha) is fixed at 51.

    • The exponent (beta) is fixed at 0.9.

  • When sample is True:
    • The scaling factor (alpha) is sampled from a truncated normal distribution with mean 51 and standard deviation 36, truncated to the range [-1, 1].

    • The exponent (beta) is sampled from a truncated normal distribution with mean 0.9 and standard deviation 1.8, truncated to the range [-1, 1].

mejiro.cosmo.cosmo.velocity_dispersion_to_einstein_radius(velocity_dispersion, z_lens, z_source, cosmo)[source]