Prepare for transition to bokeh/3
* Rename plot_height -> height * Rename plot_width -> width * Replace on_click callbacks of RadioGroup and CheckboxGroup
This commit is contained in:
parent
d145f9107d
commit
015eb095a4
@ -243,8 +243,8 @@ def create():
|
|||||||
plot = figure(
|
plot = figure(
|
||||||
x_axis_label="Scan motor",
|
x_axis_label="Scan motor",
|
||||||
y_axis_label="Counts",
|
y_axis_label="Counts",
|
||||||
plot_height=470,
|
height=470,
|
||||||
plot_width=700,
|
width=700,
|
||||||
tools="pan,wheel_zoom,reset",
|
tools="pan,wheel_zoom,reset",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -112,8 +112,8 @@ def create():
|
|||||||
plot = figure(
|
plot = figure(
|
||||||
x_axis_label="Scan motor",
|
x_axis_label="Scan motor",
|
||||||
y_axis_label="Counts",
|
y_axis_label="Counts",
|
||||||
plot_height=470,
|
height=470,
|
||||||
plot_width=700,
|
width=700,
|
||||||
tools="pan,wheel_zoom,reset",
|
tools="pan,wheel_zoom,reset",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -604,7 +604,7 @@ def create():
|
|||||||
plot_file = Button(label="Plot selected file(s)", button_type="primary", width=200)
|
plot_file = Button(label="Plot selected file(s)", button_type="primary", width=200)
|
||||||
plot_file.on_click(plot_file_callback)
|
plot_file.on_click(plot_file_callback)
|
||||||
|
|
||||||
plot = figure(plot_height=550, plot_width=550 + 32, tools="pan,wheel_zoom,reset")
|
plot = figure(height=550, width=550 + 32, tools="pan,wheel_zoom,reset")
|
||||||
plot.toolbar.logo = None
|
plot.toolbar.logo = None
|
||||||
|
|
||||||
plot.xaxis.visible = False
|
plot.xaxis.visible = False
|
||||||
|
@ -301,8 +301,8 @@ def create():
|
|||||||
x_range=det_x_range,
|
x_range=det_x_range,
|
||||||
y_range=frame_range,
|
y_range=frame_range,
|
||||||
extra_y_ranges={"scanning_motor": scanning_motor_range},
|
extra_y_ranges={"scanning_motor": scanning_motor_range},
|
||||||
plot_height=540,
|
height=540,
|
||||||
plot_width=IMAGE_PLOT_W - 3,
|
width=IMAGE_PLOT_W - 3,
|
||||||
tools="pan,box_zoom,wheel_zoom,reset",
|
tools="pan,box_zoom,wheel_zoom,reset",
|
||||||
active_scroll="wheel_zoom",
|
active_scroll="wheel_zoom",
|
||||||
)
|
)
|
||||||
@ -325,8 +325,8 @@ def create():
|
|||||||
x_range=det_y_range,
|
x_range=det_y_range,
|
||||||
y_range=frame_range,
|
y_range=frame_range,
|
||||||
extra_y_ranges={"scanning_motor": scanning_motor_range},
|
extra_y_ranges={"scanning_motor": scanning_motor_range},
|
||||||
plot_height=540,
|
height=540,
|
||||||
plot_width=IMAGE_PLOT_H + 22,
|
width=IMAGE_PLOT_H + 22,
|
||||||
tools="pan,box_zoom,wheel_zoom,reset",
|
tools="pan,box_zoom,wheel_zoom,reset",
|
||||||
active_scroll="wheel_zoom",
|
active_scroll="wheel_zoom",
|
||||||
)
|
)
|
||||||
@ -352,8 +352,8 @@ def create():
|
|||||||
colormap_select.on_change("value", colormap_select_callback)
|
colormap_select.on_change("value", colormap_select_callback)
|
||||||
colormap_select.value = "Plasma256"
|
colormap_select.value = "Plasma256"
|
||||||
|
|
||||||
def proj_auto_checkbox_callback(state):
|
def proj_auto_checkbox_callback(_attr, _old, new):
|
||||||
if state:
|
if 0 in new:
|
||||||
proj_display_min_spinner.disabled = True
|
proj_display_min_spinner.disabled = True
|
||||||
proj_display_max_spinner.disabled = True
|
proj_display_max_spinner.disabled = True
|
||||||
else:
|
else:
|
||||||
@ -365,7 +365,7 @@ def create():
|
|||||||
proj_auto_checkbox = CheckboxGroup(
|
proj_auto_checkbox = CheckboxGroup(
|
||||||
labels=["Projections Intensity Range"], active=[0], width=145, margin=[10, 5, 0, 5]
|
labels=["Projections Intensity Range"], active=[0], width=145, margin=[10, 5, 0, 5]
|
||||||
)
|
)
|
||||||
proj_auto_checkbox.on_click(proj_auto_checkbox_callback)
|
proj_auto_checkbox.on_change("active", proj_auto_checkbox_callback)
|
||||||
|
|
||||||
def proj_display_max_spinner_callback(_attr, _old, new):
|
def proj_display_max_spinner_callback(_attr, _old, new):
|
||||||
color_mapper_proj.high = new
|
color_mapper_proj.high = new
|
||||||
@ -411,8 +411,8 @@ def create():
|
|||||||
param_plot = figure(
|
param_plot = figure(
|
||||||
x_axis_label="Parameter",
|
x_axis_label="Parameter",
|
||||||
y_axis_label="Fit parameter",
|
y_axis_label="Fit parameter",
|
||||||
plot_height=400,
|
height=400,
|
||||||
plot_width=700,
|
width=700,
|
||||||
tools="pan,wheel_zoom,reset",
|
tools="pan,wheel_zoom,reset",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -458,8 +458,8 @@ def create():
|
|||||||
y_range=Range1d(0, IMAGE_H, bounds=(0, IMAGE_H)),
|
y_range=Range1d(0, IMAGE_H, bounds=(0, IMAGE_H)),
|
||||||
x_axis_location="above",
|
x_axis_location="above",
|
||||||
y_axis_location="right",
|
y_axis_location="right",
|
||||||
plot_height=IMAGE_PLOT_H,
|
height=IMAGE_PLOT_H,
|
||||||
plot_width=IMAGE_PLOT_W,
|
width=IMAGE_PLOT_W,
|
||||||
toolbar_location="left",
|
toolbar_location="left",
|
||||||
tools="pan,box_zoom,wheel_zoom,reset",
|
tools="pan,box_zoom,wheel_zoom,reset",
|
||||||
active_scroll="wheel_zoom",
|
active_scroll="wheel_zoom",
|
||||||
@ -509,8 +509,8 @@ def create():
|
|||||||
proj_v = figure(
|
proj_v = figure(
|
||||||
x_range=plot.x_range,
|
x_range=plot.x_range,
|
||||||
y_axis_location="right",
|
y_axis_location="right",
|
||||||
plot_height=150,
|
height=150,
|
||||||
plot_width=IMAGE_PLOT_W,
|
width=IMAGE_PLOT_W,
|
||||||
tools="",
|
tools="",
|
||||||
toolbar_location=None,
|
toolbar_location=None,
|
||||||
)
|
)
|
||||||
@ -524,8 +524,8 @@ def create():
|
|||||||
proj_h = figure(
|
proj_h = figure(
|
||||||
x_axis_location="above",
|
x_axis_location="above",
|
||||||
y_range=plot.y_range,
|
y_range=plot.y_range,
|
||||||
plot_height=IMAGE_PLOT_H,
|
height=IMAGE_PLOT_H,
|
||||||
plot_width=150,
|
width=150,
|
||||||
tools="",
|
tools="",
|
||||||
toolbar_location=None,
|
toolbar_location=None,
|
||||||
)
|
)
|
||||||
@ -589,8 +589,8 @@ def create():
|
|||||||
y_range=frame_range,
|
y_range=frame_range,
|
||||||
extra_x_ranges={"gamma": gamma_range},
|
extra_x_ranges={"gamma": gamma_range},
|
||||||
extra_y_ranges={"scanning_motor": scanning_motor_range},
|
extra_y_ranges={"scanning_motor": scanning_motor_range},
|
||||||
plot_height=540,
|
height=540,
|
||||||
plot_width=IMAGE_PLOT_W - 3,
|
width=IMAGE_PLOT_W - 3,
|
||||||
tools="pan,box_zoom,wheel_zoom,reset",
|
tools="pan,box_zoom,wheel_zoom,reset",
|
||||||
active_scroll="wheel_zoom",
|
active_scroll="wheel_zoom",
|
||||||
)
|
)
|
||||||
@ -617,8 +617,8 @@ def create():
|
|||||||
y_range=frame_range,
|
y_range=frame_range,
|
||||||
extra_x_ranges={"nu": nu_range},
|
extra_x_ranges={"nu": nu_range},
|
||||||
extra_y_ranges={"scanning_motor": scanning_motor_range},
|
extra_y_ranges={"scanning_motor": scanning_motor_range},
|
||||||
plot_height=540,
|
height=540,
|
||||||
plot_width=IMAGE_PLOT_H + 22,
|
width=IMAGE_PLOT_H + 22,
|
||||||
tools="pan,box_zoom,wheel_zoom,reset",
|
tools="pan,box_zoom,wheel_zoom,reset",
|
||||||
active_scroll="wheel_zoom",
|
active_scroll="wheel_zoom",
|
||||||
)
|
)
|
||||||
@ -636,7 +636,7 @@ def create():
|
|||||||
proj_y_image = proj_y_plot.image(source=proj_y_image_source, color_mapper=lin_color_mapper_proj)
|
proj_y_image = proj_y_plot.image(source=proj_y_image_source, color_mapper=lin_color_mapper_proj)
|
||||||
|
|
||||||
# ROI slice plot
|
# ROI slice plot
|
||||||
roi_avg_plot = figure(plot_height=150, plot_width=IMAGE_PLOT_W, tools="", toolbar_location=None)
|
roi_avg_plot = figure(height=150, width=IMAGE_PLOT_W, tools="", toolbar_location=None)
|
||||||
|
|
||||||
roi_avg_plot_line_source = ColumnDataSource(dict(x=[], y=[]))
|
roi_avg_plot_line_source = ColumnDataSource(dict(x=[], y=[]))
|
||||||
roi_avg_plot.line(source=roi_avg_plot_line_source, line_color="steelblue")
|
roi_avg_plot.line(source=roi_avg_plot_line_source, line_color="steelblue")
|
||||||
@ -655,8 +655,8 @@ def create():
|
|||||||
colormap_select.on_change("value", colormap_select_callback)
|
colormap_select.on_change("value", colormap_select_callback)
|
||||||
colormap_select.value = "Plasma256"
|
colormap_select.value = "Plasma256"
|
||||||
|
|
||||||
def colormap_scale_rg_callback(selection):
|
def colormap_scale_rg_callback(_attr, _old, new):
|
||||||
if selection == 0: # Linear
|
if new == 0: # Linear
|
||||||
plot_image.glyph.color_mapper = lin_color_mapper
|
plot_image.glyph.color_mapper = lin_color_mapper
|
||||||
proj_x_image.glyph.color_mapper = lin_color_mapper_proj
|
proj_x_image.glyph.color_mapper = lin_color_mapper_proj
|
||||||
proj_y_image.glyph.color_mapper = lin_color_mapper_proj
|
proj_y_image.glyph.color_mapper = lin_color_mapper_proj
|
||||||
@ -675,10 +675,10 @@ def create():
|
|||||||
colormap_scale_rg.active = 0
|
colormap_scale_rg.active = 0
|
||||||
|
|
||||||
colormap_scale_rg = RadioGroup(labels=["Linear", "Logarithmic"], active=0, width=100)
|
colormap_scale_rg = RadioGroup(labels=["Linear", "Logarithmic"], active=0, width=100)
|
||||||
colormap_scale_rg.on_click(colormap_scale_rg_callback)
|
colormap_scale_rg.on_change("active", colormap_scale_rg_callback)
|
||||||
|
|
||||||
def main_auto_checkbox_callback(state):
|
def main_auto_checkbox_callback(_attr, _old, new):
|
||||||
if state:
|
if 0 in new:
|
||||||
display_min_spinner.disabled = True
|
display_min_spinner.disabled = True
|
||||||
display_max_spinner.disabled = True
|
display_max_spinner.disabled = True
|
||||||
else:
|
else:
|
||||||
@ -690,7 +690,7 @@ def create():
|
|||||||
main_auto_checkbox = CheckboxGroup(
|
main_auto_checkbox = CheckboxGroup(
|
||||||
labels=["Frame Intensity Range"], active=[0], width=145, margin=[10, 5, 0, 5]
|
labels=["Frame Intensity Range"], active=[0], width=145, margin=[10, 5, 0, 5]
|
||||||
)
|
)
|
||||||
main_auto_checkbox.on_click(main_auto_checkbox_callback)
|
main_auto_checkbox.on_change("active", main_auto_checkbox_callback)
|
||||||
|
|
||||||
def display_max_spinner_callback(_attr, _old, new):
|
def display_max_spinner_callback(_attr, _old, new):
|
||||||
lin_color_mapper.high = new
|
lin_color_mapper.high = new
|
||||||
@ -709,8 +709,8 @@ def create():
|
|||||||
display_min_spinner = Spinner(value=0, disabled=bool(main_auto_checkbox.active), width=100)
|
display_min_spinner = Spinner(value=0, disabled=bool(main_auto_checkbox.active), width=100)
|
||||||
display_min_spinner.on_change("value", display_min_spinner_callback)
|
display_min_spinner.on_change("value", display_min_spinner_callback)
|
||||||
|
|
||||||
def proj_auto_checkbox_callback(state):
|
def proj_auto_checkbox_callback(_attr, _old, new):
|
||||||
if state:
|
if 0 in new:
|
||||||
proj_display_min_spinner.disabled = True
|
proj_display_min_spinner.disabled = True
|
||||||
proj_display_max_spinner.disabled = True
|
proj_display_max_spinner.disabled = True
|
||||||
else:
|
else:
|
||||||
@ -722,7 +722,7 @@ def create():
|
|||||||
proj_auto_checkbox = CheckboxGroup(
|
proj_auto_checkbox = CheckboxGroup(
|
||||||
labels=["Projections Intensity Range"], active=[0], width=145, margin=[10, 5, 0, 5]
|
labels=["Projections Intensity Range"], active=[0], width=145, margin=[10, 5, 0, 5]
|
||||||
)
|
)
|
||||||
proj_auto_checkbox.on_click(proj_auto_checkbox_callback)
|
proj_auto_checkbox.on_change("active", proj_auto_checkbox_callback)
|
||||||
|
|
||||||
def proj_display_max_spinner_callback(_attr, _old, new):
|
def proj_display_max_spinner_callback(_attr, _old, new):
|
||||||
lin_color_mapper_proj.high = new
|
lin_color_mapper_proj.high = new
|
||||||
|
@ -209,8 +209,8 @@ def create():
|
|||||||
plot = figure(
|
plot = figure(
|
||||||
x_axis_label="Scan motor",
|
x_axis_label="Scan motor",
|
||||||
y_axis_label="Counts",
|
y_axis_label="Counts",
|
||||||
plot_height=450,
|
height=450,
|
||||||
plot_width=700,
|
width=700,
|
||||||
tools="pan,wheel_zoom,reset",
|
tools="pan,wheel_zoom,reset",
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -243,8 +243,8 @@ def create():
|
|||||||
ov_plot = figure(
|
ov_plot = figure(
|
||||||
x_axis_label="Scan motor",
|
x_axis_label="Scan motor",
|
||||||
y_axis_label="Counts",
|
y_axis_label="Counts",
|
||||||
plot_height=450,
|
height=450,
|
||||||
plot_width=700,
|
width=700,
|
||||||
tools="pan,wheel_zoom,reset",
|
tools="pan,wheel_zoom,reset",
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -261,8 +261,8 @@ def create():
|
|||||||
y_axis_label="Param",
|
y_axis_label="Param",
|
||||||
x_range=Range1d(),
|
x_range=Range1d(),
|
||||||
y_range=Range1d(),
|
y_range=Range1d(),
|
||||||
plot_height=450,
|
height=450,
|
||||||
plot_width=700,
|
width=700,
|
||||||
tools="pan,wheel_zoom,reset",
|
tools="pan,wheel_zoom,reset",
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -279,8 +279,8 @@ def create():
|
|||||||
param_plot = figure(
|
param_plot = figure(
|
||||||
x_axis_label="Parameter",
|
x_axis_label="Parameter",
|
||||||
y_axis_label="Fit parameter",
|
y_axis_label="Fit parameter",
|
||||||
plot_height=400,
|
height=400,
|
||||||
plot_width=700,
|
width=700,
|
||||||
tools="pan,wheel_zoom,reset",
|
tools="pan,wheel_zoom,reset",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -290,8 +290,8 @@ def create():
|
|||||||
plot = figure(
|
plot = figure(
|
||||||
x_range=DataRange1d(),
|
x_range=DataRange1d(),
|
||||||
y_range=DataRange1d(),
|
y_range=DataRange1d(),
|
||||||
plot_height=550 + 27,
|
height=550 + 27,
|
||||||
plot_width=550 + 117,
|
width=550 + 117,
|
||||||
tools="pan,wheel_zoom,reset",
|
tools="pan,wheel_zoom,reset",
|
||||||
)
|
)
|
||||||
plot.toolbar.logo = None
|
plot.toolbar.logo = None
|
||||||
@ -324,7 +324,7 @@ def create():
|
|||||||
hkl_in_plane_y = TextInput(title="in-plane Y", value="", width=100, disabled=True)
|
hkl_in_plane_y = TextInput(title="in-plane Y", value="", width=100, disabled=True)
|
||||||
|
|
||||||
def redef_lattice_cb_callback(_attr, _old, new):
|
def redef_lattice_cb_callback(_attr, _old, new):
|
||||||
if new:
|
if 0 in new:
|
||||||
redef_lattice_ti.disabled = False
|
redef_lattice_ti.disabled = False
|
||||||
else:
|
else:
|
||||||
redef_lattice_ti.disabled = True
|
redef_lattice_ti.disabled = True
|
||||||
@ -334,7 +334,7 @@ def create():
|
|||||||
redef_lattice_ti = TextInput(width=490, disabled=True)
|
redef_lattice_ti = TextInput(width=490, disabled=True)
|
||||||
|
|
||||||
def redef_ub_cb_callback(_attr, _old, new):
|
def redef_ub_cb_callback(_attr, _old, new):
|
||||||
if new:
|
if 0 in new:
|
||||||
redef_ub_ti.disabled = False
|
redef_ub_ti.disabled = False
|
||||||
else:
|
else:
|
||||||
redef_ub_ti.disabled = True
|
redef_ub_ti.disabled = True
|
||||||
@ -369,8 +369,8 @@ def create():
|
|||||||
display_max_ni = NumericInput(title="max:", value=1, mode="float", width=70)
|
display_max_ni = NumericInput(title="max:", value=1, mode="float", width=70)
|
||||||
display_max_ni.on_change("value", display_max_ni_callback)
|
display_max_ni.on_change("value", display_max_ni_callback)
|
||||||
|
|
||||||
def colormap_scale_rg_callback(selection):
|
def colormap_scale_rg_callback(_attr, _old, new):
|
||||||
if selection == 0: # Linear
|
if new == 0: # Linear
|
||||||
plot_image.glyph.color_mapper = lin_color_mapper
|
plot_image.glyph.color_mapper = lin_color_mapper
|
||||||
lin_color_bar.visible = True
|
lin_color_bar.visible = True
|
||||||
log_color_bar.visible = False
|
log_color_bar.visible = False
|
||||||
@ -384,7 +384,7 @@ def create():
|
|||||||
colormap_scale_rg.active = 0
|
colormap_scale_rg.active = 0
|
||||||
|
|
||||||
colormap_scale_rg = RadioGroup(labels=["Linear", "Logarithmic"], active=0, width=100)
|
colormap_scale_rg = RadioGroup(labels=["Linear", "Logarithmic"], active=0, width=100)
|
||||||
colormap_scale_rg.on_click(colormap_scale_rg_callback)
|
colormap_scale_rg.on_change("active", colormap_scale_rg_callback)
|
||||||
|
|
||||||
xrange_min_ni = NumericInput(title="x range min:", value=0, mode="float", width=70)
|
xrange_min_ni = NumericInput(title="x range min:", value=0, mode="float", width=70)
|
||||||
xrange_max_ni = NumericInput(title="max:", value=1, mode="float", width=70)
|
xrange_max_ni = NumericInput(title="max:", value=1, mode="float", width=70)
|
||||||
@ -395,7 +395,7 @@ def create():
|
|||||||
yrange_step_ni = NumericInput(title="y mesh:", value=0.01, mode="float", width=70)
|
yrange_step_ni = NumericInput(title="y mesh:", value=0.01, mode="float", width=70)
|
||||||
|
|
||||||
def auto_range_cb_callback(_attr, _old, new):
|
def auto_range_cb_callback(_attr, _old, new):
|
||||||
if new:
|
if 0 in new:
|
||||||
xrange_min_ni.disabled = True
|
xrange_min_ni.disabled = True
|
||||||
xrange_max_ni.disabled = True
|
xrange_max_ni.disabled = True
|
||||||
yrange_min_ni.disabled = True
|
yrange_min_ni.disabled = True
|
||||||
|
@ -441,7 +441,7 @@ class PlotHKL:
|
|||||||
plot_file = Button(label="Plot selected file(s)", button_type="primary", width=200)
|
plot_file = Button(label="Plot selected file(s)", button_type="primary", width=200)
|
||||||
plot_file.on_click(plot_file_callback)
|
plot_file.on_click(plot_file_callback)
|
||||||
|
|
||||||
plot = figure(plot_height=550, plot_width=550 + 32, tools="pan,wheel_zoom,reset")
|
plot = figure(height=550, width=550 + 32, tools="pan,wheel_zoom,reset")
|
||||||
plot.toolbar.logo = None
|
plot.toolbar.logo = None
|
||||||
|
|
||||||
plot.xaxis.visible = False
|
plot.xaxis.visible = False
|
||||||
@ -517,7 +517,7 @@ class PlotHKL:
|
|||||||
tol_k_ni = NumericInput(title="k tolerance:", value=0.01, mode="float", width=100)
|
tol_k_ni = NumericInput(title="k tolerance:", value=0.01, mode="float", width=100)
|
||||||
|
|
||||||
def show_legend_cb_callback(_attr, _old, new):
|
def show_legend_cb_callback(_attr, _old, new):
|
||||||
plot.legend.visible = bool(new)
|
plot.legend.visible = 0 in new
|
||||||
|
|
||||||
show_legend_cb = CheckboxGroup(labels=["Show legend"], active=[0])
|
show_legend_cb = CheckboxGroup(labels=["Show legend"], active=[0])
|
||||||
show_legend_cb.on_change("active", show_legend_cb_callback)
|
show_legend_cb.on_change("active", show_legend_cb_callback)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user