Add bulk loading of files from afs in ccl_integrate
This commit is contained in:
parent
0e97f44cc7
commit
85c74c39f0
@ -77,9 +77,8 @@ def create():
|
||||
if file.endswith((".ccl", ".dat")):
|
||||
ccl_file_list.append((os.path.join(ccl_path, file), file))
|
||||
file_select.options = ccl_file_list
|
||||
file_select.value = ccl_file_list[0][0]
|
||||
|
||||
proposal_textinput = TextInput(title="Enter proposal number:", default_size=145)
|
||||
proposal_textinput = TextInput(title="Proposal number:", default_size=145)
|
||||
proposal_textinput.on_change("value", proposal_textinput_callback)
|
||||
|
||||
def _init_datatable():
|
||||
@ -101,17 +100,23 @@ def create():
|
||||
def ccl_file_select_callback(_attr, _old, _new):
|
||||
pass
|
||||
|
||||
file_select = Select(title="Available .ccl/.dat files:")
|
||||
file_select = MultiSelect(title="Available .ccl/.dat files:", default_size=200, height=250)
|
||||
file_select.on_change("value", ccl_file_select_callback)
|
||||
|
||||
def file_open_button_callback():
|
||||
nonlocal det_data
|
||||
with open(file_select.value) as file:
|
||||
_, ext = os.path.splitext(file_select.value)
|
||||
det_data = pyzebra.parse_1D(file, ext)
|
||||
|
||||
pyzebra.normalize_dataset(det_data, monitor_spinner.value)
|
||||
pyzebra.merge_duplicates(det_data)
|
||||
det_data = []
|
||||
for f_name in file_select.value:
|
||||
with open(f_name) as file:
|
||||
_, ext = os.path.splitext(f_name)
|
||||
if det_data:
|
||||
append_data = pyzebra.parse_1D(file, ext)
|
||||
pyzebra.normalize_dataset(append_data, monitor_spinner.value)
|
||||
pyzebra.merge_datasets(det_data, append_data)
|
||||
else:
|
||||
det_data = pyzebra.parse_1D(file, ext)
|
||||
pyzebra.normalize_dataset(det_data, monitor_spinner.value)
|
||||
pyzebra.merge_duplicates(det_data)
|
||||
|
||||
_init_datatable()
|
||||
|
||||
@ -119,12 +124,13 @@ def create():
|
||||
file_open_button.on_click(file_open_button_callback)
|
||||
|
||||
def file_append_button_callback():
|
||||
with open(file_select.value) as file:
|
||||
_, ext = os.path.splitext(file_select.value)
|
||||
append_data = pyzebra.parse_1D(file, ext)
|
||||
for f_name in file_select.value:
|
||||
with open(f_name) as file:
|
||||
_, ext = os.path.splitext(f_name)
|
||||
append_data = pyzebra.parse_1D(file, ext)
|
||||
|
||||
pyzebra.normalize_dataset(append_data, monitor_spinner.value)
|
||||
pyzebra.merge_datasets(det_data, append_data)
|
||||
pyzebra.normalize_dataset(append_data, monitor_spinner.value)
|
||||
pyzebra.merge_datasets(det_data, append_data)
|
||||
|
||||
_init_datatable()
|
||||
|
||||
@ -143,7 +149,7 @@ def create():
|
||||
_init_datatable()
|
||||
|
||||
upload_div = Div(text="or upload .ccl/.dat file:", margin=(5, 5, 0, 5))
|
||||
upload_button = FileInput(accept=".ccl,.dat")
|
||||
upload_button = FileInput(accept=".ccl,.dat", default_size=200)
|
||||
upload_button.on_change("value", upload_button_callback)
|
||||
|
||||
def append_upload_button_callback(_attr, _old, new):
|
||||
@ -158,7 +164,7 @@ def create():
|
||||
_init_datatable()
|
||||
|
||||
append_upload_div = Div(text="append extra file:", margin=(5, 5, 0, 5))
|
||||
append_upload_button = FileInput(accept=".ccl,.dat")
|
||||
append_upload_button = FileInput(accept=".ccl,.dat", default_size=200)
|
||||
append_upload_button.on_change("value", append_upload_button_callback)
|
||||
|
||||
def monitor_spinner_callback(_attr, old, new):
|
||||
@ -269,6 +275,7 @@ def create():
|
||||
TableColumn(field="export", title="Export", editor=CheckboxEditor(), width=50),
|
||||
],
|
||||
width=310, # +60 because of the index column
|
||||
height=350,
|
||||
fit_columns=False,
|
||||
editable=True,
|
||||
)
|
||||
@ -498,25 +505,27 @@ def create():
|
||||
|
||||
scan_layout = column(
|
||||
scan_table,
|
||||
monitor_spinner,
|
||||
row(column(Spacer(height=19), merge_button), merge_dest_select, merge_source_select),
|
||||
)
|
||||
|
||||
import_layout = column(
|
||||
proposal_textinput,
|
||||
file_select,
|
||||
row(file_open_button, file_append_button),
|
||||
upload_div,
|
||||
upload_button,
|
||||
append_upload_div,
|
||||
append_upload_button,
|
||||
)
|
||||
|
||||
export_layout = column(
|
||||
export_preview_textinput,
|
||||
row(hkl_precision_select, column(Spacer(height=19), row(preview_button, save_button))),
|
||||
)
|
||||
|
||||
tab_layout = column(
|
||||
row(
|
||||
proposal_textinput,
|
||||
file_select,
|
||||
column(Spacer(height=19), row(file_open_button, file_append_button)),
|
||||
Spacer(width=100),
|
||||
column(upload_div, upload_button),
|
||||
column(append_upload_div, append_upload_button),
|
||||
monitor_spinner,
|
||||
),
|
||||
row(scan_layout, plot, Spacer(width=30), export_layout),
|
||||
row(import_layout, scan_layout, plot, Spacer(width=30), export_layout),
|
||||
row(fitpeak_controls, fit_output_textinput),
|
||||
)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user