Coverage for src / galsbi / ucat / config / common.py: 100%

164 statements  

« prev     ^ index     » next       coverage.py v7.13.0, created at 2025-12-17 09:47 +0000

1# Copyright (C) 2018 ETH Zurich, Institute for Particle Physics and Astrophysics 

2 

3""" 

4Created on Mar 5, 2018 

5author: Joerg Herbel 

6""" 

7 

8import numpy as np 

9 

10# ================================================================== 

11# G E N E R A L 

12# ================================================================== 

13 

14# Filter bands (multi-band only) 

15filters = ["g", "r", "i", "z", "y"] 

16# Filters full names 

17filters_full_names = { 

18 "B": "SuprimeCam_B", 

19 "g": "HSC_g", 

20 "r": "HSC_r2", 

21 "i": "HSC_i2", 

22 "z": "HSC_z", 

23 "y": "HSC_y", 

24} 

25reference_band = "i" 

26 

27# Seeds 

28# --------------------- 

29# General seed set when initializing UFig 

30seed = 102301239 

31# Seed offset set before sampling the number of galaxies 

32gal_num_seed_offset = 100 

33# Seed offset set before drawing from luminosity function 

34gal_lum_fct_seed_offset = 1200 

35# Seed offset set before sampling galaxy positions 

36gal_dist_seed_offset = 200 

37# Seed offset set before sampling the galaxies' Sersic indices distribution 

38gal_sersic_seed_offset = 300 

39# Seed offset set before sampling the galaxies' ellipticity distribution 

40gal_ellipticities_seed_offset = 400 

41# Seed to make redshift addition deterministic 

42seed_ngal = 500 

43 

44# Sampling and other general parameters 

45# ------------------------------------- 

46# Sampling mode for galaxy catalog, either "wcs" (for image simulations) or "healpix" 

47sampling_mode = "wcs" 

48# healpy map for healpix sampling 

49healpix_map = None 

50# Healpix pixelization for sampling 

51nside_sampling = 512 

52# Remote directory containing maps 

53maps_remote_dir = "ufig_res/maps/" 

54# galaxy_catalog_name 

55galaxy_catalog_name = "ucat_galaxies.h5" 

56# galaxy_sed_catalog_name 

57galaxy_sed_catalog_name = "ucat_galaxies_sed.h5" 

58# star_catalog_name 

59star_catalog_name = "ucat_stars.h5" 

60# by how much the number of galaxies should be multiplied (used to test high or low 

61# blending regimes) 

62ngal_multiplier = 1 

63# if to enrich the catalog by parameters such as bkg, absolute ellipticity, etc. 

64enrich_catalog = False 

65 

66# ================================================================== 

67# I M A G E P R O P E R T I E S 

68# ================================================================== 

69 

70# Number of pixels on image x-axis 

71size_x = 4200 

72# Number of pixels on image y-axis 

73size_y = 4200 

74# Center of field (RA) 

75ra0 = 150.24793 

76# Center of field (Dec) 

77dec0 = 2.23140 

78# Pixel scale (arcsec/pixel) 

79pixscale = 0.168 

80 

81# ================================================================== 

82# C O S M O L O G Y 

83# ================================================================== 

84 

85# Reduced Hubble parameter 

86h = 0.678 

87# Matter density 

88omega_m = 0.308 

89# Dark energy density 

90omega_l_in = "flat" 

91 

92# ================================================================== 

93# G A L A X Y C A T A L O G 

94# ================================================================== 

95 

96# ------------------- 

97# Luminosity function 

98# ------------------- 

99 

100# Galaxy type, each will have its own luminosity functions (see luminosity_functions.py: 

101# GALAXY_TYPES_ALL, initialize_luminosity_functions) 

102galaxy_types = ["red", "blue"] 

103# Functional forms of M* and phi*, can be linexp (linear and exponential) or 

104# logpower (for logarithmic and power law) 

105lum_fct_parametrization = "linexp" 

106# Filter band in which the luminosity function is valid 

107lum_fct_filter_band = "B" 

108# Schechter parameter alpha for blue galaxies 

109lum_fct_alpha_blue = -1.3 

110# Schechter parameter alpha for red galaxies 

111lum_fct_alpha_red = -0.5 

112# Parameter a in M*(z) = a*z + b for blue galaxies (if linexp), 

113# M*(z) = a*log(1+z) + b (if logpower), M*: Schechter parameter 

114lum_fct_m_star_blue_slope = -0.9408582 

115# Parameter b in M*(z) = a*z + b for blue galaxies (if linexp), 

116# M*(z) = a*log(1+z) + b (if logpower), M*: Schechter parameter 

117lum_fct_m_star_blue_intcpt = -20.40492365 

118# Parameter a in M*(z) = a*z + b for red galaxies (if linexp), 

119# M*(z) = a*log(1+z) + b (if logpower), M*: Schechter parameter 

120lum_fct_m_star_red_slope = -0.70798041 

121# Parameter b in M*(z) = a*z + b for red galaxies (if linexp), 

122# M*(z) = a*log(1+z) + b (if logpower), M*: Schechter parameter 

123lum_fct_m_star_red_intcpt = -20.37196157 

124# Parameter a in phi*(z) = a * exp(bz) for blue galaxies (if linexp), 

125# phi*(z) = a*(1+z)**b (if logpower), phi*: Schechter parameter 

126lum_fct_phi_star_blue_amp = 0.00370253 

127# Parameter b in phi*(z) = a * exp(bz) for blue galaxies (if linexp), 

128# phi*(z) = a*(1+z)**b (if logpower), phi*: Schechter parameter 

129lum_fct_phi_star_blue_exp = -0.10268436 

130# Parameter a in phi*(z) = a * exp(bz) for red galaxies(if linexp), 

131# phi*(z) = a*(1+z)**b (if logpower), phi*: Schechter parameter 

132lum_fct_phi_star_red_amp = 0.0035097 

133# Parameter b in phi*(z) = a * exp(bz) for red galaxies (if linexp), 

134# phi*(z) = a*(1+z)**b (if logpower), phi*: Schechter parameter 

135lum_fct_phi_star_red_exp = -0.70596888 

136# Parameter controlling the redshift after which M* for blue galaxies is constant 

137# if the lum_fct_parametrization = truncated_logexp 

138lum_fct_z_const_blue = 4 

139# Parameter controlling the redshift after which M* for red galaxies is constant 

140# if the lum_fct_parametrization = truncated_logexp 

141lum_fct_z_const_red = 4 

142# Resolution for sampling redshift 

143lum_fct_z_res = 0.001 

144# Maximum redshift of galaxies to sample 

145lum_fct_z_max = 3 

146# Maximum absolute magnitude to be sampled 

147lum_fct_m_max = -5 

148# Resolution for sampling absolute magnitudes 

149lum_fct_m_res = 0.001 

150# Maximum number of blue galaxies in one healpix pixel. This parameter has the function 

151# to limit runtime for ABC runs. A reasonable value critically depends on the healpix 

152# pixelization and the maximum absolute and apparent magnitudes. 

153n_gal_max_blue = np.inf 

154# Same as parameter above for red galaxies. 

155n_gal_max_red = np.inf 

156# If to raise an exception if the above limits are reached, or just to finish the 

157# calculation and continue 

158raise_max_num_gal_error = True 

159# Raise an error if there are some galaxies that are fainter than specified 

160raise_z_m_interp_error = False 

161# Memory limit for the size of the catalog in Mb (assuming 10 float64 columns per 

162# catalog), if reached, the UCatNumGalError is thrown, prevents jobs from crashing 

163max_memlimit_gal_catalog = np.inf 

164# Precision of the catalog. 

165catalog_precision = np.float64 

166 

167 

168# ---------- 

169# Clustering 

170# ---------- 

171apply_clustering_for_galaxy_positions = False 

172 

173 

174# --------------------- 

175# Template coefficients 

176# --------------------- 

177# Template coefficients are drawn from Dirichlet distributions of order 5 separately for 

178# blue and red galaxies. 

179# The parameters alpha of these distributions evolve with redshift. The evolution is 

180# parameterized 10 parameters, separately for blue and red galaxies: 5 parameters at 

181# redshift 0 and 5 parameters at redshift z1 > 0. Dirichlet 

182# parameters are calculated separately for each galaxy according to 

183# alpha(z) = (alpha0)^(1-z/z1) * (alpha1)^(z/z1), 

184# where alpha is five-dimensional. Thus, alpha(z=0) = alpha0 and alpha(z=z1) = alpha1 

185# with a smooth transition in between. Finally, after drawing the coefficients, they are 

186# weighted separately along each dimension. 

187 

188# which sampling model to use. 

189# 'dirichlet': from Herbel et al. 2018, 

190# 'dirichlet_alpha_sum': enforce sum of alpha 

191# 'dirichlet_alpha_std': enforce standard deviation of alpha 

192# 'dirichlet_alpha_mode': use parameterisation with mode and standard deviation 

193template_coeff_sampler = "dirichlet" 

194# Redshift z1>0 for blue galaxies 

195template_coeff_z1_blue = 1 

196# Redshift z1>0 for red galaxies 

197template_coeff_z1_red = 1 

198# Dirichlet parameter for blue galaxies at z=0 

199template_coeff_alpha0_blue_0 = 1.9946549 

200# Dirichlet parameter for blue galaxies at z=0 

201template_coeff_alpha0_blue_1 = 1.99469164 

202# Dirichlet parameter for blue galaxies at z=0 

203template_coeff_alpha0_blue_2 = 1.99461187 

204# Dirichlet parameter for blue galaxies at z=0 

205template_coeff_alpha0_blue_3 = 1.9946589 

206# Dirichlet parameter for blue galaxies at z=0 

207template_coeff_alpha0_blue_4 = 1.99463069 

208# Dirichlet parameter for blue galaxies at z=z1 

209template_coeff_alpha1_blue_0 = template_coeff_alpha0_blue_0 

210# Dirichlet parameter for blue galaxies at z=z1 

211template_coeff_alpha1_blue_1 = template_coeff_alpha0_blue_1 

212# Dirichlet parameter for blue galaxies at z=z1 

213template_coeff_alpha1_blue_2 = template_coeff_alpha0_blue_2 

214# Dirichlet parameter for blue galaxies at z=z1 

215template_coeff_alpha1_blue_3 = template_coeff_alpha0_blue_3 

216# Dirichlet parameter for blue galaxies at z=z1 

217template_coeff_alpha1_blue_4 = template_coeff_alpha0_blue_4 

218# Dirichlet parameter for red galaxies at z=0 

219template_coeff_alpha0_red_0 = 1.62158197 

220# Dirichlet parameter for red galaxies at z=0 

221template_coeff_alpha0_red_1 = 1.62137391 

222# Dirichlet parameter for red galaxies at z=0 

223template_coeff_alpha0_red_2 = 1.62175061 

224# Dirichlet parameter for red galaxies at z=0 

225template_coeff_alpha0_red_3 = 1.62159144 

226# Dirichlet parameter for red galaxies at z=0 

227template_coeff_alpha0_red_4 = 1.62165971 

228# Dirichlet parameter for red galaxies at z=z1 

229template_coeff_alpha1_red_0 = template_coeff_alpha0_red_0 

230# Dirichlet parameter for red galaxies at z=z1 

231template_coeff_alpha1_red_1 = template_coeff_alpha0_red_1 

232# Dirichlet parameter for red galaxies at z=z1 

233template_coeff_alpha1_red_2 = template_coeff_alpha0_red_2 

234# Dirichlet parameter for red galaxies at z=z1 

235template_coeff_alpha1_red_3 = template_coeff_alpha0_red_3 

236# Dirichlet parameter for red galaxies at z=z1 

237template_coeff_alpha1_red_4 = template_coeff_alpha0_red_4 

238# std of the Dirichlet distribution for blue galaxies at z=0 

239template_coeff_alpha0_blue_std = 0.1 

240# std of the Dirichlet distribution for blue galaxies at z=z1 

241template_coeff_alpha1_blue_std = 0.1 

242# std of the Dirichlet distribution for red galaxies at z=0 

243template_coeff_alpha0_red_std = 0.1 

244# std of the Dirichlet distribution for red galaxies at z=z1 

245template_coeff_alpha1_red_std = 0.1 

246# Weights for blue and red galaxies applied after drawing the coefficients 

247template_coeff_weight_blue = np.array( 

248 [3.47116583e09, 3.31262983e06, 2.13298069e09, 1.63722853e10, 1.01368664e09] 

249) 

250template_coeff_weight_red = np.array( 

251 [3.84729278e09, 1.56768931e06, 3.91242928e08, 4.66363319e10, 3.03275998e07] 

252) 

253# If to store the SED in the catalog 

254save_SEDs = False 

255 

256# ------------------------------ 

257# Apparent magnitude calculation 

258# ------------------------------ 

259 

260# The way magnitudes are calculated 

261magnitude_calculation = "table" 

262# File containing filter throughputs 

263filters_file_name = "filters.h5" 

264# File containing template spectra 

265templates_file_name = "template_spectra.h5" 

266# File containing integration tables of template spectra for different filters 

267templates_int_tables_file_name = "template_integrals.h5" 

268# If True, copy the template integration table files to the current working directory 

269# (local scratch) 

270copy_template_int_tables_to_cwd = False 

271# Extinction map (expected to be in galactic coordinates) 

272extinction_map_file_name = "extinction.fits" 

273# Minimum galaxy magnitude cutoff 

274gals_mag_min = 16 

275# Maximum galaxy magnitude cutoff 

276gals_mag_max = 27 

277# Noise level corresponding to background flux, constant across bands (for abs mag 

278# calculation, see ABC for deepfields) 

279noise_const_abs_mag = None 

280# Redshift noise, z=sig*(1+z) Leigle et al 2015, doi:10.3847/0067-0049/224/2/24 

281noise_z_sigma = 0.007 

282# Redshift outlier fraction, from 0 to max_z present in catalog Leigle et al 2015, 

283# doi:10.3847/0067-0049/224/2/24 

284noise_z_outlier_fraction = 0.005 

285 

286# ------------------- 

287# Sersic distribution 

288# ------------------- 

289 

290# Mean sersic n for mag<20 galaxies 

291sersic_n_mean_low = 0.2 

292# RMS sersic n for mag<20 galaxies 

293sersic_n_sigma_low = 1 

294# 1st mean sersic n for mag>20 galaxies 

295sersic_n_mean_1_hi = 0.3 

296# 1st RMS sersic n for mag>20 galaxies 

297sersic_n_sigma_1_hi = 0.5 

298# 2nd mean sersic n for mag>20 galaxies 

299sersic_n_mean_2_hi = 1.6 

300# 2nd RMS sersic n for mag>20 galaxies 

301sersic_n_sigma_2_hi = 0.4 

302# Minimum sersic n cutoff 

303sersic_n_offset = 0.2 

304# Switch sampling methods for sersic index 

305# default = use default from Berge et al 2012 (sersic_n_mean_low, sersic_n_sigma_low, 

306# sersic_n_mean_1_hi, sersic_n_sigma_1_hi, sersic_n_mean_2_hi, sersic_n_sigma_2_hi, 

307# sersic_n_offset) 

308# blue_red_fixed = use sersic_index_blue for blue and sersic_index_red for red 

309# single = use sersic_single_value for all galaxies 

310# blue_red_betaprime = use the betaprime distribution with mode and size, limited by 

311# (0.2, 10) 

312sersic_sampling_method = "blue_red_betaprime" 

313# Fixed sersic index all galaxies in case sersic_sampling_method = single 

314sersic_single_value = 1.0 

315# Fixed sersic index for blue galaxies in case sersic_sampling_method = blue_red_fixed 

316sersic_index_blue = 1.0 

317# Fixed sersic index for red galaxies in case sersic_sampling_method = blue_red_fixed 

318sersic_index_red = 4.0 

319# Sersic_betaprime model, peak for blue galaxies 

320sersic_betaprime_blue_mode = 0.8 

321# Sersic_betaprime model, spread for blue galaxies 

322sersic_betaprime_blue_size = 5 

323# Sersic_betaprime model, slope of the redshift dependence 

324sersic_betaprime_blue_mode_alpha = 0 

325# Sersic_betaprime model, peak for red galaxies 

326sersic_betaprime_red_mode = 1.5 

327# Sersic_betaprime model, spread for red galaxies 

328sersic_betaprime_red_size = 50 

329# Sersic_betaprime model, slope of the redshift dependence 

330sersic_betaprime_red_mode_alpha = 0 

331# Sersic_betaprime model, minimum sersic index 

332sersic_n_min = 0.2 

333# Sersic_betaprime model, maximum sersic index 

334sersic_n_max = 10 

335 

336# ---------- 

337# Size model 

338# ---------- 

339# Physical sizes are sampled from a log-normal distribution and then transformed into 

340# apparent sizes using redshift and the input cosmology. The mean of the log of physical 

341# sizes depends linearly on the absolute magnitude of a galaxy: 

342# log(Mean physical sizes) = a * (Abs. mag.) + b 

343# The standard deviation of the distribution of the log of physical sizes is constant. 

344 

345# Method to sample sizes: 

346# "single" - for the same distribution for red and blue, or 

347# "red_blue" for separate parameters 

348# "sdss_fit" - for the SDSS fit from Shen et al. 2003 (in that case use the sdss_fit 

349# parameters) 

350logr50_sampling_method = "single" 

351# shift to the absolute magnitude for the mean physical size of galaxies 

352logr50_phys_M0 = -20 

353# Slope of the evolution of the log of the mean physical size of galaxies (a in eq. 

354# above) 

355logr50_phys_mean_slope = -0.24293465 

356# Intercept of the evolution of the log of the mean physical size of galaxies (b in eq. 

357# above) 

358logr50_phys_mean_intcpt = 1.2268735 

359# Standard deviation of the log of physical sizes 

360logr50_phys_std = 0.56800081 

361# logr50_phys_mean_slope for red galaxies 

362logr50_phys_mean_slope_red = -0.24293465 

363# logr50_phys_mean_intcpt for red galaxies 

364logr50_phys_mean_intcpt_red = 1.2268735 

365# logr50_phys_std for red galaxies 

366logr50_phys_std_red = 0.56800081 

367# logr50_phys_mean_slope for blue galaxies 

368logr50_phys_mean_slope_blue = -0.24293465 

369# logr50_phys_mean_intcpt for blue galaxies 

370logr50_phys_mean_intcpt_blue = 1.2268735 

371# logr50_phys_std for blue galaxies 

372logr50_phys_std_blue = 0.56800081 

373# redshift dependence scaling factor parametrized with (1+z)**alpha, also for sdss_fit 

374logr50_alpha = 0 

375logr50_alpha_red = 0 

376logr50_alpha_blue = 0 

377# SDSS fit parameters (defaults to measurements for Fig. 4 of Shen et al. 2003) 

378logr50_sdss_fit_sigma1_red = 0.48 

379logr50_sdss_fit_sigma2_red = 0.25 

380logr50_sdss_fit_M0_red = -20.52 

381logr50_sdss_fit_a_red = 0.6 

382logr50_sdss_fit_b_red = -4.63 

383logr50_sdss_fit_sigma1_blue = 0.48 

384logr50_sdss_fit_sigma2_blue = 0.25 

385logr50_sdss_fit_M0_blue = -20.52 

386logr50_sdss_fit_alpha_blue = 0.21 

387logr50_sdss_fit_beta_blue = 0.53 

388logr50_sdss_fit_gamma_blue = -1.31 

389 

390 

391# ------------------------ 

392# Ellipticity distribution 

393# ------------------------ 

394 

395# Mean galaxy e1 before PSF 

396e1_mean = 0 

397# RMS galaxy e1 before PSF 

398e1_sigma = 0.39 

399# Mean galaxy e2 before PSF 

400e2_mean = 0 

401# RMS galaxy e1 before PSF 

402e2_sigma = 0.39 

403# mean galaxy e1 for blue galaxies 

404e1_mean_blue = 0 

405# mean galaxy e2 for blue galaxies 

406e2_mean_blue = 0 

407# Sigma of a Gaussian for blue galaxies 

408ell_sigma_blue = 0.4600 

409# Sigma of a Gaussian for red galaxies 

410ell_sigma_red = 0.2 

411# Parameters for the ellipticity distribution for the 

412# ellipticity_sampling_method=blue_red_miller2013 

413ell_disc_log_a = -1.3708147902715042 

414ell_disc_emax = 0.8 

415ell_disc_min_e = 0.02 

416ell_disc_pow_alpha = 1 

417 

418ell_bulge_b = 2.368 

419ell_bulge_c = 6.691 

420 

421# Ratio of a and b parameters 

422ell_beta_ab_ratio = 0.57 

423# Mode of the ellipticity distribution 

424ell_beta_mode = 0.2 

425# Sum of a and b parameters of the beta distribution 

426ell_beta_ab_sum = 2.9 

427# Maximum ellipticity 

428ell_beta_emax = 0.98 

429# p(e) with beta_function and beta_function_mod for red galaxies: maximum ellipticity 

430ell_beta_mode_red = 0.2 

431# p(e) with beta_function and beta_function_mod for red galaxies: sum of a and b 

432# parameters of the beta distribution 

433ell_beta_ab_sum_red = 2.9 

434# p(e) with beta_function and beta_function_mode for blue galaxies: maximum ellipticity 

435ell_beta_mode_blue = 0.2 

436# p(e) with beta_function and beta_function_mode for blue galaxies: sum of a and b 

437# parameters of the beta distribution 

438ell_beta_ab_sum_blue = 2.9 

439 

440# Switch sampling methods for ellipticity: 

441# default = use single Gaussian (e*_mean, e*_sigma), 

442# blue_red = use separate Gaussians for blue and red (ell_sigma_blue, ell_sigma_red) 

443# blue_red_miller2013 = use functions from Miller et al 2013 (ell_disc_log_a, 

444# ell_disc_min_e, ell_bulge_b, ell_disc_pow_alpha) 

445# beta_ratio = use modified beta function (ell_beta_ab_ratio, ell_beta_ab_sum, 

446# ell_beta_emax) 

447# beta_mode = use modified beta function (ell_beta_mode, ell_beta_ab_sum, 

448# ell_beta_emax) 

449# beta_mode_red_blue = same as beta_function_mode, but for different parameters 

450# for red and blue 

451ellipticity_sampling_method = "beta_mode_red_blue" 

452 

453# ----- 

454# Shear 

455# ----- 

456 

457path_shear_map = None 

458 

459gamma1_sign = -1