Skip to content

Commit

Permalink
Merge pull request #738 from HEXRD/fix-simulate-gvecs
Browse files Browse the repository at this point in the history
Only pass one rMat_s to angularPixelSize
  • Loading branch information
psavery authored Jan 7, 2025
2 parents d64428f + fa63866 commit 42247f3
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions hexrd/xrdutil/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1007,7 +1007,7 @@ def simulateGVecs(
ang_ps = []
else:
# ??? preallocate for speed?
det_xy, rMat_s, _ = _project_on_detector_plane(
det_xy, rMat_ss, _ = _project_on_detector_plane(
allAngs, rMat_d, rMat_c, chi, tVec_d, tVec_c, tVec_s, distortion,
beamVec=beam_vector
)
Expand All @@ -1034,7 +1034,9 @@ def simulateGVecs(
valid_xy,
pixel_pitch,
rMat_d,
rMat_s,
# Provide only the first sample rotation matrix to angularPixelSize
# Perhaps this is something that can be improved in the future?
rMat_ss[0],
tVec_d,
tVec_s,
tVec_c,
Expand Down Expand Up @@ -1252,6 +1254,16 @@ def angularPixelSize(
if etaVec is None:
etaVec = constants.eta_vec

# Verify that rMat_s is only 2D (a single matrix).
# Arrays of matrices were previously provided, which `xy_to_gvec`
# cannot currently handle.
if rMat_s.ndim != 2:
msg = (
f'rMat_s should have 2 dimensions, but has {rMat_s.ndim} '
'dimensions instead'
)
raise ValueError(msg)

xy_expanded = np.empty((len(xy_det) * 4, 2), dtype=xy_det.dtype)
xy_expanded = _expand_pixels(
xy_det, xy_pixelPitch[0], xy_pixelPitch[1], xy_expanded
Expand Down

0 comments on commit 42247f3

Please sign in to comment.