galsbi.ucat_sps.galaxy_population_models package

Submodules

galsbi.ucat_sps.galaxy_population_models.galaxy_agn module

galsbi.ucat_sps.galaxy_population_models.galaxy_agn.sample_ratio_agn_to_galaxy_bolometric_luminosity(par, redshifts, log10_stellar_masses, galaxy_type='blue', seed=None)[source]

We first compute the probability that a galaxy hosts an AGN as function of redshift and stellar mass by taking the ratio between the redshift- evolving SMFs of blue and red galaxies and the AGN host galaxy mass function dervied in Bongiorno et al 2016. Then, we statistically assign an AGN to a host galaxy with a Bernoulli trial proportional to the computed probability. As in López-López et al. (2024), we assume fixed AGN fractions outside the redshift ranges specified by Bongiorno et al. (2016). In particular, the probability of hosting an AGN is 1% at all stellar masses below z = 0.55, while at z > 2 we maintain a constant fraction taken from the last redshift bin in Bongiorno et al. (2016). We then assign AGN flux contributions to all galaxies, regardless of whether they are classified as AGN hosts. However, fAGN is sampled from different distributions depending on the AGN classification. Galaxies hosting AGNs draw from the high-log (fAGN) distribution, while non-AGN galaxies draw from the low-log (fAGN) one. We adopt a threshold of log(fAGN) = −1 to separate these two regimes. The ratio of the AGN to galaxy bolometric luminosity fagn is sampled from the sum of two Normal distributions that matches the fagn distribution computed with Prospect using the best-fitting parameters of DEVILS D10 field used in Thorne+2022. fagn = L_bol_AGN / L_bol_galaxy.

Parameters:
  • par – (obj) par objects containing the Ucat parameters.

  • redshifts – (array_like[n_gal,]) redshifts drawn from the stellar mass function.

  • log10_stellar_masses – (array_like[n_gal,]) log10 of the stellar masses sampled from the stellar mass function.

  • galaxy_type – (str) “blue” or “red” galaxy population.

  • seed – (int) random seed.

Return fagn:

(array_like[n_gal,]) AGN to galaxy bolometric luminosity fraction.

galsbi.ucat_sps.galaxy_population_models.galaxy_dust_attenuation module

galsbi.ucat_sps.galaxy_population_models.galaxy_dust_attenuation.sample_dust_attenuation_parameters(par, log10_stellar_mass, log_specific_star_formation_rate, redshift, galaxy_type='blue', seed=None)[source]

This function samples dust attenuation parameters for the selected attenuation law and population model. tortorelli25 expects formed stellar mass and an externally supplied blue or red population. The two_population_diffuse_dust model expects surviving stellar mass and uses the supplied GalSBI galaxy type to select its blue or red coefficients.

Parameters:
  • par – (obj) par objects containing the Ucat parameters.

  • log10_stellar_mass – (array_like[n_gal,]) logarithmic formed stellar mass for tortorelli25 or surviving stellar mass for two_population_diffuse_dust, in solar masses.

  • log_specific_star_formation_rate – (array_like[n_gal,]) log10 of the specific star formation rate in yr^-1. The two-population model uses the SFR averaged over the latest 100 Myr divided by surviving stellar mass.

  • redshift – (array_like[n_gal,]) galaxy redshifts.

  • galaxy_type – (str) “blue” or “red” GalSBI galaxy population.

  • seed – (int) random seed.

Return dust_attenuation_params:

(array_like[n_gal,n_params]) dust attenuation parameters for specific attenuation law.

galsbi.ucat_sps.galaxy_population_models.galaxy_dust_attenuation.sample_dust_attenuation_parameters_charlotfall2000(par, log10_stellar_masses, log_specific_star_formation_rates, redshifts, galaxy_type='blue', seed=None)[source]

The Charlot&Fall2000 dust attenuation prescription is used in this case. It is implemented in ProSpect by means of the tau_birth, tau_screen and Eb parameters. The dependence of tau_screen and tau_birth on redshift, stellar mass and specific star-formation rate is empirically calibrated. tau_birth does not depend on any of those quantities. tau_screen depends instead on redshift, stellar mass and specific star-formation rate. tau_birth is sampled from a Gaussian distribution with different parameter values for blue and red galaxies. The Eb of the 2175 Å bump in the Drude profile is assumed to have the typical value of 1.

Parameters:
  • par – (obj) par objects containing the Ucat parameters.

  • log10_stellar_masses – (array_like[n_gal,]) log10 of the stellar masses drawn from the stellar mass function.

  • log_specific_star_formation_rates – (array_like[n_gal,]) log10 of the specific star formation rate.

  • redshifts – (array_like[n_gal,]) galaxy redshifts.

  • galaxy_type – (str) “blue” or “red” galaxy population.

  • seed – (int) random seed.

Return dust_attenuation_params:

(array_like[n_gal,3]) dust attenuation parameters tau_birth, tau_screen, Eb.

galsbi.ucat_sps.galaxy_population_models.galaxy_dust_attenuation.sample_dust_attenuation_parameters_charlotfall2000_two_population(par, log10_surviving_stellar_mass, log_specific_star_formation_rate, redshift, galaxy_type='blue', seed=None)[source]

Sample the two-population Charlot & Fall attenuation parameters.

The supplied GalSBI galaxy type selects either the blue or red parameter values. Within that galaxy type, the diffuse screen is represented by a dust-poor and a dust-rich component. Their relative probability and mean attenuations depend on redshift, surviving stellar mass, and the 100 Myr sSFR. Birth-cloud attenuation retains the published type-dependent Normal distribution and is sampled independently of the diffuse-screen component.

Parameters:
  • par – (obj) object containing the GalSBI-SPS parameters.

  • log10_surviving_stellar_mass – (array_like[n_gal,]) logarithmic surviving stellar mass in solar masses.

  • log_specific_star_formation_rate – (array_like[n_gal,]) logarithmic 100 Myr sSFR in yr^-1.

  • redshift – (array_like[n_gal,]) galaxy redshifts.

  • galaxy_type – (str) "blue" or "red" GalSBI galaxy population selecting the corresponding attenuation parameters.

  • seed – (int) random seed for population and attenuation sampling.

Return dust_attenuation_params:

(array_like[n_gal,3]) logarithmic birth-cloud attenuation, logarithmic diffuse-screen attenuation, and the 2175 Angstrom bump amplitude Eb.

galsbi.ucat_sps.galaxy_population_models.galaxy_dust_attenuation.stellar_mass_and_ssfr_for_dust_attenuation(par, log10_formed_stellar_mass, log10_surviving_stellar_mass, star_formation_rate_100_myr)[source]

Select the mass definition and calculate sSFR for the dust model.

The published Tortorelli+25 attenuation relation is preserved exactly: it uses formed stellar mass. The two-population diffuse-dust model uses surviving stellar mass and the star formation rate averaged over the latest 100 Myr. Non-positive SFR values are assigned the configured sSFR floor.

Parameters:
  • par – (obj) object containing the GalSBI-SPS parameters.

  • log10_formed_stellar_mass – (array_like[n_gal,]) logarithmic formed stellar mass in solar masses.

  • log10_surviving_stellar_mass – (array_like[n_gal,]) logarithmic surviving stellar mass in solar masses.

  • star_formation_rate_100_myr – (array_like[n_gal,]) star formation rate averaged over 100 Myr in solar masses per year.

Return log10_stellar_mass:

(array_like[n_gal,]) mass used by the selected attenuation model.

Return log_specific_star_formation_rate:

(array_like[n_gal,]) logarithmic sSFR in yr^-1 used by the selected attenuation model.

galsbi.ucat_sps.galaxy_population_models.galaxy_dust_emission module

galsbi.ucat_sps.galaxy_population_models.galaxy_dust_emission.sample_Dale2014_dust_emission_parameters(par, n_galaxies, galaxy_type='blue', seed=None)[source]

Sample Dale 2014 dust emission parameters from modelling the distribution in Thorne+2022. These parameters are used by Prospect to simulate dust emission which has a contribution of the order of 10^-4 in griZ and 10^-3 in JHKs. DaleNormSFR only for Dale2014 templates including star formation and not agn component which is instead given by Temple templates.

Parameters:
  • par – (obj) par objects containing the Ucat parameters.

  • n_galaxies – (int) number of galaxies to sample.

  • galaxy_type – (str) “blue” or “red” galaxy population.

  • seed – (int) random seed.

Return dust_emission_params:

(array_like[n_gal,2]) dust emission parameters for Dale 2014 implementation in ProSpect.

galsbi.ucat_sps.galaxy_population_models.galaxy_gas_ionization module

galsbi.ucat_sps.galaxy_population_models.galaxy_gas_ionization.sample_gas_ionization_Kashino19(Zgas_final, star_formation_rates, log10_surviv_stellar_mass, par, seed=None)[source]

This function computes the gas ionization parameter using the relation in equation 12 of Kashino+19. We keep the electron density fixed to the value with which the CLOUDY templates of FSPS have been generated, i.e. ne~100 cm^-3. We sample logU from a Normal distribution with mean given by the Kashino+19 relation and scatter of 0.1 dex, as highlighted in Kashino+19. The Normal distribution is truncated within the range [-4, -1].

Parameters:
  • Zgas_final – (array_like[n_gal,]) final gas-phase metallicity in absolute units.

  • star_formation_rates – (array_like[n_gal,]) SFR averaged over the last 100 Myr of the galaxy SFH. Units are Msun/yr.

  • log10_surviv_stellar_mass – (array_like[n_gal,]) log10 of the surviving stellar masses.

  • par – (obj) par objects containing the Ucat parameters.

  • seed – (int) random seed for the truncnorm sampling.

Return logU:

(array_like[n_gal,]) gas ionization parameters.

galsbi.ucat_sps.galaxy_population_models.light_profile module

galsbi.ucat_sps.galaxy_population_models.galaxy_light_profile.sample_sersic_for_galaxy_type(n_gal, galaxy_type, par, log10_surviv_stellar_mass)[source]

This function samples Sérsic indices conditioned on the galaxy stellar masses for different galaxy types.

Parameters:
  • n_gal – (int) number of galaxies.

  • galaxy_type – (str) “blue” or “red” galaxy population.

  • par – (obj) par objects containing the Ucat parameters.

  • log10_surviv_stellar_mass – (array_like[n_gal,]) log10 of the surviving stellar masses.

Return sersic_n:

(array_like[n_gal,]) Sérsic indices.

galsbi.ucat_sps.galaxy_population_models.galaxy_light_profile.sample_sersic_stellar_mass(n_gal, n_0, n_1, n_2, n_scatter, log10_surviv_stellar_mass, min_n, max_n)[source]

This function samples Sérsic indices conditioned on the surviving stellar masses. The stellar mass dependence of the Sérsic index is modelled using the GAMA data in Kelvin+12.

Parameters:
  • n_gal – (int) number of galaxies.

  • n_0 – (float) Sérsic index - stellar mass relation intercept.

  • n_1 – (float) Sérsic index - stellar mass relation slope.

  • n_2 – (float) Sérsic index - stellar mass relation exponent.

  • n_scatter – (float) Sérsic index - stellar mass relation scatter.

  • log10_surviv_stellar_mass – (array_like[n_gal,]) log10 of the surviving stellar masses.

  • min_n – (float) minimum Sérsic index for the truncated distribution.

  • max_n – (float) maximum Sérsic index for the truncated distribution.

Return sersic_n:

(array_like[n_gal,]) Sérsic indices.

galsbi.ucat_sps.galaxy_population_models.galaxy_metallicity_history module

galsbi.ucat_sps.galaxy_population_models.galaxy_metallicity_history.generate_gas_metallicity_history_on_ssp_grid(Zgas_final, star_formation_histories, magemaxs, ssp_age_yr, ssp_age_bins_yr, ssp_age_weights_yr, Zgas_init=0.0001, chunk_size=10000)[source]

Generate mass-mapped metallicity histories on a ProSpect SSP grid.

This function implements the deterministic Zfunc_massmap_lin_discrete prescription used for the ProMage smooth and burst training sets. Formed mass in each SSP bin is SFR * AgeWeights. The fraction of mass still to be formed is defined at the AgeBins edges and linearly interpolated to each SSP age. Consequently, metallicity approaches Zgas_final for the youngest populations and Zgas_init for the oldest populations.

The calculation is vectorized in bounded-memory chunks. It is separate from generate_gas_metallicity_history_snorm_trunc(), which retains the legacy uniform-grid trapezoidal integration and its exact existing behavior.

Parameters:
  • Zgas_final – (array_like[n_gal,]) final gas-phase metallicities in absolute units.

  • star_formation_histories – (array_like[n_gal, n_ssp_ages]) smooth or smooth-plus-burst SFHs in Msun/yr on ssp_time_grid.age_yr.

  • magemaxs – (array_like[n_gal,]) maximum stellar ages in Gyr. Formed mass and metallicity beyond each galaxy’s magemax are set to zero and Zgas_init, respectively, as in the ProMage training function.

  • ssp_age_yr – (array_like[n_ssp_ages,]) ProSpect SSP ages in years.

  • ssp_age_bins_yr – (array_like[n_ssp_ages + 1,]) SSP age-bin edges in years.

  • ssp_age_weights_yr – (array_like[n_ssp_ages,]) ProSpect integration weights in years.

  • Zgas_init – (float) common initial absolute gas metallicity.

  • chunk_size – (int) maximum number of galaxies evaluated together.

Return metallicity_histories:

(array_like[n_gal, n_ssp_ages]) absolute gas metallicity histories on the SSP look-back-time grid.

galsbi.ucat_sps.galaxy_population_models.galaxy_metallicity_history.generate_gas_metallicity_history_snorm_trunc(Zgas_final, star_formation_histories, par, Zgas_init=0.0001)[source]

This function creates, for each galaxy, a gas metallicity history under the assumption that the metallicity enrichment follows the mass build up. This prescription assumes the same low initial gas-phase metallicity for every galaxy, while different final Zgas, drawn from the sample_gas_metallicity_function. In order to compute the stellar mass formed in each time step, we use the star formation histories as function of lookback time. par.time_step needs to be equal to the time step in par.time_grid.

Parameters:
  • Zgas_final – (array_like[n_gal,]) final gas-phase metallicity in absolute units.

  • star_formation_histories – (array_like[n_gal,n_time_bins]) galaxy SFHs along a grid in lookback time. Units are Msun/yr.

  • par – (obj) par objects containing the Ucat parameters.

  • Zgas_init – (float) The initial value of the gas-phase metallicity history. Best to set this value to the lowest metallicity available in the stellar/gas templates.

Return Z_gas:

(array_like[n_gal,n_time_bins]) galaxy gas-phase metallicity histories along a grid in time since the beginning of the Universe.

galsbi.ucat_sps.galaxy_population_models.galaxy_metallicity_history.integrate_sfh(sfh, time_grid, time_step)[source]

This function computes the cumulative formed stellar mass based on the input star formation history.

Parameters:
  • sfh – (array_like[n_time_bins, ]) galaxy SFHs along a grid in increasing time. Units are Msun/yr.

  • time_grid – (array_like[n_time_bins, ]) time grid in units of yr.

  • time_step – (float) time grid step in units of yr.

Return cumulative_mass:

(array_like[n_time_bins, ]) formed stellar mass in units of Msun.

galsbi.ucat_sps.galaxy_population_models.galaxy_metallicity_history.sample_gas_metallicity(log10_stellar_masses, redshifts, star_formation_rates, par, cosmology, galaxy_type='blue', seed=None)[source]

This function samples the final gas metallicities of the galaxies based on equation 10 in Bellstedt+21. The coefficients of the equation evolves quadratically with lookback time of the observer (not that of the galaxy). The values in Bellstedt+21 have been obtained only for a sample of star-forming galaxies. The scatter around the plane also evolves quadratically with lookback time. The lookback times should be in units of Gyr.

The final gas metallicity in absolute units is obtained following equation 1 in Bellstedt+21, $Z_{gas} = Z_{odot} imes 10^{[12+log{(O/H)}] - [12+log{(O/H)}]_{odot}}$ It represents the current gas-phase metallicity of the galaxy.

Parameters:
  • log10_stellar_masses – (array_like[n_gal,]) log10 of the stellar masses drawn from the stellar mass function.

  • redshifts – (array_like[n_gal,]) redshifts drawn from the stellar mass function.

  • star_formation_rates – (array_like[n_gal,]) SFR averaged over the last 100 Myr of the galaxy SFH. Units are Msun/yr.

  • par – (obj) par objects containing the Ucat parameters.

  • cosmology – (obj) PyCosmo class object.

  • galaxy_type – (str) “blue” or “red” galaxy population.

  • seed – (int) random seed.

Return Zgas_final:

(array_like[n_gal,]) final gas-phase metallicity in absolute units.

galsbi.ucat_sps.galaxy_population_models.galaxy_metallicity_history.vectorized_truncnorm_sample(mean, std, lower_bound, upper_bound, size=None, seed=None)[source]

galsbi.ucat_sps.galaxy_population_models.galaxy_size module

galsbi.ucat_sps.galaxy_population_models.galaxy_size.mean_r50_phys_lange15(log10_surviv_stellar_mass, par, galaxy_type)[source]

Calculate the local mean physical size from the Lange+15 colour division.

The relation is the double power law measured in the rest-frame g band. Blue and red galaxies use the samples below and above the dust-corrected (u-r)_stars = 1.5 division, respectively.

Parameters:
  • log10_surviv_stellar_mass – (array_like[n_gal,]) log10 of the surviving stellar mass in solar masses.

  • par – (obj) par object containing the Lange+15 parameters.

  • galaxy_type – (str) “blue” or “red” galaxy population.

Return r50_phys_mean:

(array_like[n_gal,]) mean physical sizes in kpc.

galsbi.ucat_sps.galaxy_population_models.galaxy_size.mean_r50_phys_miller2026(redshifts, log10_surviv_stellar_mass, par, galaxy_type)[source]

Calculate the mean physical size for the Miller+26 size model.

Miller+26 is used above z=0.6. Below z=0.4 the local Lange+15 and binned Nedkova+21 continuation is used. Between these limits the two predictions are interpolated in log10(size), producing a continuous relation around the lower redshift boundary of the Miller+26 sample. The red-galaxy relation is measured only through z=3, so values above z=3 are an explicit analytic extrapolation.

Parameters:
  • redshifts – (array_like[n_gal,]) galaxy redshifts.

  • log10_surviv_stellar_mass – (array_like[n_gal,]) log10 of the surviving stellar mass in solar masses.

  • par – (obj) par object containing all size-relation parameters.

  • galaxy_type – (str) “blue” or “red” galaxy population.

Return r50_phys_mean:

(array_like[n_gal,]) mean physical sizes in kpc.

galsbi.ucat_sps.galaxy_population_models.galaxy_size.mean_r50_phys_nedkova21_binned(redshifts, log10_surviv_stellar_mass, par, galaxy_type)[source]

Calculate the mean size from the binned Nedkova+21 relations.

Each complete mass-size curve is evaluated before interpolation in redshift. This preserves the covariance between the double-power-law parameters and avoids the unphysical sizes produced by extrapolating each coefficient independently. The Lange+15 colour-selected relation is used below z=0.1 and joined smoothly to the first Nedkova+21 curve over 0.1 < z < 0.2. The final measured relation is held fixed above z=2.

Parameters:
  • redshifts – (array_like[n_gal,]) galaxy redshifts.

  • log10_surviv_stellar_mass – (array_like[n_gal,]) log10 of the surviving stellar mass in solar masses.

  • par – (obj) par object containing the Lange+15 and Nedkova+21 parameters.

  • galaxy_type – (str) “blue” or “red” galaxy population.

Return r50_phys_mean:

(array_like[n_gal,]) mean physical sizes in kpc.

galsbi.ucat_sps.galaxy_population_models.galaxy_size.mean_r50_phys_tortorelli25(redshifts, log10_surviv_stellar_mass, par, galaxy_type)[source]

Calculate the mean physical size in the published Tortorelli+25 model.

This function intentionally retains the original linear evolution of the Nedkova+21-inspired coefficients. It exists separately so the published model remains reproducible while corrected size models can be selected independently.

Parameters:
  • redshifts – (array_like[n_gal,]) galaxy redshifts.

  • log10_surviv_stellar_mass – (array_like[n_gal,]) log10 of the surviving stellar mass in solar masses.

  • par – (obj) par object containing the size-relation parameters.

  • galaxy_type – (str) “blue” or “red” galaxy population.

Return r50_phys_mean:

(array_like[n_gal,]) mean physical sizes in kpc.

galsbi.ucat_sps.galaxy_population_models.galaxy_size.sample_r50_from_stellar_mass(redshifts, log10_surviv_stellar_mass, cosmology, par, galaxy_type='blue', seed=None)[source]

This function samples galaxy sizes conditioned on their stellar masses and types.

Parameters:
  • redshifts – (array_like[n_gal,]) redshifts drawn from the stellar mass function.

  • log10_surviv_stellar_mass – (array_like[n_gal,]) log10 of the surviving stellar masses.

  • cosmology – (obj) PyCosmo class object.

  • par – (obj) par objects containing the Ucat parameters.

  • galaxy_type – (str) “blue” or “red” galaxy population.

  • seed – (int) random seed.

Return r50_ang:

(array_like[n_gal,]) angular sizes in pixel.

Return r50_phys:

(array_like[n_gal,]) physical sizes of galaxies in kpc.

galsbi.ucat_sps.galaxy_population_models.galaxy_size.sample_r50_phys_from_stellar_mass(redshifts, log10_surviv_stellar_mass, par, galaxy_type, seed=None)[source]

Sample physical galaxy sizes conditioned on stellar mass, redshift and type.

The mean relation is selected with par.size_model. tortorelli25 preserves the original GalSBI-SPS implementation. nedkova21_binned interpolates the complete mass-size relations measured in the four Nedkova+21 redshift intervals, with Lange+15 providing the local anchor. miller2026 uses the continuous Miller+26 relations and joins them to the local Lange+15 and Nedkova+21 relations.

Sizes are drawn from a log-normal distribution. The legacy model retains its original natural-log scatter. The Nedkova+21 and Miller+26 models use scatter in dex, matching the convention used in those studies.

Parameters:
  • redshifts – (array_like[n_gal,]) redshifts drawn from the stellar mass function.

  • log10_surviv_stellar_mass – (array_like[n_gal,]) log10 of the surviving stellar mass in solar masses.

  • par – (obj) par objects containing the Ucat parameters.

  • galaxy_type – (str) “blue” or “red” galaxy population.

  • seed – (int) random seed.

Return r50_phys:

(array_like[n_gal,]) physical sizes of galaxies in kpc.

galsbi.ucat_sps.galaxy_population_models.galaxy_size.scatter_r50_phys_miller2026(redshifts, log10_surviv_stellar_mass, par, galaxy_type)[source]

Calculate the logarithmic size scatter for the Miller+26 size model.

The blue-galaxy scatter has the stellar-mass dependence measured by Miller+26, while the red-galaxy scatter is constant. At low redshift these values are joined smoothly to the Nedkova+21 scatter using the same transition as the mean relation.

Parameters:
  • redshifts – (array_like[n_gal,]) galaxy redshifts.

  • log10_surviv_stellar_mass – (array_like[n_gal,]) log10 of the surviving stellar mass in solar masses.

  • par – (obj) par object containing the size-scatter parameters.

  • galaxy_type – (str) “blue” or “red” galaxy population.

Return scatter_dex:

(array_like[n_gal,]) standard deviation in log10(kpc).

galsbi.ucat_sps.galaxy_population_models.galaxy_size.scatter_r50_phys_nedkova21(redshifts, par, galaxy_type)[source]

Interpolate the Nedkova+21 logarithmic size scatter in redshift.

Parameters:
  • redshifts – (array_like[n_gal,]) galaxy redshifts.

  • par – (obj) par object containing the Nedkova+21 scatter measurements.

  • galaxy_type – (str) “blue” or “red” galaxy population.

Return scatter_dex:

(array_like[n_gal,]) standard deviation in log10(kpc).

galsbi.ucat_sps.galaxy_population_models.galaxy_star_formation_history module

galsbi.ucat_sps.galaxy_population_models.galaxy_star_formation_history.beta_shape_from_mean_concentration(mean, concentration)[source]

Convert Beta means and concentrations into shape parameters.

The conversion is alpha = mean*concentration and beta = (1-mean)*concentration.

Parameters:
  • mean – (float or array_like) finite Beta means strictly inside (0, 1).

  • concentration – (float or array_like) positive values broadcastable with mean.

Return alpha:

(array_like) positive first Beta shape parameters.

Return beta:

(array_like) positive second Beta shape parameters.

galsbi.ucat_sps.galaxy_population_models.galaxy_star_formation_history.evaluate_sfh_on_ssp_grid(log10_formed_stellar_masses, mpeak, mperiod, mskew, magemaxs, fburst, ssp_age_yr, ssp_age_weights_yr, mtrunc=2.0, mburstage=0.1, chunk_size=10000, retain_histories=True)[source]

Normalize smooth and recent-burst SFHs on the ProSpect SSP grid.

The total formed stellar mass is divided into a smooth component with mass (1-fburst)*Mformed and a recent component with mass fburst*Mformed. Both amplitudes are normalized with the ProSpect AgeWeights sum used when intSFR=False.

Galaxies are evaluated in chunks so temporary two-dimensional arrays do not scale with the complete catalogue. The full histories can be omitted when only scalar properties are needed for ProMage.

Parameters:
  • log10_formed_stellar_masses – (array_like[n_gal,]) base-10 formed stellar masses in solar-mass units.

  • mpeak – (array_like[n_gal,]) smooth SFH peak times in Gyr.

  • mperiod – (array_like[n_gal,]) smooth SFH durations in Gyr.

  • mskew – (array_like[n_gal,]) dimensionless smooth SFH skew values.

  • magemaxs – (array_like[n_gal,]) maximum stellar ages in Gyr.

  • fburst – (array_like[n_gal,]) recent-burst formed-mass fractions.

  • ssp_age_yr – (array_like[n_ssp_ages,]) ProSpect SSP ages in years.

  • ssp_age_weights_yr – (array_like[n_ssp_ages,]) ProSpect integration weights in years.

  • mtrunc – (float) ProSpect early-time truncation parameter.

  • mburstage – (float) maximum recent-burst stellar age in Gyr.

  • chunk_size – (int) maximum number of galaxies evaluated together.

  • retain_histories – (bool) return the full SFH matrix when true.

Return star_formation_histories:

(array_like[n_gal, n_ssp_ages] or None) total SFHs in Msun/yr.

Return star_formation_rates:

(array_like[n_gal,]) SFRs averaged over the most recent 100 Myr in Msun/yr.

Return star_formation_rates_10_myr:

(array_like[n_gal,]) SFRs averaged over the most recent 10 Myr in Msun/yr.

Return mSFR:

(array_like[n_gal,]) smooth SFH amplitudes in Msun/yr.

Return mburst:

(array_like[n_gal,]) recent-burst amplitudes in Msun/yr.

galsbi.ucat_sps.galaxy_population_models.galaxy_star_formation_history.evaluate_sfh_on_uniform_grid(log10_formed_stellar_masses, mpeak, mperiod, mskew, magemaxs, time_grid, mtrunc=2.0, chunk_size=10000)[source]

Evaluate the published SFHs on their uniform look-back-time grid.

This function preserves the numerical definition used by the published Tortorelli+25 model: SFHs are normalized to formed stellar mass with trapezoidal integration on time_grid, and the recent SFR is the trapezoidal average over the latest 100 Myr. Galaxies are evaluated in chunks only to avoid the former per-galaxy Python loop.

Parameters:
  • log10_formed_stellar_masses – (array_like[n_gal,]) base-10 formed stellar masses in solar-mass units.

  • mpeak – (array_like[n_gal,]) SFH peak times in Gyr.

  • mperiod – (array_like[n_gal,]) SFH durations in Gyr.

  • mskew – (array_like[n_gal,]) dimensionless SFH skew values.

  • magemaxs – (array_like[n_gal,]) maximum stellar ages in Gyr.

  • time_grid – (array_like[n_time,]) uniform look-back-time grid in years.

  • mtrunc – (float) early-time truncation parameter.

  • chunk_size – (int) maximum number of galaxies evaluated together.

Return star_formation_histories:

(array_like[n_gal, n_time]) SFHs in solar masses per year.

Return star_formation_rates:

(array_like[n_gal,]) SFRs averaged over the latest 100 Myr in solar masses per year.

Return mSFR:

(array_like[n_gal,]) normalized SFH amplitudes in solar masses per year.

galsbi.ucat_sps.galaxy_population_models.galaxy_star_formation_history.get_mean_sfh_shape_params(log10_stellar_masses, redshifts, par, galaxy_type='blue')[source]

This function returns the mean values of the SFH massfunc_snorm_trunc shape parameters conditioned on galaxy redshifts and stellar masses. We assume that mskew and logmperiod evolve linearly with stellar mass, while mpeak with both redshift and stellar mass. The stellar mass and redshift evolutions are assumed to be linear in log10(stellar_mass) and log10(1+z).

Parameters:
  • log10_stellar_masses – (array_like[n_gal,]) log10 of the stellar masses drawn from the stellar mass function.

  • redshifts – (array_like[n_gal,]) redshifts drawn from the stellar mass function.

  • par – (obj) par objects containing the Ucat parameters.

  • galaxy_type – either blue or red.

Return mean_sfh_shape_params:

(array_like[n_gal, 3]) mean values of the SFH shape parameters obtained as function of redshift and stellar mass.

galsbi.ucat_sps.galaxy_population_models.galaxy_star_formation_history.load_ssp_time_grid(ssp_library_filepath)[source]

Load the ProSpect SSP ages, age-bin edges, and integration weights.

ProSpect evaluates the SFH at the SSP ages and converts SFR to formed mass with AgeWeights when intSFR=False. These arrays are therefore read directly from the configured SSP library and cached for later pixels.

Parameters:

ssp_library_filepath – (str or os.PathLike) path to the ProSpect SSP FITS library.

Return age_yr:

(array_like[n_ssp_ages,]) SSP ages in years.

Return age_bins_yr:

(array_like[n_ssp_ages + 1,]) SSP age-bin edges in years.

Return age_weights_yr:

(array_like[n_ssp_ages,]) ProSpect integration weights in years.

galsbi.ucat_sps.galaxy_population_models.galaxy_star_formation_history.massfunc_snorm_burst_trunc(age, mburst=0.0, mSFR=10.0, mpeak=10.0, mperiod=1.0, mskew=0.5, mburstage=0.1, magemax=13.8, mtrunc=2.0)[source]

Evaluate ProSpect’s bursty truncated skewed-normal SFH.

This is a direct Python translation of ProSpect’s massfunc_snorm_burst_trunc. The burst adds a constant mburst to the smooth SFR at ages younger than mburstage. ProSpect then applies the same early-time Normal-CDF truncation to both components, so the formed burst mass is not generally mburst * mburstage and must be evaluated with the active SSP AgeWeights.

Parameters:
  • age – (array_like[n_time_bins,]) look-back time from the galaxy epoch in years. Values below 1e5 yr are evaluated at 1e5 yr, following ProSpect.

  • mburst – (float) constant pre-truncation burst amplitude in Msun/yr.

  • mSFR – (float) smooth-component amplitude in Msun/yr.

  • mpeak – (float) smooth SFH peak time in Gyr.

  • mperiod – (float) smooth SFH duration in Gyr.

  • mskew – (float) dimensionless smooth SFH skew parameter.

  • mburstage – (float) maximum stellar age assigned to the burst in Gyr. The burst is added where age < mburstage * 1e9.

  • magemax – (float) maximum allowed stellar age in Gyr.

  • mtrunc – (float) positive early-time truncation parameter.

Return sfh:

(array_like[n_time_bins,] or float) total smooth-plus-burst SFH in units of Msun/yr.

galsbi.ucat_sps.galaxy_population_models.galaxy_star_formation_history.massfunc_snorm_trunc(age, mSFR=10.0, mpeak=10.0, mperiod=1.0, mskew=0.5, magemax=13.8, mtrunc=2.0)[source]

This functions is a Python translation of the R code in ProSpect that generates SFHs from the massfunc_snorm_trunc parametrisation described in Robotham+20.

Parameters:
  • age – (array_like[n_time_bins,]) Lookback time in units of years. 0 means now from the point of view of the galaxy.

  • mSFR – (float) The value of the SFR at the peak of the SFH in Msun/yr.

  • mpeak – (float) The time at which the SFH peaks, i.e. the time at which the SFR is equal to mSFR, in units of Gyr.

  • mperiod – (float) The width of the normal distribution in units of Gyr.

  • mskew – (float) The skewness of the normal distribution in units of Gyr.

  • magemax – (float) The age beyond which the SFR is set to 0, it is defined as 13.4 Gyr - lookbacktime(z), where magemax_z0=13.4 Gyr represents the epoch at which the highest redshift galaxies are known to exist.

  • mtrunc – (float) This parameter controls truncation between mpeak and magemax. 0 means no extra truncation, 1 is about half truncated and 2 is softly but fairly fully truncated.

Return sfh:

(array_like[n_time_bins,]) The SFH of the galaxy in units of Msun/yr. The array as the same length as age.

galsbi.ucat_sps.galaxy_population_models.galaxy_star_formation_history.sample_conditional_sfh_parameters(log10_formed_stellar_masses, redshifts, magemaxs, par, galaxy_type='blue', include_recent_bursts=False, seed=None)[source]

Sample smooth SFH shapes and optional recent bursts.

The peak coordinate is Beta distributed and mapped onto [-2, magemax] Gyr. The logarithmic duration is drawn from a truncated Student-t distribution and depends on the sampled peak. The skew is then drawn from a Beta distribution conditional on both peak and duration.

When include_recent_bursts is true, a Bernoulli draw determines whether each galaxy has a burst. Its fburst is the fraction of total formed stellar mass assigned to stars younger than 0.1 Gyr. Galaxies without a recent burst have exactly fburst=0.

Parameters:
  • log10_formed_stellar_masses – (array_like[n_gal,]) base-10 formed stellar masses in solar-mass units.

  • redshifts – (array_like[n_gal,]) non-negative galaxy redshifts.

  • magemaxs – (array_like[n_gal,]) maximum stellar ages at the galaxy redshifts in Gyr.

  • par – (obj) GalSBI-SPS parameter object containing the calibrated conditional SFH coefficients.

  • galaxy_type – (str) either "blue" or "red".

  • include_recent_bursts – (bool) sample the recent-burst occurrence and formed-mass fraction when true.

  • seed – (int) random seed used for every draw in this function.

Return mpeak:

(array_like[n_gal,]) SFH peak times in Gyr.

Return mperiod:

(array_like[n_gal,]) SFH durations in Gyr.

Return mskew:

(array_like[n_gal,]) dimensionless SFH skew parameters.

Return has_burst:

(array_like[n_gal,]) Boolean recent-burst indicators.

Return fburst:

(array_like[n_gal,]) recent-burst formed-mass fractions.

galsbi.ucat_sps.galaxy_population_models.galaxy_star_formation_history.sample_sfh_shape_params(log10_stellar_masses, redshifts, par, galaxy_type='blue', seed=None)[source]

Sample the published Tortorelli+25 SFH shape distribution.

The logarithmic peak-age fraction, logarithmic SFH duration, and SFH skew are drawn jointly from the same stellar-mass- and redshift-dependent truncated multivariate Normal distribution used by Tortorelli+25. The covariance and physical limits are different for blue and red galaxies.

Most galaxies are sampled together using rejection sampling: correlated Normal proposals are generated in batches and only proposals inside all three physical limits are retained. Galaxies whose conditional means imply a very low acceptance probability, or which have no accepted proposal after 64 attempts, are sampled with the original minimax-tilting TruncatedMVN calculation. Both calculations sample the same truncated distribution; the second calculation prevents unusual combinations of stellar mass and redshift from making rejection sampling inefficient.

The returned peak parameter is converted from log10(mpeak_norm) to mpeak_norm. A value of zero corresponds to an SFH peak at the beginning of the galaxy lifetime and a value of one to a peak at the observed epoch. mperiod is similarly returned in linear Gyr units. Changing from the original per-galaxy calculation changes the random realization associated with a given seed, but not the physical probability distribution.

Parameters:
  • log10_stellar_masses – (array_like[n_gal, ]) log10 of the stellar masses drawn from the stellar mass function, in solar masses.

  • redshifts – (array_like[n_gal, ]) redshifts drawn from the stellar mass function.

  • par – (obj) object containing the GalSBI-SPS parameters.

  • galaxy_type – (str) "blue" or "red" galaxy population.

  • seed – (int) catalogue-level random seed.

Return mpeak_norm:

(array_like[n_gal, ]) fraction of the galaxy lifetime at which the SFH peaks.

Return mperiod:

(array_like[n_gal, ]) SFH duration in Gyr.

Return mskew:

(array_like[n_gal, ]) dimensionless SFH skew controlling the asymmetry around the peak.

galsbi.ucat_sps.galaxy_population_models.galaxy_star_formation_history.sample_sfh_snorm_trunc(log10_stellar_masses, redshifts, par, cosmology, galaxy_type='blue', seed=None)[source]

This function computes the galaxy star formation histories using the parametric star formation history massfunc_snorm_trunc implemented in Robotham+20 and used in Bellstedt+20,21. This parametrization is based on the four parameters mSFR, mpeak, mperiod, mskew. We do not model their distribution from GAMA and DEVILS data directly, otherwise we would end up imposing their redshift and stellar mass functions. Instead, we model the stellar mass and redshift dependence of the shape parameters mpeak, mperiod and mskew, since observationally we expect that more massive galaxies assembled their mass earlier and more rapidly than less massive galaxies. mpeak has been redefined to be the fractional age at which the SFH peaks, i.e., when mSFR occurs, where 0 means at the beginning of the galaxy life, and 1 means at the galaxy redshift. mpeak depends on both redshift and stellar mass, while mperiod and mskew depend only on stellar mass as we did not find a well-defined trend in data. We model the dependency on these physical quantities as linear relations. Once sampled from a truncated multivariate Normal distribution, we compute the shape of the SFH by imposing mSFR=1.0. We then compute the correct value of mSFR such that the integration of the star formation history yields the formed mass sampled from the stellar mass function.

The time grid used here refers to the lookback time with respect to the galaxy, so t=0 effectively means now for the galaxy, not the observer. The grid goes, however, up to 13.8 Gyr to have a common time grid for every galaxy. The SFH is set to be 0 beyond magemax = 13.4 - lookbacktime(z), i.e., age of the Universe at the galaxy redshift. We limit the sampled parameters to the observational limits set in Bellstedt+21. We also compute the star formation rate averaged over the last 100 Myr of the galaxy. magemax_z0=13.4 Gyr is the age at which the earliest galaxies are known to exist. mtrunc=2 ensures smooth truncation at SFR=0 at the beginning of the galaxy life.

Parameters:
  • log10_stellar_masses – (array_like[n_gal, ]) log10 of the stellar masses drawn from the stellar mass function.

  • redshifts – (array_like[n_gal, ]) redshifts drawn from the stellar mass function.

  • par – (obj) par objects containing the Ucat parameters.

  • cosmology – (obj) PyCosmo class object.

  • galaxy_type – Either blue or red.

  • seed – (int) random seed for the TruncatedMVN sampling.

Return sfhs:

(array_like[n_gal, n_time_bins]) galaxy star formation histories in units of Msun/yr on the linear lookback time grid.

Return sfrs:

(array_like[n_gal, ]) star formation rates averaged over the last 100 Myr of the galaxy star formation history in units of Msun/yr.

Return mSFR:

(float) The value of the SFR at the peak of the SFH in units of Msun/yr after multiplying by formed stellar mass.

Return mpeak_reconstrs:

(float) The time at which the SFH peaks, i.e. the time at which the SFR is equal to mSFR, in units of Gyr.

Return mperiod:

(float) The width of the normal distribution in units of Gyr.

Return mskew:

(float) The skewness of the normal distribution in units of Gyr.

galsbi.ucat_sps.galaxy_population_models.galaxy_star_formation_history.sample_truncated_student_t(rng, df, loc, scale, lower, upper)[source]

Sample Student-t variates within object-specific finite bounds.

Positive-tail intervals are sampled through the survival function to avoid subtracting two CDF values that have both rounded to one. Other intervals use the ordinary CDF. A collapsed numerical interval raises an error rather than creating an artificial point mass at a support boundary.

Parameters:
  • rng – (numpy.random.Generator) random generator used for every draw.

  • df – (float) positive Student-t degrees of freedom.

  • loc – (float or array_like) untruncated Student-t location parameters.

  • scale – (float or array_like) positive Student-t scale parameters.

  • lower – (float or array_like) finite lower truncation bounds.

  • upper – (float or array_like) finite upper truncation bounds. The loc, scale, lower, and upper inputs must broadcast to a common shape.

Return samples:

(array_like) truncated Student-t samples with the common broadcast shape.

galsbi.ucat_sps.galaxy_population_models.galaxy_star_formation_history.single_galaxy_sfh_snorm_trunc(time_grid, mSFR_norm, mpeak, mperiod, mskew, magemax, mtrunc)[source]

Evaluate the truncated skewed normal SFH for a single set of parameters.

This is a light-weight convenience wrapper around massfunc_snorm_trunc() that makes the intent explicit in the public API and keeps scalar inputs behaving like scalars (which is relied upon in the tests).

galsbi.ucat_sps.galaxy_population_models.galaxy_star_formation_history.stable_logit(probabilities, epsilon=None)[source]

Evaluate the logit transform with a numerical endpoint guard.

Parameters:
  • probabilities – (float or array_like) finite probabilities in [0, 1].

  • epsilon – (float, optional) clipping distance from zero and one. The default is double-precision machine epsilon.

Return logits:

(float or array_like) log odds with the same shape as probabilities.

galsbi.ucat_sps.galaxy_population_models.galaxy_star_formation_history.stable_sigmoid(values)[source]

Evaluate the logistic sigmoid without overflow or exact endpoints.

The output is clipped only at machine precision so that it remains a valid mean for a Beta distribution even for very large absolute input values.

Parameters:

values – (float or array_like) finite values on the real line.

Return probabilities:

(float or array_like) logistic probabilities with the same shape as values and values strictly inside (0, 1).

galsbi.ucat_sps.galaxy_population_models.galaxy_stellar_mass_function module

class galsbi.ucat_sps.galaxy_population_models.galaxy_stellar_mass_function.NumGalCalculator(z_max, sm_min, parametrization, sm_alpha, sm_m_star_par, sm_phi_star_par, cosmo, pixarea, ngal_multiplier=1)[source]

Bases: object

Computes galaxy number counts by integrating the galaxy stellar mass function (Schechter function).

The integral over stellar masses can be done analytically, while the integral over redshifts is computed numerically. See also docs/jupyter_notebooks/sample_redshift_magnitude.ipynb.

class galsbi.ucat_sps.galaxy_population_models.galaxy_stellar_mass_function.RedshiftSMSampler(z_res, z_max, sm_res, sm_min, parametrization, sm_alpha, sm_m_star_par, sm_phi_star_par, cosmo)[source]

Bases: object

Samples redshifts and stellar masses from the galaxy stellar mass function.

The sampling is done by first drawing redshifts from the redshift-pdf obtained by integrating out stellar masses. Then, we sample stellar masses from the conditional pdfs obtained by conditioning the stellar mass 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.

class galsbi.ucat_sps.galaxy_population_models.galaxy_stellar_mass_function.StellarMassFunction(name, sm_fct_parametrization, sm_m_star_0, sm_m_star_1, sm_m_star_2, sm_phi_star_amp, sm_phi_star_exp, sm_alpha, cosmo, pixarea, galaxy_type, seed_ngal, z_res=0.001, sm_res=0.01, z_max=3, sm_min=8, z_sm_intp=None, ngal_multiplier=1)[source]

Bases: object

Stellar Mass function.

sample_z_sm_and_apply_cut(seed_ngal, 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.

galsbi.ucat_sps.galaxy_population_models.galaxy_stellar_mass_function.double_stellar_mass_function_parametrisation(log10_stellar_masses, log_Mstar, phi_star_low_mass, phi_star_high_mass, alpha_low_mass, alpha_high_mass)[source]

This function parametrises the stellar mass function as a double Schechter function. It computes the number density of galaxies as a function of their stellar mass.

Parameters:
  • log10_stellar_masses – (array_like[n_mass_bins,]) log10 of the stellar masses drawn from the SMF.

  • log_Mstar – (float) knee of the Schechter function. It corresponds to the stellar mass at which the Schechter transitions from a simple power law with slope alpha at lower masses into an exponential function at higher masses. It has the same value for both the low and high mass SMFs.

  • phi_star_low_mass – (float) number density of galaxies at stellar mass M* (log_Mstar) for the low mass SMF.

  • phi_star_high_mass – (float) number density of galaxies at stellar mass M* (log_Mstar) for the high mass SMF.

  • alpha_low_mass – (float) faint-end slope of the low mass SMF.

  • alpha_high_mass – (float) faint-end slope of the high mass SMF.

Return stellar_mass_function:

(array_like[n_mass_bins,]) the number density of galaxies as a function of their stellar mass.

galsbi.ucat_sps.galaxy_population_models.galaxy_stellar_mass_function.find_closest_ind(grid, vals)[source]
galsbi.ucat_sps.galaxy_population_models.galaxy_stellar_mass_function.initialize_stellar_mass_functions(par, pixarea, cosmo, z_sm_intp=None, mass_key=None)[source]
galsbi.ucat_sps.galaxy_population_models.galaxy_stellar_mass_function.maximum_redshift(z_sm_intp, sm_min, z_max, parametrization, alpha, sm_m_star_par, seed_ngal)[source]

Compute the maximum redshift used to sample the stellar-mass function.

When a redshift-dependent stellar-mass completeness boundary is supplied, sampling stops when fewer than 1e-5 of the galaxies above sm_min are expected to lie above that boundary.

Parameters:
  • z_sm_intp – (callable) interpolation returning the lower logarithmic stellar- mass boundary as a function of redshift, or None when no additional cut is required.

  • sm_min – (float) minimum logarithmic stellar mass sampled before applying the redshift-dependent cut, in log10 solar-mass units.

  • z_max – (float) configured maximum sampling redshift.

  • parametrization – (str) parametrization of the redshift evolution of the characteristic stellar mass.

  • alpha – (float) low-mass slope of the Schechter function.

  • sm_m_star_par – (tuple) parameters describing the characteristic stellar mass.

  • seed_ngal – (int) random seed used for the small redshift-grid displacement.

Return z_max:

(float) maximum redshift used for sampling.

galsbi.ucat_sps.galaxy_population_models.galaxy_stellar_mass_function.single_stellar_mass_function_parametrisation(log10_stellar_masses, log_Mstar, phi_star, alpha)[source]

This function parametrises the stellar mass function as a single Schechter function. It computes the number density of galaxies as a function of their stellar mass.

Parameters:
  • log10_stellar_masses – (array_like[n_mass_bins,]) log10 of the stellar masses drawn from the SMF.

  • log_Mstar – (float) knee of the Schechter function. It corresponds to the stellar mass at which the Schechter transitions from a simple power law with slope alpha at lower masses into an exponential function at higher masses.

  • phi_star – (float) number density of galaxies at stellar mass M* (log_Mstar).

  • alpha – (float) faint-end slope.

Return stellar_mass_function:

(array_like[n_mass_bins,]) the number density of galaxies as a function of their stellar mass.

galsbi.ucat_sps.galaxy_population_models.galaxy_stellar_mass_function.stellar_mass_function_m_star(z, parametrization, intercept, slope, quadratic_term=0)[source]
galsbi.ucat_sps.galaxy_population_models.galaxy_stellar_mass_function.stellar_mass_function_phi_star(z, parametrization, amplitude, exp)[source]
galsbi.ucat_sps.galaxy_population_models.galaxy_stellar_mass_function.upper_inc_gamma(a, x)[source]

galsbi.ucat_sps.galaxy_population_models.galaxy_surviving_stellar_massmodule

Compute surviving stellar masses for GalSBI-SPS galaxies.

galsbi.ucat_sps.galaxy_population_models.galaxy_surviving_stellar_mass.compute_legacy_surviving_stellar_mass(redshifts, log10_stellar_masses, mSFR, mpeak, mperiod, mskew, Zgas_final, par)[source]

Compute surviving stellar masses for the published Tortorelli+25 model.

This function retains the original network trained for the legacy Tortorelli+25 massfunc_snorm_trunc population model. The conditional smooth and recent-burst models use predict_log10_surviving_stellar_mass instead.

Parameters:
  • redshifts – (array_like[n_gal,]) galaxy redshifts.

  • log10_stellar_masses – (array_like[n_gal,]) base-10 formed stellar masses in Msun.

  • mSFR – (array_like[n_gal,]) smooth SFH amplitudes in Msun/yr.

  • mpeak – (array_like[n_gal,]) smooth SFH peak times in Gyr.

  • mperiod – (array_like[n_gal,]) smooth SFH durations in Gyr.

  • mskew – (array_like[n_gal,]) dimensionless SFH skew values.

  • Zgas_final – (array_like[n_gal,]) final gas metallicities.

  • par – (obj) GalSBI-SPS parameter object containing the legacy model and scaler paths.

Return log10_surviving_stellar_masses:

(array_like[n_gal,]) base-10 surviving stellar masses in Msun.

galsbi.ucat_sps.galaxy_population_models.galaxy_surviving_stellar_mass.load_surviving_stellar_mass_model(emulator_directory, sfh_model, emulator_version='1.0.0', device='cpu')[source]

Load one surviving-stellar-mass network and its trained parameter limits.

The TorchScript network contains the property and target scaling. The accompanying JSON files identify the SFH used for training, the property order, and the part of parameter space represented by the training sample.

Parameters:
  • emulator_directory – (str or os.PathLike) directory containing manifest.json and the files named within it.

  • sfh_model – (str) ProSpect SFH used to generate the training sample.

  • emulator_version – (str) required trained-network version.

  • device – (str) Torch device used for inference.

Return model:

(torch.jit.ScriptModule) loaded TorchScript network.

Return model_limits:

(dict) property order, property limits, redshift limits, SFH model, device, and network version.

galsbi.ucat_sps.galaxy_population_models.galaxy_surviving_stellar_mass.predict_log10_surviving_stellar_mass(log10_formed_stellar_masses, redshifts, magemaxs, mpeak, mperiod, mskew, Zgas_final, has_burst, fburst, smooth_model, smooth_model_limits, burst_model=None, burst_model_limits=None)[source]

Predict surviving stellar masses for smooth and recent-burst galaxies.

Smooth galaxies use the network trained with massfunc_snorm_trunc. Recent-burst galaxies use the network trained with massfunc_snorm_burst_trunc and receive log10(fburst) as an additional property.

Parameters:
  • log10_formed_stellar_masses – (array_like[n_gal,]) base-10 formed stellar masses in Msun.

  • redshifts – (array_like[n_gal,]) galaxy redshifts.

  • magemaxs – (array_like[n_gal,]) maximum stellar ages in Gyr.

  • mpeak – (array_like[n_gal,]) smooth SFH peak times in Gyr.

  • mperiod – (array_like[n_gal,]) smooth SFH durations in Gyr.

  • mskew – (array_like[n_gal,]) dimensionless smooth SFH skew values.

  • Zgas_final – (array_like[n_gal,]) final gas metallicities.

  • has_burst – (array_like[n_gal,]) recent-burst indicators.

  • fburst – (array_like[n_gal,]) recent-burst formed-mass fractions.

  • smooth_model – (torch.jit.ScriptModule) smooth-SFH network.

  • smooth_model_limits – (dict) smooth-network parameter limits.

  • burst_model – (torch.jit.ScriptModule, optional) burst-SFH network.

  • burst_model_limits – (dict, optional) burst-network parameter limits.

Return log10_surviving_stellar_masses:

(array_like[n_gal,]) base-10 surviving stellar masses in Msun, in the original galaxy order.

galsbi.ucat_sps.galaxy_population_models.galaxy_surviving_stellar_mass.predict_log10_surviving_to_formed_mass_ratio(model, model_limits, physical_properties, redshifts)[source]

Predict the logarithmic surviving-to-formed stellar-mass ratio.

Parameters:
  • model – (torch.jit.ScriptModule) loaded surviving-mass network.

  • model_limits – (dict) property order and trained parameter limits returned by load_surviving_stellar_mass_model.

  • physical_properties – (dict[str, array_like[n_gal,]]) physical properties required by the selected SFH network.

  • redshifts – (array_like[n_gal,]) galaxy redshifts.

Return log10_mass_ratios:

(array_like[n_gal,]) base-10 logarithm of surviving stellar mass divided by formed stellar mass.

galsbi.ucat_sps.galaxy_population_models.galaxy_velocity_dispersion module

galsbi.ucat_sps.galaxy_population_models.galaxy_velocity_dispersion.sample_velocity_dispersion_zahid(par, log10_surviv_stellar_mass, seed=None)[source]

This function samples the velocity dispersion of each galaxy conditioned on its stellar mass. We use equation 5 in Zahid+2016 to determine the mean velocity dispersion as function of stellar mass. Then we sample the actual velocity dispersion from a Gaussian having width from Figure 9 in Zahid+2016. We also set a lower limit equal to 10 km/s for the velocity dispersion.

Parameters:
  • par – (obj) par objects containing the Ucat parameters.

  • log10_surviv_stellar_mass – (array_like[n_gal,]) log10 of the surviving stellar masses.

  • seed – (int) random seed.

Return vel_disp:

(array_like[n_gal,]) velocity dispersions in units of km/s.

Module contents