Plot fit results on denser grid

This commit is contained in:
usov_i 2021-02-26 17:53:44 +01:00
parent 966d6349df
commit af1336df78
2 changed files with 8 additions and 6 deletions

View File

@ -187,12 +187,13 @@ def create():
fit = scan.get("fit") fit = scan.get("fit")
if fit is not None: if fit is not None:
plot_fit_source.data.update(x=x, y=fit.best_fit) x_fit = np.linspace(x[0], x[-1], 100)
plot_fit_source.data.update(x=x_fit, y=fit.eval(x=x_fit))
for i, model in enumerate(fit_params): for i, model in enumerate(fit_params):
if "background" in model: if "background" in model:
comps = fit.eval_components() comps = fit.eval_components(x=x_fit)
plot_bkg_source.data.update(x=x, y=comps[f"f{i}_"]) plot_bkg_source.data.update(x=x_fit, y=comps[f"f{i}_"])
break break
else: else:
plot_bkg_source.data.update(x=[], y=[]) plot_bkg_source.data.update(x=[], y=[])

View File

@ -205,12 +205,13 @@ def create():
fit = scan.get("fit") fit = scan.get("fit")
if fit is not None: if fit is not None:
plot_fit_source.data.update(x=x, y=fit.best_fit) x_fit = np.linspace(x[0], x[-1], 100)
plot_fit_source.data.update(x=x_fit, y=fit.eval(x=x_fit))
for i, model in enumerate(fit_params): for i, model in enumerate(fit_params):
if "background" in model: if "background" in model:
comps = fit.eval_components() comps = fit.eval_components(x=x_fit)
plot_bkg_source.data.update(x=x, y=comps[f"f{i}_"]) plot_bkg_source.data.update(x=x_fit, y=comps[f"f{i}_"])
break break
else: else:
plot_bkg_source.data.update(x=[], y=[]) plot_bkg_source.data.update(x=[], y=[])