ImageD11.transform
index
/sware/exp/fable/standalone/redhate4-a64/lib/python2.5/site-packages/ImageD11/transform.py

Functions for transforming peaks

 
Modules
       
logging
numpy

 
Functions
       
compute_g_vectors(tth, eta, omega, wavelength, wedge=0.0, chi=0.0, **kwds)
Generates spot positions in reciprocal space from 
  twotheta, wavelength, omega and eta
Assumes single axis vertical
... unless a wedge angle is specified
compute_grain_origins(omega, wedge=0.0, chi=0.0, t_x=0.0, t_y=0.0, t_z=0.0)
# print "Using translations t_x %f t_y %f t_z %f"%(t_x,t_y,t_z)
# Compute positions of grains
# expecting tx, ty, tz for each diffraction spot
#
# g =  R . W . k
#  g - is g-vector w.r.t crystal
#  k is scattering vector in lab
#  so we want displacement in lab from displacement in sample
#  shift =  W-1  R-1 crystal_translation
#
# R = ( cos(omega) , sin(omega), 0 )
#     (-sin(omega) , cos(omega), 0 )
#     (         0  ,         0 , 1 )
#
# W = ( cos(wedge) ,  0  ,  sin(wedge) )
#     (         0  ,  1  ,          0  )
#     (-sin(wedge) ,  0  ,  cos(wedge) )
#
# C = (         1  ,          0  ,       0     ) ??? Use eta0 instead
#     (         0  ,   cos(chi)  ,  sin(chi)   )  ??? Use eta0 instead
#     (         0  ,  -sin(chi)  ,  cos(chi)   )  ??? Use eta0 instead
compute_k_vectors(tth, eta, wavelength)
generate k vectors - scattering vectors in laboratory frame
compute_lorentz_factors(tth, eta, omega, wavelength, wedge=0.0, chi=0.0)
From Kabsch 1988 J. Appl. Cryst. 21 619
 
Multiply the intensities by:
Lorentz = | S.(u x So)| / |S|.|So|
S = scattered vector
So = incident vector
u = unit vector along rotation axis
compute_polarisation_factors(args)
From Kabsch 1988 J. Appl. Cryst. 21 619
 
DIVIDE the intensities by:
<sin2 psi> = ( 1 - 2p) [ 1 - (n.S/|S|^2) ] + p { 1 + [S.S_0/(|S||S_0|)^2]^2}
 
p = degree of polarisation (sync = 1, tube = 0.5 , mono + tube in between)
    or "probability of finding electric field vector in plane having normal, n"
S = scattered vector
S_0 = incident vector
n = normal to polarisation plane, typically perpendicular to S_0
 
In ImageD11 we normally expect to find:
x axis along the beam
z axis being up, and parallel to the normal n mentioned above
compute_tth_eta(peaks, y_center=0.0, y_size=0.0, tilt_y=0.0, z_center=0.0, z_size=0.0, tilt_z=0.0, tilt_x=0.0, distance=0.0, o11=1.0, o12=0.0, o21=0.0, o22=-1.0, t_x=0.0, t_y=0.0, t_z=0.0, omega=None, wedge=0.0, chi=0.0, **kwds)
0/10 for style
compute_tth_eta_from_xyz(peaks_xyz, omega, t_x=0.0, t_y=0.0, t_z=0.0, wedge=0.0, chi=0.0, **kwds)
Peaks is a 3 d array of x,y,z peak co-ordinates
crystal_translation is the position of the grain giving rise 
to a diffraction spot
             in x,y,z ImageD11 co-ordinates
             x,y with respect to axis of rotation and or beam centre ??
             z with respect to beam height, z centre
omega data needed if crystal translations used
compute_tth_histo(tth, no_bins=100, **kwds)
Compute a histogram of tth values
 
Returns a normalised histogram (should make this a probability
*and*
 For each datapoint, the number of other points in the same bin
compute_xyz_lab(peaks, y_center=0.0, y_size=0.0, tilt_y=0.0, z_center=0.0, z_size=0.0, tilt_z=0.0, tilt_x=0.0, distance=0.0, o11=1.0, o12=0.0, o21=0.0, o22=-1.0, **kwds)
Peaks is a 2 d array of x,y
yc is the centre in y
ys is the y pixel size
ty is the tilt around y
zc is the centre in z
zs is the z pixel size
tz is the tilt around z
dist is the sample - detector distance
detector_orientation is a matrix to apply to peaks arg to get 
ImageD11 convention
     (( 0, 1),( 1, 0)) for ( y, x)
     ((-1, 0),( 0, 1)) for (-x, y)
     (( 0,-1),(-1, 0)) for (-y,-x)
  etc...
cross_product_2x2(a, b)
returns axb for two len(3) vectors a,b
degrees(x)
Convenience function
radians(x)
Convenience function
uncompute_g_vectors(g, wavelength, wedge=0.0, chi=0.0)
Given g-vectors compute tth,eta,omega
assert uncompute_g_vectors(compute_g_vector(tth,eta,omega))==tth,eta,omega
uncompute_one_g_vector(gv, wavelength, wedge=0.0)
Given g-vectors compute tth,eta,omega
assert uncompute_g_vectors(compute_g_vector(tth,eta,omega))==tth,eta,omega

 
Data
        pi = 3.1415926535897931
test = array([ 1.57079633, 1.57079633, 1.57079633, 1...57079633, 1.57079633, 1.57079633, 1.57079633])