-
Notifications
You must be signed in to change notification settings - Fork 4
Description
If errors are applied manually via the apply_*_error_to functions, the order is important, especially for arex/arey (add_aperture_offset_error_to).
The way that errors are applied is as following: we have an element and immediately before it and immediately after its aperture we squeeze in the transformation and back transformation elements, e.g. XYShift and SRotation.
Example: starting with
-------element--elemaperture------
apply dx offset ↑ and back transformation ↓:
-----↑-element--elemaperture-↓------
apply tilt ↶ and back tilt ↷:
-----↑- element--elemaperture -↓------
-----↑-↶-element--elemaperture-↷-↓------
This way the order of transformation and back transformation is automatically kept: offset→rotation→back-rotation→back-offset
Unfortunately it doesn't work with arex/arey if you try to include another transformation after them, because the initial offset is squeezed between element and aperture:
-------element--elemaperture------
apply arex aperture offset ↑ and back transformation ↓:
-------element--↑-elemaperture-↓------
apply tilt ↶ and back tilt ↷:
------- element--↑-elemaperture -↓------
-------↶-element--↑-elemaperture-↷-↓------
as you can see, the correct order of transformation is not kept, we have rotation→offset→back-rotation→back-offset in a different direction than the initial offset.
To avoid this we either need to include some kind of book keeping. Alternatively, we could misalign element and aperture separately, e.g.
-------↶-element-↷--↶-elemaperture-↷--------
which would include a lot of unnecessary transformations (that CAN be reduced later though with a merge_consecutive_drifts-style clean-up function).
Users that want to manually apply errors can avoid this problem by always applying arex/arey (add_aperture_offset_error_to) last.