Skip to content

Commit

Permalink
base decision on dont_hash_settings
Browse files Browse the repository at this point in the history
  • Loading branch information
hammannr committed Oct 11, 2024
1 parent cb20f4a commit 98a9a2b
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 8 deletions.
6 changes: 2 additions & 4 deletions blueice/likelihood.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 0 additions & 2 deletions blueice/source.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'):
Expand Down
2 changes: 0 additions & 2 deletions tests/test_likelihood.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 98a9a2b

Please sign in to comment.