diff --git a/firecrown/likelihood/likelihood.py b/firecrown/likelihood/likelihood.py index 0945174f3..7b466f77c 100644 --- a/firecrown/likelihood/likelihood.py +++ b/firecrown/likelihood/likelihood.py @@ -36,9 +36,9 @@ class Likelihood(Updatable): these methods, and provide other abstract methods for their subclasses to implement. """ - def __init__(self) -> None: + def __init__(self, parameter_prefix: Optional[str] = None) -> None: """Default initialization for a base Likelihood object.""" - super().__init__() + super().__init__(parameter_prefix=parameter_prefix) self.predicted_data_vector: Optional[npt.NDArray[np.double]] = None self.measured_data_vector: Optional[npt.NDArray[np.double]] = None diff --git a/tests/connector/cobaya/test_model_likelihood.py b/tests/connector/cobaya/test_model_likelihood.py index 7c50a928a..c6446544d 100644 --- a/tests/connector/cobaya/test_model_likelihood.py +++ b/tests/connector/cobaya/test_model_likelihood.py @@ -214,7 +214,7 @@ def test_sampler_parameter_likelihood_missing(fiducial_params): "lk_connector": { "external": LikelihoodConnector, "firecrownIni": "tests/likelihood/lkdir/lk_sampler_parameter.py", - "build_parameters": NamedParameters({"sacc_tracer": "my_prefix"}), + "build_parameters": NamedParameters({"parameter_prefix": "my_prefix"}), } }, "theory": { @@ -235,7 +235,7 @@ def test_sampler_parameter_likelihood(fiducial_params): "lk_connector": { "external": LikelihoodConnector, "firecrownIni": "tests/likelihood/lkdir/lk_sampler_parameter.py", - "build_parameters": NamedParameters({"sacc_tracer": "my_prefix"}), + "build_parameters": NamedParameters({"parameter_prefix": "my_prefix"}), } }, "theory": { diff --git a/tests/likelihood/lkdir/lk_sampler_parameter.py b/tests/likelihood/lkdir/lk_sampler_parameter.py index 5bc943c9b..32a3772b9 100644 --- a/tests/likelihood/lkdir/lk_sampler_parameter.py +++ b/tests/likelihood/lkdir/lk_sampler_parameter.py @@ -1,6 +1,6 @@ """ Provides a trivial likelihood factory function for testing purposes. -The likelihood created requires a string parameter named "sacc_tracer" +The likelihood created requires a string parameter named "parameter_prefix" and has a sampler parameter named "sampler_param0". """ from firecrown.likelihood.likelihood import NamedParameters diff --git a/tests/likelihood/lkdir/lkmodule.py b/tests/likelihood/lkdir/lkmodule.py index d18a46f34..76d46a195 100644 --- a/tests/likelihood/lkdir/lkmodule.py +++ b/tests/likelihood/lkdir/lkmodule.py @@ -54,10 +54,9 @@ class SamplerParameterLikelihood(Likelihood): def __init__(self, params: NamedParameters): """Initialize the SamplerParameterLikelihood by reading the specificed - sacc_tracer value and creates a sampler parameter called "sampler_param0". + parameter_prefix value and creates a sampler parameter called "sampler_param0". """ - super().__init__() - self.sacc_tracer = params.get_string("sacc_tracer") + super().__init__(parameter_prefix=params.get_string("parameter_prefix")) self.sampler_param0 = parameters.create() def read(self, sacc_data: sacc.Sacc) -> None: