galsbi.ucat.galaxy_population_models package

Submodules

galsbi.ucat.galaxy_population_models.galaxy_light_profile module

Created 2021 author: Tomasz Kacprzak

galsbi.ucat.galaxy_population_models.galaxy_light_profile.sample_sersic_berge(numgalaxies, int_mag, par)[source]

Sample the Sersic index-distribution parametrized as described in (Berge et al. 2013)

Parameters:
  • numgalaxies – number of galaxies, i.e. number of samples

  • int_mag – intrinsic, unmagnified magnitude of all galaxies

  • par – ctx.parameters; part of ctx containing parameters

Returns:

Sersic index

galsbi.ucat.galaxy_population_models.galaxy_light_profile.sample_sersic_betaprime(n_gal, mode, size, alpha=0, z=0.0, min_n=0.2, max_n=5.0)[source]

Sample the Sersic index-distribution parametrized as described in (Moser et al. 2024). The parameter mode corresponds to the mode of the distribution, the size parameter is responsible for the scatter (with larger size the distribution becomes tighter). The alpha parameter is responsible for the redshift dependence of the mode. This was first introduced in Fischbacher et al. 2024.

Parameters:
  • n_gal – number of galaxies, i.e. number of samples

  • mode – mode of the distribution

  • size – size of the distribution (with larger size the distribution becomes tighter)

  • alpha – redshift dependence of the mode

  • z – redshift

  • min_n – minimum Sersic index, raise exception if the sampled value is below this value

  • max_n – maximum Sersic index, raise exception if the sampled value is above this value

Returns:

Sersic index

galsbi.ucat.galaxy_population_models.galaxy_light_profile.sample_sersic_for_galaxy_type(n_gal, galaxy_type, app_mag, par, z=0.0)[source]

galsbi.ucat.galaxy_population_models.galaxy_luminosity_function module

Created on Sept 2021 author: Tomasz Kacprzak using code from: Joerg Herbel

class galsbi.ucat.galaxy_population_models.galaxy_luminosity_function.LuminosityFunction(name, lum_fct_parametrization, m_star_slope, m_star_intcpt, phi_star_amp, phi_star_exp, z_const, alpha, cosmo, pixarea, galaxy_type, seed_ngal, z_res=0.001, m_res=0.001, z_min=0, z_max=6, m_min=None, m_max=2, z_m_intp=None, ngal_multiplier=1)[source]

Bases: object

Luminosity function

analytical_number_density(m, z)[source]

Returns the number density of galaxies at redshift z and absolute magnitude m. Classic Schechter function with units of Mpc^-3 mag^-1.

Parameters:
  • m – Absolute magnitude

  • z – Redshift

Returns:

Number density of galaxies at redshift z and absolute magnitude m

sample_z_mabs_and_apply_cut(seed_ngal, seed_lumfun, n_gal_max=inf, size_chunk=10000)[source]

This function gets the abs mag and z using chunking, which uses less memory than the original method. It does not give exactly the same result as before due to different order of random draws in z_mabs_sampler, but it’s the same sample.

class galsbi.ucat.galaxy_population_models.galaxy_luminosity_function.NumGalCalculator(z_min, z_max, m_min, m_max, parametrization, z_const, alpha, m_star_par, phi_star_par, cosmo, pixarea, ngal_multiplier=1)[source]

Bases: object

Computes galaxy number counts by integrating the galaxy luminosity function. The integral over absolute magnitudes can be done analytically, while the integral over redshifts is computed numerically. See also docs/jupyter_notebooks/sample_redshift_magnitude.ipynb.

class galsbi.ucat.galaxy_population_models.galaxy_luminosity_function.RedshiftAbsMagSampler(z_res, z_min, z_max, m_res, m_min, m_max, parametrization, z_const, alpha, m_star_par, phi_star_par, cosmo)[source]

Bases: object

Samples redshifts and absolute magnitudes from the galaxy luminosity function. The sampling is done by first drawing redshifts from the redshift-pdf obtained by integrating out absolute magnitudes. Then, we sample absolute magnitudes from the conditional pdfs obtained by conditioning the luminosity function on the sampled redshifts (the conditional pdf is different for each redshift). See also docs/jupyter_notebooks/sample_redshift_magnitude.ipynb and docs/jupyter_notebooks/test_self_consistency.ipynb.

galsbi.ucat.galaxy_population_models.galaxy_luminosity_function.find_closest_ind(grid, vals)[source]
galsbi.ucat.galaxy_population_models.galaxy_luminosity_function.initialize_luminosity_functions(par, pixarea, cosmo, z_m_intp=None)[source]
galsbi.ucat.galaxy_population_models.galaxy_luminosity_function.m_star_lum_fct(z, parametrization, z_const, slope, intercept)[source]
galsbi.ucat.galaxy_population_models.galaxy_luminosity_function.maximum_redshift(z_m_intp, m_max, z_max, parametrization, z_const, alpha, m_star_par, seed_ngal)[source]

Computes the maximum redshift up to which we sample objects from the luminosity function. The cutoff is based on the criterion that the CDF for absolute magnitudes is larger than 1e-5, i.e. that there is a reasonable probability of actually obtaining objects at this redshift and absolute magnitude which still pass the cut on par.gals_mag_max.

galsbi.ucat.galaxy_population_models.galaxy_luminosity_function.phi_star_lum_fct(z, parametrization, amplitude, exp)[source]
galsbi.ucat.galaxy_population_models.galaxy_luminosity_function.upper_inc_gamma(a, x)[source]

galsbi.ucat.galaxy_population_models.galaxy_position module

Created 2021 author: Tomasz Kacprzak

galsbi.ucat.galaxy_population_models.galaxy_position.get_halo_catalog(par)[source]

Loads the halo catalog from the specified file and adds a column indicating whether the galaxy is blue or not based on the SHAM-OT model parameters.

Parameters:

par – ucat parameters from config file

Returns:

halo catalog with an additional column ‘is_blue’

galsbi.ucat.galaxy_population_models.galaxy_position.get_ot_epsilon(par, galaxy_type)[source]

Get the OT epsilon parameter based on the configuration parameters. If ot_epsilon is not None, it is used for both galaxy types. If ot_epsilon is None, the ot_epsilon_red and ot_epsilon_blue parameters are used

Parameters:
  • par – ucat parameters from config file

  • galaxy_type – Type of galaxy (“red” or “blue”)

Returns:

OT epsilon parameter

galsbi.ucat.galaxy_population_models.galaxy_position.sample_position_uniform(numobj, w, pixel_index, nside)[source]

Sample a RING-ordered HEALPix pixel uniformly in solid angle.

Longitude bounds are unwrapped around the pixel centre when they cross the signed-longitude boundary. Sampling is uniform in longitude and cos(theta), followed by rejection outside the requested pixel. The caller controls reproducibility through NumPy’s existing random state.

Parameters:
  • numobj – Number of uniform samples

  • w – wcs-object containing all the relevant wcs-information

  • pixel_index – Index of the Healpix pixels sampled

  • nside – NSIDE of the Healpix map

Returns:

Uniformly drawn x-coordinate (in pixels)

Returns:

Uniformly drawn y-coordinate (in pixels)

galsbi.ucat.galaxy_population_models.galaxy_position.sample_rest_of_lf(lumfunc, zmin, zmax, m_min, pixels, par)[source]

Samples the rest of the luminosity function in case there are not enough halos. Positions are sampled uniformly.

Parameters:
  • lumfunc – Luminosity function instance

  • zmin – Minimum redshift

  • zmax – Maximum redshift

  • m_min – Minimum absolute magnitude (brightest magnitude still to be sampled)

  • pixels – Healpix pixels to sample from

  • par – ucat parameters from config file

Returns:

Absolute magnitude, redshift, ra and dec of galaxies

galsbi.ucat.galaxy_population_models.galaxy_position.sample_with_sham_ot(par, halo_catalog, lumfunc, pixels, w=None)[source]

Samples absolute magnitude, redshift and position of galaxies using the SHAM-OT framework. If the halo catalog does not contain enough halos to populate the faint end of the luminosity function or the high redshift part, the rest of the luminosity function is sampled with a uniform distribution in position.

Parameters:
  • par – ucat parameters from config file

  • halo_catalog – Halo catalog with halo mass, redshift, ra, dec and is_blue

  • lumfunc – Luminosity function instance

  • pixels – Healpix pixels to sample from

  • w – wcs-object containing all the relevant wcs-information

Returns:

Absolute magnitude, redshift, position of galaxies, logmasses, halo_or_subhalo, time_since_merger

galsbi.ucat.galaxy_population_models.galaxy_sed module

Created 2021 author: Tomasz Kacprzak

galsbi.ucat.galaxy_population_models.galaxy_sed.dirichlet_alpha_ev(z, alpha0, alpha1, z1)[source]
galsbi.ucat.galaxy_population_models.galaxy_sed.draw_dirichlet_add_weight(alpha, weight)[source]
galsbi.ucat.galaxy_population_models.galaxy_sed.sample_template_coeff_dirichlet(z, alpha0, alpha1, z1, weight)[source]

Samples template coefficients from redshift-dependent Dirichlet distributions. See also docs/jupyter_notebooks/coeff_distribution_dirichlet.ipynb.

galsbi.ucat.galaxy_population_models.galaxy_sed.sample_template_coeff_dirichlet__alpha_mode(z, amode0, amode1, z1, weight, alpha0_std, alpha1_std)[source]

Samples template coefficients from redshift-dependent Dirichlet distributions. See also docs/jupyter_notebooks/coeff_distribution_dirichlet.ipynb. Then the alpha0 and alpha1 will be scaled such that std(alpha)=alpha_std, for a equal alphas. alpha_std is also interpolated between redshifts.

galsbi.ucat.galaxy_population_models.galaxy_sed.sample_template_coeff_lumfuncs(par, redshift_z, n_templates)[source]

galsbi.ucat.galaxy_population_models.galaxy_shape module

Created 2021 author: Tomasz Kacprzak

galsbi.ucat.galaxy_population_models.galaxy_shape.backwards_compatibility(par)[source]
galsbi.ucat.galaxy_population_models.galaxy_shape.distortion_to_shear(distortion_x)[source]
galsbi.ucat.galaxy_population_models.galaxy_shape.pe_bulge(ngal, b=2.368, c=6.691)[source]

From miller2013.

galsbi.ucat.galaxy_population_models.galaxy_shape.pe_disc(ngal, log_a=np.float64(-1.3708147902715042), emax=0.8, emin=0.0256, pow_alpha=1)[source]

From miller2013.

galsbi.ucat.galaxy_population_models.galaxy_shape.sample_ellipticities_beta(n_gal, par)[source]
galsbi.ucat.galaxy_population_models.galaxy_shape.sample_ellipticities_beta_mode(n_gal, ell_beta_ab_sum, ell_beta_mode, ell_beta_emax)[source]
galsbi.ucat.galaxy_population_models.galaxy_shape.sample_ellipticities_for_galaxy_type(n_gal, galaxy_type, par)[source]
galsbi.ucat.galaxy_population_models.galaxy_shape.sample_ellipticities_gaussian(numgalaxies, e1_mean, e2_mean, e1_sigma, e2_sigma)[source]

Sample Gaussian distributions for the intrinsic e1 and e2 while enforcing that e1**2 + e2**2 <= 1

Parameters:
  • numgalaxies – number of galaxies, i.e. number of samples

  • par – ctx.parameters; part of ctx containing parameters

Returns:

e1 values

Returns:

e2 values

galsbi.ucat.galaxy_population_models.galaxy_size module

Created 2021 author: Tomasz Kacprzak

galsbi.ucat.galaxy_population_models.galaxy_size.apply_pycosmo_distfun(dist_fun, z)[source]
galsbi.ucat.galaxy_population_models.galaxy_size.backwards_compatibility(par)[source]
galsbi.ucat.galaxy_population_models.galaxy_size.r50_phys_to_ang(r50_phys, cosmo, z)[source]

Convert physical size to angular size

Parameters:
  • r50_phys – physical size of the galaxy in kpc

  • cosmo – cosmological model

  • z – redshift of the galaxy

Returns:

angular size of the galaxy in arcsec

galsbi.ucat.galaxy_population_models.galaxy_size.sample_r50_for_galaxy_type(z, abs_mag, cosmo, par, galaxy_type)[source]

Sample the physical size of a galaxy given its absolute magnitude and redshift. The physical size is sampled from a log-normal distribution with a mean that depends on the absolute magnitude and redshift. The physical size is then converted to an angular size using the cosmological distance.

Parameters:
  • z – redshift of the galaxy

  • abs_mag – absolute magnitude of the galaxy

  • cosmo – cosmological model

  • par – ucat parameters

  • galaxy_type – type of the galaxy (e.g. “red”, “blue”)

Returns:

angular size of the galaxy in pixels, in arcsec and physical size in kpc

galsbi.ucat.galaxy_population_models.galaxy_size.sample_r50_phys(abs_mag_shift, logr50_phys_std, logr50_phys_mean_slope, logr50_phys_mean_intcpt, logr50_alpha=0.0, z=0.0)[source]

Module contents