Skip to content

Commit cafff84

Browse files
committed
small bugfix in check_ells_in
1 parent a26e38d commit cafff84

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

main.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1074,9 +1074,13 @@ def plot_cls():
10741074
if cfg['C_ell']['use_input_cls']:
10751075
for ells_in, ells_out in zip(
10761076
[ells_WL_in, ells_XC_in, ells_GC_in],
1077-
[ell_obj.ells_3x2pt_unb, ell_obj.ells_3x2pt_unb, ell_obj.ells_3x2pt_unb],
1077+
[ell_obj.ells_3x2pt_unb, ell_obj.ells_3x2pt_unb, ell_obj.ells_3x2pt_unb],
1078+
strict=True,
10781079
):
1079-
io_obj.check_ells_in(ells_in, ells_out)
1080+
io_handler.check_ells_for_spline(ells_in)
1081+
io_handler.check_ells_for_spline(ells_out)
1082+
1083+
10801084

10811085
# initialize nmt_cov_obj and set a couple useful attributes
10821086
nmt_cov_obj = cov_partial_sky.NmtCov(

spaceborne/io_handler.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,12 @@ def cov_heracles_dict_to_sb_10d(
299299
return cov_10d
300300

301301

302+
def check_ells_for_spline(ells):
303+
"""Make sure ells are sorted and unique for spline interpolation"""
304+
assert np.all(np.diff(ells) > 0), 'ells are not sorted'
305+
assert len(np.unique(ells)) == len(ells), 'ells are not unique'
306+
307+
302308
class IOHandler:
303309
"""Handles loading of input data (n(z) and Cls) from various file formats.
304310
@@ -447,13 +453,12 @@ def _load_cls_el(self):
447453

448454
def check_ells_in(self, ell_obj):
449455
"""Make sure ells are sorted and unique for spline interpolation"""
450-
for _ells in [ # fmt: skip
456+
for _ells in [
451457
self.ells_WL_in, ell_obj.ells_WL,
452458
self.ells_XC_in, ell_obj.ells_XC,
453459
self.ells_GC_in, ell_obj.ells_GC,
454460
]: # fmt: skip
455-
assert np.all(np.diff(_ells) > 0), 'ells are not sorted'
456-
assert len(np.unique(_ells)) == len(_ells), 'ells are not unique'
461+
check_ells_for_spline(_ells)
457462

458463
def save_cov_euclidlib(self, cov_hs_obj):
459464
"""Helper function to save the covariance in the heracles/cloelikeeuclidlib

0 commit comments

Comments
 (0)