Skip to content

Commit 2a6a3e2

Browse files
cailmdaleyclaude
andcommitted
refactor: remove redshift_file parameter and use catalog config
Eliminate redundant redshift_file parameter and load n(z) directly from catalog configuration. Added get_redshift() method as single source of truth. - Renamed shear.redshift_distr → shear.redshift_path in cat_config.yaml - Added get_redshift(version) method for catalog-aware n(z) loading - Updated calculate_pure_eb(), plot_pure_eb(), calculate_pseudo_cl_eb_cov() to use get_redshift() - Removed redshift_file parameter from __init__, calculate_pure_eb(), plot_pure_eb() signatures and docstrings 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 1b55238 commit 2a6a3e2

File tree

4 files changed

+279
-39
lines changed

4 files changed

+279
-39
lines changed
Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
#parameters used elsewhere in this file
2+
[DEFAULT]
3+
FITS_FILE = data/SP_v1.4.5_A_minsep=1_maxsep=250_nbins=20_npatch=1/cosmosis_SP_v1.4.5_A_minsep=1_maxsep=250_nbins=20_npatch=1.fits
4+
SCRATCH = /n09data/guerrini/output_chains/SP_v1.4.5_A_minsep=1_maxsep=250_nbins=20_npatch=1
5+
COSMOSIS_DIR = /home/guerrini/cosmosis-standard-library
6+
7+
8+
[pipeline]
9+
priors = cosmosis_config/priors_psf.ini
10+
values = cosmosis_config/values_psf.ini
11+
modules = consistency sample_S8 camb load_nz_fits photoz_bias linear_alignment projection add_intrinsic 2pt_shear add_xi_sys tau_from_rho 2pt_like
12+
likelihoods = 2pt_like
13+
extra_output = cosmological_parameters/omega_lambda cosmological_parameters/S_8 cosmological_parameters/sigma_8 cosmological_parameters/omega_m
14+
timing = T
15+
debug = T
16+
17+
[runtime]
18+
sampler = polychord
19+
verbosity = debug
20+
21+
[test]
22+
save_dir = %(SCRATCH)s/test_new_pipeline
23+
24+
[polychord]
25+
polychord_outfile_root = SP_v1.4.5_A_minsep=1_maxsep=250_nbins=20_npatch=1
26+
live_points = 192
27+
feedback = 3
28+
resume = T
29+
base_dir = %(SCRATCH)s/polychord
30+
31+
[output]
32+
filename = %(SCRATCH)s/SP_v1.4.5_A_minsep=1_maxsep=250_nbins=20_npatch=1/samples_SP_v1.4.5_A_minsep=1_maxsep=250_nbins=20_npatch=1.txt
33+
format = text
34+
lock = F
35+
36+
[consistency]
37+
file = %(COSMOSIS_DIR)s/utility/consistency/consistency_interface.py
38+
verbose = F
39+
40+
[sample_S8]
41+
file = %(COSMOSIS_DIR)s/utility/sample_sigma8/sample_S8.py
42+
43+
[camb]
44+
file = %(COSMOSIS_DIR)s/boltzmann/camb/camb_interface.py
45+
mode=power
46+
lmax=2508
47+
feedback=0
48+
do_reionization=F
49+
kmin=1e-5
50+
kmax=20.0
51+
nk=200
52+
zmax=5.0
53+
zmax_background=5.0
54+
nz_background=500
55+
halofit_version=mead2020_feedback
56+
nonlinear=pk
57+
neutrino_hierarchy=normal
58+
kmax_extrapolate = 500.0
59+
60+
[load_nz_fits]
61+
file = %(COSMOSIS_DIR)s/number_density/load_nz_fits/load_nz_fits.py
62+
nz_file =%(FITS_FILE)s
63+
data_sets = SOURCE
64+
65+
[photoz_bias]
66+
file = %(COSMOSIS_DIR)s/number_density/photoz_bias/photoz_bias.py
67+
mode = additive
68+
sample = nz_source
69+
bias_section = nofz_shifts
70+
interpolation = cubic
71+
output_deltaz_section_name = delta_z_out
72+
73+
[linear_alignment]
74+
file = %(COSMOSIS_DIR)s/intrinsic_alignments/la_model/linear_alignments_interface.py
75+
method = bk_corrected
76+
77+
[projection]
78+
file = %(COSMOSIS_DIR)s/structure/projection/project_2d.py
79+
ell_min_logspaced = 1.0
80+
ell_max_logspaced = 25000.0
81+
n_ell_logspaced = 400
82+
shear-shear = source-source
83+
shear-intrinsic = source-source
84+
intrinsic-intrinsic = source-source
85+
get_kernel_peaks = F
86+
verbose = F
87+
88+
[add_intrinsic]
89+
file = %(COSMOSIS_DIR)s/shear/add_intrinsic/add_intrinsic.py
90+
shear-shear=T
91+
position-shear=F
92+
perbin=F
93+
94+
[2pt_shear]
95+
file = %(COSMOSIS_DIR)s/shear/cl_to_xi_nicaea/nicaea_interface.so
96+
corr_type = 0 ; shear_cl -> shear_xi
97+
98+
[shear_m_bias]
99+
file = shear/shear_bias/shear_m_bias.py
100+
m_per_bin = True
101+
; Despite the parameter name, this can operate on xi as well as C_ell.
102+
cl_section = shear_xi_plus shear_xi_minus
103+
verbose = F
104+
105+
[add_xi_sys]
106+
file = %(COSMOSIS_DIR)s/shear/xi_sys/xi_sys_psf.py
107+
data_file=%(FITS_FILE)s
108+
rho_stats_name=RHO_STATS
109+
110+
[tau_from_rho]
111+
file = %(COSMOSIS_DIR)s/shear/xi_sys/tau_from_rho.py
112+
data_file=%(FITS_FILE)s
113+
114+
[2pt_like]
115+
add_xi_sys=T
116+
data_sets=XI_PLUS XI_MINUS TAU_0_PLUS TAU_2_PLUS
117+
file = %(COSMOSIS_DIR)s/likelihood/2pt/2pt_like_xi_sys.py
118+
data_file=%(FITS_FILE)s
119+
gaussian_covariance=F
120+
covmat_name=COVMAT
121+
cut_zeros=F
122+
like_name=2pt_like
123+
angle_range_XI_PLUS_1_1= 3.0 150.0
124+
angle_range_XI_MINUS_1_1= 10.0 200.0
Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
#parameters used elsewhere in this file
2+
[DEFAULT]
3+
FITS_FILE = data/SP_v1.4.5_leak_corr_A_minsep=1_maxsep=250_nbins=20_npatch=1/cosmosis_SP_v1.4.5_leak_corr_A_minsep=1_maxsep=250_nbins=20_npatch=1.fits
4+
SCRATCH = /n09data/guerrini/output_chains/SP_v1.4.5_leak_corr_A_minsep=1_maxsep=250_nbins=20_npatch=1
5+
COSMOSIS_DIR = /home/guerrini/cosmosis-standard-library
6+
7+
8+
[pipeline]
9+
priors = cosmosis_config/priors_psf.ini
10+
values = cosmosis_config/values_psf.ini
11+
modules = consistency sample_S8 camb load_nz_fits photoz_bias linear_alignment projection add_intrinsic 2pt_shear add_xi_sys tau_from_rho 2pt_like
12+
likelihoods = 2pt_like
13+
extra_output = cosmological_parameters/omega_lambda cosmological_parameters/S_8 cosmological_parameters/sigma_8 cosmological_parameters/omega_m
14+
timing = T
15+
debug = T
16+
17+
[runtime]
18+
sampler = polychord
19+
verbosity = debug
20+
21+
[test]
22+
save_dir = %(SCRATCH)s/test_new_pipeline
23+
24+
[polychord]
25+
polychord_outfile_root = SP_v1.4.5_leak_corr_A_minsep=1_maxsep=250_nbins=20_npatch=1
26+
live_points = 192
27+
feedback = 3
28+
resume = T
29+
base_dir = %(SCRATCH)s/polychord
30+
31+
[output]
32+
filename = %(SCRATCH)s/SP_v1.4.5_leak_corr_A_minsep=1_maxsep=250_nbins=20_npatch=1/samples_SP_v1.4.5_leak_corr_A_minsep=1_maxsep=250_nbins=20_npatch=1.txt
33+
format = text
34+
lock = F
35+
36+
[consistency]
37+
file = %(COSMOSIS_DIR)s/utility/consistency/consistency_interface.py
38+
verbose = F
39+
40+
[sample_S8]
41+
file = %(COSMOSIS_DIR)s/utility/sample_sigma8/sample_S8.py
42+
43+
[camb]
44+
file = %(COSMOSIS_DIR)s/boltzmann/camb/camb_interface.py
45+
mode=power
46+
lmax=2508
47+
feedback=0
48+
do_reionization=F
49+
kmin=1e-5
50+
kmax=20.0
51+
nk=200
52+
zmax=5.0
53+
zmax_background=5.0
54+
nz_background=500
55+
halofit_version=mead2020_feedback
56+
nonlinear=pk
57+
neutrino_hierarchy=normal
58+
kmax_extrapolate = 500.0
59+
60+
[load_nz_fits]
61+
file = %(COSMOSIS_DIR)s/number_density/load_nz_fits/load_nz_fits.py
62+
nz_file =%(FITS_FILE)s
63+
data_sets = SOURCE
64+
65+
[photoz_bias]
66+
file = %(COSMOSIS_DIR)s/number_density/photoz_bias/photoz_bias.py
67+
mode = additive
68+
sample = nz_source
69+
bias_section = nofz_shifts
70+
interpolation = cubic
71+
output_deltaz_section_name = delta_z_out
72+
73+
[linear_alignment]
74+
file = %(COSMOSIS_DIR)s/intrinsic_alignments/la_model/linear_alignments_interface.py
75+
method = bk_corrected
76+
77+
[projection]
78+
file = %(COSMOSIS_DIR)s/structure/projection/project_2d.py
79+
ell_min_logspaced = 1.0
80+
ell_max_logspaced = 25000.0
81+
n_ell_logspaced = 400
82+
shear-shear = source-source
83+
shear-intrinsic = source-source
84+
intrinsic-intrinsic = source-source
85+
get_kernel_peaks = F
86+
verbose = F
87+
88+
[add_intrinsic]
89+
file = %(COSMOSIS_DIR)s/shear/add_intrinsic/add_intrinsic.py
90+
shear-shear=T
91+
position-shear=F
92+
perbin=F
93+
94+
[2pt_shear]
95+
file = %(COSMOSIS_DIR)s/shear/cl_to_xi_nicaea/nicaea_interface.so
96+
corr_type = 0 ; shear_cl -> shear_xi
97+
98+
[shear_m_bias]
99+
file = shear/shear_bias/shear_m_bias.py
100+
m_per_bin = True
101+
; Despite the parameter name, this can operate on xi as well as C_ell.
102+
cl_section = shear_xi_plus shear_xi_minus
103+
verbose = F
104+
105+
[add_xi_sys]
106+
file = %(COSMOSIS_DIR)s/shear/xi_sys/xi_sys_psf.py
107+
data_file=%(FITS_FILE)s
108+
rho_stats_name=RHO_STATS
109+
110+
[tau_from_rho]
111+
file = %(COSMOSIS_DIR)s/shear/xi_sys/tau_from_rho.py
112+
data_file=%(FITS_FILE)s
113+
114+
[2pt_like]
115+
add_xi_sys=T
116+
data_sets=XI_PLUS XI_MINUS TAU_0_PLUS TAU_2_PLUS
117+
file = %(COSMOSIS_DIR)s/likelihood/2pt/2pt_like_xi_sys.py
118+
data_file=%(FITS_FILE)s
119+
gaussian_covariance=F
120+
covmat_name=COVMAT
121+
cut_zeros=F
122+
like_name=2pt_like
123+
angle_range_XI_PLUS_1_1= 3.0 150.0
124+
angle_range_XI_MINUS_1_1= 10.0 200.0

notebooks/cosmo_val/cat_config.yaml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ SP_test:
211211
R: 1.0
212212
covmat_file: ./covs/shapepipe_A/cov_shapepipe_A.txt
213213
path: v1.4.x/v1.4.5/unions_shapepipe_cut_struc_2024_v1.4.5.fits
214-
redshift_distr: /n17data/mkilbing/astro/data/CFIS/v1.0/nz/dndz_SP_A.txt
214+
redshift_path: /n17data/mkilbing/astro/data/CFIS/v1.0/nz/dndz_SP_A.txt
215215
w_col: w_iv
216216
e1_col: e1
217217
e1_PSF_col: e1_PSF
@@ -883,7 +883,7 @@ SP_v1.4.5:
883883
R: 1.0
884884
covmat_file: ./covs/shapepipe_A/cov_shapepipe_A.txt
885885
path: v1.4.5/unions_shapepipe_cut_struc_2024_v1.4.5.fits
886-
redshift_distr: /n17data/mkilbing/astro/data/CFIS/v1.0/nz/dndz_SP_A.txt
886+
redshift_path: /n17data/mkilbing/astro/data/CFIS/v1.0/nz/dndz_SP_A.txt
887887
w_col: w_des
888888
e1_col: e1
889889
e1_col_corrected: e1_leak_corrected
@@ -928,7 +928,7 @@ SP_v1.4.5.A:
928928
R: 1.0
929929
covmat_file: ./covs/shapepipe_A/cov_shapepipe_A.txt
930930
path: shapepipe_SPv1.fits
931-
redshift_distr: /n17data/mkilbing/astro/data/CFIS/v1.0/nz/dndz_SP_A.txt
931+
redshift_path: /n17data/mkilbing/astro/data/CFIS/v1.0/nz/dndz_SP_A.txt
932932
w_col: w
933933
e1_col: g1
934934
e1_PSF_col: e1_PSF
@@ -971,7 +971,7 @@ SP_v1.4.5_bright:
971971
R: 1.0
972972
covmat_file: ./covs/shapepipe_A/cov_shapepipe_A.txt
973973
path: unions_shapepipe_cut_struc_2024_v1.4.5_bright.fits
974-
redshift_distr: /n17data/mkilbing/astro/data/CFIS/v1.0/nz/dndz_SP_A.txt
974+
redshift_path: /n17data/mkilbing/astro/data/CFIS/v1.0/nz/dndz_SP_A.txt
975975
w_col: w_des
976976
e1_col: e1
977977
e1_PSF_col: e1_PSF
@@ -1014,7 +1014,7 @@ SP_v1.4.5_faint:
10141014
R: 1.0
10151015
covmat_file: ./covs/shapepipe_A/cov_shapepipe_A.txt
10161016
path: unions_shapepipe_cut_struc_2024_v1.4.5_faint.fits
1017-
redshift_distr: /n17data/mkilbing/astro/data/CFIS/v1.0/nz/dndz_SP_A.txt
1017+
redshift_path: /n17data/mkilbing/astro/data/CFIS/v1.0/nz/dndz_SP_A.txt
10181018
w_col: w_des
10191019
e1_col: e1
10201020
e1_PSF_col: e1_PSF
@@ -1057,7 +1057,7 @@ SP_v1.4.5_glass_mock:
10571057
R: 1.0
10581058
covmat_file: ./covs/shapepipe_A/cov_shapepipe_A.txt
10591059
path: /n09data/guerrini/glass_mock/results/unions_glass_sim_00000_4096.fits
1060-
redshift_distr: /n17data/mkilbing/astro/data/CFIS/v1.0/nz/dndz_SP_A.txt
1060+
redshift_path: /n17data/mkilbing/astro/data/CFIS/v1.0/nz/dndz_SP_A.txt
10611061
w_col: w
10621062
e1_col: e1
10631063
e1_PSF_col: e1_PSF
@@ -1100,7 +1100,7 @@ SP_v1.4.5_intermediate:
11001100
R: 1.0
11011101
covmat_file: ./covs/shapepipe_A/cov_shapepipe_A.txt
11021102
path: unions_shapepipe_cut_struc_2024_v1.4.5_intermediate.fits
1103-
redshift_distr: /n17data/mkilbing/astro/data/CFIS/v1.0/nz/dndz_SP_A.txt
1103+
redshift_path: /n17data/mkilbing/astro/data/CFIS/v1.0/nz/dndz_SP_A.txt
11041104
w_col: w_des
11051105
e1_col: e1
11061106
e1_PSF_col: e1_PSF
@@ -1144,7 +1144,7 @@ SP_v1.4.6:
11441144
R: 1.0
11451145
covmat_file: ./covs/shapepipe_A/cov_shapepipe_A.txt
11461146
path: v1.4.6/unions_shapepipe_cut_struc_2024_v1.4.6.fits
1147-
redshift_distr: /n17data/mkilbing/astro/data/CFIS/v1.0/nz/dndz_SP_A.txt
1147+
redshift_path: /n17data/mkilbing/astro/data/CFIS/v1.0/nz/dndz_SP_A.txt
11481148
w_col: w_des
11491149
e1_col: e1
11501150
e1_col_corrected: e1_leak_corrected
@@ -1190,7 +1190,7 @@ SP_v1.4.7:
11901190
R: 1.0
11911191
covmat_file: ./covs/shapepipe_A/cov_shapepipe_A.txt
11921192
path: v1.4.7/unions_shapepipe_cut_struc_2024_v1.4.7.fits
1193-
redshift_distr: /n17data/mkilbing/astro/data/CFIS/v1.0/nz/dndz_SP_A.txt
1193+
redshift_path: /n17data/mkilbing/astro/data/CFIS/v1.0/nz/dndz_SP_A.txt
11941194
w_col: w_des
11951195
e1_col: e1
11961196
e1_col_corrected: e1_leak_corrected
@@ -1236,7 +1236,7 @@ SP_v1.4.8:
12361236
R: 1.0
12371237
covmat_file: ./covs/shapepipe_A/cov_shapepipe_A.txt
12381238
path: v1.4.8/unions_shapepipe_cut_struc_2024_v1.4.8.fits
1239-
redshift_distr: /n17data/mkilbing/astro/data/CFIS/v1.0/nz/dndz_SP_A.txt
1239+
redshift_path: /n17data/mkilbing/astro/data/CFIS/v1.0/nz/dndz_SP_A.txt
12401240
w_col: w_des
12411241
e1_col: e1
12421242
e1_col_corrected: e1_leak_corrected

0 commit comments

Comments
 (0)