From 6aefe739b9c4a3705a217f5e424a300e7a842e2f Mon Sep 17 00:00:00 2001 From: Antony Lewis Date: Wed, 14 Aug 2024 12:27:10 +0100 Subject: [PATCH] renames/tidy --- mflike/EE.yaml | 2 +- mflike/TE.yaml | 2 +- mflike/TT.yaml | 4 ++-- mflike/TTTEEE.yaml | 2 +- mflike/{params_EE.yaml => fg_EE.yaml} | 0 mflike/{params_TE.yaml => fg_TE.yaml} | 0 mflike/{params_TT.yaml => fg_TT.yaml} | 0 mflike/{params_common.yaml => fg_common.yaml} | 0 mflike/foreground.py | 8 ++++---- mflike/mflike.py | 17 ----------------- .../{calib_common.yaml => mflike_common.yaml} | 0 11 files changed, 9 insertions(+), 26 deletions(-) rename mflike/{params_EE.yaml => fg_EE.yaml} (100%) rename mflike/{params_TE.yaml => fg_TE.yaml} (100%) rename mflike/{params_TT.yaml => fg_TT.yaml} (100%) rename mflike/{params_common.yaml => fg_common.yaml} (100%) rename mflike/{calib_common.yaml => mflike_common.yaml} (100%) diff --git a/mflike/EE.yaml b/mflike/EE.yaml index 1b45eb8..a185e28 100644 --- a/mflike/EE.yaml +++ b/mflike/EE.yaml @@ -8,4 +8,4 @@ defaults: scales: EE: [ 30, 9000 ] -params: !defaults [ calib_common, calib_E ] \ No newline at end of file +params: !defaults [ mflike_common, calib_E ] \ No newline at end of file diff --git a/mflike/TE.yaml b/mflike/TE.yaml index a81c8ae..31c3fb9 100644 --- a/mflike/TE.yaml +++ b/mflike/TE.yaml @@ -12,4 +12,4 @@ defaults: # instead of TE and ET separately. symmetrize: false -params: !defaults [ calib_common, calib_T, calib_E ] +params: !defaults [ mflike_common, calib_T, calib_E ] diff --git a/mflike/TT.yaml b/mflike/TT.yaml index 7134810..c33993b 100644 --- a/mflike/TT.yaml +++ b/mflike/TT.yaml @@ -1,6 +1,6 @@ # Specify default set of spectra and scale cuts # to be used -requested_cls: [ "tt", "te", "ee" ] +requested_cls: [ "tt" ] defaults: # Which spectra? polarizations: [ TT ] @@ -8,5 +8,5 @@ defaults: scales: TT: [ 30, 9000 ] -params: !defaults [ calib_common, calib_T ] +params: !defaults [ mflike_common, calib_T ] diff --git a/mflike/TTTEEE.yaml b/mflike/TTTEEE.yaml index f049990..9a0b572 100644 --- a/mflike/TTTEEE.yaml +++ b/mflike/TTTEEE.yaml @@ -14,4 +14,4 @@ defaults: # instead of TE and ET separately. symmetrize: false -params: !defaults [ calib_common, calib_T, calib_E ] +params: !defaults [ mflike_common, calib_T, calib_E ] diff --git a/mflike/params_EE.yaml b/mflike/fg_EE.yaml similarity index 100% rename from mflike/params_EE.yaml rename to mflike/fg_EE.yaml diff --git a/mflike/params_TE.yaml b/mflike/fg_TE.yaml similarity index 100% rename from mflike/params_TE.yaml rename to mflike/fg_TE.yaml diff --git a/mflike/params_TT.yaml b/mflike/fg_TT.yaml similarity index 100% rename from mflike/params_TT.yaml rename to mflike/fg_TT.yaml diff --git a/mflike/params_common.yaml b/mflike/fg_common.yaml similarity index 100% rename from mflike/params_common.yaml rename to mflike/fg_common.yaml diff --git a/mflike/foreground.py b/mflike/foreground.py index ada0beb..c719452 100644 --- a/mflike/foreground.py +++ b/mflike/foreground.py @@ -39,10 +39,9 @@ """ import os - import numpy as np from cobaya.log import LoggedError -from cobaya.theory import Provider, Theory +from cobaya.theory import Theory from cobaya.yaml import yaml_load from scipy import constants @@ -81,13 +80,14 @@ class ForegroundParamsTheory(Theory): @classmethod def get_class_options(cls, input_options={}): + options = super().get_class_options().copy() if cls is ForegroundParamsTheory and ( param_requested_cls := input_options.get('requested_cls', ['tt', 'te', 'ee'])) \ or ('requested_cls' not in input_options and (param_requested_cls := options.get('requested_cls'))): - params = yaml_load(cls.get_text_file_content('params_common.yaml')) + params = yaml_load(cls.get_text_file_content('fg_common.yaml')) for spec in param_requested_cls: - params |= yaml_load(cls.get_text_file_content('params_%s.yaml' % spec.upper())) + params |= yaml_load(cls.get_text_file_content('fg_%s.yaml' % spec.upper())) options["params"] = params return options diff --git a/mflike/mflike.py b/mflike/mflike.py index a3bf8a8..1b1c1a7 100644 --- a/mflike/mflike.py +++ b/mflike/mflike.py @@ -94,23 +94,6 @@ def initialize(self): # Read data self._prepare_data() - # Setting mode given likelihood name - likelihood_name = self.__class__.__name__ - self.mode = likelihood_name.replace("MFLike_", "").lower() - if self.mode not in ["tt", "te", "ee", "ttteee"]: - raise LoggedError( - self.log, - f"This likelihood mode ({self.mode}) is not supported." - ) - - # State requisites to the theory code - requested_cls = { - "tt": ["tt"], - "te": ["te"], - "ee": ["ee"], - "ttteee": ["tt", "te", "ee"], - } - self.requested_cls = requested_cls[self.mode] self.lmax_theory = self.lmax_theory or 9000 self.log.debug(f"Maximum multipole value: {self.lmax_theory}") diff --git a/mflike/calib_common.yaml b/mflike/mflike_common.yaml similarity index 100% rename from mflike/calib_common.yaml rename to mflike/mflike_common.yaml