From 5d1ef9c6921ccd1c520a335f0a7fc0f15accff52 Mon Sep 17 00:00:00 2001 From: Saransh Singh Date: Mon, 16 Dec 2024 15:00:12 -0800 Subject: [PATCH] Fix x-ray propagation sign to always be positive Signed-off-by: Patrick Avery --- hexrdgui/calibration/cartesian_plot.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/hexrdgui/calibration/cartesian_plot.py b/hexrdgui/calibration/cartesian_plot.py index 1b329e5d8..9a25d769f 100644 --- a/hexrdgui/calibration/cartesian_plot.py +++ b/hexrdgui/calibration/cartesian_plot.py @@ -22,6 +22,8 @@ def cartesian_viewer(): return InstrumentViewer() +def get_xray_propagation_sign(instr): + return np.sign(instr.beam_vector[2]) class InstrumentViewer: @@ -40,7 +42,8 @@ def __init__(self): self.detector_corners = {} dist = HexrdConfig().cartesian_virtual_plane_distance - dplane_tvec = np.array([0., 0., -dist]) + sgn = get_xray_propagation_sign(self.instr) + dplane_tvec = np.array([0., 0., sgn*dist]) rotate_x = HexrdConfig().cartesian_plane_normal_rotate_x rotate_y = HexrdConfig().cartesian_plane_normal_rotate_y