Verified Commit efe695dc authored by Tobias WEBER's avatar Tobias WEBER
Browse files

included changes from https://github.com/t-weber/takin2

parent f18a8bed
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
# #
# @desc For a good explanation of the covariance matrix method, see (Arens 2015), pp. 795 and 1372. # @desc For a good explanation of the covariance matrix method, see (Arens 2015), pp. 795 and 1372.
# @desc reimplements the functionality of https://github.com/McStasMcXtrace/McCode/blob/master/tools/Legacy-Perl/mcresplot.pl # @desc reimplements the functionality of https://github.com/McStasMcXtrace/McCode/blob/master/tools/Legacy-Perl/mcresplot.pl
# @desc see also [eck14] G. Eckold and O. Sobolev, NIM A 752, pp. 54-64 (2014), doi: 10.1016/j.nima.2014.03.019
# #
import os import os
...@@ -201,11 +202,10 @@ def calc_covar(Q, E, w, Qpara, Qperp): ...@@ -201,11 +202,10 @@ def calc_covar(Q, E, w, Qpara, Qperp):
# #
def descr_ellipse(quadric): def descr_ellipse(quadric):
[ evals, evecs ] = la.eig(quadric) [ evals, evecs ] = la.eig(quadric)
#print("Evals: %s" % evals)
fwhms = 1./np.sqrt(np.abs(evals)) * sig2fwhm fwhms = 1./np.sqrt(np.abs(evals)) * sig2fwhm
angles = np.array([]) angles = np.array([])
if len(quadric) == 2: if len(quadric) == 2:
angles = np.array([ np.arctan2(evecs[1][0], evecs[0][0]) ]) angles = np.array([ np.arctan2(evecs[1][0], evecs[0][0]) ])
...@@ -215,6 +215,7 @@ def descr_ellipse(quadric): ...@@ -215,6 +215,7 @@ def descr_ellipse(quadric):
# #
# projects along one axis of the quadric # projects along one axis of the quadric
# see [eck14], equ. 57
# #
def proj_quad(_E, idx): def proj_quad(_E, idx):
E = np.delete(np.delete(_E, idx, axis=0), idx, axis=1) E = np.delete(np.delete(_E, idx, axis=0), idx, axis=1)
......
...@@ -144,10 +144,6 @@ def get_A(lattice, angles): ...@@ -144,10 +144,6 @@ def get_A(lattice, angles):
(cs[0]-cs[1]*cs[2]) / s2, \ (cs[0]-cs[1]*cs[2]) / s2, \
(np.sqrt(1. - np.dot(cs,cs) + 2.*cs[0]*cs[1]*cs[2])) / s2]) (np.sqrt(1. - np.dot(cs,cs) + 2.*cs[0]*cs[1]*cs[2])) / s2])
# testing equality with own derivation
#print((np.sqrt(1. - np.dot(cs,cs) + 2.*cs[0]*cs[1]*cs[2])) / s2)
#print(np.sqrt(1. - cs[1]*cs[1] - ((cs[0] - cs[2]*cs[1])/s2)**2.))
# the real-space basis vectors form the columns of the A matrix # the real-space basis vectors form the columns of the A matrix
return np.transpose(np.array([a, b, c])) return np.transpose(np.array([a, b, c]))
...@@ -200,7 +196,6 @@ def get_a3a4(ki, kf, Q_rlu, orient_rlu, orient_up_rlu, B, sense_sample=1., a3_of ...@@ -200,7 +196,6 @@ def get_a3a4(ki, kf, Q_rlu, orient_rlu, orient_up_rlu, B, sense_sample=1., a3_of
a3 = - psi - xi + a3_offs a3 = - psi - xi + a3_offs
a4 = get_a4(ki, kf, Qlen) a4 = get_a4(ki, kf, Qlen)
#print("xi = " + str(xi/np.pi*180.) + ", psi = " + str(psi/np.pi*180.) + ", offs = " + str(a3_offs/np.pi*180.))
return [a3, a4, dist_Q_plane] return [a3, a4, dist_Q_plane]
...@@ -435,8 +430,6 @@ class TasGUI: ...@@ -435,8 +430,6 @@ class TasGUI:
self.tasstatus.setText("") self.tasstatus.setText("")
else: else:
metric = get_metric(self.B) metric = get_metric(self.B)
#ang1 = angle(Q_rlu, self.orient_rlu, metric)
#ang2 = angle(Q_rlu, self.orient2_rlu, metric)
ang_plane = np.pi*0.5 - angle(Q_rlu, self.orient_up_rlu, metric) ang_plane = np.pi*0.5 - angle(Q_rlu, self.orient_up_rlu, metric)
self.tasstatus.setText(u"WARNING: Q is out of the plane by %.4g \u212b\u207b\u00b9, i.e. %.4g deg!" \ self.tasstatus.setText(u"WARNING: Q is out of the plane by %.4g \u212b\u207b\u00b9, i.e. %.4g deg!" \
...@@ -1017,7 +1010,6 @@ class TasGUI: ...@@ -1017,7 +1010,6 @@ class TasGUI:
self.xtalChanged() self.xtalChanged()
self.KiKfChanged() self.KiKfChanged()
self.comboA3ConvChanged() self.comboA3ConvChanged()
#self.QChanged()
self.KiKfChanged_angles() self.KiKfChanged_angles()
dlg.show() dlg.show()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment