Add ang2hkl function
This function is based on angtohkl, but doesn't include prints
This commit is contained in:
parent
f2fad95339
commit
d9fcffe42e
@ -327,7 +327,15 @@ def angtohkl(wave,ddist,gammad,om,ch,ph,nud,x,y):
|
|||||||
print('Bisecting angles to put reflection into the detector center: ga=', ga, ', om=', om, ', ch=', ch, ', ph=', ph, ', nu=', nu)
|
print('Bisecting angles to put reflection into the detector center: ga=', ga, ', om=', om, ', ch=', ch, ', ph=', ph, ', nu=', nu)
|
||||||
|
|
||||||
|
|
||||||
|
def ang2hkl(wave, ddist, gammad, om, ch, ph, nud, ub, x, y):
|
||||||
|
"""Calculate hkl-indices of a reflection from its position (x,y,angles) at the 2d-detector
|
||||||
|
"""
|
||||||
|
ga, nu = det2pol(ddist, gammad, nud, x, y)
|
||||||
|
z1 = z1frmd(wave, ga, om, ch, ph, nu)
|
||||||
|
ubinv = np.linalg.inv(ub)
|
||||||
|
|
||||||
|
h = ubinv[0, 0] * z1[0] + ubinv[0, 1] * z1[1] + ubinv[0, 2] * z1[2]
|
||||||
|
k = ubinv[1, 0] * z1[0] + ubinv[1, 1] * z1[1] + ubinv[1, 2] * z1[2]
|
||||||
|
l = ubinv[2, 0] * z1[0] + ubinv[2, 1] * z1[1] + ubinv[2, 2] * z1[2]
|
||||||
|
|
||||||
|
return h, k, l
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user