From 03ed97e0638d899f677215290cc9bf692ea47a59 Mon Sep 17 00:00:00 2001 From: Ivan Usov Date: Fri, 11 Mar 2022 17:05:45 +0100 Subject: [PATCH] Add panel_ccl_prepare Basic layout only --- pyzebra/app/app.py | 2 + pyzebra/app/panel_ccl_prepare.py | 143 +++++++++++++++++++++++++++++++ 2 files changed, 145 insertions(+) create mode 100644 pyzebra/app/panel_ccl_prepare.py diff --git a/pyzebra/app/app.py b/pyzebra/app/app.py index 351680e..7bd798c 100644 --- a/pyzebra/app/app.py +++ b/pyzebra/app/app.py @@ -14,6 +14,7 @@ import panel_hdf_param_study import panel_hdf_viewer import panel_param_study import panel_spind +import panel_ccl_prepare doc = curdoc() @@ -55,6 +56,7 @@ doc.add_root( Panel(child=column(proposal_textinput, apply_button), title="user config"), panel_hdf_viewer.create(), panel_hdf_anatric.create(), + panel_ccl_prepare.create(), panel_ccl_integrate.create(), panel_ccl_compare.create(), panel_param_study.create(), diff --git a/pyzebra/app/panel_ccl_prepare.py b/pyzebra/app/panel_ccl_prepare.py new file mode 100644 index 0000000..ccc1999 --- /dev/null +++ b/pyzebra/app/panel_ccl_prepare.py @@ -0,0 +1,143 @@ +from bokeh.layouts import column, row +from bokeh.models import ( + Button, + CheckboxGroup, + DataRange1d, + Div, + FileInput, + MultiSelect, + NumericInput, + Panel, + Plot, + RadioGroup, + Select, + Spacer, + TextAreaInput, + TextInput, +) + + +def create(): + geom_radiogroup_div = Div(text="Geometry:") + geom_radiogroup = RadioGroup(labels=["bisecting", "normal beam"], width=150) + open_cfl_div = Div(text="or open CFL:") + open_cfl = FileInput(accept=".cfl", width=200) + + wavelen_select = Select(title="Wavelength:", width=70) + wavelen_input = NumericInput(title="\u200B", width=70, mode="float") + + anglim_div = Div(text="Angular min/max limits:") + sttgamma_min = NumericInput(title="stt/gamma", width=50, mode="float") + sttgamma_max = NumericInput(title="\u200B", width=50, mode="float") + omega_min = NumericInput(title="omega", width=50, mode="float") + omega_max = NumericInput(title="\u200B", width=50, mode="float") + chinu_min = NumericInput(title="chi/nu", width=50, mode="float") + chinu_max = NumericInput(title="\u200B", width=50, mode="float") + phi_min = NumericInput(title="phi", width=50, mode="float") + phi_max = NumericInput(title="\u200B", width=50, mode="float") + + open_geom_div = Div(text="or open GEOM:") + open_geom = FileInput(accept=".geom", width=200) + open_cif_div = Div(text="or open CIF:") + open_cif = FileInput(accept=".cif", width=200) + + cryst_div = Div(text="Crystal structure:") + cryst_space_group = TextInput(title="space group", width=100) + cryst_cell = TextInput(title="cell", width=500) + + ub_matrix_calc = Button(label="UB matrix:", button_type="primary", width=100) + ub_matrix = TextInput(title="\u200B", width=600) + + ranges_div = Div(text="Ranges:") + ranges_hkl = TextInput(title="HKL") + ranges_expression = TextInput(title="sin(​θ​)/λ", width=200) + + mag_struct_div = Div(text="Magnetic structure (optional):") + mag_struct_lattice = TextInput(title="lattice", width=150) + mag_struct_kvec = TextAreaInput(title="k vector", width=150) + mag_struct_go = Button(label="GO", button_type="primary", width=50) + + sorting_div = Div(text="Sorting:") + sorting_1 = TextInput(title="1st", width=50) + sorting_1_dt = TextInput(title="Δ", width=50) + sorting_2 = TextInput(title="2nd", width=50) + sorting_2_dt = TextInput(title="Δ", width=50) + sorting_3 = TextInput(title="3rd", width=50) + sorting_3_dt = TextInput(title="Δ", width=50) + sorting_go = Button(label="GO", button_type="primary", width=50) + + created_lists = MultiSelect(title="Created lists:", width=200, height=150) + preview_lists = TextAreaInput(title="Preview selected list:", width=600, height=150) + + download_file = Button(label="Download file", button_type="success", width=200) + plot_list = Button(label="Plot selected list", button_type="primary", width=200) + + measured_data_div = Div(text="Measured data:") + measured_data = FileInput(accept=".comm,.incomm", width=200) + plot_file = Button(label="Plot selected file", button_type="primary", width=200) + + plot = Plot(x_range=DataRange1d(), y_range=DataRange1d(), plot_height=450, plot_width=500) + plot.toolbar.logo = None + + hkl_normal = TextInput(title="HKL normal", width=100) + delta = TextInput(title="delta", width=100) + in_plane_x = TextInput(title="in-plane X", width=100) + in_plane_y = TextInput(title="in-plane Y", width=100) + + disting_opt_div = Div(text="Distinguish options:") + disting_opt_cb = CheckboxGroup( + labels=["files (symbols)", "intensities (size)", "k vectors nucl/magn (colors)"], width=200, + ) + disting_opt_rb = RadioGroup(labels=["scan direction", "resolution ellipsoid"], width=200) + + clear_plot = Button(label="Clear plot", button_type="warning", width=200) + + util_column1 = column( + row(column(geom_radiogroup_div, geom_radiogroup), column(open_cfl_div, open_cfl)), + row(wavelen_select, wavelen_input, column(open_cif_div, open_cif)), + ) + + anglim_layout = column( + anglim_div, + row(sttgamma_min, sttgamma_max, Spacer(width=10), omega_min, omega_max), + row(chinu_min, chinu_max, Spacer(width=10), phi_min, phi_max), + ) + + column1_layout = column( + row(util_column1, row(anglim_layout, column(open_geom_div, open_geom))), + row(cryst_div, cryst_space_group, cryst_cell), + row(column(Spacer(height=18), ub_matrix_calc), ub_matrix), + row(ranges_div, ranges_hkl, ranges_expression), + row( + mag_struct_div, + mag_struct_lattice, + mag_struct_kvec, + column(Spacer(height=18), mag_struct_go), + ), + row( + sorting_div, + sorting_1, + sorting_1_dt, + Spacer(width=50), + sorting_2, + sorting_2_dt, + Spacer(width=50), + sorting_3, + sorting_3_dt, + column(Spacer(height=18), sorting_go), + ), + row(created_lists, preview_lists), + row(download_file, plot_list), + ) + + column2_layout = column( + row(column(measured_data_div, measured_data), plot_file), + plot, + row(hkl_normal, delta, Spacer(width=50), in_plane_x, in_plane_y), + row(disting_opt_div, disting_opt_cb, disting_opt_rb), + row(clear_plot), + ) + + tab_layout = row(column1_layout, column2_layout) + + return Panel(child=tab_layout, title="ccl prepare")