Fix datatable selection
This commit is contained in:
parent
983e0dab42
commit
e3de0f7217
@ -284,7 +284,7 @@ def create():
|
|||||||
# skip unnecessary update caused by selection drop
|
# skip unnecessary update caused by selection drop
|
||||||
return
|
return
|
||||||
|
|
||||||
_update_plot(det_data[scan_table_source.data["scan"][new[0]]])
|
_update_plot(det_data[new[0]])
|
||||||
|
|
||||||
scan_table_source = ColumnDataSource(dict(scan=[], hkl=[], peaks=[], fit=[], export=[]))
|
scan_table_source = ColumnDataSource(dict(scan=[], hkl=[], peaks=[], fit=[], export=[]))
|
||||||
scan_table = DataTable(
|
scan_table = DataTable(
|
||||||
@ -303,9 +303,7 @@ def create():
|
|||||||
scan_table_source.selected.on_change("indices", scan_table_select_callback)
|
scan_table_source.selected.on_change("indices", scan_table_select_callback)
|
||||||
|
|
||||||
def _get_selected_scan():
|
def _get_selected_scan():
|
||||||
selected_index = scan_table_source.selected.indices[0]
|
return det_data[scan_table_source.selected.indices[0]]
|
||||||
selected_scan_id = scan_table_source.data["scan"][selected_index]
|
|
||||||
return det_data[selected_scan_id]
|
|
||||||
|
|
||||||
def peak_pos_textinput_callback(_attr, _old, new):
|
def peak_pos_textinput_callback(_attr, _old, new):
|
||||||
if new is not None and not peak_pos_textinput_lock:
|
if new is not None and not peak_pos_textinput_lock:
|
||||||
@ -512,7 +510,7 @@ def create():
|
|||||||
with tempfile.TemporaryDirectory() as temp_dir:
|
with tempfile.TemporaryDirectory() as temp_dir:
|
||||||
temp_file = temp_dir + "/temp"
|
temp_file = temp_dir + "/temp"
|
||||||
export_data = deepcopy(det_data)
|
export_data = deepcopy(det_data)
|
||||||
for s, export in zip(scan_table_source.data["scan"], scan_table_source.data["export"]):
|
for s, export in enumerate(scan_table_source.data["export"]):
|
||||||
if not export:
|
if not export:
|
||||||
if "fit" in export_data[s]:
|
if "fit" in export_data[s]:
|
||||||
del export_data[s]["fit"]
|
del export_data[s]["fit"]
|
||||||
@ -545,7 +543,7 @@ def create():
|
|||||||
with tempfile.TemporaryDirectory() as temp_dir:
|
with tempfile.TemporaryDirectory() as temp_dir:
|
||||||
temp_file = temp_dir + "/temp"
|
temp_file = temp_dir + "/temp"
|
||||||
export_data = deepcopy(det_data)
|
export_data = deepcopy(det_data)
|
||||||
for s, export in zip(scan_table_source.data["scan"], scan_table_source.data["export"]):
|
for s, export in enumerate(scan_table_source.data["export"]):
|
||||||
if not export:
|
if not export:
|
||||||
del export_data[s]
|
del export_data[s]
|
||||||
|
|
||||||
|
@ -262,9 +262,8 @@ def create():
|
|||||||
x = []
|
x = []
|
||||||
y = []
|
y = []
|
||||||
par = []
|
par = []
|
||||||
for ind, p in enumerate(scan_table_source.data["param"]):
|
for s, p in enumerate(scan_table_source.data["param"]):
|
||||||
if p:
|
if p:
|
||||||
s = scan_table_source.data["scan"][ind]
|
|
||||||
xs.append(np.array(det_data[s]["om"]))
|
xs.append(np.array(det_data[s]["om"]))
|
||||||
x.extend(det_data[s]["om"])
|
x.extend(det_data[s]["om"])
|
||||||
ys.append(np.array(det_data[s]["Counts"]))
|
ys.append(np.array(det_data[s]["Counts"]))
|
||||||
@ -404,9 +403,7 @@ def create():
|
|||||||
scan_table_source.on_change("data", scan_table_source_callback)
|
scan_table_source.on_change("data", scan_table_source_callback)
|
||||||
|
|
||||||
def _get_selected_scan():
|
def _get_selected_scan():
|
||||||
selected_index = scan_table_source.selected.indices[0]
|
return det_data[scan_table_source.selected.indices[0]]
|
||||||
selected_scan_id = scan_table_source.data["scan"][selected_index]
|
|
||||||
return det_data[selected_scan_id]
|
|
||||||
|
|
||||||
def peak_pos_textinput_callback(_attr, _old, new):
|
def peak_pos_textinput_callback(_attr, _old, new):
|
||||||
if new is not None and not peak_pos_textinput_lock:
|
if new is not None and not peak_pos_textinput_lock:
|
||||||
@ -613,7 +610,7 @@ def create():
|
|||||||
with tempfile.TemporaryDirectory() as temp_dir:
|
with tempfile.TemporaryDirectory() as temp_dir:
|
||||||
temp_file = temp_dir + "/temp"
|
temp_file = temp_dir + "/temp"
|
||||||
export_data = deepcopy(det_data)
|
export_data = deepcopy(det_data)
|
||||||
for s, export in zip(scan_table_source.data["scan"], scan_table_source.data["export"]):
|
for s, export in enumerate(scan_table_source.data["export"]):
|
||||||
if not export:
|
if not export:
|
||||||
del export_data[s]
|
del export_data[s]
|
||||||
|
|
||||||
@ -640,7 +637,7 @@ def create():
|
|||||||
with tempfile.TemporaryDirectory() as temp_dir:
|
with tempfile.TemporaryDirectory() as temp_dir:
|
||||||
temp_file = temp_dir + "/temp"
|
temp_file = temp_dir + "/temp"
|
||||||
export_data = deepcopy(det_data)
|
export_data = deepcopy(det_data)
|
||||||
for s, export in zip(scan_table_source.data["scan"], scan_table_source.data["export"]):
|
for s, export in enumerate(scan_table_source.data["export"]):
|
||||||
if not export:
|
if not export:
|
||||||
if "fit" in export_data[s]:
|
if "fit" in export_data[s]:
|
||||||
del export_data[s]["fit"]
|
del export_data[s]["fit"]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user