Display angular coordinates in hovertool
This commit is contained in:
parent
b1ac05e7f7
commit
1b17f73a4a
@ -86,6 +86,9 @@ def create():
|
||||
magnetic_field_spinner.value = det_data["magnetic_field"][index]
|
||||
temperature_spinner.value = det_data["temperature"][index]
|
||||
|
||||
gamma, nu = calculate_pol(det_data, index)
|
||||
image_source.data.update(gamma=[gamma], nu=[nu])
|
||||
|
||||
def update_overview_plot():
|
||||
h5_data = det_data["data"]
|
||||
n_im, n_y, n_x = h5_data.shape
|
||||
@ -156,6 +159,8 @@ def create():
|
||||
h=[np.zeros((1, 1))],
|
||||
k=[np.zeros((1, 1))],
|
||||
l=[np.zeros((1, 1))],
|
||||
gamma=[np.zeros((1, 1))],
|
||||
nu=[np.zeros((1, 1))],
|
||||
x=[0],
|
||||
y=[0],
|
||||
dw=[IMAGE_W],
|
||||
@ -166,10 +171,14 @@ def create():
|
||||
h_glyph = Image(image="h", x="x", y="y", dw="dw", dh="dh", global_alpha=0)
|
||||
k_glyph = Image(image="k", x="x", y="y", dw="dw", dh="dh", global_alpha=0)
|
||||
l_glyph = Image(image="l", x="x", y="y", dw="dw", dh="dh", global_alpha=0)
|
||||
gamma_glyph = Image(image="gamma", x="x", y="y", dw="dw", dh="dh", global_alpha=0)
|
||||
nu_glyph = Image(image="nu", x="x", y="y", dw="dw", dh="dh", global_alpha=0)
|
||||
|
||||
plot.add_glyph(image_source, h_glyph)
|
||||
plot.add_glyph(image_source, k_glyph)
|
||||
plot.add_glyph(image_source, l_glyph)
|
||||
plot.add_glyph(image_source, gamma_glyph)
|
||||
plot.add_glyph(image_source, nu_glyph)
|
||||
|
||||
image_glyph = Image(image="image", x="x", y="y", dw="dw", dh="dh")
|
||||
plot.add_glyph(image_source, image_glyph, name="image_glyph")
|
||||
@ -210,7 +219,16 @@ def create():
|
||||
proj_h.add_glyph(proj_h_line_source, Line(x="x", y="y", line_color="steelblue"))
|
||||
|
||||
# add tools
|
||||
hovertool = HoverTool(tooltips=[("intensity", "@image"), ("h", "@h"), ("k", "@k"), ("l", "@l")])
|
||||
hovertool = HoverTool(
|
||||
tooltips=[
|
||||
("intensity", "@image"),
|
||||
("gamma", "@gamma"),
|
||||
("nu", "@nu"),
|
||||
("h", "@h"),
|
||||
("k", "@k"),
|
||||
("l", "@l"),
|
||||
]
|
||||
)
|
||||
|
||||
box_edit_source = ColumnDataSource(dict(x=[], y=[], width=[], height=[]))
|
||||
box_edit_glyph = Rect(
|
||||
@ -504,3 +522,18 @@ def calculate_hkl(det_data, index, setup_type="nb_bi"):
|
||||
)
|
||||
|
||||
return h, k, l
|
||||
|
||||
|
||||
def calculate_pol(det_data, index):
|
||||
gamma = np.empty(shape=(IMAGE_H, IMAGE_W))
|
||||
nu = np.empty(shape=(IMAGE_H, IMAGE_W))
|
||||
|
||||
ddist = det_data["ddist"]
|
||||
gammad = det_data["pol_angle"][index]
|
||||
nud = det_data["tlt_angle"]
|
||||
|
||||
for xi in np.arange(IMAGE_W):
|
||||
for yi in np.arange(IMAGE_H):
|
||||
gamma[yi, xi], nu[yi, xi] = pyzebra.det2pol(ddist, gammad, nud, xi, yi)
|
||||
|
||||
return gamma, nu
|
||||
|
Loading…
x
Reference in New Issue
Block a user