Update layouts

This commit is contained in:
2021-02-12 15:59:47 +01:00
parent b63ef90e11
commit dab52d9508
4 changed files with 75 additions and 68 deletions

View File

@ -244,7 +244,7 @@ def create():
numfit_max_span.location = None numfit_max_span.location = None
# Main plot # Main plot
plot = Plot(x_range=DataRange1d(), y_range=DataRange1d(), plot_height=400, plot_width=700) plot = Plot(x_range=DataRange1d(), y_range=DataRange1d(), plot_height=470, plot_width=700)
plot.add_layout(LinearAxis(axis_label="Counts"), place="left") plot.add_layout(LinearAxis(axis_label="Counts"), place="left")
plot.add_layout(LinearAxis(axis_label="Omega"), place="below") plot.add_layout(LinearAxis(axis_label="Omega"), place="below")
@ -460,7 +460,7 @@ def create():
fitparams_add_dropdown_callback(types.SimpleNamespace(item="background")) fitparams_add_dropdown_callback(types.SimpleNamespace(item="background"))
fitparams_add_dropdown_callback(types.SimpleNamespace(item="gauss")) fitparams_add_dropdown_callback(types.SimpleNamespace(item="gauss"))
fit_output_textinput = TextAreaInput(title="Fit results:", width=450, height=400) fit_output_textinput = TextAreaInput(title="Fit results:", width=450, height=200)
def _get_peakfind_params(): def _get_peakfind_params():
return dict( return dict(
@ -638,8 +638,8 @@ def create():
column(upload_div, upload_button), column(upload_div, upload_button),
column(append_upload_div, append_upload_button), column(append_upload_div, append_upload_button),
), ),
row(scan_layout, plot, Spacer(width=30), fit_output_textinput, export_layout), row(scan_layout, plot, Spacer(width=30), export_layout),
row(findpeak_controls, Spacer(width=30), fitpeak_controls), row(findpeak_controls, Spacer(width=30), fitpeak_controls, fit_output_textinput),
) )
return Panel(child=tab_layout, title="ccl integrate") return Panel(child=tab_layout, title="ccl integrate")

View File

@ -112,7 +112,7 @@ def create():
def logfile_textinput_callback(_attr, _old, new): def logfile_textinput_callback(_attr, _old, new):
config.logfile = new config.logfile = new
logfile_textinput = TextInput(title="Logfile:", value="logfile.log", width=520) logfile_textinput = TextInput(title="Logfile:", value="logfile.log", width=320)
logfile_textinput.on_change("value", logfile_textinput_callback) logfile_textinput.on_change("value", logfile_textinput_callback)
def logfile_verbosity_select_callback(_attr, _old, new): def logfile_verbosity_select_callback(_attr, _old, new):
@ -133,7 +133,7 @@ def create():
def filelist_format_textinput_callback(_attr, _old, new): def filelist_format_textinput_callback(_attr, _old, new):
config.filelist_format = new config.filelist_format = new
filelist_format_textinput = TextInput(title="format:", width=490) filelist_format_textinput = TextInput(title="format:", width=290)
filelist_format_textinput.on_change("value", filelist_format_textinput_callback) filelist_format_textinput.on_change("value", filelist_format_textinput_callback)
def filelist_datapath_textinput_callback(_attr, _old, new): def filelist_datapath_textinput_callback(_attr, _old, new):
@ -161,7 +161,7 @@ def create():
def lambda_textinput_callback(_attr, _old, new): def lambda_textinput_callback(_attr, _old, new):
config.crystal_lambda = new config.crystal_lambda = new
lambda_textinput = TextInput(title="lambda:", width=140) lambda_textinput = TextInput(title="lambda:", width=145)
lambda_textinput.on_change("value", lambda_textinput_callback) lambda_textinput.on_change("value", lambda_textinput_callback)
def ub_textareainput_callback(_attr, _old, new): def ub_textareainput_callback(_attr, _old, new):
@ -173,19 +173,19 @@ def create():
def zeroOM_textinput_callback(_attr, _old, new): def zeroOM_textinput_callback(_attr, _old, new):
config.crystal_zeroOM = new config.crystal_zeroOM = new
zeroOM_textinput = TextInput(title="zeroOM:", width=140) zeroOM_textinput = TextInput(title="zeroOM:", width=145)
zeroOM_textinput.on_change("value", zeroOM_textinput_callback) zeroOM_textinput.on_change("value", zeroOM_textinput_callback)
def zeroSTT_textinput_callback(_attr, _old, new): def zeroSTT_textinput_callback(_attr, _old, new):
config.crystal_zeroSTT = new config.crystal_zeroSTT = new
zeroSTT_textinput = TextInput(title="zeroSTT:", width=140) zeroSTT_textinput = TextInput(title="zeroSTT:", width=145)
zeroSTT_textinput.on_change("value", zeroSTT_textinput_callback) zeroSTT_textinput.on_change("value", zeroSTT_textinput_callback)
def zeroCHI_textinput_callback(_attr, _old, new): def zeroCHI_textinput_callback(_attr, _old, new):
config.crystal_zeroCHI = new config.crystal_zeroCHI = new
zeroCHI_textinput = TextInput(title="zeroCHI:", width=140) zeroCHI_textinput = TextInput(title="zeroCHI:", width=145)
zeroCHI_textinput.on_change("value", zeroCHI_textinput_callback) zeroCHI_textinput.on_change("value", zeroCHI_textinput_callback)
# ---- DataFactory # ---- DataFactory
@ -193,14 +193,14 @@ def create():
config.dataFactory_implementation = new config.dataFactory_implementation = new
dataFactory_implementation_select = Select( dataFactory_implementation_select = Select(
title="DataFactory implementation:", options=DATA_FACTORY_IMPLEMENTATION, width=300, title="DataFactory implement.:", options=DATA_FACTORY_IMPLEMENTATION, width=145,
) )
dataFactory_implementation_select.on_change("value", dataFactory_implementation_select_callback) dataFactory_implementation_select.on_change("value", dataFactory_implementation_select_callback)
def dataFactory_dist1_textinput_callback(_attr, _old, new): def dataFactory_dist1_textinput_callback(_attr, _old, new):
config.dataFactory_dist1 = new config.dataFactory_dist1 = new
dataFactory_dist1_textinput = TextInput(title="dist1:", width=290) dataFactory_dist1_textinput = TextInput(title="dist1:", width=145)
dataFactory_dist1_textinput.on_change("value", dataFactory_dist1_textinput_callback) dataFactory_dist1_textinput.on_change("value", dataFactory_dist1_textinput_callback)
# ---- BackgroundProcessor # ---- BackgroundProcessor
@ -212,7 +212,7 @@ def create():
config.reflectionPrinter_format = new config.reflectionPrinter_format = new
reflectionPrinter_format_select = Select( reflectionPrinter_format_select = Select(
title="ReflectionPrinter format:", options=REFLECTION_PRINTER_FORMATS, width=300, title="ReflectionPrinter format:", options=REFLECTION_PRINTER_FORMATS, width=145,
) )
reflectionPrinter_format_select.on_change("value", reflectionPrinter_format_select_callback) reflectionPrinter_format_select.on_change("value", reflectionPrinter_format_select_callback)
@ -357,24 +357,23 @@ def create():
process_button = Button(label="Process", button_type="primary") process_button = Button(label="Process", button_type="primary")
process_button.on_click(process_button_callback) process_button.on_click(process_button_callback)
output_log = TextAreaInput(title="Logfile output:", height=700, disabled=True) output_log = TextAreaInput(title="Logfile output:", height=600, disabled=True)
output_config = TextAreaInput(title="Current config:", height=700, width=400, disabled=True) output_config = TextAreaInput(title="Current config:", height=600, width=400, disabled=True)
tab_layout = row( general_params_layout = column(
column(
row(column(Spacer(height=2), upload_div), upload_button),
row(logfile_textinput, logfile_verbosity_select), row(logfile_textinput, logfile_verbosity_select),
row(filelist_type, filelist_format_textinput), row(filelist_type, filelist_format_textinput),
filelist_datapath_textinput, filelist_datapath_textinput,
filelist_ranges_textareainput, filelist_ranges_textareainput,
crystal_sample_textinput, crystal_sample_textinput,
row(lambda_textinput, zeroOM_textinput, zeroSTT_textinput, zeroCHI_textinput), row(lambda_textinput, zeroOM_textinput),
row(zeroSTT_textinput, zeroCHI_textinput),
ub_textareainput, ub_textareainput,
row(dataFactory_implementation_select, dataFactory_dist1_textinput), row(dataFactory_implementation_select, dataFactory_dist1_textinput),
reflectionPrinter_format_select, reflectionPrinter_format_select,
process_button, )
),
column( algorithm_params_layout = column(
mode_radio_button_group, mode_radio_button_group,
row( row(
column( column(
@ -397,9 +396,15 @@ def create():
displacementCurve_textinput, displacementCurve_textinput,
), ),
), ),
)
tab_layout = column(
row(column(Spacer(height=2), upload_div), upload_button),
row(
general_params_layout,
algorithm_params_layout,
column(row(output_config, output_log), row(process_button)),
), ),
output_config,
output_log,
) )
async def update_config(): async def update_config():

View File

@ -41,6 +41,8 @@ import pyzebra
IMAGE_W = 256 IMAGE_W = 256
IMAGE_H = 128 IMAGE_H = 128
IMAGE_PLOT_W = int(IMAGE_W * 2.5)
IMAGE_PLOT_H = int(IMAGE_H * 2.5)
PROPOSAL_PATH = "/afs/psi.ch/project/sinqdata/2020/zebra/" PROPOSAL_PATH = "/afs/psi.ch/project/sinqdata/2020/zebra/"
@ -179,8 +181,8 @@ def create():
plot = Plot( plot = Plot(
x_range=Range1d(0, IMAGE_W, bounds=(0, IMAGE_W)), x_range=Range1d(0, IMAGE_W, bounds=(0, IMAGE_W)),
y_range=Range1d(0, IMAGE_H, bounds=(0, IMAGE_H)), y_range=Range1d(0, IMAGE_H, bounds=(0, IMAGE_H)),
plot_height=IMAGE_H * 3, plot_height=IMAGE_PLOT_H,
plot_width=IMAGE_W * 3, plot_width=IMAGE_PLOT_W,
toolbar_location="left", toolbar_location="left",
) )
@ -233,8 +235,8 @@ def create():
proj_v = Plot( proj_v = Plot(
x_range=plot.x_range, x_range=plot.x_range,
y_range=DataRange1d(), y_range=DataRange1d(),
plot_height=200, plot_height=150,
plot_width=IMAGE_W * 3, plot_width=IMAGE_PLOT_W,
toolbar_location=None, toolbar_location=None,
) )
@ -250,8 +252,8 @@ def create():
proj_h = Plot( proj_h = Plot(
x_range=DataRange1d(), x_range=DataRange1d(),
y_range=plot.y_range, y_range=plot.y_range,
plot_height=IMAGE_H * 3, plot_height=IMAGE_PLOT_H,
plot_width=200, plot_width=150,
toolbar_location=None, toolbar_location=None,
) )
@ -314,8 +316,8 @@ def create():
title=Title(text="Projections on X-axis"), title=Title(text="Projections on X-axis"),
x_range=det_x_range, x_range=det_x_range,
y_range=frame_range, y_range=frame_range,
plot_height=500, plot_height=400,
plot_width=IMAGE_W * 3, plot_width=IMAGE_PLOT_W,
) )
# ---- tools # ---- tools
@ -351,8 +353,8 @@ def create():
title=Title(text="Projections on Y-axis"), title=Title(text="Projections on Y-axis"),
x_range=det_y_range, x_range=det_y_range,
y_range=frame_range, y_range=frame_range,
plot_height=500, plot_height=400,
plot_width=IMAGE_H * 3, plot_width=IMAGE_PLOT_H,
) )
# ---- tools # ---- tools
@ -393,7 +395,7 @@ def create():
x_range=DataRange1d(), x_range=DataRange1d(),
y_range=DataRange1d(), y_range=DataRange1d(),
plot_height=200, plot_height=200,
plot_width=IMAGE_W * 3, plot_width=IMAGE_PLOT_W,
toolbar_location="left", toolbar_location="left",
) )

View File

@ -278,7 +278,7 @@ def create():
ov_param_plot_scatter_source.data.update(x=x, y=y, param=par) ov_param_plot_scatter_source.data.update(x=x, y=y, param=par)
# Main plot # Main plot
plot = Plot(x_range=DataRange1d(), y_range=DataRange1d(), plot_height=400, plot_width=700) plot = Plot(x_range=DataRange1d(), y_range=DataRange1d(), plot_height=450, plot_width=700)
plot.add_layout(LinearAxis(axis_label="Counts"), place="left") plot.add_layout(LinearAxis(axis_label="Counts"), place="left")
plot.add_layout(LinearAxis(axis_label="Omega"), place="below") plot.add_layout(LinearAxis(axis_label="Omega"), place="below")
@ -534,7 +534,7 @@ def create():
fitparams_add_dropdown_callback(types.SimpleNamespace(item="background")) fitparams_add_dropdown_callback(types.SimpleNamespace(item="background"))
fitparams_add_dropdown_callback(types.SimpleNamespace(item="gauss")) fitparams_add_dropdown_callback(types.SimpleNamespace(item="gauss"))
fit_output_textinput = TextAreaInput(title="Fit results:", width=450, height=400) fit_output_textinput = TextAreaInput(title="Fit results:", width=450, height=200)
def _get_peakfind_params(): def _get_peakfind_params():
return dict( return dict(
@ -696,8 +696,8 @@ def create():
column(upload_div, upload_button), column(upload_div, upload_button),
column(append_upload_div, append_upload_button), column(append_upload_div, append_upload_button),
), ),
row(scan_table, plots, Spacer(width=30), fit_output_textinput, export_layout), row(scan_table, plots, Spacer(width=30), export_layout),
row(findpeak_controls, Spacer(width=30), fitpeak_controls), row(findpeak_controls, Spacer(width=30), fitpeak_controls, fit_output_textinput),
) )
return Panel(child=tab_layout, title="param study") return Panel(child=tab_layout, title="param study")