diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index dbd368a89..9050a960f 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -5,7 +5,7 @@ name: Cobaya Tests on: [push, pull_request] env: - COBAYA_INSTALL_SKIP_BASE: planck_2015,CamSpec2021,2018_highl_CamSpec,unbinned,keck + COBAYA_INSTALL_SKIP_BASE: CamSpec2021,2018_highl_CamSpec,unbinned,keck COBAYA_PACKAGES_PATH: ../packages jobs: diff --git a/CHANGELOG.md b/CHANGELOG.md index 1b2ac8219..eb5d5fb48 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,11 @@ - Documentation can now be built as markdown for LLM context. Flat context file provided. - Periodic sampled parameters implemented (for now fully supported by MCMC only), as well as tagging of derived parameters as periodic for analysis with GetDist. +### Cosmology + +- Planck `clik`-based likelihoods now use the new `clipy` Python implementation +- Planck 2015 likelihoods deprecated + ## 3.5.7 - 2025-03-31 ### General diff --git a/cobaya/cosmo_input/input_database.py b/cobaya/cosmo_input/input_database.py index 15b8ebe22..800908633 100644 --- a/cobaya/cosmo_input/input_database.py +++ b/cobaya/cosmo_input/input_database.py @@ -1148,8 +1148,7 @@ install_tests = deepcopy(install_basic) install_tests["likelihood"].update( { - "planck_2015_lowl": None, - "planck_2018_highl_plik.TT_unbinned": None, + "planck_2018_highl_plik.TT": None, "planck_2018_highl_plik.TT_lite_native": None, "planck_2018_highl_CamSpec.TT": None, "planck_2018_highl_CamSpec2021.TT": None, diff --git a/cobaya/install.py b/cobaya/install.py index 83790d3cd..ffe08eaca 100644 --- a/cobaya/install.py +++ b/cobaya/install.py @@ -198,6 +198,7 @@ def install(*infos, **kwargs): unknown_components = [] # could not be identified failed_components = [] # general errors obsolete_components = [] # older or unknown version already installed + incompatible_components = [] # not compatible with current OS skip_keywords_arg = set(kwargs.get("skip") or []) # NB: if passed with quotes as `--skip "a b"`, it's interpreted as a single key skip_keywords_arg = set(chain(*[word.split() for word in skip_keywords_arg])) @@ -304,10 +305,10 @@ def _imported_class(): name_w_kind = imported_class.get_kind() + ":" + component is_compatible = getattr(imported_class, "is_compatible", lambda: True)() if not is_compatible: - logger.error( + logger.info( f"Skipping '{name_w_kind}' because it is not compatible with your OS." ) - failed_components += [name_w_kind] + incompatible_components += [name_w_kind] continue logger.info("Checking if dependencies have already been installed...") is_installed = getattr(imported_class, "is_installed", None) @@ -466,6 +467,12 @@ def _imported_class(): ), bullet + bullet.join(obsolete_components), ) + if incompatible_components: + logger.warning( + "The following components were skipped because they are not compatible " + "with your OS: %s", + bullet + bullet.join(incompatible_components), + ) if not unknown_components and not failed_components and not obsolete_components: logger.info( "All requested components' dependencies correctly installed at " diff --git a/cobaya/likelihoods/base_classes/__init__.py b/cobaya/likelihoods/base_classes/__init__.py index bbe6d8bd3..2464c6411 100644 --- a/cobaya/likelihoods/base_classes/__init__.py +++ b/cobaya/likelihoods/base_classes/__init__.py @@ -7,7 +7,6 @@ from .InstallableLikelihood import InstallableLikelihood as InstallableLikelihood from .Mb import Mb as Mb from .planck_2018_CamSpec_python import Planck2018CamSpecPython as Planck2018CamSpecPython -from .planck_clik import Planck2015Clik as Planck2015Clik from .planck_clik import Planck2018Clik as Planck2018Clik from .planck_clik import PlanckClik as PlanckClik from .planck_pliklite import PlanckPlikLite as PlanckPlikLite diff --git a/cobaya/likelihoods/base_classes/planck_clik.py b/cobaya/likelihoods/base_classes/planck_clik.py index 88f7bbb0c..6179bbc6f 100644 --- a/cobaya/likelihoods/base_classes/planck_clik.py +++ b/cobaya/likelihoods/base_classes/planck_clik.py @@ -1,42 +1,31 @@ r""" .. module:: planck_clik -:Synopsis: Definition of the clik-based likelihoods +:Synopsis: Definition of the clik-based likelihoods using clipy :Author: Jesus Torrado (initially based on MontePython's version by Julien Lesgourgues and Benjamin Audren) + Updated to use clipy by Antony Lewis and Jesus Torrado """ import os -import re -import sys import numpy as np -from packaging import version from cobaya.component import ComponentNotInstalledError, load_external_module from cobaya.input import get_default_info -from cobaya.install import download_file, pip_install +from cobaya.install import download_file, download_github_release, pip_install from cobaya.likelihood import Likelihood from cobaya.log import LoggedError, get_logger -from cobaya.tools import ( - VersionCheckError, - are_different_params_lists, - create_banner, - working_directory, -) - -_deprecation_msg_2015 = create_banner(""" -The likelihoods from the Planck 2015 data release have been superseded -by the 2018 ones, and will eventually be deprecated. -""") - -clik_url = "https://github.com/benabed/clik/archive/refs/heads/main.zip" +from cobaya.tools import VersionCheckError, are_different_params_lists + pla_url_prefix = r"https://pla.esac.esa.int/pla-sl/data-action?COSMOLOGY.COSMOLOGY_OID=" +# Clipy installation +clipy_repo_name = "benabed/clipy" +clipy_repo_min_version = "0.15" + last_version_supp_data_and_covmats = "v2.1" -last_version_clik = "16.0" -min_version_clik = "3.1" class PlanckClik(Likelihood): @@ -47,36 +36,30 @@ class PlanckClik(Likelihood): clik_file: str def initialize(self): - if "2015" in self.get_name(): - for line in _deprecation_msg_2015.split("\n"): - self.log.warning(line) + msg_to_install = "run `cobaya-install planck_2018_highl_plik.TTTEEE`" try: install_path = (lambda p: self.get_code_path(p) if p else None)( self.packages_path ) - # min_version here is checked inside get_clik_import_path, since it is - # displayed in the folder name and cannot be retrieved from the module. - clik = load_clik( - "clik", + # Load clipy instead of clik + clipy = load_clipy( path=self.path, install_path=install_path, - get_import_path=get_clik_import_path, logger=self.log, not_installed_level="debug", ) - except VersionCheckError as excpt: - raise VersionCheckError( - str(excpt) + " Upgrade with `cobaya-install " - "planck_2018_highl_plik.TTTEEE --upgrade`." - ) except ComponentNotInstalledError as excpt: raise ComponentNotInstalledError( self.log, - ( - f"Could not find clik: {excpt}. To install it, " - f"run `cobaya-install planck_2018_highl_plik.TTTEEE`" - ), - ) + f"Could not find clipy: {excpt}. To install it, {msg_to_install}", + ) from excpt + except VersionCheckError as excpt: + raise VersionCheckError( + self.log, + f"{excpt}. To install a new version, {msg_to_install} with `--upgrade`.", + ) from excpt + # Disable JAX to avoid dependency issues + os.environ["CLIPY_NOJAX"] = "1" # Loading the likelihood data data_path = get_data_path(self.__class__.get_qualified_class_name()) if not os.path.isabs(self.clik_file): @@ -86,47 +69,56 @@ def initialize(self): os.path.join(self.path or self.packages_path, "data", data_path), ) self.clik_file = os.path.join(self.path_data, self.clik_file) - # Differences in the wrapper for lensing and non-lensing likes - self.lensing = clik.try_lensing(self.clik_file) + # Prepare clipy commands + if isinstance(self.commands, str): + self.commands = [self.commands] try: - self.clik = ( - clik.clik_lensing(self.clik_file) - if self.lensing - else clik.clik(self.clik_file) - ) - except clik.lkl.CError: + self.clik_likelihood = clipy.clik(self.clik_file, crop=self.commands or []) + except clipy.clik_emul_error as excpt: # Is it that the file was not found? if not os.path.exists(self.clik_file): raise ComponentNotInstalledError( self.log, - "The .clik file was not found where specified in the " - "'clik_file' field of the settings of this likelihood. " - "Maybe the 'path' given is not correct? The full path where" - " the .clik file was searched for is '%s'", - self.clik_file, - ) - # Else: unknown clik error - self.log.error( - "An unexpected error occurred in clik (possibly related to " - "multiple simultaneous initialization, or simultaneous " - "initialization of incompatible likelihoods; e.g. polarised " - "vs non-polarised 'lite' likelihoods. See error info below:" - ) - raise - self.l_maxs = self.clik.get_lmax() - # calculate requirements here so class can also be separately instantiated - requested_cls = ["tt", "ee", "bb", "te", "tb", "eb"] - if self.lensing: - has_cl = [lmax != -1 for lmax in self.l_maxs] - requested_cls = ["pp"] + requested_cls - else: - has_cl = self.clik.get_has_cl() - self.requested_cls = [cl for cl, i in zip(requested_cls, has_cl) if int(i)] - self.l_maxs_cls = [lmax for lmax, i in zip(self.l_maxs, has_cl) if int(i)] - self.expected_params = list(self.clik.extra_parameter_names) - # Placeholder for vector passed to clik - length = len(self.l_maxs) if self.lensing else len(self.clik.get_has_cl()) - self.vector = np.zeros(np.sum(self.l_maxs) + length + len(self.expected_params)) + "The .clik file was not found where specified in the 'clik_file' " + "field of the settings of this likelihood. Install this likelihood " + f"with 'cobaya-install {self.get_qualified_class_name()}'. If this " + "error persists, maybe the 'path' given is not correct? The full path" + " where the .clik file was searched for is '{self.clik_file}'", + ) from excpt + # Else: unknown clipy error + raise LoggedError( + self.log, + f"An unexpected managed error occurred in clipy: {excpt}", + ) from excpt + except Exception as excpt: + if self.commands: # check if bad command + raise LoggedError( + self.log, + f"An unmanaged error occurred in clipy: {excpt}. This may have been " + "caused by a worngly-formatted 'command'. Please check your command " + "syntax, or disable and try again to check that clipy is working as " + f"expected. The list of commands passed were: {self.commands}" + ) from excpt + else: # unknown clippy error + raise LoggedError( + self.log, + f"An unmanaged error occurred in clipy: {excpt}. Please report it as " + "a GitHub issue in the Cobaya repo.", + ) from excpt + lmaxs = self.clik_likelihood.lmax + cls_sorted = ["tt", "ee", "bb", "te", "tb", "eb"] + if len(lmaxs) > 6: # lensing likelihood! + cls_sorted = ["pp"] + cls_sorted + self.requested_cls_lmax = { + cl: lmax for cl, lmax in zip(cls_sorted, lmaxs) if lmax != -1 + } + self.expected_params = list(self.clik_likelihood.extra_parameter_names) + # Placeholder for vector passed to clipy + self.vector = np.zeros( + sum(list(self.requested_cls_lmax.values())) + + len(self.requested_cls_lmax) # account for ell=0 + + len(self.expected_params) + ) def initialize_with_params(self): # Check that the parameters are the right ones @@ -144,65 +136,51 @@ def initialize_with_params(self): def get_requirements(self): # State requisites to the theory code - return {"Cl": dict(zip(self.requested_cls, self.l_maxs_cls))} + return {"Cl": self.requested_cls_lmax} def logp(self, **params_values): - # get Cl's from the theory code + # Get Cl's from the theory code cl = self.provider.get_Cl(units="FIRASmuK2") return self.log_likelihood(cl, **params_values) def log_likelihood(self, cl, **params_values): - # fill with Cl's + # Fill with Cl's self.vector[: -len(self.expected_params)] = np.concatenate( [ - ( - cl[spectrum][: 1 + lmax] - if spectrum not in ["tb", "eb"] - else np.zeros(1 + lmax) - ) - for spectrum, lmax in zip(self.requested_cls, self.l_maxs_cls) + cl[spec][: 1 + lmax] if spec not in ["tb", "eb"] else np.zeros(1 + lmax) + for spec, lmax in self.requested_cls_lmax.items() ] ) - # check for nan's: mey produce a segfault in clik + # check for nan's: may produce issues in clipy # dot product is apparently the fastest way in threading-enabled numpy if np.isnan(np.dot(self.vector, self.vector)): return -np.inf - # fill with likelihood parameters + # Fill with likelihood parameters self.vector[-len(self.expected_params) :] = [ params_values[p] for p in self.expected_params ] - loglike = self.clik(self.vector)[0] - # "zero" of clik, and sometimes nan's returned - if np.allclose(loglike, -1e30) or np.isnan(loglike): + loglike = self.clik_likelihood(self.vector) + # "zero" of clipy, and sometimes nan's returned + if loglike <= -1e30 or np.isnan(loglike): loglike = -np.inf return loglike - def close(self): - del self.clik # MANDATORY: forces deallocation of the Cython class - # Actually, it does not work for low-l likelihoods, which is quite dangerous! - @classmethod def get_code_path(cls, path): return os.path.realpath(os.path.join(path, "code", common_path)) - @classmethod - def is_compatible(cls): - import platform - - return platform.system() != "Windows" - @classmethod def is_installed(cls, reload=False, **kwargs): code_path = common_path data_path = get_data_path(cls.get_qualified_class_name()) result = True if kwargs.get("code", True): - result &= bool( - is_installed_clik( - os.path.realpath(os.path.join(kwargs["path"], "code", code_path)), - reload=reload, - ) + # Check if clipy is installed in the packages path specifically + # Don't fall back to global installation during installation check + packages_clipy_path = os.path.realpath( + os.path.join(kwargs["path"], "code", code_path) ) + result &= is_installed_clipy(packages_clipy_path, reload=reload) if kwargs.get("data", True): # NB: will never raise VersionCheckerror, since version number is in the path _, filename = get_product_id_and_clik_file(cls.get_qualified_class_name()) @@ -228,16 +206,11 @@ def install( **_kwargs, ): name = cls.get_qualified_class_name() - log = get_logger(name) + logger = get_logger(name) path_names = {"code": common_path, "data": get_data_path(name)} - import platform - - if platform.system() == "Windows": - log.error("Not compatible with Windows.") - return False - global _clik_install_failed - if _clik_install_failed: - log.info("Previous clik install failed, skipping") + global _clipy_install_failed + if _clipy_install_failed: + logger.info("Previous clipy install failed, skipping") return False # Create common folders: all planck likelihoods share install # folder for code and data @@ -248,20 +221,19 @@ def install( if not os.path.exists(paths[s]): os.makedirs(paths[s]) success = True - # Install clik - if code and (not is_installed_clik(paths["code"]) or force): - log.info("Installing the clik code.") - success *= install_clik(paths["code"], no_progress_bars=no_progress_bars) + # Install clipy to packages path (don't rely on global installation) + if code and (not is_installed_clipy(paths["code"], logger=logger) or force): + logger.info("Installing clipy.") + success *= install_clipy( + paths["code"], no_progress_bars=no_progress_bars, logger=logger + ) if not success: - log.warning( - "clik code installation failed! " - "Try configuring+compiling by hand at " + paths["code"] - ) - _clik_install_failed = True + logger.warning("clipy installation failed!") + _clipy_install_failed = True if data: # 2nd test, in case the code wasn't there but the data is: if force or not cls.is_installed(path=path, code=False, data=True): - log.info("Downloading the likelihood data.") + logger.info("Downloading the likelihood data.") product_id, _ = get_product_id_and_clik_file(name) # Download and decompress the particular likelihood url = pla_url_prefix + product_id @@ -278,10 +250,10 @@ def install( url, paths["data"], size=size, - logger=log, + logger=logger, no_progress_bars=no_progress_bars, ): - log.error("Not possible to download this likelihood.") + logger.error("Not possible to download this likelihood.") success = False # Additional data and covmats, stored in same repo as the # 2018 python lensing likelihood @@ -303,10 +275,8 @@ def install( # path to be shared by all Planck likelihoods common_path = "planck" -# To see full clik build output even if installs OK (e.g. to check warnings) -_clik_verbose = any((s in os.getenv("COMMIT_MESSAGE", "")) for s in ["clik", "planck"]) -# Don't try again to install clik if it failed for a previous likelihood -_clik_install_failed = False +# Don't try again to install clipy if it failed for a previous likelihood +_clipy_install_failed = False def get_data_path(name): @@ -317,145 +287,148 @@ def get_release(name): return next(re for re in ["2015", "2018"] if re in name) -def get_clik_source_folder(starting_path): +def get_clipy_import_path(path): """ Starting from the installation folder, returns the subdirectory from which the - compilation must be run. + ``clipy`` module must be imported. - In practice, crawls inside the install folder ``packages/code/planck`` - until >1 subfolders. - - Raises ``FileNotFoundError`` if no clik install was found. + Raises ``FileNotFoundError`` if no clipy install was found. """ - source_dir = starting_path - while ( - len( - folders := [ - f - for f in os.listdir(source_dir) - if os.path.isdir(os.path.join(source_dir, f)) - ] + clipy_path = os.path.join(path, "clipy") + if not os.path.exists(clipy_path): + raise FileNotFoundError(f"clipy installation not found at {clipy_path}") + # Check if it has the proper structure + init_file = os.path.join(clipy_path, "clipy", "__init__.py") + if not os.path.exists(init_file): + raise FileNotFoundError(f"clipy package structure not found at {clipy_path}") + return clipy_path + + +def load_clipy( + path=None, + install_path=None, + logger=None, + not_installed_level="error", + reload=False, + default_global=False, +): + """ + Load clipy module and check that it's the correct one. + + Returns + ------- + clipy: module + The imported clipy module + + Raises + ------ + ComponentNotInstalledError + If clipy has not been installed + VersionCheckError + If clipy is found, but with a smaller version number. + """ + if logger is None: + logger = get_logger("clipy") + clipy = load_external_module( + module_name="clipy", + path=path, + install_path=install_path, + get_import_path=get_clipy_import_path if install_path else None, + min_version=clipy_repo_min_version, + logger=logger, + not_installed_level=not_installed_level, + reload=reload, + default_global=default_global, + ) + # Check that it has the expected clipy interface + if not hasattr(clipy, "clik"): + raise ComponentNotInstalledError( + logger, + "Loaded wrong clipy: you may have pip-installed 'clipy' instead of " + "'clipy-like'.", ) - <= 1 - ): - if len(folders) == 0: - raise FileNotFoundError( - f"Could not find a clik installation under {starting_path}" - ) - source_dir = os.path.join(source_dir, folders[0]) # type: ignore - return source_dir + return clipy -def get_clik_import_path(path, min_version=min_version_clik): +def is_installed_clipy(path=None, reload=False, logger=None): """ - Starting from the installation folder, returns the subdirectory from which the - ``clik`` module must be imported. - - Raises ``FileNotFoundError`` if no clik install was found, or - :class:`tools.VersionCheckError` if the installed version is too old. + Check if clipy is installed and working in the specified path. It should not raise any + exception. + + Parameters + ---------- + path: str, optional + Path where the clipy installation is tested, to which ``clipy`` will be appended + before testing. If not defined, a test for a global python installation will be + performed instead (``default_global=True`` will be passed to the module loader). + reload: bool + Whether to attemp to reload the ``clipy`` module before checking. + logger: logging.Logger, optional + Initialized logger. If note passed, one named ``clipy`` will be created. + + Returns + ------- + bool + ``True`` if the installation was successful, and ``False`` otherwise. """ - clik_src_path = get_clik_source_folder(path) - version_file = os.path.join(clik_src_path, "readme.md") - if os.path.exists(version_file): - with open(version_file) as f: - if version_match := re.search(r"(clik|plc) (\d+\.\d+)", f.read()): - installed_version = version_match.group(2) - else: - installed_version = "16.0" - else: - installed_version = clik_src_path.rstrip(os.sep).split("-")[-1] - installed_version = version.parse(installed_version) - if installed_version < version.parse(min_version): - raise VersionCheckError( - f"Installed version of the Planck likelihood code 'clik' ({installed_version})" - f" older than minimum required one ({last_version_clik})." + if logger is None: + logger = get_logger("clipy") + try: + # If path is specified, don't fall back to global import + default_global = path is None + load_clipy( + path=os.path.join(path, "clipy"), + logger=logger, + not_installed_level="debug", + reload=reload, + default_global=default_global, ) - elif installed_version > version.parse(last_version_clik): - raise ValueError("This should not happen: min version needs update.") - return os.path.join(clik_src_path, "lib/python/site-packages") + return True + except (ComponentNotInstalledError, VersionCheckError): + return False -def load_clik(*args, **kwargs): - """ - Just a wrapper around :func:`component.load_external_module`, that checks that we are - not being fooled by the wrong `clik `_. +def install_clipy(path, logger=None, no_progress_bars=False): """ - clik = load_external_module(*args, **kwargs) - if not hasattr(clik, "try_lensing"): - raise ComponentNotInstalledError( - kwargs.get("logger"), "Loaded wrong clik: `https://pypi.org/project/clik/`" - ) - return clik + Install clipy from GitHub repository to the specified path. + Parameters + ---------- + path: str + Path where clipy will be downloaded into, to which ``clipy`` will be appended. -def is_installed_clik(path, reload=False): - # min_version here is checked inside get_clik_import_path, since it is displayed - # in the folder name and cannot be retrieved from the module. - try: - return bool( - load_clik( - "clik", - path=path, - get_import_path=get_clik_import_path, - reload=reload, - logger=get_logger("clik"), - not_installed_level="debug", - ) - ) - except ComponentNotInstalledError: - return False + logger: logging.Logger, optional + Initialized logger. If note passed, one named ``clipy`` will be created. + no_progress_bars: bool + Whether to show download/install progress bars. -def execute(command): - from subprocess import PIPE, STDOUT, Popen - - if _clik_verbose: - process = Popen(command, stdout=PIPE, stderr=STDOUT) - out = [] - assert process.stdout - while (nextline := process.stdout.readline()) != b"" or process.poll() is None: - sys.stdout.buffer.write(nextline) - out.append(nextline) - sys.stdout.flush() - _, err = process.communicate() - return b"finished successfully" in out[-1] - else: - process = Popen(command, stdout=PIPE, stderr=PIPE) - stdout, stderr = process.communicate() - OK = b"finished successfully" in stdout.split(b"\n")[-2] - if not OK: - print(stdout.decode("utf-8")) - print(stderr.decode("utf-8")) - return OK - - -def install_clik(path, no_progress_bars=False): - log = get_logger("clik") - log.info("Installing pre-requisites...") - for req in ("cython", "astropy"): + Returns + ------- + bool + ``True`` if the installation was successful, and ``False`` otherwise. + """ + if logger is None: + logger = get_logger("clipy") + # Install pre-requisites + logger.info("Installing pre-requisites...") + for req in ("astropy",): exit_status = pip_install(req) if exit_status: - raise LoggedError(log, "Failed installing '%s'.", req) - log.info("Downloading...") - if not download_file(clik_url, path, no_progress_bars=no_progress_bars, logger=log): - log.error("Not possible to download clik.") - return False - source_dir = get_clik_source_folder(path) - log.info("Installing from directory %s" % source_dir) - with working_directory(source_dir): - log.info("Configuring... (and maybe installing dependencies...)") - flags = [ - "--install_all_deps", - "--extra_lib=m", - ] # missing for some reason in some systems, but harmless - if not execute([sys.executable, "waf", "configure"] + flags): - log.error("Configuration failed!") - return False - log.info("Compiling...") - if not execute([sys.executable, "waf", "install"]): - log.error("Compilation failed!") + logger.error("Failed installing '%s'.", req) return False - log.info("Finished!") + logger.info("Installing clipy from GitHub repository...") + success = download_github_release( + path, + clipy_repo_name, + "clipy_" + clipy_repo_min_version, # TODO: check if "clipy_" still in release + no_progress_bars=no_progress_bars, + logger=logger, + ) + if not success: + logger.error("Could not download clipy from GitHub.") + return False + logger.info("clipy installation finished!") return True @@ -465,9 +438,5 @@ def get_product_id_and_clik_file(name): return defaults.get("product_id"), defaults.get("clik_file") -class Planck2015Clik(PlanckClik): - bibtex_file = "planck2015.bibtex" - - class Planck2018Clik(PlanckClik): bibtex_file = "planck2018.bibtex" diff --git a/cobaya/likelihoods/planck_2015_lensing/__init__.py b/cobaya/likelihoods/planck_2015_lensing/__init__.py deleted file mode 100644 index 51f0b7a16..000000000 --- a/cobaya/likelihoods/planck_2015_lensing/__init__.py +++ /dev/null @@ -1,10 +0,0 @@ -from cobaya.likelihoods.base_classes import PlanckClik - - -class planck_2015_lensing(PlanckClik): - r""" - Lensing likelihood of Planck's 2015 data release based on temperature+polarization - map-based lensing reconstruction \cite{Ade:2015zua}. - """ - - pass diff --git a/cobaya/likelihoods/planck_2015_lensing/planck_2015_lensing.bibtex b/cobaya/likelihoods/planck_2015_lensing/planck_2015_lensing.bibtex deleted file mode 100644 index 1e5275b4e..000000000 --- a/cobaya/likelihoods/planck_2015_lensing/planck_2015_lensing.bibtex +++ /dev/null @@ -1,14 +0,0 @@ -@article{Ade:2015zua, - author = "Ade, P. A. R. and others", - title = "{Planck 2015 results. XV. Gravitational lensing}", - collaboration = "Planck", - journal = "Astron. Astrophys.", - volume = "594", - year = "2016", - pages = "A15", - doi = "10.1051/0004-6361/201525941", - eprint = "1502.01591", - archivePrefix = "arXiv", - primaryClass = "astro-ph.CO", - SLACcitation = "%%CITATION = ARXIV:1502.01591;%%" -} diff --git a/cobaya/likelihoods/planck_2015_lensing/planck_2015_lensing.yaml b/cobaya/likelihoods/planck_2015_lensing/planck_2015_lensing.yaml deleted file mode 100644 index fffbb591a..000000000 --- a/cobaya/likelihoods/planck_2015_lensing/planck_2015_lensing.yaml +++ /dev/null @@ -1,12 +0,0 @@ -# Planck 2015 release: lensing T+P-based likelihood -# See https://wiki.cosmos.esa.int/planckpla2015/index.php/CMB_spectrum_%26_Likelihood_Code - -path: -clik_file: plc_2.0/lensing/smica_g30_ftl_full_pp.clik_lensing -product_id: "1900" -# Aliases for automatic covariance matrix -aliases: [lensing] -# Speed in evaluations/second -speed: 800 - -params: !defaults [../base_classes/planck_calib] diff --git a/cobaya/likelihoods/planck_2015_lensing_cmblikes/__init__.py b/cobaya/likelihoods/planck_2015_lensing_cmblikes/__init__.py deleted file mode 100644 index 51eee534f..000000000 --- a/cobaya/likelihoods/planck_2015_lensing_cmblikes/__init__.py +++ /dev/null @@ -1,10 +0,0 @@ -from cobaya.likelihoods.planck_2018_lensing import native - - -class planck_2015_lensing_cmblikes(native): - r""" - Lensing likelihood of Planck's 2015 data release based on temperature+polarization - map-based lensing reconstruction \cite{Ade:2015zua}. - """ - - pass diff --git a/cobaya/likelihoods/planck_2015_lensing_cmblikes/planck_2015_lensing_cmblikes.bibtex b/cobaya/likelihoods/planck_2015_lensing_cmblikes/planck_2015_lensing_cmblikes.bibtex deleted file mode 100644 index 1e5275b4e..000000000 --- a/cobaya/likelihoods/planck_2015_lensing_cmblikes/planck_2015_lensing_cmblikes.bibtex +++ /dev/null @@ -1,14 +0,0 @@ -@article{Ade:2015zua, - author = "Ade, P. A. R. and others", - title = "{Planck 2015 results. XV. Gravitational lensing}", - collaboration = "Planck", - journal = "Astron. Astrophys.", - volume = "594", - year = "2016", - pages = "A15", - doi = "10.1051/0004-6361/201525941", - eprint = "1502.01591", - archivePrefix = "arXiv", - primaryClass = "astro-ph.CO", - SLACcitation = "%%CITATION = ARXIV:1502.01591;%%" -} diff --git a/cobaya/likelihoods/planck_2015_lensing_cmblikes/planck_2015_lensing_cmblikes.yaml b/cobaya/likelihoods/planck_2015_lensing_cmblikes/planck_2015_lensing_cmblikes.yaml deleted file mode 100644 index dfe313297..000000000 --- a/cobaya/likelihoods/planck_2015_lensing_cmblikes/planck_2015_lensing_cmblikes.yaml +++ /dev/null @@ -1,15 +0,0 @@ -# CMBlikes version of the Planck 2015 likelihood - -# Path to the data: where the planck_supp_data_and_covmats has been cloned -path: null -dataset_file: lensing/2015/smica_g30_ftl_full_pp.dataset -# Overriding of .dataset parameters -dataset_params: -# Overriding of the maximum ell computed -l_max: -# Aliases for automatic covariance matrix -aliases: [lensing] -# Speed in evaluations/second -speed: 1100 - -params: !defaults [../base_classes/planck_calib] diff --git a/cobaya/likelihoods/planck_2015_lowTEB/__init__.py b/cobaya/likelihoods/planck_2015_lowTEB/__init__.py deleted file mode 100644 index 04dfc0975..000000000 --- a/cobaya/likelihoods/planck_2015_lowTEB/__init__.py +++ /dev/null @@ -1,10 +0,0 @@ -from cobaya.likelihoods.base_classes import Planck2015Clik - - -class planck_2015_lowTEB(Planck2015Clik): - r""" - Low-$\ell$ polarization likelihood of Planck's 2015 data release - \cite{Aghanim:2015xee}. - """ - - pass diff --git a/cobaya/likelihoods/planck_2015_lowTEB/planck_2015_lowTEB.yaml b/cobaya/likelihoods/planck_2015_lowTEB/planck_2015_lowTEB.yaml deleted file mode 100644 index c12efbbd6..000000000 --- a/cobaya/likelihoods/planck_2015_lowTEB/planck_2015_lowTEB.yaml +++ /dev/null @@ -1,12 +0,0 @@ -# Planck 2015 release: low-ell, CMB temperature+polarization likelihood -# See https://wiki.cosmos.esa.int/planckpla2015/index.php/CMB_spectrum_%26_Likelihood_Code - -path: -clik_file: plc_2.0/low_l/bflike/lowl_SMW_70_dx11d_2014_10_03_v5c_Ap.clik -product_id: "1900" -# Aliases for automatic covariance matrix -aliases: [lowTEB] -# Speed in evaluations/second -speed: 4 - -params: !defaults [../base_classes/planck_calib] diff --git a/cobaya/likelihoods/planck_2015_lowl/__init__.py b/cobaya/likelihoods/planck_2015_lowl/__init__.py deleted file mode 100644 index 23a1886b2..000000000 --- a/cobaya/likelihoods/planck_2015_lowl/__init__.py +++ /dev/null @@ -1,10 +0,0 @@ -from cobaya.likelihoods.base_classes import Planck2015Clik - - -class planck_2015_lowl(Planck2015Clik): - r""" - Low-$\ell$ temperature-only likelihood of Planck's 2015 data release - \cite{Aghanim:2015xee}. - """ - - pass diff --git a/cobaya/likelihoods/planck_2015_lowl/planck_2015_lowl.yaml b/cobaya/likelihoods/planck_2015_lowl/planck_2015_lowl.yaml deleted file mode 100644 index 87461081b..000000000 --- a/cobaya/likelihoods/planck_2015_lowl/planck_2015_lowl.yaml +++ /dev/null @@ -1,12 +0,0 @@ -# Planck 2015 release: low-ell, CMB temperature only likelihood -# See https://wiki.cosmos.esa.int/planckpla2015/index.php/CMB_spectrum_%26_Likelihood_Code - -path: -clik_file: plc_2.0/low_l/commander/commander_rc2_v1.1_l2_29_B.clik -product_id: "1900" -# Aliases for automatic covariance matrix -aliases: [lowl] -# Speed in evaluations/second -speed: 3500 - -params: !defaults [../base_classes/planck_calib] diff --git a/cobaya/likelihoods/planck_2015_plikHM_TT/__init__.py b/cobaya/likelihoods/planck_2015_plikHM_TT/__init__.py deleted file mode 100644 index 98c5d5ae5..000000000 --- a/cobaya/likelihoods/planck_2015_plikHM_TT/__init__.py +++ /dev/null @@ -1,10 +0,0 @@ -from cobaya.likelihoods.base_classes import Planck2015Clik - - -class planck_2015_plikHM_TT(Planck2015Clik): - r""" - High-$\ell$ temperature-only likelihood (binned) of Planck's 2015 data release - \cite{Aghanim:2015xee}. - """ - - pass diff --git a/cobaya/likelihoods/planck_2015_plikHM_TT/params_TT_2015.yaml b/cobaya/likelihoods/planck_2015_plikHM_TT/params_TT_2015.yaml deleted file mode 100644 index b3069bd92..000000000 --- a/cobaya/likelihoods/planck_2015_plikHM_TT/params_TT_2015.yaml +++ /dev/null @@ -1,169 +0,0 @@ - cib_index: -1.3 - A_cib_217: - prior: - dist: uniform - min: 0 - max: 200 - ref: - dist: norm - loc: 65 - scale: 10 - proposal: 1.2 - latex: A^\mathrm{CIB}_{217} - renames: acib217 - xi_sz_cib: - prior: - dist: uniform - min: 0 - max: 1 - ref: - dist: halfnorm - loc: 0 - scale: 0.1 - proposal: 0.1 - latex: \xi^{\mathrm{tSZ}\times\mathrm{CIB}} - renames: xi - A_sz: - prior: - dist: uniform - min: 0 - max: 10 - ref: - dist: norm - loc: 5 - scale: 2 - proposal: 0.6 - latex: A^\mathrm{tSZ}_{143} - renames: asz143 - ps_A_100_100: - prior: - dist: uniform - min: 0 - max: 400 - ref: - dist: norm - loc: 250 - scale: 24 - proposal: 17 - latex: A^\mathrm{PS}_{100} - renames: aps100 - ps_A_143_143: - prior: - dist: uniform - min: 0 - max: 400 - ref: - dist: norm - loc: 40 - scale: 10 - proposal: 3 - latex: A^\mathrm{PS}_{143} - renames: aps143 - ps_A_143_217: - prior: - dist: uniform - min: 0 - max: 400 - ref: - dist: norm - loc: 40 - scale: 12 - proposal: 2 - latex: A^\mathrm{PS}_{\mathrm{143}\times\mathrm{217}} - renames: aps143217 - ps_A_217_217: - prior: - dist: uniform - min: 0 - max: 400 - ref: - dist: norm - loc: 100 - scale: 13 - proposal: 2.5 - latex: A^\mathrm{PS}_{217} - renames: aps217 - ksz_norm: - prior: - dist: uniform - min: 0 - max: 10 - ref: - dist: halfnorm - loc: 0 - scale: 3 - proposal: 1 - latex: A^\mathrm{kSZ} - renames: aksz - gal545_A_100: - prior: - dist: norm - loc: 7 - scale: 2 - ref: - dist: norm - loc: 7 - scale: 2 - proposal: 1 - latex: A^\mathrm{dustTT}_{100} - renames: kgal100 - gal545_A_143: - prior: - dist: norm - loc: 9 - scale: 2 - ref: - dist: norm - loc: 9 - scale: 2 - proposal: 1 - latex: A^\mathrm{dustTT}_{143} - renames: kgal143 - gal545_A_143_217: - prior: - dist: norm - loc: 21 - scale: 8.5 - ref: - dist: norm - loc: 21 - scale: 4 - proposal: 1.5 - latex: A^\mathrm{dustTT}_{\mathrm{143}\times\mathrm{217}} - renames: kgal143217 - gal545_A_217: - prior: - dist: norm - loc: 80 - scale: 20 - ref: - dist: norm - loc: 80 - scale: 15 - proposal: 2 - latex: A^\mathrm{dustTT}_{217} - renames: kgal217 - calib_100T: - prior: - dist: norm - loc: 0.999 - scale: 0.001 - ref: - dist: norm - loc: 0.999 - scale: 0.001 - proposal: 0.0005 - latex: c_{100} - renames: cal0 - calib_217T: - prior: - dist: norm - loc: 0.995 - scale: 0.002 - ref: - dist: norm - loc: 0.995 - scale: 0.002 - proposal: 0.001 - latex: c_{217} - renames: cal2 diff --git a/cobaya/likelihoods/planck_2015_plikHM_TT/planck_2015_plikHM_TT.yaml b/cobaya/likelihoods/planck_2015_plikHM_TT/planck_2015_plikHM_TT.yaml deleted file mode 100644 index eeccbbe97..000000000 --- a/cobaya/likelihoods/planck_2015_plikHM_TT/planck_2015_plikHM_TT.yaml +++ /dev/null @@ -1,14 +0,0 @@ -# Planck 2015 release: high-ell, CMB temperature only likelihood -# See https://wiki.cosmos.esa.int/planckpla2015/index.php/CMB_spectrum_%26_Likelihood_Code - -path: -clik_file: plc_2.0/hi_l/plik/plik_dx11dr2_HM_v18_TT.clik -product_id: "1900" -# Aliases for automatic covariance matrix -aliases: [plikHM_TT] -# Speed in evaluations/second -speed: 90 - -params: !defaults [../base_classes/planck_calib, params_TT_2015] - -prior: !defaults [prior_SZ_2015] diff --git a/cobaya/likelihoods/planck_2015_plikHM_TT/prior_SZ_2015.yaml b/cobaya/likelihoods/planck_2015_plikHM_TT/prior_SZ_2015.yaml deleted file mode 100644 index 1bbf442c9..000000000 --- a/cobaya/likelihoods/planck_2015_plikHM_TT/prior_SZ_2015.yaml +++ /dev/null @@ -1 +0,0 @@ - SZ: "lambda ksz_norm, A_sz: stats.norm.logpdf(ksz_norm+1.6*A_sz, loc=9.5, scale=3.0)" diff --git a/cobaya/likelihoods/planck_2015_plikHM_TTTEEE/__init__.py b/cobaya/likelihoods/planck_2015_plikHM_TTTEEE/__init__.py deleted file mode 100644 index 0cc9847b3..000000000 --- a/cobaya/likelihoods/planck_2015_plikHM_TTTEEE/__init__.py +++ /dev/null @@ -1,10 +0,0 @@ -from cobaya.likelihoods.base_classes import Planck2015Clik - - -class planck_2015_plikHM_TTTEEE(Planck2015Clik): - r""" - High-$\ell$ polarization likelihood (binned) of Planck's 2015 data release - \cite{Aghanim:2015xee}. - """ - - pass diff --git a/cobaya/likelihoods/planck_2015_plikHM_TTTEEE/params_TEEE_2015.yaml b/cobaya/likelihoods/planck_2015_plikHM_TTTEEE/params_TEEE_2015.yaml deleted file mode 100644 index b5c55258c..000000000 --- a/cobaya/likelihoods/planck_2015_plikHM_TTTEEE/params_TEEE_2015.yaml +++ /dev/null @@ -1,234 +0,0 @@ - A_pol: 1 - calib_100P: 1 - calib_143P: 1 - calib_217P: 1 - galf_EE_index: -2.4 - galf_TE_index: -2.4 - bleak_epsilon_0_0T_0E: 0 - bleak_epsilon_1_0T_0E: 0 - bleak_epsilon_2_0T_0E: 0 - bleak_epsilon_3_0T_0E: 0 - bleak_epsilon_4_0T_0E: 0 - bleak_epsilon_0_0T_1E: 0 - bleak_epsilon_1_0T_1E: 0 - bleak_epsilon_2_0T_1E: 0 - bleak_epsilon_3_0T_1E: 0 - bleak_epsilon_4_0T_1E: 0 - bleak_epsilon_0_0T_2E: 0 - bleak_epsilon_1_0T_2E: 0 - bleak_epsilon_2_0T_2E: 0 - bleak_epsilon_3_0T_2E: 0 - bleak_epsilon_4_0T_2E: 0 - bleak_epsilon_0_1T_1E: 0 - bleak_epsilon_1_1T_1E: 0 - bleak_epsilon_2_1T_1E: 0 - bleak_epsilon_3_1T_1E: 0 - bleak_epsilon_4_1T_1E: 0 - bleak_epsilon_0_1T_2E: 0 - bleak_epsilon_1_1T_2E: 0 - bleak_epsilon_2_1T_2E: 0 - bleak_epsilon_3_1T_2E: 0 - bleak_epsilon_4_1T_2E: 0 - bleak_epsilon_0_2T_2E: 0 - bleak_epsilon_1_2T_2E: 0 - bleak_epsilon_2_2T_2E: 0 - bleak_epsilon_3_2T_2E: 0 - bleak_epsilon_4_2T_2E: 0 - bleak_epsilon_0_0E_0E: 0 - bleak_epsilon_1_0E_0E: 0 - bleak_epsilon_2_0E_0E: 0 - bleak_epsilon_3_0E_0E: 0 - bleak_epsilon_4_0E_0E: 0 - bleak_epsilon_0_0E_1E: 0 - bleak_epsilon_1_0E_1E: 0 - bleak_epsilon_2_0E_1E: 0 - bleak_epsilon_3_0E_1E: 0 - bleak_epsilon_4_0E_1E: 0 - bleak_epsilon_0_0E_2E: 0 - bleak_epsilon_1_0E_2E: 0 - bleak_epsilon_2_0E_2E: 0 - bleak_epsilon_3_0E_2E: 0 - bleak_epsilon_4_0E_2E: 0 - bleak_epsilon_0_1E_1E: 0 - bleak_epsilon_1_1E_1E: 0 - bleak_epsilon_2_1E_1E: 0 - bleak_epsilon_3_1E_1E: 0 - bleak_epsilon_4_1E_1E: 0 - bleak_epsilon_0_1E_2E: 0 - bleak_epsilon_1_1E_2E: 0 - bleak_epsilon_2_1E_2E: 0 - bleak_epsilon_3_1E_2E: 0 - bleak_epsilon_4_1E_2E: 0 - bleak_epsilon_0_2E_2E: 0 - bleak_epsilon_1_2E_2E: 0 - bleak_epsilon_2_2E_2E: 0 - bleak_epsilon_3_2E_2E: 0 - bleak_epsilon_4_2E_2E: 0 - galf_EE_A_100: - prior: - dist: norm - loc: 0.060 - scale: 0.012 - ref: - dist: norm - loc: 0.06 - scale: 0.012 - proposal: 0.006 - latex: A^\mathrm{dustEE}_{100} - renames: galfEE100 - galf_EE_A_100_143: - prior: - dist: norm - loc: 0.050 - scale: 0.015 - ref: - dist: norm - loc: 0.05 - scale: 0.015 - proposal: 0.007 - latex: A^\mathrm{dustEE}_{\mathrm{100}\times\mathrm{143}} - renames: galfEE100143 - galf_EE_A_100_217: - prior: - dist: norm - loc: 0.110 - scale: 0.033 - ref: - dist: norm - loc: 0.11 - scale: 0.03 - proposal: 0.02 - latex: A^\mathrm{dustEE}_{\mathrm{100}\times\mathrm{217}} - renames: galfEE100217 - galf_EE_A_143: - prior: - dist: norm - loc: 0.10 - scale: 0.02 - ref: - dist: norm - loc: 0.1 - scale: 0.02 - proposal: 0.01 - latex: A^\mathrm{dustEE}_{143} - renames: galfEE143 - galf_EE_A_143_217: - prior: - dist: norm - loc: 0.240 - scale: 0.048 - ref: - dist: norm - loc: 0.24 - scale: 0.05 - proposal: 0.03 - latex: A^\mathrm{dustEE}_{\mathrm{143}\times\mathrm{217}} - renames: galfEE143217 - galf_EE_A_217: - prior: - dist: norm - loc: 0.72 - scale: 0.14 - ref: - dist: norm - loc: 0.72 - scale: 0.15 - proposal: 0.07 - latex: A^\mathrm{dustEE}_{217} - renames: galfEE217 - galf_TE_A_100: - prior: - dist: norm - loc: 0.140 - scale: 0.042 - ref: - dist: norm - loc: 0.14 - scale: 0.04 - proposal: 0.02 - latex: A^\mathrm{dustTE}_{100} - renames: galfTE100 - galf_TE_A_100_143: - prior: - dist: norm - loc: 0.120 - scale: 0.036 - ref: - dist: norm - loc: 0.12 - scale: 0.04 - proposal: 0.02 - latex: A^\mathrm{dustTE}_{\mathrm{100}\times\mathrm{143}} - renames: galfTE100143 - galf_TE_A_100_217: - prior: - dist: norm - loc: 0.30 - scale: 0.09 - ref: - dist: norm - loc: 0.3 - scale: 0.09 - proposal: 0.05 - latex: A^\mathrm{dustTE}_{\mathrm{100}\times\mathrm{217}} - renames: galfTE100217 - galf_TE_A_143: - prior: - dist: norm - loc: 0.240 - scale: 0.072 - ref: - dist: norm - loc: 0.24 - scale: 0.07 - proposal: 0.04 - latex: A^\mathrm{dustTE}_{143} - renames: galfTE143 - galf_TE_A_143_217: - prior: - dist: norm - loc: 0.60 - scale: 0.18 - ref: - dist: norm - loc: 0.60 - scale: 0.18 - proposal: 0.1 - latex: A^\mathrm{dustTE}_{\mathrm{143}\times\mathrm{217}} - renames: galfTE143217 - galf_TE_A_217: - prior: - dist: norm - loc: 1.80 - scale: 0.54 - ref: - dist: norm - loc: 1.8 - scale: 0.5 - proposal: 0.3 - latex: A^\mathrm{dustTE}_{217} - renames: galfTE217 - calib_100T: - prior: - dist: norm - loc: 0.999 - scale: 0.001 - ref: - dist: norm - loc: 0.999 - scale: 0.001 - proposal: 0.0005 - latex: c_{100} - renames: cal0 - calib_217T: - prior: - dist: norm - loc: 0.995 - scale: 0.002 - ref: - dist: norm - loc: 0.995 - scale: 0.002 - proposal: 0.001 - latex: c_{217} - renames: cal2 diff --git a/cobaya/likelihoods/planck_2015_plikHM_TTTEEE/planck_2015_plikHM_TTTEEE.yaml b/cobaya/likelihoods/planck_2015_plikHM_TTTEEE/planck_2015_plikHM_TTTEEE.yaml deleted file mode 100644 index 6fb9c07b3..000000000 --- a/cobaya/likelihoods/planck_2015_plikHM_TTTEEE/planck_2015_plikHM_TTTEEE.yaml +++ /dev/null @@ -1,15 +0,0 @@ -# Planck 2015 release: high-ell, CMB temperature+polarization likelihood -# See https://wiki.cosmos.esa.int/planckpla2015/index.php/CMB_spectrum_%26_Likelihood_Code -# NB: There is a typo in the wiki: the sigma of galf_TE_A_143_217 should be 0.18, not 0.018 - -path: -clik_file: plc_2.0/hi_l/plik/plik_dx11dr2_HM_v18_TTTEEE.clik -product_id: "1900" -# Aliases for automatic covariance matrix -aliases: [plikHM_TTTEEE] -# Speed in evaluations/second -speed: 26 - -params: !defaults [../base_classes/planck_calib, ../planck_2015_plikHM_TT/params_TT_2015, params_TEEE_2015] - -prior: !defaults [../planck_2015_plikHM_TT/prior_SZ_2015] diff --git a/cobaya/likelihoods/planck_2015_plikHM_TTTEEE_unbinned/__init__.py b/cobaya/likelihoods/planck_2015_plikHM_TTTEEE_unbinned/__init__.py deleted file mode 100644 index ceb27f17f..000000000 --- a/cobaya/likelihoods/planck_2015_plikHM_TTTEEE_unbinned/__init__.py +++ /dev/null @@ -1,10 +0,0 @@ -from cobaya.likelihoods.base_classes import Planck2015Clik - - -class planck_2015_plikHM_TTTEEE_unbinned(Planck2015Clik): - r""" - High-$\ell$ polarization likelihood (unbinned) of Planck's 2015 data release - \cite{Aghanim:2015xee}. - """ - - pass diff --git a/cobaya/likelihoods/planck_2015_plikHM_TTTEEE_unbinned/planck_2015_plikHM_TTTEEE_unbinned.yaml b/cobaya/likelihoods/planck_2015_plikHM_TTTEEE_unbinned/planck_2015_plikHM_TTTEEE_unbinned.yaml deleted file mode 100644 index 796f1a364..000000000 --- a/cobaya/likelihoods/planck_2015_plikHM_TTTEEE_unbinned/planck_2015_plikHM_TTTEEE_unbinned.yaml +++ /dev/null @@ -1,15 +0,0 @@ -# Planck 2015 release: high-ell, unbinned CMB temperature+polarization likelihood -# See https://wiki.cosmos.esa.int/planckpla2015/index.php/CMB_spectrum_%26_Likelihood_Code -# NB: There is a typo in the wiki: the sigma of galf_TE_A_143_217 should be 0.18, not 0.018 - -path: -clik_file: plik_unbinned/plik_dx11dr2_HM_v18_TTTEEE_bin1.clik -product_id: "1903" -# Aliases for automatic covariance matrix -aliases: [plikHM_TTTEEE] -# Speed in evaluations/second -speed: 1.7 - -params: !defaults [../base_classes/planck_calib, ../planck_2015_plikHM_TT/params_TT_2015, ../planck_2015_plikHM_TTTEEE/params_TEEE_2015] - -prior: !defaults [../planck_2015_plikHM_TT/prior_SZ_2015] diff --git a/cobaya/likelihoods/planck_2015_plikHM_TT_unbinned/__init__.py b/cobaya/likelihoods/planck_2015_plikHM_TT_unbinned/__init__.py deleted file mode 100644 index 0ead31d4a..000000000 --- a/cobaya/likelihoods/planck_2015_plikHM_TT_unbinned/__init__.py +++ /dev/null @@ -1,10 +0,0 @@ -from cobaya.likelihoods.base_classes import Planck2015Clik - - -class planck_2015_plikHM_TT_unbinned(Planck2015Clik): - r""" - High-$\ell$ temperature-only likelihood (unbinned) of Planck's 2015 data release - \cite{Aghanim:2015xee}. - """ - - pass diff --git a/cobaya/likelihoods/planck_2015_plikHM_TT_unbinned/planck_2015_plikHM_TT_unbinned.yaml b/cobaya/likelihoods/planck_2015_plikHM_TT_unbinned/planck_2015_plikHM_TT_unbinned.yaml deleted file mode 100644 index e8f792b3f..000000000 --- a/cobaya/likelihoods/planck_2015_plikHM_TT_unbinned/planck_2015_plikHM_TT_unbinned.yaml +++ /dev/null @@ -1,14 +0,0 @@ -# Planck 2015 release: high-ell, unbinned CMB temperature only likelihood -# See https://wiki.cosmos.esa.int/planckpla2015/index.php/CMB_spectrum_%26_Likelihood_Code - -path: -clik_file: plik_unbinned/plik_dx11dr2_HM_v18_TT_bin1.clik -product_id: "1903" -# Aliases for automatic covariance matrix -aliases: [plikHM_TT] -# Speed in evaluations/second -speed: 8 - -params: !defaults [../base_classes/planck_calib, ../planck_2015_plikHM_TT/params_TT_2015] - -prior: !defaults [../planck_2015_plikHM_TT/prior_SZ_2015] diff --git a/cobaya/likelihoods/planck_2018_highl_plik/EE.yaml b/cobaya/likelihoods/planck_2018_highl_plik/EE.yaml index 61014e9ea..36d15077c 100644 --- a/cobaya/likelihoods/planck_2018_highl_plik/EE.yaml +++ b/cobaya/likelihoods/planck_2018_highl_plik/EE.yaml @@ -1,9 +1,11 @@ -# Planck 2018 release: high-ell, TE power spectrum likelihood (plik) +# Planck 2018 release: high-ell, EE power spectrum likelihood (plik) # See https://wiki.cosmos.esa.int/planck-legacy-archive/index.php/CMB_spectrum_%26_Likelihood_Code path: clik_file: extended_plik/plc_3.0/hi_l/plik/plik_rd12_HM_v22_EE.clik product_id: "151905" +# Clipy commands -- string or list of strings, e.g. ["no TT", "only EE 217x217 500 800 lax"] +commands: # Aliases for automatic covariance matrix aliases: [plikHM_EE] # Speed in evaluations/second diff --git a/cobaya/likelihoods/planck_2018_highl_plik/TE.yaml b/cobaya/likelihoods/planck_2018_highl_plik/TE.yaml index ceaa8ebd6..94604a907 100644 --- a/cobaya/likelihoods/planck_2018_highl_plik/TE.yaml +++ b/cobaya/likelihoods/planck_2018_highl_plik/TE.yaml @@ -4,6 +4,8 @@ path: clik_file: extended_plik/plc_3.0/hi_l/plik/plik_rd12_HM_v22_TE.clik product_id: "151905" +# Clipy commands -- string or list of strings, e.g. ["no TT", "only EE 217x217 500 800 lax"] +commands: # Aliases for automatic covariance matrix aliases: [plikHM_TE] # Speed in evaluations/second diff --git a/cobaya/likelihoods/planck_2018_highl_plik/TT.yaml b/cobaya/likelihoods/planck_2018_highl_plik/TT.yaml index 110528ee5..8222b01d5 100644 --- a/cobaya/likelihoods/planck_2018_highl_plik/TT.yaml +++ b/cobaya/likelihoods/planck_2018_highl_plik/TT.yaml @@ -4,6 +4,8 @@ path: clik_file: baseline/plc_3.0/hi_l/plik/plik_rd12_HM_v22_TT.clik product_id: "151902" +# Clipy commands -- string or list of strings, e.g. ["no TT", "only EE 217x217 500 800 lax"] +commands: # Aliases for automatic covariance matrix aliases: [plikHM_TT] # Speed in evaluations/second diff --git a/cobaya/likelihoods/planck_2018_highl_plik/TTTEEE.yaml b/cobaya/likelihoods/planck_2018_highl_plik/TTTEEE.yaml index de306302f..0e17a2ad1 100644 --- a/cobaya/likelihoods/planck_2018_highl_plik/TTTEEE.yaml +++ b/cobaya/likelihoods/planck_2018_highl_plik/TTTEEE.yaml @@ -4,6 +4,8 @@ path: clik_file: baseline/plc_3.0/hi_l/plik/plik_rd12_HM_v22b_TTTEEE.clik product_id: "151902" +# Clipy commands -- string or list of strings, e.g. ["no TT", "only EE 217x217 500 800 lax"] +commands: # Aliases for automatic covariance matrix aliases: [plikHM_TTTEEE] # Speed in evaluations/second diff --git a/cobaya/likelihoods/planck_2018_highl_plik/TTTEEE_lite.yaml b/cobaya/likelihoods/planck_2018_highl_plik/TTTEEE_lite.yaml index 9ad33681f..6c0b2d39d 100644 --- a/cobaya/likelihoods/planck_2018_highl_plik/TTTEEE_lite.yaml +++ b/cobaya/likelihoods/planck_2018_highl_plik/TTTEEE_lite.yaml @@ -4,6 +4,8 @@ path: clik_file: baseline/plc_3.0/hi_l/plik_lite/plik_lite_v22_TTTEEE.clik product_id: "151902" +# Clipy commands -- string or list of strings, e.g. ["no TT", "only EE 217x217 500 800 lax"] +commands: # Aliases for automatic covariance matrix aliases: [plikHM_TTTEEE] # Speed in evaluations/second diff --git a/cobaya/likelihoods/planck_2018_highl_plik/TTTEEE_unbinned.yaml b/cobaya/likelihoods/planck_2018_highl_plik/TTTEEE_unbinned.yaml index 1e1017408..b00f902e4 100644 --- a/cobaya/likelihoods/planck_2018_highl_plik/TTTEEE_unbinned.yaml +++ b/cobaya/likelihoods/planck_2018_highl_plik/TTTEEE_unbinned.yaml @@ -4,6 +4,8 @@ path: clik_file: extended_plik/plc_3.0/hi_l/plik/plik_rd12_HM_v22b_TTTEEE_bin1.clik product_id: "151905" +# Clipy commands -- string or list of strings, e.g. ["no TT", "only EE 217x217 500 800 lax"] +commands: # Aliases for automatic covariance matrix aliases: [plikHM_TTTEEE] # Speed in evaluations/second diff --git a/cobaya/likelihoods/planck_2018_highl_plik/TT_lite.yaml b/cobaya/likelihoods/planck_2018_highl_plik/TT_lite.yaml index d7f837067..607e32c0c 100644 --- a/cobaya/likelihoods/planck_2018_highl_plik/TT_lite.yaml +++ b/cobaya/likelihoods/planck_2018_highl_plik/TT_lite.yaml @@ -4,6 +4,8 @@ path: clik_file: baseline/plc_3.0/hi_l/plik_lite/plik_lite_v22_TT.clik product_id: "151902" +# Clipy commands -- string or list of strings, e.g. ["no TT", "only EE 217x217 500 800 lax"] +commands: # Aliases for automatic covariance matrix aliases: [plikHM_TT] # Speed in evaluations/second diff --git a/cobaya/likelihoods/planck_2018_highl_plik/TT_unbinned.yaml b/cobaya/likelihoods/planck_2018_highl_plik/TT_unbinned.yaml index 84d1b122f..f34e403cf 100644 --- a/cobaya/likelihoods/planck_2018_highl_plik/TT_unbinned.yaml +++ b/cobaya/likelihoods/planck_2018_highl_plik/TT_unbinned.yaml @@ -4,6 +4,8 @@ path: clik_file: extended_plik/plc_3.0/hi_l/plik/plik_rd12_HM_v22_TT_bin1.clik product_id: "151905" +# Clipy commands -- string or list of strings, e.g. ["no TT", "only EE 217x217 500 800 lax"] +commands: # Aliases for automatic covariance matrix aliases: [plikHM_TT] # Speed in evaluations/second diff --git a/cobaya/likelihoods/planck_2018_lensing/clik.yaml b/cobaya/likelihoods/planck_2018_lensing/clik.yaml index 966c91efd..15d61fd7a 100644 --- a/cobaya/likelihoods/planck_2018_lensing/clik.yaml +++ b/cobaya/likelihoods/planck_2018_lensing/clik.yaml @@ -4,6 +4,8 @@ path: clik_file: baseline/plc_3.0/lensing/smicadx12_Dec5_ftl_mv2_ndclpp_p_teb_consext8.clik_lensing product_id: "151902" +# Clipy commands -- string or list of strings, e.g. ["no TT", "only EE 217x217 500 800 lax"] +commands: # Aliases for automatic covariance matrix aliases: [lensing] # Speed in evaluations/second diff --git a/cobaya/likelihoods/planck_2018_lowl/EE_clik.yaml b/cobaya/likelihoods/planck_2018_lowl/EE_clik.yaml index 55d700fd5..6ac9c3739 100644 --- a/cobaya/likelihoods/planck_2018_lowl/EE_clik.yaml +++ b/cobaya/likelihoods/planck_2018_lowl/EE_clik.yaml @@ -4,6 +4,8 @@ path: clik_file: baseline/plc_3.0/low_l/simall/simall_100x143_offlike5_EE_Aplanck_B.clik product_id: "151902" +# Clipy commands -- string or list of strings, e.g. ["no TT", "only EE 217x217 500 800 lax"] +commands: # Aliases for automatic covariance matrix aliases: [lowE] # Speed in evaluations/second diff --git a/cobaya/likelihoods/planck_2018_lowl/TT_clik.yaml b/cobaya/likelihoods/planck_2018_lowl/TT_clik.yaml index f67d9905e..623c7c2ae 100644 --- a/cobaya/likelihoods/planck_2018_lowl/TT_clik.yaml +++ b/cobaya/likelihoods/planck_2018_lowl/TT_clik.yaml @@ -4,6 +4,8 @@ path: clik_file: baseline/plc_3.0/low_l/commander/commander_dx12_v3_2_29.clik product_id: "151902" +# Clipy commands -- string or list of strings, e.g. ["no TT", "only EE 217x217 500 800 lax"] +commands: # Aliases for automatic covariance matrix aliases: [lowl] # Speed in evaluations/second diff --git a/docs/likelihood_planck.rst b/docs/likelihood_planck.rst index 11e143978..ec588fb2d 100644 --- a/docs/likelihood_planck.rst +++ b/docs/likelihood_planck.rst @@ -12,28 +12,16 @@ You can find a description of the different original likelihoods in the The Planck 2018 baseline likelihoods defined here are: -- ``planck_2018_lowl.TT``: low-:math:`\ell` temperature (native python implementation) -- ``planck_2018_lowl.EE``: low-:math:`\ell` EE polarization (native python implementation) -- ``planck_2018_lowl.[TT|EE]_clik``: original clik versions of the above -- ``planck_2018_highl_plik.[TT|TTTEEE]``: ``plikHM`` high-:math:`\ell` temperature|temperature+polarization -- ``planck_2018_highl_plik.[TT|TTTEEE]_unbinned``: unbinned versions of the previous ones -- ``planck_2018_highl_plik.[TT|TTTEEE]_lite``: faster nuisance-marginalized versions of the previous (binned) ones -- ``planck_2018_highl_plik.[TT|TTTEEE]_lite_native``: Python native versions of the nuisance-marginalizes ones (more customizable) -- ``planck_2018_highl_CamSpec.[TT|TTTEEE][_native]``: ``clik`` and native Python versions of the alternative high-:math:`\ell` ``CamSpec`` likelihoods. -- ``planck_2018_lensing.clik``: lensing temperature+polarisation-based; official ``clik`` code. -- ``planck_2018_lensing.native``: lensing temperature+polarisation-based; native Python version (more customizable) -- ``planck_2018_lensing.CMBMarged``: CMB-marginalized, temperature+polarisation-based lensing likelihood; native Python version (more customizable). Do not combine with any of the ones above! - -Other more recent Planck likelihoods are: - -- ``planck_NPIPE_highl_CamSpec.[TT|TE|EE|TTEE|TTTEEE]``: latest native (bundled) python NPIPE (PR4) CamSpec high-:math:`\ell` likelihoods -- ``planck_2020_lollipop.[lowlE|lowlB|lowlEB]``: latest python NPIPE (PR4) Lollipop low-:math:`\ell` likelihoods. pip install from `GitHub `_ -- ``planck_2020_hillipop.[TT|TE|EE|TTTEEE]``: latest python NPIPE (PR4) Hillipop high-:math:`\ell` likelihoods. pip install from `GitHub `_ -- ``planckpr4lensing.[PlanckPR4Lensing|PlanckPR4LensingMarged]``: NPIPE lensing; pip install from `GitHub `_ -- ``planck_2018_highl_CamSpec2021.[TT|TTTEEE]``: native Python versions of high-:math:`\ell` ``CamSpec`` likelihoods (from `arXiv 1910.00483 `_). -- ``planck_2018_lowl.EE_sroll2``: low-:math:`\ell` EE polarization from 2019 Sroll2 analysis (native python) - -The combination of planck_2018_lowl.TT, planck_2018_lowl.EE, planck_NPIPE_highl_CamSpec.TTTEEE, planckpr4lensing, planck_2020_hillipop and planck_2020_lollipop can be run using the pure python without installing the 2018 clik likelihood package. +- ``planck_2018_lowl.[TT|EE]``: low-:math:`\ell` temperature-only or EE polarization-only (Cobaya-native python implementation) +- ``planck_2018_lowl.[TT|EE]_clik``: original ``clik`` versions of the above +- ``planck_2018_highl_plik.[TT|TE|EE|TTTEEE]``: ``plikHM`` high-:math:`\ell` temperature|polarization|temperature+polarization (``clik`` version) +- ``planck_2018_highl_plik.[TT|TTTEEE]_unbinned``: unbinned versions of the previous ones (``clik`` version) +- ``planck_2018_highl_plik.[TT|TTTEEE]_lite``: faster nuisance-marginalized versions of the previous (binned) ones (``clik`` version) +- ``planck_2018_highl_plik.[TT|TTTEEE]_lite_native``: Python Cobaya-native versions of the nuisance-marginalizes ones (more customizable) +- ``planck_2018_highl_CamSpec.[TT|TTTEEE]``: Cobaya-native Python versions of the alternative high-:math:`\ell` ``CamSpec`` likelihoods. +- ``planck_2018_lensing.clik``: lensing temperature+polarization-based (``clik`` version) +- ``planck_2018_lensing.native``: lensing temperature+polarization-based; Cobaya-native Python version (more customizable) +- ``planck_2018_lensing.CMBMarged``: CMB-marginalized, temperature+polarization-based lensing likelihood; Cobaya-native Python version (more customizable). Do not combine with any of the ones above! .. note:: @@ -45,39 +33,14 @@ The combination of planck_2018_lowl.TT, planck_2018_lowl.EE, planck_NPIPE_highl_ Planck Collaboration, `Planck 2018 results. VIII. Gravitational lensing` `(arXiv:1807.06210) `_ +Other more recent Planck likelihoods are: -The Planck 2015 likelihoods defined here are: - -- ``planck_2015_lowl`` -- ``planck_2015_lowTEB`` -- ``planck_2015_plikHM_TT`` -- ``planck_2015_plikHM_TT_unbinned`` -- ``planck_2015_plikHM_TTTEEE`` -- ``planck_2015_plikHM_TTTEEE_unbinned`` -- ``planck_2015_lensing`` -- ``planck_2015_lensing_cmblikes`` - (a native non-clik, more customizable version of the previous clik-wrapped one) - -.. note:: - - **If you use any of these likelihoods, please cite them as:** - |br| - **2015**: N. Aghanim et al, - `Planck 2015 results. XI. CMB power spectra, likelihoods, and robustness of parameters` - `(arXiv:1507.02704) `_ - - -.. warning:: - - The Planck 2015 likelihoods have been superseded by the 2018 release, and will - eventually be deprecated. - -.. warning:: - - Some likelihoods cannot be instantiated more than once, or some particular two at the same time. - This should have no consequences when calling ``cobaya-run`` from the shell, but will impede running - a sampler or defining a model more than once per Python interpreter session. - +- ``planck_NPIPE_highl_CamSpec.[TT|TE|EE|TTEE|TTTEEE]``: latest native (bundled) python NPIPE (PR4) CamSpec high-:math:`\ell` likelihoods +- ``planck_2020_lollipop.[lowlE|lowlB|lowlEB]``: latest python NPIPE (PR4) Lollipop low-:math:`\ell` likelihoods. pip install from `GitHub `_ +- ``planck_2020_hillipop.[TT|TE|EE|TTTEEE]``: latest python NPIPE (PR4) Hillipop high-:math:`\ell` likelihoods. pip install from `GitHub `_ +- ``planckpr4lensing.[PlanckPR4Lensing|PlanckPR4LensingMarged]``: NPIPE lensing; pip install from `GitHub `_ +- ``planck_2018_highl_CamSpec2021.[TT|TTTEEE]``: native Python versions of high-:math:`\ell` ``CamSpec`` likelihoods (from `arXiv 1910.00483 `_). +- ``planck_2018_lowl.EE_sroll2``: low-:math:`\ell` EE polarization from 2019 Sroll2 analysis (native python) Usage ----- @@ -90,6 +53,20 @@ so you don't have to care about listing them in the ``params`` block. The nuisance parameters and their default priors can be obtained as explained in :ref:`citations`. +Customization of ``clik``-based likelihoods +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Likelihoods based on the official ``clik`` code (``planck_2018_lowl.[TT|EE]_clik``, ``planck_2018_highl_plik.[TT|TE|EE|TTTEEE]][_unbinned|_lite]``, ``planck_2018_highl_plik.[TT|TTTEEE]``, ``planck_2018_lensing.clik``) now use the pure-Python `clipy implementation `_. + +These likelihoods can now take commands at initialization for cropping, notching or spectra from individual frequency maps. The syntax can be found in the ``README`` section of the `Github repo `_. + +To use any of this commands in Cobaya, simply pass a single one or a list of them, e.g.: + +.. code:: yaml + + likelihood: + planck_2018_highl_plik.TTTEEE: + commands: ["no TT", "only EE 217x217 500 800 lax"] Installation ------------ @@ -98,73 +75,25 @@ This likelihoods can be installed automatically as explained in :doc:`installati If you are following the instructions there (you should!), you don't need to read the rest of this section. -.. note:: - - For the 2018 clik likelihoods, by default the ``gfortran`` compiler will be used, - and the ``cfitsio`` library will be downloaded and compiled automatically. +Manual installation of the Planck 2018 likelihoods +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - If the installation fails, make sure that the packages ``liblapack3`` and - ``liblapack-dev`` are installed in the system (in Debian/Ubuntu, simply do - ``sudo apt install liblapack3 liblapack-dev``). +If you would like to install the Python-native ``clipy`` implementation by hand (e.g. with the purpose of modifying it), you can simply clone its `Github repo `_ anywhere and install this local copy with ``pip install .``. Alternatively, you can automatically install the last release with ``pip install clipy-like`` (NB: ``pip install clipy`` installs a completely different package!). In both cases, make sure that you can ``import clipy`` from anywhere. - If that did not solve the issue, check out specific instructions for some systems in the - ``readme.md`` file in the folder ``[packages_path]/code/planck/code/plc_3.0/plc-3.01``. +Now, download the required likelihood files from the `Planck Legacy Archive `_. For instance, if you want to reproduce the baseline Planck 2018 results, download the file ``COM_Likelihood_Data-baseline_R3.00.tar.gz`` and decompress it under e.g. ``/your/path/to/planck_2018``. - If you want to re-compile the Planck likelihood to your liking (e.g. with MKL), simply - go into the chosen external packages installation folder and re-run the ``python waf configure`` - and ``python waf install`` with the desired options, - substituting ``python`` by the Python of choice in your system. +Finally, download and decompress in that same folder the last release at +`this repo `_. -However, if you wish to install it manually or have a previous installation already in -your system, simply make sure that ``clik`` can be imported from anywhere, -and give **absolute** paths for each *clik file*, e.g.: +You can now invoke the Planck 2018 likelihoods as .. code-block:: yaml likelihood: planck_2018_lowl.TT_clik: - clik_file: /your/path/to/plc_3.0/low_l/commander/commander_dx12_v3_2_29.clik + clik_file: /your/path/to/planck_2018/plc_3.0/low_l/commander/commander_dx12_v3_2_29.clik planck_2018_highl_plik.TTTEEE: - clik_file: /your/path/to/plc_3.0/hi_l/plik/plik_rd12_HM_v22b_TTTEEE.clik - - -Manual installation of the Planck 2018 likelihoods -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -Assuming you are installing all your likelihoods under ``/path/to/likelihoods``: - -.. code:: bash - - $ cd /path/to/likelihoods - $ mkdir planck_2018 - $ cd planck_2018 - $ wget "https://pla.esac.esa.int/pla-sl/data-action?COSMOLOGY.COSMOLOGY_OID=151912" - $ tar xvjf "data-action?COSMOLOGY.COSMOLOGY_OID=151912" - $ rm "data-action?COSMOLOGY.COSMOLOGY_OID=151912" - $ cd code/plc_3.0/plc-3.01 - $ python waf configure # [options] - -If the last step failed, try adding the option ``--install_all_deps``. -It it doesn't solve it, follow the instructions in the ``readme.md`` -file in the ``plc_3.0`` folder. - -If you have Intel's compiler and Math Kernel Library (MKL), you may want to also add the -option ``--lapack_mkl=${MKLROOT}`` in the last line to make use of it. - -If ``python waf configure`` ended successfully run ``python waf install`` -in the same folder. You do **not** need to run ``clik_profile.sh``, as advised. - -Now, download the required likelihood files from the -`Planck Legacy Archive `_ (Europe) or the -`NASA/IPAC Archive `_ (US, **outdated!**). - -For instance, if you want to reproduce the baseline Planck 2018 results, -download the file ``COM_Likelihood_Data-baseline_R3.00.tar.gz`` -from any of the two links above, and decompress it under the ``planck_2018`` folder -that you created above. - -Finally, download and decompress in the ``planck_2018`` folder the last release at -`this repo `_. + clik_file: /your/path/to/planck_2018/plc_3.0/hi_l/plik/plik_rd12_HM_v22b_TTTEEE.clik Interface for official ``clik`` code diff --git a/tests/test_cosmo_bao.py b/tests/test_cosmo_bao.py index e55fc0cf3..3f9ea6ba4 100644 --- a/tests/test_cosmo_bao.py +++ b/tests/test_cosmo_bao.py @@ -3,7 +3,7 @@ from cobaya.component import get_component_class from .common_cosmo import body_of_test -from .test_cosmo_planck_2015 import derived_lowTEB_highTTTEEE, params_lowTEB_highTTTEEE +from .test_cosmo_quantities import derived_lowTEB_highTTTEEE, params_lowTEB_highTTTEEE # Tests both the bao.generic class, and class renaming for multiple instances diff --git a/tests/test_cosmo_des_y1.py b/tests/test_cosmo_des_y1.py index da7bb8024..506a9f50b 100644 --- a/tests/test_cosmo_des_y1.py +++ b/tests/test_cosmo_des_y1.py @@ -4,7 +4,7 @@ from cobaya.cosmo_input import planck_lss_precision from .common_cosmo import body_of_test -from .test_cosmo_planck_2015 import params_lowTEB_highTTTEEE +from .test_cosmo_quantities import params_lowTEB_highTTTEEE best_fit = deepcopy(params_lowTEB_highTTTEEE) info_camb = MappingProxyType({"camb": {"extra_args": planck_lss_precision["camb"]}}) diff --git a/tests/test_cosmo_planck_2015.py b/tests/test_cosmo_planck_2015.py deleted file mode 100644 index 329a837a0..000000000 --- a/tests/test_cosmo_planck_2015.py +++ /dev/null @@ -1,369 +0,0 @@ -# Tries to evaluate the likelihood at LCDM's best fit of Planck 2015, with CAMB and CLASS -from copy import deepcopy - -# Generating plots in tests -import matplotlib - -from cobaya.cosmo_input import planck_precision - -from .common_cosmo import body_of_test - -matplotlib.use("agg") - -# Downgrade of Planck 2018 precision/model - -cmb_precision = deepcopy(planck_precision) -cmb_precision["camb"].update( - {"halofit_version": "takahashi", "bbn_predictor": "BBN_fitting_parthenope"} -) -cmb_precision["classy"].update( - { - # Something changed in CLASS that makes halofit work differently that it did - # before, and hamcode gives results closer to the original chi2, computed with halofit - # "non linear": "halofit", - "non linear": "hmcode", - } -) - -# Derived parameters not understood by CLASS -# https://wiki.cosmos.esa.int/planckpla2015/images/b/b9/Parameter_tag_definitions_2015.pdf -classy_unknown = [ - "zstar", - "rstar", - "thetastar", - "DAstar", - "zdrag", - "kd", - "thetad", - "zeq", - "keq", - "thetaeq", - "thetarseq", - "DH", - "Y_p", -] - -# Small chi2 difference with CLASS (total still <0.5) -classy_extra_tolerance = 0.49 - - -def test_planck_2015_t_camb(packages_path, skip_not_installed): - best_fit = deepcopy(params_lowl_highTT) - best_fit.pop("H0") - info_likelihood = lik_info_lowl_highTT - info_theory = {"camb": {"extra_args": planck_precision["camb"]}} - best_fit_derived = derived_lowl_highTT - body_of_test( - packages_path, - best_fit, - info_likelihood, - info_theory, - chi2_lowl_highTT, - best_fit_derived, - skip_not_installed=skip_not_installed, - ) - - -def test_planck_2015_p_camb(packages_path, skip_not_installed): - best_fit = deepcopy(params_lowTEB_highTTTEEE) - best_fit.pop("H0") - info_likelihood = lik_info_lowTEB_highTTTEEE - info_theory = {"camb": {"extra_args": planck_precision["camb"]}} - best_fit_derived = derived_lowTEB_highTTTEEE - body_of_test( - packages_path, - best_fit, - info_likelihood, - info_theory, - chi2_lowTEB_highTTTEEE, - best_fit_derived, - skip_not_installed=skip_not_installed, - ) - - -def test_planck_2015_l_camb(packages_path, skip_not_installed): - best_fit = deepcopy(params_lensing) - best_fit.pop("H0") - info_likelihood = lik_info_lensing - info_theory = {"camb": {"extra_args": planck_precision["camb"]}} - best_fit_derived = derived_lensing - body_of_test( - packages_path, - best_fit, - info_likelihood, - info_theory, - chi2_lensing, - best_fit_derived, - skip_not_installed=skip_not_installed, - ) - - -def test_planck_2015_l2_camb(packages_path, skip_not_installed): - best_fit = deepcopy(params_lensing) - best_fit.pop("H0") - lik_name = "planck_2015_lensing_cmblikes" - clik_name = "planck_2015_lensing" - info_likelihood = {lik_name: lik_info_lensing[clik_name]} - chi2_lensing_cmblikes = deepcopy(chi2_lensing) - chi2_lensing_cmblikes[lik_name] = chi2_lensing[clik_name] - info_theory = {"camb": {"extra_args": planck_precision["camb"]}} - best_fit_derived = derived_lensing - body_of_test( - packages_path, - best_fit, - info_likelihood, - info_theory, - chi2_lensing_cmblikes, - best_fit_derived, - skip_not_installed=skip_not_installed, - ) - - -def test_planck_2015_t_classy(packages_path, skip_not_installed): - best_fit = deepcopy(params_lowl_highTT) - best_fit.pop("theta_MC_100") - info_likelihood = lik_info_lowl_highTT - info_theory = {"classy": {"extra_args": planck_precision["classy"]}} - best_fit_derived = deepcopy(derived_lowl_highTT) - for p in classy_unknown: - best_fit_derived.pop(p, None) - chi2_lowl_highTT_classy = deepcopy(chi2_lowl_highTT) - chi2_lowl_highTT_classy["tolerance"] += classy_extra_tolerance - body_of_test( - packages_path, - best_fit, - info_likelihood, - info_theory, - chi2_lowl_highTT_classy, - best_fit_derived, - skip_not_installed=skip_not_installed, - ) - - -def test_planck_2015_p_classy(packages_path, skip_not_installed): - best_fit = deepcopy(params_lowTEB_highTTTEEE) - best_fit.pop("theta_MC_100") - info_likelihood = lik_info_lowTEB_highTTTEEE - info_theory = {"classy": {"extra_args": planck_precision["classy"]}} - best_fit_derived = deepcopy(derived_lowTEB_highTTTEEE) - for p in classy_unknown: - best_fit_derived.pop(p, None) - chi2_lowTEB_highTTTEEE_classy = deepcopy(chi2_lowTEB_highTTTEEE) - chi2_lowTEB_highTTTEEE_classy["tolerance"] += classy_extra_tolerance - body_of_test( - packages_path, - best_fit, - info_likelihood, - info_theory, - chi2_lowTEB_highTTTEEE_classy, - best_fit_derived, - skip_not_installed=skip_not_installed, - ) - - -def test_planck_2015_l_classy(packages_path, skip_not_installed): - best_fit = deepcopy(params_lensing) - best_fit.pop("theta_MC_100") - info_likelihood = lik_info_lensing - info_theory = {"classy": {"extra_args": planck_precision["classy"]}} - best_fit_derived = deepcopy(derived_lensing) - for p in classy_unknown: - best_fit_derived.pop(p, None) - chi2_lensing_classy = deepcopy(chi2_lensing) - chi2_lensing_classy["tolerance"] += classy_extra_tolerance - body_of_test( - packages_path, - best_fit, - info_likelihood, - info_theory, - chi2_lensing_classy, - best_fit_derived, - skip_not_installed=skip_not_installed, - ) - - -# Temperature only ####################################################################### - -lik_info_lowl_highTT = {"planck_2015_lowl": None, "planck_2015_plikHM_TT": None} - -chi2_lowl_highTT = { - "planck_2015_lowl": 15.39, - "planck_2015_plikHM_TT": 761.09, - "tolerance": 0.1, -} - -params_lowl_highTT = { - # Sampled - "omegabh2": 0.02249139, - "omegach2": 0.1174684, - # only one of the next two is finally used! - "H0": 68.43994, # will be ignored in the CAMB case - "theta_MC_100": 1.041189, # will be ignored in the CLASS case - "tau": 0.1249913, - "logA": 3.179, - "ns": 0.9741693, - # Planck likelihood - "A_planck": 1.00027, - "A_cib_217": 61.1, - "xi_sz_cib": 0.56, - "A_sz": 6.84, - "ps_A_100_100": 242.9, - "ps_A_143_143": 43.0, - "ps_A_143_217": 46.1, - "ps_A_217_217": 104.1, - "ksz_norm": 0.00, - "gal545_A_100": 7.31, - "gal545_A_143": 9.07, - "gal545_A_143_217": 17.99, - "gal545_A_217": 82.9, - "calib_100T": 0.99796, - "calib_217T": 0.99555, -} - -derived_lowl_highTT = { - # param: [best_fit, sigma] - "H0": [params_lowl_highTT["H0"], 1.2], - "omegal": [0.6998, 0.016], - "omegam": [0.3002, 0.016], - "sigma8": [0.8610, 0.023], - "zrei": [13.76, 2.5], - # "YHe": [0.2454462, 0.0001219630], - # "Y_p": [0.2467729, 0.0001224069], - # "DH": [2.568606e-5, 0.05098625e-5], - "age": [13.7664, 0.048], - "zstar": [1089.55, 0.52], - "rstar": [145.00, 0.55], - "thetastar": [1.041358, 0.0005117986], - "DAstar": [13.924, 0.050], - "zdrag": [1060.05, 0.52], - "rdrag": [147.63, 0.53], - "kd": [0.14039, 0.00053], - "thetad": [0.160715, 0.00029], - "zeq": [3345, 58], - "keq": [0.010208, 0.00018], - "thetaeq": [0.8243, 0.011], - "thetarseq": [0.4550, 0.0058], -} - -# Best fit Polarization ################################################################## - -lik_info_lowTEB_highTTTEEE = { - "planck_2015_lowTEB": None, - "planck_2015_plikHM_TTTEEE": None, -} - -chi2_lowTEB_highTTTEEE = { - "planck_2015_lowTEB": 10496.93, - "planck_2015_plikHM_TTTEEE": 2431.65, - "tolerance": 0.15, -} - -params_lowTEB_highTTTEEE = { - # Sampled - "omegabh2": 0.02225203, - "omegach2": 0.1198657, - # only one of the next two is finally used! - "H0": 67.25, # will be ignored in the CAMB case - "theta_MC_100": 1.040778, # will be ignored in the CLASS case - "logA": 3.0929, - "ns": 0.9647522, - "tau": 0.07888604, - # Planck likelihood - "A_planck": 1.00029, - "A_cib_217": 66.4, - "xi_sz_cib": 0.13, - "A_sz": 7.17, - "ps_A_100_100": 255.0, - "ps_A_143_143": 40.1, - "ps_A_143_217": 36.4, - "ps_A_217_217": 98.7, - "ksz_norm": 0.00, - "gal545_A_100": 7.34, - "gal545_A_143": 8.97, - "gal545_A_143_217": 17.56, - "gal545_A_217": 81.9, - "galf_EE_A_100": 0.0813, - "galf_EE_A_100_143": 0.0488, - "galf_EE_A_100_217": 0.0995, - "galf_EE_A_143": 0.1002, - "galf_EE_A_143_217": 0.2236, - "galf_EE_A_217": 0.645, - "galf_TE_A_100": 0.1417, - "galf_TE_A_100_143": 0.1321, - "galf_TE_A_100_217": 0.307, - "galf_TE_A_143": 0.155, - "galf_TE_A_143_217": 0.338, - "galf_TE_A_217": 1.667, - "calib_100T": 0.99818, - "calib_217T": 0.99598, -} - -derived_lowTEB_highTTTEEE = { - # param: [best_fit, sigma] - "H0": [params_lowTEB_highTTTEEE["H0"], 0.66], - "omegal": [0.6844, 0.0091], - "omegam": [0.3156, 0.0091], - "sigma8": [0.8310, 0.013], - "zrei": [10.07, 1.6], - # "YHe": [0.2453409, 0.000072], - # "Y_p": [0.2466672, 0.000072], - # "DH": [2.6136e-5, 0.030e-5], - "age": [13.8133, 0.026], - "zstar": [1090.057, 0.30], - "rstar": [144.556, 0.32], - "thetastar": [1.040967, 0.00032], - "DAstar": [13.8867, 0.030], - "zdrag": [1059.666, 0.31], - "rdrag": [147.257, 0.31], - "kd": [0.140600, 0.00032], - "thetad": [0.160904, 0.00018], - "zeq": [3396.2, 33], - "keq": [0.010365, 0.00010], - "thetaeq": [0.8139, 0.0063], - "thetarseq": [0.44980, 0.0032], -} - -# Best fit lensing (from best combination with lowTEB+_highTTTEEE ######################## - -lik_info_lensing = {"planck_2015_lensing": None} - -chi2_lensing = {"planck_2015_lensing": 9.78, "tolerance": 0.09} - -params_lensing = { - # Sampled - "omegabh2": 0.022274, - "omegach2": 0.11913, - # only one of the next two is finally used! - "H0": 67.56, # will be ignored in the CAMB case - "theta_MC_100": 1.040867, # will be ignored in the CLASS case - "logA": 3.0600, - "ns": 0.96597, - "tau": 0.0639, - # Planck likelihood - "A_planck": 0.99995, -} - -derived_lensing = { - # param: [best_fit, sigma] - "H0": [params_lensing["H0"], 0.64], - "omegal": [0.6888, 0.0087], - "omegam": [0.3112, 0.0087], - "sigma8": [0.8153, 0.0087], - "zrei": [8.64, 1.3], - # "YHe": [0.245350, 0.000071], - # "Y_p": [0.246677, 0.000072], - # "DH": [2.6095e-5, 0.030e-5], - "age": [13.8051, 0.026], - "zstar": [1089.966, 0.29], - "rstar": [144.730, 0.31], - "thetastar": [1.041062, 0.00031], - "DAstar": [13.9022, 0.029], - "zdrag": [1059.6468, 0.31], - "rdrag": [147.428, 0.30], - "kd": [0.140437, 0.00032], - "thetad": [0.160911, 0.00018], - "zeq": [3379.1, 32], - "keq": [0.010313, 0.000096], - "thetaeq": [0.8171, 0.0060], - "thetarseq": [0.45146, 0.0031], -} diff --git a/tests/test_cosmo_planck_2018.py b/tests/test_cosmo_planck_2018.py index 3e6f0bb6e..4964648b2 100644 --- a/tests/test_cosmo_planck_2018.py +++ b/tests/test_cosmo_planck_2018.py @@ -41,7 +41,7 @@ def test_planck_2018_t_camb(packages_path, skip_not_installed, clik=False): best_fit = deepcopy(params_lowl_highTT_lensing) best_fit.pop("H0") - info_likelihood = lik_info_lowl_highTT_lensing + info_likelihood = lik_info_lowl_highTT_lensing.copy() chi2 = chi2_lowl_highTT_lensing.copy() if clik: info_likelihood["planck_2018_lowl.TT_clik"] = info_likelihood.pop( @@ -320,7 +320,7 @@ def test_planck_2018_p_CamSpec2021_camb(packages_path, skip_not_installed): def test_planck_2018_lcmbmarged_camb(packages_path, skip_not_installed): best_fit = params_lensing_cmbmarged - info_likelihood = lik_info_lensing_cmbmarged + info_likelihood = lik_info_lensing_cmbmarged.copy() info_theory = {"camb": {"extra_args": planck_precision["camb"]}} best_fit_derived = {} body_of_test( @@ -341,7 +341,7 @@ def test_planck_2018_t_classy(packages_path, skip_not_installed): best_fit = deepcopy(params_lowl_highTT_lensing) best_fit.pop("theta_MC_100") best_fit = params_lowl_highTT_lensing - info_likelihood = lik_info_lowl_highTT_lensing + info_likelihood = lik_info_lowl_highTT_lensing.copy() info_theory = {"classy": {"extra_args": planck_precision["classy"]}} best_fit_derived = deepcopy(derived_lowl_highTT_lensing) for p in classy_unknown: @@ -362,7 +362,7 @@ def test_planck_2018_t_classy(packages_path, skip_not_installed): def test_planck_2018_p_classy(packages_path, skip_not_installed): best_fit = deepcopy(params_lowTE_highTTTEEE_lensingcmblikes) best_fit.pop("theta_MC_100") - info_likelihood = lik_info_lowTE_highTTTEEE_lensingcmblikes + info_likelihood = lik_info_lowTE_highTTTEEE_lensingcmblikes.copy() info_theory = {"classy": {"extra_args": planck_precision["classy"]}} best_fit_derived = deepcopy(derived_lowTE_highTTTEEE_lensingcmblikes) for p in classy_unknown: diff --git a/tests/test_cosmo_quantities.py b/tests/test_cosmo_quantities.py index f94caefca..198c92936 100644 --- a/tests/test_cosmo_quantities.py +++ b/tests/test_cosmo_quantities.py @@ -13,7 +13,72 @@ from .common import process_packages_path from .conftest import install_test_wrapper -from .test_cosmo_planck_2015 import params_lowTEB_highTTTEEE + +# Best fit Planck 2015 as test point +params_lowTEB_highTTTEEE = { + # Sampled + "omegabh2": 0.02225203, + "omegach2": 0.1198657, + # only one of the next two is finally used! + "H0": 67.25, # will be ignored in the CAMB case + "theta_MC_100": 1.040778, # will be ignored in the CLASS case + "logA": 3.0929, + "ns": 0.9647522, + "tau": 0.07888604, + # Planck likelihood + "A_planck": 1.00029, + "A_cib_217": 66.4, + "xi_sz_cib": 0.13, + "A_sz": 7.17, + "ps_A_100_100": 255.0, + "ps_A_143_143": 40.1, + "ps_A_143_217": 36.4, + "ps_A_217_217": 98.7, + "ksz_norm": 0.00, + "gal545_A_100": 7.34, + "gal545_A_143": 8.97, + "gal545_A_143_217": 17.56, + "gal545_A_217": 81.9, + "galf_EE_A_100": 0.0813, + "galf_EE_A_100_143": 0.0488, + "galf_EE_A_100_217": 0.0995, + "galf_EE_A_143": 0.1002, + "galf_EE_A_143_217": 0.2236, + "galf_EE_A_217": 0.645, + "galf_TE_A_100": 0.1417, + "galf_TE_A_100_143": 0.1321, + "galf_TE_A_100_217": 0.307, + "galf_TE_A_143": 0.155, + "galf_TE_A_143_217": 0.338, + "galf_TE_A_217": 1.667, + "calib_100T": 0.99818, + "calib_217T": 0.99598, +} + +derived_lowTEB_highTTTEEE = { + # param: [best_fit, sigma] + "H0": [params_lowTEB_highTTTEEE["H0"], 0.66], + "omegal": [0.6844, 0.0091], + "omegam": [0.3156, 0.0091], + "sigma8": [0.8310, 0.013], + "zrei": [10.07, 1.6], + # "YHe": [0.2453409, 0.000072], + # "Y_p": [0.2466672, 0.000072], + # "DH": [2.6136e-5, 0.030e-5], + "age": [13.8133, 0.026], + "zstar": [1090.057, 0.30], + "rstar": [144.556, 0.32], + "thetastar": [1.040967, 0.00032], + "DAstar": [13.8867, 0.030], + "zdrag": [1059.666, 0.31], + "rdrag": [147.257, 0.31], + "kd": [0.140600, 0.00032], + "thetad": [0.160904, 0.00018], + "zeq": [3396.2, 33], + "keq": [0.010365, 0.00010], + "thetaeq": [0.8139, 0.0063], + "thetarseq": [0.44980, 0.0032], +} fiducial_parameters = deepcopy(params_lowTEB_highTTTEEE) redshifts = [100, 10, 1, 0] diff --git a/tests/test_cosmo_sn.py b/tests/test_cosmo_sn.py index 57b3f5c53..e60066a82 100644 --- a/tests/test_cosmo_sn.py +++ b/tests/test_cosmo_sn.py @@ -3,7 +3,7 @@ from cobaya.typing import empty_dict from .common_cosmo import body_of_test -from .test_cosmo_planck_2015 import params_lowTEB_highTTTEEE +from .test_cosmo_quantities import params_lowTEB_highTTTEEE def _test_sn(