From 47481ec9ab0e917677850aa2107b5e9bde31bbf2 Mon Sep 17 00:00:00 2001 From: Patrick Avery Date: Fri, 10 Nov 2023 14:04:23 -0600 Subject: [PATCH] Apply tvec_s when convert masks to raw This doesn't matter for most examples, which have all zeros for their tvec_s. However, it is important to include this for the examples that do. Signed-off-by: Patrick Avery --- hexrdgui/create_raw_mask.py | 5 +++-- hexrdgui/utils/conversions.py | 6 ++++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/hexrdgui/create_raw_mask.py b/hexrdgui/create_raw_mask.py index ea185f6aa..fd18eca42 100644 --- a/hexrdgui/create_raw_mask.py +++ b/hexrdgui/create_raw_mask.py @@ -47,9 +47,10 @@ def convert_polar_to_raw(line_data, reverse_tth_distortion=True): line_data[i] = line raw_line_data = [] + instr = create_hedm_instrument() for line in line_data: - for key, panel in create_hedm_instrument().detectors.items(): - raw = angles_to_pixels(line, panel) + for key, panel in instr.detectors.items(): + raw = angles_to_pixels(line, panel, tvec_s=instr.tvec) if all([np.isnan(x) for x in raw.flatten()]): continue diff --git a/hexrdgui/utils/conversions.py b/hexrdgui/utils/conversions.py index facd80a0e..4f5ed9740 100644 --- a/hexrdgui/utils/conversions.py +++ b/hexrdgui/utils/conversions.py @@ -46,8 +46,10 @@ def angles_to_cart(angles, panel, tvec_s=None, tvec_c=None, return panel.angles_to_cart(**kwargs) -def angles_to_pixels(angles, panel): - xys = angles_to_cart(angles, panel) +def angles_to_pixels(angles, panel, tvec_s=None, tvec_c=None, + apply_distortion=True): + xys = angles_to_cart(angles, panel, tvec_s=tvec_s, tvec_c=tvec_c, + apply_distortion=apply_distortion) return cart_to_pixels(xys, panel)