Add a temporary workaround for integral area

This commit is contained in:
usov_i 2021-05-11 14:22:55 +02:00
parent a2fceffc1b
commit e99edbaf72
2 changed files with 8 additions and 4 deletions

View File

@ -371,7 +371,6 @@ def create():
# ("Pseudo Voigt1", "pseudovoigt1"),
],
width=145,
disabled=True,
)
fitparams_add_dropdown.on_click(fitparams_add_dropdown_callback)
@ -406,7 +405,7 @@ def create():
fitparams_select.value = []
fitparams_remove_button = Button(label="Remove fit function", width=145, disabled=True)
fitparams_remove_button = Button(label="Remove fit function", width=145)
fitparams_remove_button.on_click(fitparams_remove_button_callback)
def fitparams_factory(function):

View File

@ -3,6 +3,7 @@ import re
from collections import defaultdict
import numpy as np
from scipy.integrate import simpson, trapezoid
META_VARS_STR = (
"instrument",
@ -277,8 +278,12 @@ def export_1D(data, path, area_method=AREA_METHODS[0], lorentz=False, hkl_precis
break
else:
# no peak functions in a fit model
area_n = np.nan
area_s = np.nan
# assume this is a background fit, so do numeric integration
y_val = scan["Counts"]
x_val = scan[scan["scan_motor"]]
y_bkg = scan["fit"].eval(x=x_val)
area_n = simpson(y_val, x=x_val) - trapezoid(y_bkg, x=x_val)
area_s = np.sqrt(area_n)
# apply lorentz correction to area
if lorentz: