Skip to content

Commit 96e3e17

Browse files
committed
clipy: crop command support, updated docs, changelog
1 parent ac429c9 commit 96e3e17

File tree

14 files changed

+88
-122
lines changed

14 files changed

+88
-122
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@
77
- Added pre-commit hooks for automated code quality checks (trailing whitespace, end-of-file-fixer, pyupgrade, ruff)
88
- Documentation can now be built as markdown for LLM context. Flat context file provided.
99

10+
### Cosmology
11+
12+
- Planck `clik`-based likelihoods now use the new `clipy` Python implementation
13+
- Planck 2015 likelihoods deprecated
14+
1015
## 3.5.7 - 2025-03-31
1116

1217
### General

cobaya/likelihoods/base_classes/planck_clik.py

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,11 @@ def initialize(self):
6969
os.path.join(self.path or self.packages_path, "data", data_path),
7070
)
7171
self.clik_file = os.path.join(self.path_data, self.clik_file)
72+
# Prepare clipy commands
73+
if isinstance(self.commands, str):
74+
self.commands = [self.commands]
7275
try:
73-
self.commands = None
74-
75-
self.clik_likelihood = clipy.clik(self.clik_file, **(self.commands or {}))
76+
self.clik_likelihood = clipy.clik(self.clik_file, crop=self.commands)
7677
except clipy.clik_emul_error as excpt:
7778
# Is it that the file was not found?
7879
if not os.path.exists(self.clik_file):
@@ -87,14 +88,23 @@ def initialize(self):
8788
# Else: unknown clipy error
8889
raise LoggedError(
8990
self.log,
90-
f"An unexpected error occurred in clipy: {excpt}",
91-
) from excpt
92-
except Exception as excpt: # unknown clippy error
93-
raise LoggedError(
94-
self.log,
95-
f"An unmanaged error occurred in clipy: {excpt}. Please report it as a "
96-
"GitHub issue in the Cobaya repo.",
91+
f"An unexpected managed error occurred in clipy: {excpt}",
9792
) from excpt
93+
except Exception as excpt:
94+
if self.commands: # check if bad command
95+
raise LoggedError(
96+
self.log,
97+
f"An unmanaged error occurred in clipy: {excpt}. This may have been "
98+
"caused by a worngly-formatted 'command'. Please check your command "
99+
"syntax, or disable and try again to check that clipy is working as "
100+
f"expected. The list of commands passed were: {self.commands}"
101+
) from excpt
102+
else: # unknown clippy error
103+
raise LoggedError(
104+
self.log,
105+
f"An unmanaged error occurred in clipy: {excpt}. Please report it as "
106+
"a GitHub issue in the Cobaya repo.",
107+
) from excpt
98108
lmaxs = self.clik_likelihood.lmax
99109
cls_sorted = ["tt", "ee", "bb", "te", "tb", "eb"]
100110
if len(lmaxs) > 6: # lensing likelihood!

cobaya/likelihoods/planck_2018_highl_plik/EE.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1-
# Planck 2018 release: high-ell, TE power spectrum likelihood (plik)
1+
# Planck 2018 release: high-ell, EE power spectrum likelihood (plik)
22
# See https://wiki.cosmos.esa.int/planck-legacy-archive/index.php/CMB_spectrum_%26_Likelihood_Code
33

44
path:
55
clik_file: extended_plik/plc_3.0/hi_l/plik/plik_rd12_HM_v22_EE.clik
66
product_id: "151905"
7+
# Clipy commands -- string or list of strings, e.g. ["no TT", "only EE 217x217 500 800 lax"]
8+
commands:
79
# Aliases for automatic covariance matrix
810
aliases: [plikHM_EE]
911
# Speed in evaluations/second

cobaya/likelihoods/planck_2018_highl_plik/TE.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
path:
55
clik_file: extended_plik/plc_3.0/hi_l/plik/plik_rd12_HM_v22_TE.clik
66
product_id: "151905"
7+
# Clipy commands -- string or list of strings, e.g. ["no TT", "only EE 217x217 500 800 lax"]
8+
commands:
79
# Aliases for automatic covariance matrix
810
aliases: [plikHM_TE]
911
# Speed in evaluations/second

cobaya/likelihoods/planck_2018_highl_plik/TT.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
path:
55
clik_file: baseline/plc_3.0/hi_l/plik/plik_rd12_HM_v22_TT.clik
66
product_id: "151902"
7+
# Clipy commands -- string or list of strings, e.g. ["no TT", "only EE 217x217 500 800 lax"]
8+
commands:
79
# Aliases for automatic covariance matrix
810
aliases: [plikHM_TT]
911
# Speed in evaluations/second

cobaya/likelihoods/planck_2018_highl_plik/TTTEEE.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
path:
55
clik_file: baseline/plc_3.0/hi_l/plik/plik_rd12_HM_v22b_TTTEEE.clik
66
product_id: "151902"
7+
# Clipy commands -- string or list of strings, e.g. ["no TT", "only EE 217x217 500 800 lax"]
8+
commands:
79
# Aliases for automatic covariance matrix
810
aliases: [plikHM_TTTEEE]
911
# Speed in evaluations/second

cobaya/likelihoods/planck_2018_highl_plik/TTTEEE_lite.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
path:
55
clik_file: baseline/plc_3.0/hi_l/plik_lite/plik_lite_v22_TTTEEE.clik
66
product_id: "151902"
7+
# Clipy commands -- string or list of strings, e.g. ["no TT", "only EE 217x217 500 800 lax"]
8+
commands:
79
# Aliases for automatic covariance matrix
810
aliases: [plikHM_TTTEEE]
911
# Speed in evaluations/second

cobaya/likelihoods/planck_2018_highl_plik/TTTEEE_unbinned.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
path:
55
clik_file: extended_plik/plc_3.0/hi_l/plik/plik_rd12_HM_v22b_TTTEEE_bin1.clik
66
product_id: "151905"
7+
# Clipy commands -- string or list of strings, e.g. ["no TT", "only EE 217x217 500 800 lax"]
8+
commands:
79
# Aliases for automatic covariance matrix
810
aliases: [plikHM_TTTEEE]
911
# Speed in evaluations/second

cobaya/likelihoods/planck_2018_highl_plik/TT_lite.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
path:
55
clik_file: baseline/plc_3.0/hi_l/plik_lite/plik_lite_v22_TT.clik
66
product_id: "151902"
7+
# Clipy commands -- string or list of strings, e.g. ["no TT", "only EE 217x217 500 800 lax"]
8+
commands:
79
# Aliases for automatic covariance matrix
810
aliases: [plikHM_TT]
911
# Speed in evaluations/second

cobaya/likelihoods/planck_2018_highl_plik/TT_unbinned.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
path:
55
clik_file: extended_plik/plc_3.0/hi_l/plik/plik_rd12_HM_v22_TT_bin1.clik
66
product_id: "151905"
7+
# Clipy commands -- string or list of strings, e.g. ["no TT", "only EE 217x217 500 800 lax"]
8+
commands:
79
# Aliases for automatic covariance matrix
810
aliases: [plikHM_TT]
911
# Speed in evaluations/second

0 commit comments

Comments
 (0)