Menu

xfab.detector

Anonymous

Back to [xfab]

NAME
xfab.detector

FUNCTIONS
det_coor(Gt, costth, wavelength, distance, y_size, z_size, dety_center, detz_center, R_tilt, tx, ty, tz)
Calculates detector coordinates dety,detz

INPUT:
Gt is the g-vector
y_size and z-size are the detector pixel size in y, and z (in microns)
(dety_center, detz-center) is the beam center of the detector (in pixels)
R_tilt is the rotation matrix of the detector
(tx, ty, tz) is the position of the grain at the present omega

OUTPUT:
[dety, detz]

det_coor2(tth, eta, distance, y_size, z_size, dety_center, detz_center, R_tilt, tx, ty, tz)
Calculates detector coordinates dety,detz
Alternative to det_coor using the angles the azimuthal angle eta for calculation of
the detector coordinates instead of the g-vector

INPUT:
tth is two-theta
eta is the azimuthal angle around the beam center ccw with eta= 0 at +ylab
y_size and z-size are the detector pixel size in y, and z (in microns)
(dety_center, detz-center) is the beam center of the detector (in pixels)
R_tilt is the rotation matrix of the detector
(tx, ty, tz) is the position of the grain at the present omega

OUTPUT:
[dety, detz]

detector2lab(dety, detz, L, py, pz, y0, z0, R_tilt)
calculates the laboratory coordinates (xl,yl,zl) from the detector coordinates (dety,detz),
the sample-to-detector distance L, the pixel sizes (py and pz), the beam centre (y0,z0)
and the detector tilt R_tilt

detyz2xy(coor, o11, o12, o21, o22, dety_size, detz_size)
Transforming dety, detz coordinates to meet (x,y) coordinates
of the raw image according to the detector orientation matrix given.
The definition of (dety,detz) is defined in
"3DXRD and TotalCryst Geometry - Version 1.0.2" by
H.F. Poulsen, S. Schmidt, J. Wright, H.O. Sorensen

Detector_orientation: o= [[o11,o12],[o21,o22]]
returns (dety,detz)

distort(coor, o11, o12, o21, o22, dety_size, detz_size, spatial)

image_flipping(img, o11, o12, o21, o22, dir='forward')
Transforming image matrix according to the
detector orientation matrix given the
output image matrix will have coordinates (dety,detz)
as defined in
"3DXRD and TotalCryst Geometry - Version 1.0.2" by
H.F. Poulsen, S. Schmidt, J. Wright, H.O. Sorensen

Detector_orientation: [[o11,o12],[o21,o22]]

[[o11,o12],[o21,o22]]
[[ 1, 0],[ 0, 1]] => nothing
[[ -1, 0],[ 0, 1]] => flipud
[[ 1, 0],[ 0, -1]] => fliplr
[[ -1, 0],[ 0, -1]] => flipud fliplr

[[ 0, 1],[ 1, 0]] => transpose
[[ 0, -1],[ -1, 0]] => transpose fliplr flipud
[[ 0, -1],[ 1, 0]] => transpose flipud
[[ 0, 1],[ -1, 0]] => transpose flipud

dir can takes the values 'forward' or 'inverse'
┬┤forward': raw image -> 3DXRD standard
'inverse': 3DXRD standard -> raw image

trans_orientation(img, o11, o12, o21, o22, dir='forward')
Transforming image matrix according to the
detector orientation matrix given the
output image matrix will have coordinates (dety,detz)
as defined in
"3DXRD and TotalCryst Geometry - Version 1.0.2" by
H.F. Poulsen, S. Schmidt, J. Wright, H.O. Sorensen

It is important to note that the image is not only flipped
using the orientation matrix, but also transposed such the
the returned array img has the coordinates [dety,detz].
Therefore even the identy orientation matrix performs a transformation.
To avoid this please use the function image_flipping

Detector_orientation: [[o11,o12],[o21,o22]]
if pretransposed to get img -> img(dety,detz) then
[[o11,o12],[o21,o22]]
[[ 1, 0],[ 0, 1]] => nothing
[[ -1, 0],[ 0, 1]] => fliplr
[[ 1, 0],[ 0, -1]] => flipud
[[ -1, 0],[ 0, -1]] => flipud fliplr
These will not be pretransposed
[[ 0, 1],[ 1, 0]] => nothing
[[ 0, -1],[ -1, 0]] => fliplr flipud
[[ 0, -1],[ 1, 0]] => fliplr
[[ 0, 1],[ -1, 0]] => flipud

dir can takes the values 'forward' or 'inverse'
┬┤forward': raw image -> 3DXRD standard
'inverse': 3DXRD standard -> raw image

xy2detyz(coor, o11, o12, o21, o22, dety_size, detz_size)
Transforming (x,y) coordinates of the raw image
to (dety, detz) coordinates according to the
detector orientation matrix given.
The definition of (dety,detz) is defined in
"3DXRD and TotalCryst Geometry - Version 1.0.2" by
H.F. Poulsen, S. Schmidt, J. Wright, H.O. Sorensen

Detector_orientation: o= [[o11,o12],[o21,o22]]
returns (dety,detz)


Related

Wiki: xfab