diff --git a/autofit/interpolator/abstract.py b/autofit/interpolator/abstract.py index 51f0c6453..164566b99 100644 --- a/autofit/interpolator/abstract.py +++ b/autofit/interpolator/abstract.py @@ -95,6 +95,11 @@ def __getitem__(self, item: Equality) -> ModelInstance: value_map = self._value_map(item.path) x = sorted(value_map) + if not self.instances: + raise IndexError( + "Cannot interpolate: no instances have been added to the interpolator." + ) + instance = self.instances[0] new_instance = copy.copy(instance) diff --git a/autofit/non_linear/grid/grid_search/result.py b/autofit/non_linear/grid/grid_search/result.py index d85dcab27..39ecc1b99 100644 --- a/autofit/non_linear/grid/grid_search/result.py +++ b/autofit/non_linear/grid/grid_search/result.py @@ -303,7 +303,12 @@ def log_evidences(self, relative_to_value: float = 0.0) -> GridList: The value to subtract from every log likelihood, for example if Bayesian model comparison is performed on the grid search and the subtracted value is the maximum log likelihood of a previous search. """ - return [sample.log_evidence - relative_to_value for sample in self.samples] + return [ + sample.log_evidence - relative_to_value + if sample.log_evidence is not None + else None + for sample in self.samples + ] def figure_of_merits( self, use_log_evidences: bool, relative_to_value: float = 0.0