-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix rotation omega to match GDA behavior #720
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #720 +/- ##
==========================================
+ Coverage 86.94% 86.96% +0.02%
==========================================
Files 101 101
Lines 6918 6929 +11
==========================================
+ Hits 6015 6026 +11
Misses 903 903
|
4390162
to
dadf5ee
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like this fixes the issue, but it's annoying that we have to do lots of weird logic just to replicate a bug in GDA. Once we are no longer using GDA at all, maybe we can remove all this additional complexity. We could make another issue for that, although it would probably be years before we got around to it 🥲
# start_motion_deg = -start_motion_deg | ||
# distance_to_move_deg = -distance_to_move_deg |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you mean to leave these in?
direction = params.rotation_direction.multiplier | ||
assert params.rotation_increment_deg > 0 | ||
|
||
direction = params.rotation_direction |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add a docstring to RotationDirection
to explain that this now means the direction of rotation relative to the omega sweep in the Hyperion request
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not the correct interpretation of RotationDirection
, RotationDirection
is used both in Zebra PositionCompare
and in the RotationScan
parameter class. A positive rotation in both these represent opposite rotation directions in the real world, if omega_flip
is true.
RotationDirection
represents the direction of the rotation in the context of the coordinate space of the interface that requires it as a parameter. It has only the meaning, that the sweep / rotation increment should be added or subtracted from the initial position, in whatever class is using it.
Fix latent issue with FeatureFlags not being read from the server for rotations
Make type-checking, ruff happy
dadf5ee
to
db33f04
Compare
These changes address #247
This introduces a new
omega_flip
feature flag that can be set. The default is True.omega_flip
should be specified according to whether the goniometer omega rotation axis is consistent with the nexus file specification or not https://journals.iucr.org/m/issues/2020/05/00/ti5018/ti5018.pdfThe
omega_flip
determines the/entry/sample/transformations/omega
vector in the nexus file and sets it to (-1, 0, 0) if True (in line with GDA) or (+1, 0, 0) if False. It also inverts the motor motions for rotation scans. Whenomega_flip
is False, the smargon omega and the omega values in the request have the same sign.The
rotation_direction
request parameter now indicates the direction of rotation with respect to the omega sweep specified in the Hyperion request (whereas before,rotation_direction
was always set toNegative
by GDA, and this changed the physical motor direction but not the start of the rotation. Everything else was reported as positive in the nexus files and ispyb.The intention of these changes is that this makes Hyperion behave identically with GDA, under the following conditions:
omega_flip
is Truerotation_direction
is PositiveAs currently,
rotation_direction
is hard-coded in GDA, an alternative setting that would arguably produce "nicer" output in nexus files would beomega_flip
= False,rotation_direction
= Positive, however the motion would be in the opposite sense and nexus output would have have different (positive) transformation omega vector, so this would need to be tested to make sure downstream analysis tools are happy with the output.This change doesn't affect gridscans or rotation snapshots - we may want to also make changes for rotation snapshots if we want the reported snapshot angles to be congruent with the rotation sweep.
I'm not sure whether a
FeatureFlag
is the best way of presenting this setting, perhaps it may be better as a soft (or maybe even hard) signal that's exposed by thesmargon
. I am open to discussion on this.