diff --git a/pyzebra/app/panel_ccl_integrate.py b/pyzebra/app/panel_ccl_integrate.py index 114ba35..e92e150 100644 --- a/pyzebra/app/panel_ccl_integrate.py +++ b/pyzebra/app/panel_ccl_integrate.py @@ -38,7 +38,6 @@ from bokeh.models import ( Spinner, TableColumn, TextAreaInput, - TextInput, WheelZoomTool, Whisker, ) @@ -202,7 +201,7 @@ def create(): def monitor_spinner_callback(_attr, old, new): if det_data: pyzebra.normalize_dataset(det_data, new) - _update_plot(_get_selected_scan()) + _update_plot() monitor_spinner = Spinner(title="Monitor:", mode="int", value=100_000, low=1, width=145) monitor_spinner.on_change("value", monitor_spinner_callback) @@ -212,7 +211,8 @@ def create(): export = [scan.get("active", True) for scan in det_data] scan_table_source.data.update(fit=fit_ok, export=export) - def _update_plot(scan): + def _update_plot(): + scan = _get_selected_scan() scan_motor = scan["scan_motor"] y = scan["counts"] @@ -322,13 +322,14 @@ def create(): # skip unnecessary update caused by selection drop return - _update_plot(det_data[new[0]]) + _update_plot() def scan_table_source_callback(_attr, _old, _new): _update_preview() scan_table_source = ColumnDataSource(dict(scan=[], hkl=[], fit=[], export=[])) scan_table_source.on_change("data", scan_table_source_callback) + scan_table_source.selected.on_change("indices", scan_table_select_callback) scan_table = DataTable( source=scan_table_source, @@ -344,8 +345,6 @@ def create(): editable=True, ) - scan_table_source.selected.on_change("indices", scan_table_select_callback) - def _get_selected_scan(): return det_data[scan_table_source.selected.indices[0]] @@ -361,7 +360,7 @@ def create(): pyzebra.merge_scans(scan_into, scan_from) _update_datatable() - _update_plot(_get_selected_scan()) + _update_plot() merge_button = Button(label="Merge into current", width=145) merge_button.on_click(merge_button_callback) @@ -369,7 +368,7 @@ def create(): def restore_button_callback(): pyzebra.restore_scan(_get_selected_scan()) _update_datatable() - _update_plot(_get_selected_scan()) + _update_plot() restore_button = Button(label="Restore scan", width=145) restore_button.on_click(restore_button_callback) @@ -505,7 +504,7 @@ def create(): lorentz=lorentz_checkbox.active, ) - _update_plot(_get_selected_scan()) + _update_plot() _update_datatable() proc_all_button = Button(label="Process All", button_type="primary", width=145) @@ -522,7 +521,7 @@ def create(): lorentz=lorentz_checkbox.active, ) - _update_plot(scan) + _update_plot() _update_datatable() proc_button = Button(label="Process Current", width=145) diff --git a/pyzebra/app/panel_hdf_param_study.py b/pyzebra/app/panel_hdf_param_study.py index 7985322..e0be84d 100644 --- a/pyzebra/app/panel_hdf_param_study.py +++ b/pyzebra/app/panel_hdf_param_study.py @@ -33,7 +33,6 @@ from bokeh.models import ( Spinner, TableColumn, Tabs, - TextInput, Title, WheelZoomTool, ) @@ -198,7 +197,16 @@ def create(): else: # zebra_mode == "bi" metadata_table_source.data.update(geom=["bisecting"]) - update_image(0) + if "mf" in det_data: + metadata_table_source.data.update(mf=[det_data["mf"][0]]) + else: + metadata_table_source.data.update(mf=[None]) + + if "temp" in det_data: + metadata_table_source.data.update(temp=[det_data["temp"][0]]) + else: + metadata_table_source.data.update(temp=[None]) + update_overview_plot() def scan_table_source_callback(_attr, _old, _new): @@ -247,17 +255,6 @@ def create(): ) param_select.on_change("value", param_select_callback) - def update_image(index=None): - if "mf" in det_data: - metadata_table_source.data.update(mf=[det_data["mf"][index]]) - else: - metadata_table_source.data.update(mf=[None]) - - if "temp" in det_data: - metadata_table_source.data.update(temp=[det_data["temp"][index]]) - else: - metadata_table_source.data.update(temp=[None]) - def update_overview_plot(): h5_data = det_data["data"] n_im, n_y, n_x = h5_data.shape diff --git a/pyzebra/app/panel_hdf_viewer.py b/pyzebra/app/panel_hdf_viewer.py index 37a325a..a64611b 100644 --- a/pyzebra/app/panel_hdf_viewer.py +++ b/pyzebra/app/panel_hdf_viewer.py @@ -37,7 +37,6 @@ from bokeh.models import ( Spacer, Spinner, TableColumn, - TextInput, Title, WheelZoomTool, ) diff --git a/pyzebra/app/panel_param_study.py b/pyzebra/app/panel_param_study.py index 5452642..d78925b 100644 --- a/pyzebra/app/panel_param_study.py +++ b/pyzebra/app/panel_param_study.py @@ -42,7 +42,6 @@ from bokeh.models import ( TableColumn, Tabs, TextAreaInput, - TextInput, WheelZoomTool, Whisker, ) @@ -237,10 +236,11 @@ def create(): scan_table_source.data.update(fit=fit_ok) def _update_plot(): - _update_single_scan_plot(_get_selected_scan()) + _update_single_scan_plot() _update_overview() - def _update_single_scan_plot(scan): + def _update_single_scan_plot(): + scan = _get_selected_scan() scan_motor = scan["scan_motor"] y = scan["counts"] @@ -488,6 +488,7 @@ def create(): scan_table_source = ColumnDataSource(dict(file=[], scan=[], param=[], fit=[], export=[])) scan_table_source.on_change("data", scan_table_source_callback) + scan_table_source.selected.on_change("indices", scan_table_select_callback) scan_table = DataTable( source=scan_table_source, @@ -503,13 +504,6 @@ def create(): autosize_mode="none", ) - def scan_table_source_callback(_attr, _old, _new): - if scan_table_source.selected.indices: - _update_plot() - - scan_table_source.selected.on_change("indices", scan_table_select_callback) - scan_table_source.on_change("data", scan_table_source_callback) - def _get_selected_scan(): return det_data[scan_table_source.selected.indices[0]] diff --git a/pyzebra/ccl_process.py b/pyzebra/ccl_process.py index 0abc28d..44dda47 100644 --- a/pyzebra/ccl_process.py +++ b/pyzebra/ccl_process.py @@ -1,4 +1,3 @@ -import itertools import os import numpy as np