Skip to content

Commit

Permalink
Fixed bug in MosaicCrystal when normal is in the 'z' direction.
Browse files Browse the repository at this point in the history
  • Loading branch information
amicitas committed Mar 8, 2023
1 parent 69ca0f6 commit 35ebab6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion xicsrt/optics/_InteractCrystal.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class InteractCrystal(InteractMirror):

def default_config(self):
"""
crystal_spacing
crystal_spacing: float [angstroms]
The spacing between crystal planes.
.. Note::
Expand Down
4 changes: 2 additions & 2 deletions xicsrt/optics/_InteractMosaicCrystal.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,9 @@ def mosaic_normals(self, normals, mask, copy=True):

R = np.empty((np.sum(m), 3, 3,), dtype=np.float64)

# Create two vectors perpendicular to the surface normal,
# Create two vectors perpendicular to the surface normal and each other,
# it doesn't matter how they are oriented otherwise.
R[:, 0, :] = np.cross(normals[m], [0,0,1])
R[:, 0, :] = np.cross(normals[m], [1,0,0]) + np.cross(normals[m], [0,0,1])
R[:, 0, :] /= np.linalg.norm(R[:, 0, :], axis=1)[:, np.newaxis]
R[:, 1, :] = np.cross(normals[m], R[:, 0, :])
R[:, 1, :] /= np.linalg.norm(R[:, 1, :], axis=1)[:, np.newaxis]
Expand Down

0 comments on commit 35ebab6

Please sign in to comment.