Minor simplifications

This commit is contained in:
usov_i 2023-02-06 15:32:32 +01:00
parent dc397062ad
commit bc66c593f3
2 changed files with 23 additions and 32 deletions

View File

@ -119,7 +119,7 @@ def create():
) )
# Convert all hkls to cartesian # Convert all hkls to cartesian
hkl = [[h[:, :, :], k[:, :, :], l[:, :, :]]] hkl = [[h, k, l]]
hkl = np.transpose(hkl) hkl = np.transpose(hkl)
hkl_c = np.matmul(M, hkl) hkl_c = np.matmul(M, hkl)
@ -153,9 +153,9 @@ def create():
y = np.transpose(y) y = np.transpose(y)
# Get slices: # Get slices:
x_slice = x[ind[0], ind[1], ind[2]] x_slice = x[ind]
y_slice = y[ind[0], ind[1], ind[2]] y_slice = y[ind]
I_slice = I_matrix[ind[0], ind[1], ind[2]] I_slice = I_matrix[ind]
# Meshgrid limits for plotting # Meshgrid limits for plotting
if auto_range_cb.active: if auto_range_cb.active:

View File

@ -51,11 +51,6 @@ class PlotHKL:
k = np.array(k_vectors.value.split()).astype(float).reshape(-1, 3) k = np.array(k_vectors.value.split()).astype(float).reshape(-1, 3)
tol_k = tol_k_ni.value tol_k = tol_k_ni.value
# Plotting options
grid_flag = 1
grid_minor_flag = 1
grid_div = 2 # Number of minor division lines per unit
# different symbols based on file number # different symbols based on file number
file_flag = 0 in disting_opt_cb.active file_flag = 0 in disting_opt_cb.active
# scale marker size according to intensity # scale marker size according to intensity
@ -144,9 +139,7 @@ class PlotHKL:
# Calculate resolution in degrees # Calculate resolution in degrees
expr = np.tan(gammad / 2 * np.pi / 180) expr = np.tan(gammad / 2 * np.pi / 180)
res = ( res = np.sqrt(0.4639 * expr**2 - 0.4452 * expr + 0.1506) * res_mult
np.sqrt(0.4639 * expr**2 - 0.4452 * expr + 0.1506) * res_mult
) # res in deg
# convert to resolution in hkl along scan line # convert to resolution in hkl along scan line
ang2hkl_1d = pyzebra.ang2hkl_1d ang2hkl_1d = pyzebra.ang2hkl_1d
@ -196,7 +189,6 @@ class PlotHKL:
# Plot grid lines # Plot grid lines
xs, ys = [], [] xs, ys = [], []
xs_minor, ys_minor = [], [] xs_minor, ys_minor = [], []
if grid_flag:
for yy in np.arange(min_grid_y, max_grid_y, 1): for yy in np.arange(min_grid_y, max_grid_y, 1):
hkl1 = M @ [0, yy, 0] hkl1 = M @ [0, yy, 0]
xs.append([min_grid_y, max_grid_y]) xs.append([min_grid_y, max_grid_y])
@ -208,13 +200,12 @@ class PlotHKL:
xs.append([hkl1[0], hkl2[0]]) xs.append([hkl1[0], hkl2[0]])
ys.append([hkl1[1], hkl2[1]]) ys.append([hkl1[1], hkl2[1]])
if grid_minor_flag: for yy in np.arange(min_grid_y, max_grid_y, 0.5):
for yy in np.arange(min_grid_y, max_grid_y, 1 / grid_div):
hkl1 = M @ [0, yy, 0] hkl1 = M @ [0, yy, 0]
xs_minor.append([min_grid_y, max_grid_y]) xs_minor.append([min_grid_y, max_grid_y])
ys_minor.append([hkl1[1], hkl1[1]]) ys_minor.append([hkl1[1], hkl1[1]])
for xx in np.arange(min_grid_x, max_grid_x, 1 / grid_div): for xx in np.arange(min_grid_x, max_grid_x, 0.5):
hkl1 = M @ [xx, min_grid_x, 0] hkl1 = M @ [xx, min_grid_x, 0]
hkl2 = M @ [xx, max_grid_x, 0] hkl2 = M @ [xx, max_grid_x, 0]
xs_minor.append([hkl1[0], hkl2[0]]) xs_minor.append([hkl1[0], hkl2[0]])