diff --git a/pyzebra/app/panel_ccl_integrate.py b/pyzebra/app/panel_ccl_integrate.py index f12c155..31d0c93 100644 --- a/pyzebra/app/panel_ccl_integrate.py +++ b/pyzebra/app/panel_ccl_integrate.py @@ -495,13 +495,9 @@ def create(): fit_button = Button(label="Fit Current", default_size=145) fit_button.on_click(fit_button_callback) - def area_method_radiobutton_callback(_attr, _old, new): - det_data["meta"]["area_method"] = AREA_METHODS[new] - area_method_radiobutton = RadioButtonGroup( labels=["Fit area", "Int area"], active=0, default_size=145 ) - area_method_radiobutton.on_change("active", area_method_radiobutton_callback) bin_size_spinner = Spinner(title="Bin size:", value=1, low=1, step=1, default_size=145) @@ -520,6 +516,7 @@ def create(): pyzebra.export_1D( export_data, temp_file, + area_method=AREA_METHODS[int(area_method_radiobutton.active)], lorentz=lorentz_toggle.active, hkl_precision=int(hkl_precision_select.value), ) @@ -551,6 +548,7 @@ def create(): pyzebra.export_1D( export_data, temp_file, + area_method=AREA_METHODS[int(area_method_radiobutton.active)], lorentz=lorentz_toggle.active, hkl_precision=int(hkl_precision_select.value), ) diff --git a/pyzebra/app/panel_param_study.py b/pyzebra/app/panel_param_study.py index 2d13c4d..92457aa 100644 --- a/pyzebra/app/panel_param_study.py +++ b/pyzebra/app/panel_param_study.py @@ -601,13 +601,9 @@ def create(): fit_button = Button(label="Fit Current", default_size=145) fit_button.on_click(fit_button_callback) - def area_method_radiobutton_callback(_attr, _old, new): - det_data["meta"]["area_method"] = AREA_METHODS[new] - area_method_radiobutton = RadioButtonGroup( labels=["Fit area", "Int area"], active=0, default_size=145, ) - area_method_radiobutton.on_change("active", area_method_radiobutton_callback) bin_size_spinner = Spinner(title="Bin size:", value=1, low=1, step=1, default_size=145) @@ -623,7 +619,12 @@ def create(): if not export: del export_data["scan"][s] - pyzebra.export_1D(export_data, temp_file, lorentz=lorentz_toggle.active) + pyzebra.export_1D( + export_data, + temp_file, + area_method=AREA_METHODS[int(area_method_radiobutton.active)], + lorentz=lorentz_toggle.active, + ) exported_content = "" for ext in (".comm", ".incomm"): @@ -645,7 +646,12 @@ def create(): if not export: del export_data["scan"][s] - pyzebra.export_1D(export_data, temp_file, lorentz=lorentz_toggle.active) + pyzebra.export_1D( + export_data, + temp_file, + area_method=AREA_METHODS[int(area_method_radiobutton.active)], + lorentz=lorentz_toggle.active, + ) for ext in (".comm", ".incomm"): fname = temp_file + ext diff --git a/pyzebra/ccl_io.py b/pyzebra/ccl_io.py index a6a50e3..e528966 100644 --- a/pyzebra/ccl_io.py +++ b/pyzebra/ccl_io.py @@ -218,12 +218,11 @@ def parse_1D(fileobj, data_type): s["indices"] = "real" metadata["data_type"] = data_type - metadata["area_method"] = AREA_METHODS[0] return {"meta": metadata, "scan": scan} -def export_1D(data, path, lorentz=False, hkl_precision=2): +def export_1D(data, path, area_method=AREA_METHODS[0], lorentz=False, hkl_precision=2): """Exports data in the .comm/.incomm format Scans with integer/real hkl values are saved in .comm/.incomm files correspondingly. If no scans @@ -245,7 +244,6 @@ def export_1D(data, path, lorentz=False, hkl_precision=2): else: # scan["indices"] == "real" hkl_str = f"{h:8.{hkl_precision}f}{k:8.{hkl_precision}f}{l:8.{hkl_precision}f}" - area_method = data["meta"]["area_method"] area_n = scan["fit"][area_method].n area_s = scan["fit"][area_method].s