diff --git a/pyzebra/app/panel_ccl_integrate.py b/pyzebra/app/panel_ccl_integrate.py index e3ea304..5bdbc17 100644 --- a/pyzebra/app/panel_ccl_integrate.py +++ b/pyzebra/app/panel_ccl_integrate.py @@ -186,9 +186,16 @@ def create(): fit = scan.get("fit") if fit is not None: - comps = fit.eval_components() plot_fit_source.data.update(x=x, y=fit.best_fit) - plot_bkg_source.data.update(x=x, y=comps["f0_"]) + + for i, model in enumerate(fit_params): + if "background" in model: + comps = fit.eval_components() + plot_bkg_source.data.update(x=x, y=comps[f"f{i}_"]) + break + else: + plot_bkg_source.data.update(x=[], y=[]) + fit_output_textinput.value = fit.fit_report() # numfit_min, numfit_max = fit["numfit"] diff --git a/pyzebra/app/panel_param_study.py b/pyzebra/app/panel_param_study.py index 1d8dbb9..a34ede0 100644 --- a/pyzebra/app/panel_param_study.py +++ b/pyzebra/app/panel_param_study.py @@ -204,9 +204,16 @@ def create(): fit = scan.get("fit") if fit is not None: - comps = fit.eval_components() plot_fit_source.data.update(x=x, y=fit.best_fit) - plot_bkg_source.data.update(x=x, y=comps["f0_"]) + + for i, model in enumerate(fit_params): + if "background" in model: + comps = fit.eval_components() + plot_bkg_source.data.update(x=x, y=comps[f"f{i}_"]) + break + else: + plot_bkg_source.data.update(x=[], y=[]) + fit_output_textinput.value = fit.fit_report() # numfit_min, numfit_max = fit["numfit"]