Skip to content

Commit 7dd6605

Browse files
committed
Merge branch 'develop'
2 parents c601579 + b75a826 commit 7dd6605

File tree

6 files changed

+96
-264
lines changed

6 files changed

+96
-264
lines changed

config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,8 @@ binning:
109109
ell_max_ref: 1500 # Type: int. Maximum ell for reference case
110110
ell_bins_ref: 32 # Type: int. Number of bins for reference case
111111

112-
WL_bins_filename: '../Spaceborne/output/ell_values_3x2pt.txt'
113-
GC_bins_filename: '../Spaceborne/output/ell_values_3x2pt.txt'
112+
WL_bins_filename: '...'
113+
GC_bins_filename: '...'
114114

115115
# theta binning for the real-space covariance matrix
116116
theta_min_arcmin: 50 # Type: float | int

main.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -199,10 +199,7 @@ def plot_cls():
199199
# ! START HARDCODED OPTIONS/PARAMETERS
200200
use_h_units = False # whether or not to normalize Megaparsecs by little h
201201

202-
ell_max_max = max(cfg['binning']['ell_max_WL'], cfg['binning']['ell_max_GC'])
203-
ell_min_unb_oc = 2
204-
ell_max_unb_oc = 5000 if ell_max_max < 5000 else ell_max_max
205-
nbl_3x2pt_oc = 500
202+
206203
# for the Gaussian covariance computation
207204
k_steps_sigma2_simps = 20_000
208205
k_steps_sigma2_levin = 300
@@ -1187,6 +1184,11 @@ def plot_cls():
11871184
np.savetxt(f'{oc_path}/{nz_lns_ascii_filename}', nz_lns_tosave)
11881185

11891186
# oc needs finer ell sampling to avoid issues with ell bin edges
1187+
ell_max_max = max(cfg['binning']['ell_max_WL'], cfg['binning']['ell_max_GC'])
1188+
ell_min_unb_oc = 2
1189+
ell_max_unb_oc = 5000 if ell_max_max < 5000 else ell_max_max
1190+
nbl_3x2pt_oc = 500
1191+
11901192
ells_3x2pt_oc = np.geomspace(
11911193
ell_obj.ell_min_3x2pt, ell_obj.ell_max_3x2pt, nbl_3x2pt_oc
11921194
)
@@ -1751,7 +1753,6 @@ def plot_cls():
17511753
if cfg['covariance']['save_cov_fits'] and obs_space == 'harmonic':
17521754
io_obj.save_cov_euclidlib(cov_hs_obj=_cov_obj)
17531755

1754-
17551756
print(f'Covariance matrices saved in {output_path}\n')
17561757

17571758
# ! ============================ plot & tests ==========================================

spaceborne/config_checker.py

Lines changed: 10 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -338,33 +338,16 @@ def check_types(self) -> None:
338338
assert isinstance(binning_cfg.get('binning_type'), str), (
339339
'binning: binning_type must be a string'
340340
)
341-
assert isinstance(binning_cfg.get('ell_min_WL'), int), (
342-
'binning: ell_min_WL must be an int'
343-
)
344-
assert isinstance(binning_cfg.get('ell_max_WL'), int), (
345-
'binning: ell_max_WL must be an int'
346-
)
347-
assert isinstance(binning_cfg.get('ell_bins_WL'), int), (
348-
'binning: ell_bins_WL must be an int'
349-
)
350-
assert isinstance(binning_cfg.get('ell_min_GC'), int), (
351-
'binning: ell_min_GC must be an int'
352-
)
353-
assert isinstance(binning_cfg.get('ell_max_GC'), int), (
354-
'binning: ell_max_GC must be an int'
355-
)
356-
assert isinstance(binning_cfg.get('ell_bins_GC'), int), (
357-
'binning: ell_bins_GC must be an int'
358-
)
359-
assert isinstance(binning_cfg.get('ell_min_ref'), int), (
360-
'binning: ell_min_ref must be an int'
361-
)
362-
assert isinstance(binning_cfg.get('ell_max_ref'), int), (
363-
'binning: ell_max_ref must be an int'
364-
)
365-
assert isinstance(binning_cfg.get('ell_bins_ref'), int), (
366-
'binning: ell_bins_ref must be an int'
367-
)
341+
for case in ['WL', 'GC', 'ref']:
342+
assert isinstance(binning_cfg.get(f'ell_min_{case}'), int), (
343+
f'binning: ell_min_{case} must be an int'
344+
)
345+
assert isinstance(binning_cfg.get(f'ell_max_{case}'), int), (
346+
f'binning: ell_max_{case} must be an int'
347+
)
348+
assert isinstance(binning_cfg.get(f'ell_bins_{case}'), int), (
349+
f'binning: ell_bins_{case} must be an int'
350+
)
368351
assert isinstance(binning_cfg.get('theta_min_arcmin'), (float, int)), (
369352
'binning: theta_min_arcmin must be a float or an int'
370353
)

spaceborne/cov_harmonic_space.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -396,8 +396,6 @@ def _add_ssc(self, ccl_obj: CCLInterface, oc_obj: OneCovarianceInterface):
396396
"""Helper function to get the SSC from the required code and uniform its
397397
shape"""
398398
if self.include_ssc:
399-
print('Including SSC in total covariance')
400-
401399
if self.ssc_code == 'Spaceborne':
402400
self.cov_3x2pt_ssc_10d = self._cov_8d_dict_to_10d_arr(
403401
self.cov_ssc_sb_3x2pt_dict_8D
@@ -414,15 +412,13 @@ def _add_ssc(self, ccl_obj: CCLInterface, oc_obj: OneCovarianceInterface):
414412
)
415413

416414
else:
417-
print('SSC not requested, setting it to zero')
415+
print('Skipping SSC computation')
418416
self.cov_3x2pt_ssc_10d = np.zeros_like(self.cov_3x2pt_g_10d)
419417

420418
def _add_cng(self, ccl_obj: CCLInterface, oc_obj: OneCovarianceInterface):
421419
"""Helper function to get the SSC from the required code and uniform its
422420
shape"""
423421
if self.include_cng:
424-
print('Including cNG in total covariance')
425-
426422
if self.cng_code == 'PyCCL':
427423
self.cov_3x2pt_cng_10d = self._cov_8d_dict_to_10d_arr(
428424
ccl_obj.cov_cng_ccl_3x2pt_dict_8D
@@ -435,7 +431,7 @@ def _add_cng(self, ccl_obj: CCLInterface, oc_obj: OneCovarianceInterface):
435431
)
436432

437433
else:
438-
print('cNG term not requested, setting it to zero')
434+
print('Skipping cNG computation')
439435
self.cov_3x2pt_cng_10d = np.zeros_like(self.cov_3x2pt_g_10d)
440436

441437
def _slice_3x2pt_cov(self, split_gaussian_cov: bool) -> None:

spaceborne/cov_real_space.py

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,10 @@ def __project_ellspace_cov_vec_2d(
131131
): # fmt: skip
132132
"""This version is fully vectorized"""
133133

134+
warnings.warn(
135+
'This function is deprecated.', cathegory=DeprecationWarning, stacklevel=2
136+
)
137+
134138
def integrand_func(ell1, ell2, cov_ell):
135139
kmu = k_mu(ell1, theta_1_l, theta_1_u, mu)
136140
knu = k_mu(ell2, theta_2_l, theta_2_u, nu)
@@ -163,6 +167,10 @@ def __project_ellspace_cov_vec_1d(
163167
): # fmt: skip
164168
"""This version is vectorized anly along ell1"""
165169

170+
warnings.warn(
171+
'This function is deprecated.', cathegory=DeprecationWarning, stacklevel=2
172+
)
173+
166174
def integrand_func(ell1, ell2, cov_ell_diag):
167175
# Vectorized computation of k_mu and k_nu
168176
kmu = k_mu(ell1, theta_1_l, theta_1_u, mu)
@@ -188,6 +196,9 @@ def __project_hs_cov_simps(
188196
zi, zj, zk, zl,
189197
Amax, ell1_values, ell2_values, cov_ell,
190198
): # fmt: skip
199+
warnings.warn(
200+
'This function is deprecated.', cathegory=DeprecationWarning, stacklevel=2
201+
)
191202
# def integrand_func(ell1, ell2, cov_ell):
192203
# kmu = k_mu(ell1, theta_1_l, theta_1_u, mu)
193204
# knu = k_mu(ell2, theta_2_l, theta_2_u, nu)
@@ -233,6 +244,10 @@ def __project_ellspace_cov_helper( # fmt: skip
233244
): # fmt: skip
234245
# TODO unify helper funcs
235246

247+
warnings.warn(
248+
'This function is deprecated.', cathegory=DeprecationWarning, stacklevel=2
249+
)
250+
236251
theta_1_l = self.theta_edges_fine[theta_1_ix]
237252
theta_1_u = self.theta_edges_fine[theta_1_ix + 1]
238253
theta_2_l = self.theta_edges_fine[theta_2_ix]
@@ -254,6 +269,9 @@ def __project_ellspace_cov_helper( # fmt: skip
254269
def __project_ellspace_cov_vec_helper(
255270
self, theta_1_ix, theta_2_ix, mu, nu, Amax, ell1_values, ell2_values, cov_ell
256271
):
272+
warnings.warn(
273+
'This function is deprecated.', cathegory=DeprecationWarning, stacklevel=2
274+
)
257275
theta_1_l = self.theta_edges_fine[theta_1_ix]
258276
theta_1_u = self.theta_edges_fine[theta_1_ix + 1]
259277
theta_2_l = self.theta_edges_fine[theta_2_ix]
@@ -774,7 +792,6 @@ def __init__(self, cfg, pvt_cfg, mask_obj):
774792

775793
# other miscellaneous settings
776794
self.n_jobs = self.cfg['misc']['num_threads']
777-
self.tpcf_ingr_method = 'fftlog'
778795
self.integration_method = self.cfg['precision']['cov_rs_int_method']
779796
self.levin_bin_avg = self.cfg['precision']['levin_bin_avg']
780797

@@ -832,6 +849,7 @@ def _set_survey_info(self):
832849
self.fsky = self.mask_obj.fsky
833850
self.srtoarcmin2 = const.SR_TO_ARCMIN2
834851
# maximum survey area in sr
852+
# TODO generalise to multiple survey areas
835853
self.amax = max((self.survey_area_sr, self.survey_area_sr))
836854

837855
def _set_theta_binning(self):
@@ -840,8 +858,7 @@ def _set_theta_binning(self):
840858
self.nbt_coarse = self.cfg['binning']['theta_bins']
841859
self.nbt_fine = self.nbt_coarse
842860

843-
844-
# TODO this should probably go in the ell_binning class (which should be
861+
# TODO this should probably go in the ell_binning class (which should be
845862
# TODO renamed)
846863
if self.cfg['binning']['binning_type'] == 'log':
847864
_binning_func = np.geomspace
@@ -1289,7 +1306,6 @@ def compute_realspace_cov(self, cov_hs_obj, probe, term):
12891306
and probes specfied
12901307
"""
12911308

1292-
# TODO check I'm not messing up anything here...
12931309
probe_ab, probe_cd = sl.split_probe_name(probe)
12941310

12951311
mu, nu = const.MU_DICT[probe_ab], const.MU_DICT[probe_cd]

0 commit comments

Comments
 (0)