Debian Codegraph @

tests/test_quatfit.py

raw symbols SCIP
1 from unittest import TestCase
2
3 from shelxfile.fit.quatfit import matrix_minus_vect, matrix_plus_vect, transpose, centroid
4
5
6 class Test(TestCase):
7 def test_matrix_minus_vect(self):
8 source = [[-0.01453, 1.6659, 0.10966], [-0.00146, 0.26814, 0.06351], [-0.27813, -0.21605, 1.52795]]
9 cent = [-0.09804, 0.57266333, 0.56704]
10
11 self.assertEqual([[0.08351, 1.09323667, -0.45738], [0.09658, -0.30452333000000004, -0.50353],
12 [-0.18008999999999997, -0.78871333, 0.9609099999999999]], matrix_minus_vect(source, cent))
13 self.assertEqual([[0, 0, 0], [1, 1, 1], [2, 2, 2]],
14 matrix_minus_vect([[1, 1, 1], [2, 2, 2], [3, 3, 3]], [1, 1, 1]))
15
16 def test_matrix_plus_vect(self):
17 source = [[-0.01453, 1.6659, 0.10966], [-0.00146, 0.26814, 0.06351], [-0.27813, -0.21605, 1.52795]]
18 cent = [-0.09804, 0.57266333, 0.56704]
19 self.assertEqual([[-0.11257, 2.23856333, 0.6767], [-0.0995, 0.84080333, 0.6305499999999999],
20 [-0.37617, 0.35661333000000006, 2.09499]], matrix_plus_vect(source, cent))
21 self.assertEqual([[2, 2, 2], [3, 3, 3], [4, 4, 4]],
22 matrix_plus_vect([[1, 1, 1], [2, 2, 2], [3, 3, 3]], [1, 1, 1]))
23
24 def test_transpose(self):
25 m = [[1, 2, 3], [1, 2, 3], [1, 2, 3]]
26 self.assertEqual([(1, 1, 1), (2, 2, 2), (3, 3, 3)], transpose(m))
27
28 def test_centroid(self):
29 self.assertEqual((-0.09804, 0.5726633333333333, 0.56704), centroid(
30 [[-1.45300e-02, 1.66590e+00, 1.09660e-01], [-1.46000e-03, 2.68140e-01, 6.35100e-02],
31 [-2.78130e-01, -2.16050e-01, 1.52795e+00]]))