From 98a9a2bad29f890cc980af71d29f9b692b9c4d4c Mon Sep 17 00:00:00 2001 From: Robert Hammann Date: Fri, 11 Oct 2024 14:35:06 +0200 Subject: [PATCH] base decision on dont_hash_settings --- blueice/likelihood.py | 6 ++---- blueice/source.py | 2 -- tests/test_likelihood.py | 2 -- 3 files changed, 2 insertions(+), 8 deletions(-) diff --git a/blueice/likelihood.py b/blueice/likelihood.py index f3fdaba..ba8eb76 100644 --- a/blueice/likelihood.py +++ b/blueice/likelihood.py @@ -115,10 +115,8 @@ def source_shape_parameters(self): """Dict of sources with shape parameters. source name -> dict of shape parameters.""" source_shape_parameters = OrderedDict() for sn, source in zip(self.source_name_list, self.base_model.sources): - parameter_names = source.parameters - if parameter_names is None: - raise ValueError("The `parameters` of each source need to be specified when using `source_wise_interpolation`.") - shape_parameters = OrderedDict({k: v for k, v in self.shape_parameters.items() if k in parameter_names}) + dont_hash_settings = source.config['dont_hash_settings'] + shape_parameters = OrderedDict({k: v for k, v in self.shape_parameters.items() if k not in dont_hash_settings}) if shape_parameters: source_shape_parameters[sn] = shape_parameters return source_shape_parameters diff --git a/blueice/source.py b/blueice/source.py index 9bcbeb9..145a260 100644 --- a/blueice/source.py +++ b/blueice/source.py @@ -86,8 +86,6 @@ def __init__(self, config, *args, **kwargs): self.name = c['name'] del c['name'] - self.parameters = c.pop('parameters', None) - # events_per_day and fraction_in_range may be modified / set properly for the first time later (see comments # in 'defaults' above) if hasattr(self, 'events_per_day'): diff --git a/tests/test_likelihood.py b/tests/test_likelihood.py index 20dbf9b..d67d79c 100644 --- a/tests/test_likelihood.py +++ b/tests/test_likelihood.py @@ -106,8 +106,6 @@ def test_source_wise_interpolation(): ret_1 = lf(full_output=True, mu=1) config["source_wise_interpolation"] = True - # We need to specify all parameters used by each source - config["sources"][0]["parameters"] = ["mu", "sigma", "strlen_multiplier", "some_multiplier", "s0_rate_multiplier"] lf_source_wise = UnbinnedLogLikelihood(config) lf_source_wise.add_shape_parameter("mu", anchors={-2:-2, 0:0, 2:2}) lf_source_wise.prepare()