Skip to content

Commit

Permalink
Invert rotation axis for negative scans (#694)
Browse files Browse the repository at this point in the history
This complements 39e463e.

Twirling, always twirling.
  • Loading branch information
graeme-winter authored Feb 13, 2024
1 parent 39e463e commit f901366
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions newsfragments/694.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
NXmx: if reversed, reverse rotation axis. This is part 2 of previous commit.
9 changes: 7 additions & 2 deletions src/dxtbx/format/FormatNXmx.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,16 @@ def _start(self):
scan = self._scan_model
oscillation = scan.get_oscillation()

# FIXME this really should not be correct but it works in this one
# weird case
if oscillation[1] < 0:
# invert the scan parameters so that the attitude of roation is positive
self._scan_model.set_oscillation((-oscillation[0], -oscillation[1]))

# invert the axis direction so that the universe is aligned
axes = self._goniometer_model.get_axes()
axis = self._goniometer_model.get_scan_axis()
axes[axis] = -1 * axes[axis][0], -1 * axes[axis][1], -1 * axes[axis][2]
self._goniometer_model.set_axes(axes)

def _get_nxmx(self, fh: h5py.File):
return nxmx.NXmx(fh)

Expand Down

0 comments on commit f901366

Please sign in to comment.