Enable export function

This commit is contained in:
usov_i 2021-03-01 11:48:13 +01:00
parent a65708004b
commit c7b05d252f
3 changed files with 16 additions and 10 deletions

View File

@ -477,7 +477,7 @@ def create():
preview_output_textinput.value = exported_content
preview_output_button = Button(label="Preview file", default_size=200, disabled=True)
preview_output_button = Button(label="Preview file", default_size=200)
preview_output_button.on_click(preview_output_button_callback)
hkl_precision_select = Select(
@ -509,9 +509,7 @@ def create():
cont = ""
js_data[ext].data.update(cont=[cont], ext=[ext])
save_button = Button(
label="Download file", button_type="success", default_size=200, disabled=True
)
save_button = Button(label="Download file", button_type="success", default_size=200)
save_button.on_click(save_button_callback)
save_button.js_on_click(CustomJS(args={"js_data": js_data[".comm"]}, code=javaScript))
save_button.js_on_click(CustomJS(args={"js_data": js_data[".incomm"]}, code=javaScript))

View File

@ -552,7 +552,7 @@ def create():
preview_output_textinput.value = exported_content
preview_output_button = Button(label="Preview file", default_size=220, disabled=True)
preview_output_button = Button(label="Preview file", default_size=220)
preview_output_button.on_click(preview_output_button_callback)
def save_button_callback():
@ -580,9 +580,7 @@ def create():
cont = ""
js_data[ext].data.update(cont=[cont], ext=[ext])
save_button = Button(
label="Download file", button_type="success", default_size=220, disabled=True
)
save_button = Button(label="Download file", button_type="success", default_size=220)
save_button.on_click(save_button_callback)
save_button.js_on_click(CustomJS(args={"js_data": js_data[".comm"]}, code=javaScript))
save_button.js_on_click(CustomJS(args={"js_data": js_data[".incomm"]}, code=javaScript))

View File

@ -259,8 +259,18 @@ def export_1D(data, path, area_method=AREA_METHODS[0], lorentz=False, hkl_precis
else:
hkl_str = f"{h:8.{hkl_precision}f}{k:8.{hkl_precision}f}{l:8.{hkl_precision}f}"
area_n = scan["fit"][area_method].n
area_s = scan["fit"][area_method].s
for name, param in scan["fit"].params.items():
if "amplitude" in name:
area_n = param.value
area_s = param.stderr
break
else:
area_n = 0
area_s = 0
if area_n is None or area_s is None:
print(f"Couldn't export scan: {scan['idx']}")
continue
# apply lorentz correction to area
if lorentz: