Hexrd: Distortion #549
donald-e-boyce
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Distortion in Hexrd
The abstract base class for distortion is
DistortionABC
, located in thehexrd.distortion
package.A distortion class has
apply
andapply_inverse
methods. Theapply
method applies the distortioncorrection, and
apply_inverse
applies the distortion to a corrected field.Each class also has a
maptype
attribute that gives a name to the particular subclass and is usedin a dictionary to lookup distortion classes by name.
The
apply
method is used in convert Cartesian coordinate to angles, andapply_inverse
is used in convertingsangles back to Cartesian coordinates.
The distortion is used in a few other places as well, such as computing pixel angles and sizes and simulating
a Laue pattern.
GE41RT
The main distortion class available in hexrd is the GE41RT.
This class models the distortion on the GE detector as a barrel distortion.
Barrel distortion is a radial rescaling, but the GE41RT modifies this somewhat.
The model for distortion correction is this.$(x, y)$ is an input point and $(\bar{x}, \bar{y})$ are the corrected values, then the rescaling is given by
If
where
In the above equation,$\rho = r/r_{max}$ with $r = \sqrt{x^2 + y^2}$ ; $r_{max}$ is the maximum value of $r$ $\eta$ is the polar angle of $(x, y)$ ; and $c_1, c_2, c_3, \alpha_1, \alpha_2,$ and $\alpha_3$ are model parameters.
for the detector;
Barrel Distortion
Barrel distortion is a type of distortion that arises when a lens magnifies less as you move radially from the center,
while pincushion distortion is when the lens magnifies more as you move radially from the center.
There are several models for barrel distortion, but a standard one is$(\bar{x}, \bar{y}) = f(r) (x, y)$ , where
Note that this is an even order polynomial in$(x, y)$ since $r^2 = x^2 + y^2$ .
Usually a small number of terms are used, maybe up to fourth degree.
Also note that some consider the division model$(\bar{x}, \bar{y}) = (x, y)/f(r)$ to be an improvement.
References
Discussion
Now compare the barrel distortion with the GE41RT.
In the GE41RT the powers$\alpha_i$ are input parameters, but are usually taken to be 2.$\alpha_i$ to be arbitrary
As Zack noted, this produces a cubic equation for the inverse, which can be
solved much faster than the general case. It seems that allowing
complicates the code while not improving modeling capability significantly.
The GE also has terms involving the polar angle$\eta$ . These allow for the radial scaling to vary with the polar angle. The particular terms of $\cos(2\eta)$ and $\cos(4\eta)$ were chosen to model the variation, but the overall expressions are not very general.
In the end, the physics of the detector distortion is not the same as the barrel distortion due to
variable lens magnification, but it may be reasonable to model the detector distortion as a radial
scaling depending on polar angle.
Suggestion
I suggest the following model as a cleaner version.
For the radial scaling dependency on$r$ , use the polynomial model above,
and for the polar angle dependency, use a truncated Fourier series with mean value 1.
The full model would look like:
where
and
Some comments.
take
changing it could be compensated by changing all the
Beta Was this translation helpful? Give feedback.
All reactions