ImageD11.gv_general module#
- ImageD11.gv_general.angmod(a)#
- ImageD11.gv_general.axis_from_matrix(m)#
Factory method to create a rotation_axis object from a direction cosine matrix http://en.wikipedia.org/wiki/Rotation_representation_%28mathematics%29
- ImageD11.gv_general.chimat(c)#
- ImageD11.gv_general.chiwedge(chi=0.0, wedge=0.0)#
in transform: g = omega . chi . wedge .k
- ImageD11.gv_general.g_to_k(g, wavelength, axis=array([0., 0., 1.]), pre=None, post=None)#
- Get the k and angles given the g in
g = pre . rot(axis, angle) . post . k g = omega . chi . wedge . k
…where k will satisfy the Laue equations
- The recipe is:
- Find the components of g along and perpendicular to the rotation axis
- co-ords are a0 = axis,
a1 = axis x g, a2 = a1 x axis = ( axis x g ) x axis
Rotated vector will be a0 + a1 sin(angle) + a2 cos(angle) Laue condition says that [incident beam].[k] = k.sin(theta)
Apply any post rotations to the incident beam Apply any pre-rotations to the g vector |g| = [a0 + a1 sin(angle) + a2 cos(angle) ] . [incident beam] => solve for angle
http://www.ping.be/~ping1339/gonio.htm a sin(u) + b cos(u) = c let: tan(u’) = -b/a and: A = a / cos(u’) Finally you’ll find:
A.sin(u-u’) = c A.cos(pi/2 - u - u’) = c
- ImageD11.gv_general.k_to_g(k, angles, axis=None, pre=None, post=None)#
Computes g = pre . rot(axis, angle) . post . k Typically in ImageD11 post = [wedge][chi] and pre = identity
since g = Omega.Chi.Wedge.k or k = Wedge-1.Chi-1.Omega-1.g that is to say omega is directly under the sample and wedge is at the bottom of the stack
- class ImageD11.gv_general.rotation_axis(direction, angle=0.0)#
Bases:
object- Represents an axis - so far includes:
axis/angle matrix (direction cosines)
potentially can add quaternions and euler etc later?
- rotate_vectors(vectors, angles=None)#
Given a list of vectors, rotate them to new ones Angle is either self.angle, or 1 per vector, in degrees
http://www.ecse.rpi.edu/Homepages/wrf/Research/Short_Notes/rotation.html p’ = a . p a + (p - a . p a) cos q + a * p sin q
= p cos q + a . p a (1-cos q) + a * p sin q point p, axis a, angle q
http://mathworld.wolfram.com/RotationFormula.html r’ = r cos(t) + n(n.r)(1-cos(t)) + rxn sin(t)
- rotate_vectors_inverse(vectors, angles=None)#
Same as rotate vectors, but opposing sense
- to_matrix()#
Returns a 3x3 rotation matrix R = I3cos(t) + ww^T (1-cos(t)) - W sin(t) t = angle W = vector with hat operator = [ 0 -wz wy
wz 0 -wx
- -wy
wx 0 ]
- ImageD11.gv_general.wedgechi(wedge=0.0, chi=0.0)#
in transform: g = omega . chi . wedge .k
- ImageD11.gv_general.wedgemat(w)#