Skip to content

Commit

Permalink
Apply tvec_s when convert masks to raw
Browse files Browse the repository at this point in the history
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 <patrick.avery@kitware.com>
  • Loading branch information
psavery committed Nov 10, 2023
1 parent 5f36777 commit 47481ec
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
5 changes: 3 additions & 2 deletions hexrdgui/create_raw_mask.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
6 changes: 4 additions & 2 deletions hexrdgui/utils/conversions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)


Expand Down

0 comments on commit 47481ec

Please sign in to comment.