From 5dbb208e92ffac8174b51a6222757208fa5105d5 Mon Sep 17 00:00:00 2001 From: Ivan Usov Date: Fri, 26 Feb 2021 11:31:18 +0100 Subject: [PATCH] Correctly plot background component --- pyzebra/app/panel_ccl_integrate.py | 11 +++++++++-- pyzebra/app/panel_param_study.py | 11 +++++++++-- 2 files changed, 18 insertions(+), 4 deletions(-) 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"]