galsbi.ucat_sps package
Subpackages
- galsbi.ucat_sps.config package
- galsbi.ucat_sps.galaxy_population_models package
- Submodules
- galsbi.ucat_sps.galaxy_population_models.galaxy_agn module
- galsbi.ucat_sps.galaxy_population_models.galaxy_dust_attenuation module
- galsbi.ucat_sps.galaxy_population_models.galaxy_dust_emission module
- galsbi.ucat_sps.galaxy_population_models.galaxy_gas_ionization module
- galsbi.ucat_sps.galaxy_population_models.light_profile module
- galsbi.ucat_sps.galaxy_population_models.galaxy_metallicity_history module
- galsbi.ucat_sps.galaxy_population_models.galaxy_size module
- galsbi.ucat_sps.galaxy_population_models.galaxy_star_formation_history module
beta_shape_from_mean_concentration()evaluate_sfh_on_ssp_grid()evaluate_sfh_on_uniform_grid()get_mean_sfh_shape_params()load_ssp_time_grid()massfunc_snorm_burst_trunc()massfunc_snorm_trunc()sample_conditional_sfh_parameters()sample_sfh_shape_params()sample_sfh_snorm_trunc()sample_truncated_student_t()single_galaxy_sfh_snorm_trunc()stable_logit()stable_sigmoid()
- galsbi.ucat_sps.galaxy_population_models.galaxy_stellar_mass_function module
NumGalCalculatorRedshiftSMSamplerStellarMassFunctiondouble_stellar_mass_function_parametrisation()find_closest_ind()initialize_stellar_mass_functions()maximum_redshift()single_stellar_mass_function_parametrisation()stellar_mass_function_m_star()stellar_mass_function_phi_star()upper_inc_gamma()
- galsbi.ucat_sps.galaxy_population_models.galaxy_surviving_stellar_massmodule
- galsbi.ucat_sps.galaxy_population_models.galaxy_velocity_dispersion module
- Module contents
- galsbi.ucat_sps.plugins package
Submodules
galsbi.ucat_sps.spectrum_util_sps module
- galsbi.ucat_sps.spectrum_util_sps.apply_extinction(spectra, observed_wavelengths, excess_b_v, extinction_spline)[source]
This function applies Milky Way extinction to galaxy spectra.
- Parameters:
spectra – (array_like[n_gal, n_lambda]) input spectra.
observed_wavelengths – (array_like[n_gal, n_lambda]) observed- frame wavelengths array.
excess_b_v – (array_like[n_gal,]) E(B-V) Milky Way extinction.
extinction_spline – (obj) scipy InterpolatedUnivariateSpline object.
- Return ext_spectra:
(array_like[n_gal, n_lambda]) extincted spectra.
- galsbi.ucat_sps.spectrum_util_sps.apply_velocity_broadening(spectra, lam, sigma_smooth, min_wave=3000, max_wave=20000)[source]
This function applies velocity broadening to the spectra based on the velocity dispersion sampled from GalSBI.
- Parameters:
spectra – (array_like[n_gal, n_lambda]) input spectra.
lam – (array_like[n_lambda,]) rest-frame wavelength array.
sigma_smooth – (array_like[n_gal,]) Velocity dispersions in km/s.
min_wave – (float) Minimum wavelength.
max_wave – (float) Maximum wavelength.
- Return vel_disp_smooth_spectra:
(array_like[n_gal, n_lambda]) Velocity dispersion smoothed spectra.
- galsbi.ucat_sps.spectrum_util_sps.compute_Temple21_AGN_contributions(par, rest_frame_fluxes_erg_s_A, rest_frame_wave_A, fagn, redshift)[source]
This function computes the quasar spectra from the Temple+21 AGN templates. As specified in the paper and through private communication, we compute the AGN bolometric luminosity as fraction fagn of the galaxy bolometric luminosity and apply simple prescription to compute the luminosity at 3000 Å and the absolute magnitude in the i-band. These quantities are needed for qsogen package to work.
- Parameters:
par – (obj) par objects containing the Ucat parameters.
rest_frame_fluxes_erg_s_A – (array_like[n_gal, n_lambda]) galaxy rest-frame flux in erg/s/Å from ProSpect.
rest_frame_wave_A – (array_like[n_lambda,]) rest-frame wavelength array in Ångstrom.
fagn – (array_like[n_gal,]) fraction of AGN luminosity sampled from GalSBI-SPS.
redshift – (array_like[n_gal,]) galaxy redshift.
- Return quasar_fluxes_erg_s_cm2_A:
(array_like[n_gal, n_lambda]) quasar observed-frame flux in erg/s/cm2/Å.
galsbi.ucat_sps.util_sps module
General numerical and model-evaluation utilities for GalSBI-SPS.
- galsbi.ucat_sps.util_sps.apply_extinction_to_magnitudes(magnitudes, excess_b_v, par, filter_names=None, extinction_spline=None)[source]
Apply Milky Way extinction to observed-frame band magnitudes.
- Parameters:
magnitudes – (array_like[n_gal, n_bands]) observed-frame magnitudes.
excess_b_v – (array_like[n_gal,]) Milky Way E(B-V) values.
par – (obj) GalSBI-SPS parameter object containing filter data.
filter_names – (sequence[str], optional) ProSpect/ProMage filter names; defaults to
par.filters_full_names_prospect.extinction_spline – (obj, optional) extinction-law interpolation spline. It is constructed when omitted.
- Return extincted_magnitudes:
(array_like[n_gal, n_bands]) observed-frame magnitudes including Milky Way extinction.
- galsbi.ucat_sps.util_sps.apply_galaxy_observed_magnitude_cut(par, galaxy_properties)[source]
Select galaxies brighter than the ProMage observed-magnitude limit.
Smooth and recent-burst galaxies are evaluated with their corresponding ProMage selection models. Their predictions are restored to catalogue order before Milky Way extinction and the common magnitude cut are applied. The configured limit must be supported by every SFH family used by the selected population model.
- Parameters:
par – (obj) object containing the GalSBI-SPS parameters.
galaxy_properties – (obj) galaxy catalogue containing the ProMage physical properties,
has_burst,fburst, andexcess_b_v.
- Return selected_objects:
(array_like[n_gal,]) Boolean mask selecting objects that pass the magnitude cut.
- galsbi.ucat_sps.util_sps.build_promage_physical_properties(z, mSFR, mpeak, mperiod, mskew, Zgas_final, logU, dust_attenuation_params, dust_emission_params)[source]
Build the smooth-SFH physical properties required by ProMage.
- Parameters:
z – (array_like[n_gal,]) galaxy redshifts.
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 smooth SFH skew values.
Zgas_final – (array_like[n_gal,]) gas metallicities at observation.
logU – (array_like[n_gal,]) base-10 gas ionisation parameters.
dust_attenuation_params – (array_like[n_gal, 3]) ProSpect
logtaubirth,logtauscreen, andEbparameters.dust_emission_params – (array_like[n_gal, 2]) ProSpect
alphabirthandalphascreenparameters.
- Return physical_properties:
(dict[str, array_like[n_gal,]]) properties in the order used to train the smooth ProMage model.
- galsbi.ucat_sps.util_sps.compute_ab_magnitudes(par, observed_wavelengths_A, observed_fluxes_erg_s_cm2_A)[source]
Integrate observed galaxy SEDs to obtain AB magnitudes.
- Parameters:
par – (obj) GalSBI-SPS parameter object containing filter curves.
observed_wavelengths_A – (array_like[n_gal, n_lambda]) observed-frame wavelengths in Angstrom.
observed_fluxes_erg_s_cm2_A – (array_like[n_gal, n_lambda]) observed flux densities in erg/s/cm2/Angstrom.
- Return observed_magnitudes:
(array_like[n_gal, n_bands]) observed-frame AB magnitudes in
par.filtersorder.
- galsbi.ucat_sps.util_sps.galaxy_property_seed(par, pixel, galaxy_type, property_name, mass_component=None)[source]
Return a reproducible and independent seed for one sampled property.
The seed depends on the catalogue seed, HEALPix pixel, galaxy population, physical property and, for the stellar mass function, Schechter component. It does not depend on the position of a pixel in the input pixel list, so reordering that list does not alter the realization assigned to each pixel.
- Parameters:
par – (obj) GalSBI parameter object containing the catalogue seed.
pixel – (int) HEALPix pixel being sampled.
galaxy_type – (str)
"red"or"blue"galaxy population.property_name – (str) name of the sampled physical property.
mass_component – (str or None)
"lowmass"or"highmass"for the corresponding Schechter component; otherwiseNone.
- Return seed:
(int) deterministic 32-bit seed for the requested random stream.
- galsbi.ucat_sps.util_sps.get_age_of_the_universe_from_redshift(redshifts, cosmology)[source]
Return the age of the Universe at each input redshift.
The calculation uses the flat matter-plus-cosmological-constant solution and the parameters stored in the configured PyCosmo object.
- Parameters:
redshifts – (float or array_like[n_gal,]) galaxy redshifts.
cosmology – (obj) configured PyCosmo cosmology object.
- Return age:
(float or array_like[n_gal,]) age of the Universe in years.
- galsbi.ucat_sps.util_sps.get_lookbacktime_from_redshift(redshifts, cosmology)[source]
Return the observer lookback time at each input redshift.
- Parameters:
redshifts – (float or array_like[n_gal,]) galaxy redshifts.
cosmology – (obj) configured PyCosmo cosmology object.
- Return lookback_time:
(float or array_like[n_gal,]) lookback time in years.
- galsbi.ucat_sps.util_sps.load_promage_models(par, include_recent_bursts=False)[source]
Load the smooth ProMage model and the recent-burst model when needed.
- Parameters:
par – (obj) GalSBI-SPS parameter object.
include_recent_bursts – (bool) load the model trained with
massfunc_snorm_burst_truncin addition to the smooth model.
- Return smooth_model:
(ProMage) magnitude model for smooth SFHs.
- Return burst_model:
(ProMage or None) magnitude model for recent-burst SFHs.
- galsbi.ucat_sps.util_sps.predict_promage_magnitudes(physical_properties, has_burst, fburst, bands, frame, role, smooth_model, burst_model=None)[source]
Predict ProMage magnitudes and restore the original galaxy order.
- Parameters:
physical_properties – (dict[str, array_like[n_gal,]]) common smooth and burst ProMage inputs.
has_burst – (array_like[n_gal,]) recent-burst indicators.
fburst – (array_like[n_gal,]) recent-burst formed-mass fractions.
bands – (sequence[str]) requested ProSpect filter names.
frame – (str)
observedorabsolutemagnitude frame.role – (str)
selectionormagnitudemodel purpose.smooth_model – (ProMage) model trained with smooth SFHs.
burst_model – (ProMage, optional) model trained with recent bursts.
- Return magnitudes:
(array_like[n_gal, n_bands]) predicted magnitudes in input galaxy order.
- galsbi.ucat_sps.util_sps.reorder_prospect_magnitudes_to_filters(par, magnitudes, filter_names=None)[source]
Reorder ProSpect or ProMage magnitudes to match
par.filters.- Parameters:
par – (obj) GalSBI-SPS parameter object containing the explicit ProSpect-to-GalSBI filter mapping.
magnitudes – (array_like[n_gal, n_bands]) magnitudes in the supplied ProSpect filter order.
filter_names – (sequence[str], optional) order of the magnitude columns; defaults to
par.filters_full_names_prospect.
- Return reordered_magnitudes:
(array_like[n_gal, n_bands]) magnitudes in
par.filtersorder.
- galsbi.ucat_sps.util_sps.stellar_mass_function_seed(par, pixel, galaxy_type, mass_component)[source]
Return a distinct seed for each stellar-mass-function component.
The red and blue populations each contain low- and high-mass Schechter components. These four components must use different random streams so their Poisson counts and sampled masses are statistically independent.
- Parameters:
par – (obj) GalSBI parameter object containing the catalogue seed.
pixel – (int) HEALPix pixel being sampled.
galaxy_type – (str)
"red"or"blue"galaxy population.mass_component – (str)
"lowmass"or"highmass"Schechter component.
- Return seed:
(int) deterministic seed for the requested population and Schechter component.
- galsbi.ucat_sps.util_sps.validate_recent_burst_properties(has_burst, fburst, n_galaxies)[source]
Prepare recent-burst arrays for magnitude and mass calculations.
Omitting both inputs represents a purely smooth population, preserving the magnitude-function interface used before the burst model was introduced. The population sampler is responsible for enforcing the physical relation between the burst indicator and burst formed-mass fraction.
- Parameters:
has_burst – (array_like[n_gal,] or None) recent-burst indicators.
fburst – (array_like[n_gal,] or None) recent-burst formed-mass fractions.
n_galaxies – (int) expected number of galaxies.
- 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.sps_sed_generator module
- class galsbi.ucat_sps.sps_sed_generator.MagnitudeGenerator(par)[source]
Bases:
objectClass to generate magnitudes using SPS models.
It will contain ProSpect, magnitude emulator and spectra emulator.
- galsbi.ucat_sps.sps_sed_generator.get_magnitudes_with_ProSpect(par, z, mSFR, mpeak, mperiod, mskew, Zgas_final, logU, fagn, dust_attenuation_params, excess_b_v, dust_emission_params=None, vel_disp=None, ssp_library_filepath=None, filter_names=None, cosmology=None, log10_stellar_mass=None, has_burst=None, fburst=None)[source]
This function returns AB magnitudes for the galaxies sampled in GalSBI- SPS. It computes rest-frame SEDs with ProSpect, applies velocity broadening, adds the AGN component, applies Milky Way extinction, and integrates in the filter bands.
- Parameters:
par – (obj) par objects containing the Ucat parameters.
z – (array_like[n_gal,]) galaxy redshift.
mSFR – (array_like[n_gal, ]) mSFR parameter for the massfunc_snorm_trunc function in ProSpect in Msun/yr.
mpeak – (array_like[n_gal, ]) mpeak parameter for the massfunc_snorm_trunc function in ProSpect in Gyr.
mperiod – (array_like[n_gal, ]) mperiod parameter for the massfunc_snorm_trunc function in ProSpect.
mskew – (array_like[n_gal, ]) mskew parameter for the massfunc_snorm_trunc function in ProSpect.
Zgas_final – (array_like[n_gal, ]) gas-phase metallicity at the time of observation.
logU – (array_like[n_gal, ]) gas ionisation parameter.
vel_disp – (array_like[n_gal, ]) velocity dispersion in km/s.
fagn – (array_like[n_gal, ]) fraction of AGN luminosity sampled from GalSBI-SPS.
dust_attenuation_params – (array_like[n_gal,3]) dust attenuation parameters for the tau_birth and tau_screen parameters in ProSpect.
excess_b_v – (array_like[n_gal, ]) E(B-V) Milky Way extinction.
dust_emission_params – (array_like[n_gal,2]) dust emission parameters for the alpha_SF_birth and alpha_SF_screen parameters in ProSpect.
ssp_library_filepath – (str) Filepath to the SSP library generated with ProGeny.
filter_names – (list) filter names recognized by ProSpect.
cosmology – (obj) PyCosmo cosmology object.
log10_stellar_mass – (array_like[n_gal, ]) log10 total formed stellar mass. For recent-burst galaxies this sets the target burst formed mass used to derive the ProSpect
mburstamplitude.has_burst – (array_like[n_gal,] or None) recent-burst occurrence indicators. If omitted together with
fburst, all galaxies use the smooth SFH.fburst – (array_like[n_gal,] or None) fractions of total formed stellar mass assigned to the recent burst.
- Return rest_mags:
(array_like[n_gal, n_bands]) rest-frame AB magnitudes.
- Return obs_mags:
(array_like[n_gal, n_bands]) observed-frame AB magnitudes.
- galsbi.ucat_sps.sps_sed_generator.get_magnitudes_with_emulator(par, z, mSFR, mpeak, mperiod, mskew, Zgas_final, logU, fagn, dust_attenuation_params, excess_b_v, dust_emission_params=None, vel_disp=None, ssp_library_filepath=None, filter_names=None, cosmology=None, log10_stellar_mass=None, has_burst=None, fburst=None)[source]
This function returns AB observed-frame and rest-frame magnitudes using the ProMage emulator trained on ProSpect outputs. Magnitudes refer to the host galaxy only, without AGN contribution. Milky-Way dust attenuation is added a posteriori.
- Parameters:
par – (obj) par objects containing the Ucat parameters.
z – (array_like[n_gal,]) galaxy redshift.
mSFR – (array_like[n_gal,]) mSFR parameter for the massfunc_snorm_trunc function in ProSpect in Msun/yr.
mpeak – (array_like[n_gal,]) mpeak parameter for the massfunc_snorm_trunc function in ProSpect in Gyr.
mperiod – (array_like[n_gal,]) mperiod parameter for the massfunc_snorm_trunc function in ProSpect.
mskew – (array_like[n_gal,]) mskew parameter for the massfunc_snorm_trunc function in ProSpect.
Zgas_final – (array_like[n_gal,]) gas-phase metallicity at the time of observation.
logU – (array_like[n_gal,]) gas ionisation parameter.
fagn – (array_like[n_gal,]) fraction of AGN luminosity sampled from GalSBI-SPS.
dust_attenuation_params – (array_like[n_gal,3]) dust attenuation parameters for the tau_birth and tau_screen parameters in ProSpect.
excess_b_v – (array_like[n_gal,]) E(B-V) Milky Way extinction.
dust_emission_params – (array_like[n_gal,2]) dust emission parameters for the alpha_SF_birth and alpha_SF_screen parameters in ProSpect.
vel_disp – (array_like[n_gal,]) velocity dispersion in km/s. Not needed in this function, but used in ProSpect.
ssp_library_filepath – (str) Filepath to the SSP library generated with ProGeny. Not needed in this function, but used in ProSpect.
filter_names – (list) filter names recognized by ProSpect. Not needed in this function, but used in ProSpect.
cosmology – (obj) PyCosmo cosmology object. Not needed in this function, but used in ProSpect.
log10_stellar_mass – (array_like[n_gal,]) log10 stellar mass.
has_burst – (array_like[n_gal,] or None) recent-burst occurrence indicators. If omitted together with
fburst, all galaxies use the smooth ProMage model.fburst – (array_like[n_gal,] or None) fractions of total formed stellar mass assigned to the recent burst. ProMage receives
log10(fburst)only for galaxies with a recent burst.
- Return rest_mags:
(array_like[n_gal,n_bands]) emulated rest-frame AB magnitudes.
- Return obs_mags:
(array_like[n_gal,n_bands]) emulated observed-frame AB magnitudes.