Coverage for src/galsbi/configs/config_Moser+24_emulator.py: 100%

49 statements  

« prev     ^ index     » next       coverage.py v7.6.9, created at 2024-12-13 03:24 +0000

1# Copyright (C) 2024 ETH Zurich 

2# Institute for Particle Physics and Astrophysics 

3# Author: Silvan Fischbacher 

4# created: Thu Aug 08 2024 

5 

6import os 

7 

8import numpy as np 

9import ufig.config.common 

10from cosmic_toolbox import file_utils 

11from cosmo_torrent import data_path 

12from edelweiss.emulator import load_emulator 

13from ivy.loop import Loop 

14from ufig.workflow_util import FiltersStopCriteria 

15 

16import galsbi.ucat.config.common 

17 

18 

19# Import all common settings from ucat and ufig as default 

20def _update_globals(module, globals_): 

21 globals_.update( 

22 {k: v for k, v in module.__dict__.items() if not k.startswith("__")} 

23 ) 

24 

25 

26_update_globals(galsbi.ucat.config.common, globals()) 

27_update_globals(ufig.config.common, globals()) 

28 

29# Default size of the image 

30sampling_mode = "healpix" 

31healpix_map = np.zeros(12 * 64**2) 

32healpix_map[0] = 1 

33 

34# Define the filters 

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

36filters_full_names = { 

37 "B": "SuprimeCam_B", 

38 "g": "HSC_g", 

39 "r": "HSC_r2", 

40 "i": "HSC_i2", 

41 "z": "HSC_z", 

42 "y": "HSC_y", 

43} 

44reference_band = "i" 

45 

46# Define the plugins that should be used 

47plugins = [ 

48 "ufig.plugins.multi_band_setup", 

49 "galsbi.ucat.plugins.sample_galaxies", 

50 Loop( 

51 [ 

52 "ufig.plugins.single_band_setup_intrinsic_only", 

53 "ufig.plugins.write_catalog_for_emu", 

54 ], 

55 stop=FiltersStopCriteria(), 

56 ), 

57 "ufig.plugins.run_emulator", 

58 "ufig.plugins.cleanup_catalogs", 

59 "ivy.plugin.show_stats", 

60] 

61 

62# Luminosity function 

63lum_fct_z_res = 0.001 

64lum_fct_m_max = -4 

65lum_fct_z_max = 6 

66 

67# Sampling methods ucat 

68nside_sampling = 4096 

69 

70# Magnitude limits 

71stars_mag_max = 26 

72gals_mag_max = 28 

73stars_mag_min = 12 

74gals_mag_min = 14 

75 

76# Filter throughputs 

77filters_file_name = os.path.join( 

78 data_path("HSC_tables"), "HSC_filters_collection_yfix.h5" 

79) 

80 

81# Template spectra & integration tables 

82n_templates = 5 

83templates_file_name = os.path.join( 

84 data_path("template_BlantonRoweis07"), "template_spectra_BlantonRoweis07.h5" 

85) 

86 

87# Extinction 

88extinction_map_file_name = os.path.join( 

89 data_path("lambda_sfd_ebv"), "lambda_sfd_ebv.fits" 

90) 

91 

92# magnitude table 

93magnitude_calculation = "table" 

94templates_int_tables_file_name = os.path.join( 

95 data_path("HSC_tables"), "HSC_template_integrals_yfix.h5" 

96) 

97 

98# Catalog precision 

99catalog_precision = np.float32 

100 

101# Seed 

102seed = 1996 

103 

104# emulator 

105path2emu = data_path("emulator_moser24") 

106clf, nflow = load_emulator( 

107 path2emu, 

108 bands=None, 

109) 

110emu_conf = file_utils.read_yaml(os.path.join(path2emu, "config_emu.yaml")) 

111emu_mini = True 

112 

113 

114# Parameters that are specific to the Moser+24 model 

115# Mainly the different parametrizations of the galaxy population model. 

116# DO NOT CHANGE THESE VALUES IF YOU WANT TO USE THE GALAXY POPULATION MODEL OF MOSER+24 

117# CHANGING THESE VALUES WILL LEAD TO A DIFFERENT MEANING OF SOME OF THE PARAMETERS 

118lum_fct_parametrization = "logpower" 

119ellipticity_sampling_method = "beta_mode_red_blue" 

120sersic_sampling_method = "blue_red_betaprime" 

121logr50_sampling_method = "red_blue" 

122template_coeff_sampler = "dirichlet_alpha_mode" 

123template_coeff_weight_blue = np.array([1.0, 1.0, 1.0, 1.0, 1.0]) 

124template_coeff_weight_red = np.array([1.0, 1.0, 1.0, 1.0, 1.0]) 

125template_coeff_z1_blue = 3 

126template_coeff_z1_red = 3