From c9cd96c521523c18fab0781acba59d163d03cd0d Mon Sep 17 00:00:00 2001 From: Ivan Usov Date: Tue, 20 Apr 2021 18:25:14 +0200 Subject: [PATCH] Set lower and upper bounds for center and sigma --- pyzebra/ccl_process.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/pyzebra/ccl_process.py b/pyzebra/ccl_process.py index 3ccd7e1..6af7844 100644 --- a/pyzebra/ccl_process.py +++ b/pyzebra/ccl_process.py @@ -128,6 +128,17 @@ def fit_scan(scan, model_dict, fit_from=None, fit_to=None): else: param_hints[hint_name] = tmp + if "center" in param_name: + if np.isneginf(param_hints["min"]): + param_hints["min"] = np.min(x_fit) + + if np.isposinf(param_hints["max"]): + param_hints["max"] = np.max(x_fit) + + if "sigma" in param_name: + if np.isposinf(param_hints["max"]): + param_hints["max"] = np.max(x_fit) - np.min(x_fit) + _model.set_param_hint(param_name, **param_hints) if model is None: