From 82bcea45c80661c2146b0983e2447c2b946e9394 Mon Sep 17 00:00:00 2001 From: Ian Harrison Date: Tue, 26 Aug 2025 10:51:18 +0100 Subject: [PATCH 1/4] update tensorflow requirements --- requirements.txt | 7 +++++-- setup.py | 10 ++++++---- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/requirements.txt b/requirements.txt index 1587fa7..d9815e0 100644 --- a/requirements.txt +++ b/requirements.txt @@ -8,5 +8,8 @@ matplotlib pytest pyDOE h5py -tensorflow<2.14 -tensorflow_probability<0.22 +tensorflow +tensorflow-probability +tf-keras +tf-keras-nightly +tfp-nightly diff --git a/setup.py b/setup.py index 4a88abc..6f79b99 100644 --- a/setup.py +++ b/setup.py @@ -19,10 +19,12 @@ def read_file(file): long_description = read_file("README.md") # Determine whether the system is M1/M2 Mac -if 'arm' in os.uname().machine: - tensorflow = 'tensorflow-metal' -else: - tensorflow = 'tensorflow<2.14' +# if 'arm' in os.uname().machine: +# tensorflow = 'tensorflow-metal' +# else: +# tensorflow = 'tensorflow<2.14' + +tensorflow = 'tensorflow' setup(classifiers=['Operating System :: OS Independent', 'Intended Audience :: Developers', From 3f610e2578b67d25d3750b925f93cb7a56fe314b Mon Sep 17 00:00:00 2001 From: Ian Harrison Date: Tue, 26 Aug 2025 11:01:33 +0100 Subject: [PATCH 2/4] add contributors.md --- CONTRIBUTORS.md | 7 +++++++ cosmopower/__init__.py | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 CONTRIBUTORS.md diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md new file mode 100644 index 0000000..21206ea --- /dev/null +++ b/CONTRIBUTORS.md @@ -0,0 +1,7 @@ +# Contributors (Alphabetical Order) + +- Pierre Burger +- Ian Harrison [ORCID: 0000-0002-4437-0770](https://orcid.org/0000-0002-4437-0770) +- Hidde T Jense [0000-0002-9429-0015](https://orcid.org/0000-0002-9429-0015) +- Alessio Spurio Mancini [0000-0001-5698-0990](https://orcid.org/0000-0001-5698-0990) +- Davide Piras [ORCID: 0000-0002-9836-2661](https://orcid.org/0000-0002-9836-2661) diff --git a/cosmopower/__init__.py b/cosmopower/__init__.py index 261bd56..b63d0a6 100644 --- a/cosmopower/__init__.py +++ b/cosmopower/__init__.py @@ -8,7 +8,7 @@ __version__ = "0.2.0" -__author__ = "Alessio Spurio Mancini, Hidde Jense, and Ian Harrison" +__author__ = "Alessio Spurio Mancini" def get_cobaya_class(): From 9b38e28249a6c60c4607cd0be41eacbffc53607c Mon Sep 17 00:00:00 2001 From: Ian Harrison Date: Fri, 29 Aug 2025 08:50:32 +0100 Subject: [PATCH 3/4] corrected ellfac for pp --- cosmopower/util.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cosmopower/util.py b/cosmopower/util.py index efc3f36..13d9300 100644 --- a/cosmopower/util.py +++ b/cosmopower/util.py @@ -73,7 +73,7 @@ def ell_factor(ls: np.ndarray, spectra: str) -> np.ndarray: elif spectra in ["pt", "pe", "pb", "tp", "ep", "bp"]: ellfac = ls * (ls + 1.0) / (2.0 * np.pi) elif spectra in ["pp"]: - ellfac = ls * (ls + 1.0) / (2.0 * np.pi) + ellfac = (ls * (ls + 1.0))**2. / (2.0 * np.pi) return ellfac From aad14db2d91dd6d0e3ffe9f39162715129801982 Mon Sep 17 00:00:00 2001 From: Ian Harrison Date: Mon, 6 Oct 2025 18:42:03 +0100 Subject: [PATCH 4/4] pp units and example 4 typos --- cosmopower/examples/4_cobaya.py | 13 ++++++++----- .../wrappers/cosmosis/cosmopower_interface.py | 8 ++++++-- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/cosmopower/examples/4_cobaya.py b/cosmopower/examples/4_cobaya.py index 8361909..7d1d134 100644 --- a/cosmopower/examples/4_cobaya.py +++ b/cosmopower/examples/4_cobaya.py @@ -74,10 +74,12 @@ min: 0.01 max: 0.12 ref: 0.05 - H0: - derived: true - sigma8: - derived: true + h: + prior: + min: 0.6 + max: 0.8 + ref: 0.67 + """ yaml = yaml_load(model) @@ -85,13 +87,14 @@ install(yaml) # Create the cobaya model. -model = get_model(model) +model = get_model(yaml) # The best-fit values from the Planck paper. plik_best_fit = { "ombh2": 22.383e-3, "omch2": 12.011e-2, "cosmomc_theta": 104.0909e-4, + "h": 0.67, "logA": 3.0448, "ns": 0.96605, "tau": 0.0543, diff --git a/cosmopower/wrappers/cosmosis/cosmopower_interface.py b/cosmopower/wrappers/cosmosis/cosmopower_interface.py index 62e2dec..6fe8e70 100644 --- a/cosmopower/wrappers/cosmosis/cosmopower_interface.py +++ b/cosmopower/wrappers/cosmosis/cosmopower_interface.py @@ -74,8 +74,12 @@ def get_cosmopower_outputs(block, netname, data, config): if config['ell_factor']: prefac *= cp.util.ell_factor(block[cmb_cl, 'ell'], cl_type) - #ToDo: ambiguity of 'Cl' vs 'cmb_cl' here - block[cmb_cl, cl_type] = data * prefac * cp.util.cmb_unit_factor(cl_type, config['units'], 2.7255) + if cl_type == 'pp': + ell = block[cmb_cl, 'ell'] + block[cmb_cl, cl_type] = 2.* np.pi * data * cp.util.cmb_unit_factor(cl_type, config['units'], 2.7255) / (ell*(ell + 1)) + else: + #ToDo: ambiguity of 'Cl' vs 'cmb_cl' here + block[cmb_cl, cl_type] = data * prefac * cp.util.cmb_unit_factor(cl_type, config['units'], 2.7255) if config['lmax'] > 0: ell_select = block[cmb_cl, 'ell'] <= config['lmax']