diff --git a/src/rail/estimation/algos/bpz_lite.py b/src/rail/estimation/algos/bpz_lite.py index 199d3ec..1480123 100644 --- a/src/rail/estimation/algos/bpz_lite.py +++ b/src/rail/estimation/algos/bpz_lite.py @@ -138,7 +138,13 @@ def _find_fractions(self): self.fo_arr = np.array([frac_results[0]]) self.kt_arr = np.array([frac_results[1]]) else: - self.fo_arr = frac_results[:self.ntyp - 1] + tmpfo = frac_results[:self.ntyp - 1] + # minimizer can sometimes give fractions greater than one, if so normalize + fracnorm = np.sum(tmpfo) + if fracnorm > 1.: # pragma: no cover + print("bad norm for f0, normalizing") + tmpfo /= fracnorm + self.fo_arr = tmpfo self.kt_arr = frac_results[self.ntyp - 1:] def _dndz_likelihood(self, params):