diff --git a/pyzebra/app/panel_hdf_viewer.py b/pyzebra/app/panel_hdf_viewer.py index d688738..4f0a485 100644 --- a/pyzebra/app/panel_hdf_viewer.py +++ b/pyzebra/app/panel_hdf_viewer.py @@ -258,8 +258,9 @@ def create(): # handle both, ascending and descending sequences scanning_motor_range.bounds = (min(var_start, var_end), max(var_start, var_end)) - gamma_start = det_data["gamma"][0] + det_data["x_deg"][0] - gamma_end = det_data["gamma"][0] + det_data["x_deg"][-1] + gamma = image_source.data["gamma"][0] + gamma_start = gamma[0, 0] + gamma_end = gamma[0, -1] gamma_range.start = gamma_start gamma_range.end = gamma_end @@ -267,8 +268,9 @@ def create(): gamma_range.reset_end = gamma_end gamma_range.bounds = (min(gamma_start, gamma_end), max(gamma_start, gamma_end)) - nu_start = det_data["nu"][0] + det_data["y_deg"][0] - nu_end = det_data["nu"][0] + det_data["y_deg"][-1] + nu = image_source.data["nu"][0] + nu_start = nu[0, 0] + nu_end = nu[-1, 0] nu_range.start = nu_start nu_range.end = nu_end @@ -899,15 +901,10 @@ def calculate_hkl(det_data, index): 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["gamma"][index] nud = det_data["nu"] - - 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) + yi, xi = np.ogrid[:IMAGE_H, :IMAGE_W] + gamma, nu = pyzebra.det2pol(ddist, gammad, nud, xi, yi) return gamma, nu diff --git a/pyzebra/h5.py b/pyzebra/h5.py index 3a2a6a4..1a25fa9 100644 --- a/pyzebra/h5.py +++ b/pyzebra/h5.py @@ -135,12 +135,4 @@ def read_detector_data(filepath, cami_meta=None): if "dist1" in cami_meta_detparam: det_data["ddist"] = cami_meta_detparam["dist1"] - x = h5f["/entry1/ZEBRA/area_detector2/x"][:] - y = h5f["/entry1/ZEBRA/area_detector2/y"][:] - x_pixel_offset = int(h5f["/entry1/ZEBRA/area_detector2/x_pixel_offset"][:]) - y_pixel_offset = int(h5f["/entry1/ZEBRA/area_detector2/y_pixel_offset"][:]) - distance = h5f["/entry1/ZEBRA/area_detector2/distance"][:] - det_data["x_deg"] = np.arctan((x - x[x_pixel_offset]) / distance) - det_data["y_deg"] = np.arctan((y - y[y_pixel_offset]) / distance) - return det_data diff --git a/pyzebra/xtal.py b/pyzebra/xtal.py index d14a9a0..50c3e11 100644 --- a/pyzebra/xtal.py +++ b/pyzebra/xtal.py @@ -379,6 +379,7 @@ def ang_proc(wave, ddist, gammad, om, ch, ph, nud, x, y): z1 = z1frmd(wave, ga, om, ch, ph, nu) ch2, ph2 = eqchph(z1) ch, ph, ga, om = fixdnu(wave, z1, ch2, ph2, nu) + return ch, ph, ga, om