mailr11438 - /1.3/test_suite/unit_tests/_maths_fns/test_frame_order_matrix_ops.py


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by edward on August 09, 2010 - 10:28:
Author: bugman
Date: Mon Aug  9 10:28:53 2010
New Revision: 11438

URL: http://svn.gna.org/viewcvs/relax?rev=11438&view=rev
Log:
Wrote 4 unit tests for the compile_2nd_matrix_iso_cone*() frame order 
functions.


Modified:
    1.3/test_suite/unit_tests/_maths_fns/test_frame_order_matrix_ops.py

Modified: 1.3/test_suite/unit_tests/_maths_fns/test_frame_order_matrix_ops.py
URL: 
http://svn.gna.org/viewcvs/relax/1.3/test_suite/unit_tests/_maths_fns/test_frame_order_matrix_ops.py?rev=11438&r1=11437&r2=11438&view=diff
==============================================================================
--- 1.3/test_suite/unit_tests/_maths_fns/test_frame_order_matrix_ops.py 
(original)
+++ 1.3/test_suite/unit_tests/_maths_fns/test_frame_order_matrix_ops.py Mon 
Aug  9 10:28:53 2010
@@ -22,7 +22,7 @@
 
 # Python module imports.
 from math import pi
-from numpy import array, float64, zeros
+from numpy import array, eye, float64, zeros
 from unittest import TestCase
 
 # relax module imports.
@@ -34,8 +34,166 @@
 class Test_frame_order_matrix_ops(TestCase):
     """Unit tests for the maths_fns.frame_order_matrix_ops relax module."""
 
-
-    def test_compile_2nd_matrix_pseudo_ellipse(self):
+    def setUp(self):
+        """Initialise a few data structures for the tests."""
+
+        # Temp storage.
+        self.f2_temp = zeros((9, 9), float64)
+
+        # Set up the identity matrices.
+        self.setup_identity()
+
+        # Set up the identity matrices for free rotors.
+        self.setup_identity_free_rotor()
+
+
+    def setup_identity(self):
+        """Set up a few identity matrices."""
+
+        # The order identity matrix.
+        self.I_order = zeros((9, 9), float64)
+        for i in range(9):
+            self.I_order[i, i] = 1.0
+
+        # The disorder identity matrix.
+        data = [[0, 0, 1.0/3.0],
+                [4, 4, 1.0/3.0],
+                [8, 8, 1.0/3.0],
+                [0, 4, 1.0/3.0],
+                [4, 0, 1.0/3.0],
+                [0, 8, 1.0/3.0],
+                [8, 0, 1.0/3.0],
+                [4, 8, 1.0/3.0],
+                [8, 4, 1.0/3.0]]
+        self.I_disorder = zeros((9, 9), float64)
+        for i, j, val in data:
+            self.I_disorder[i, j] = val
+
+
+    def setup_identity_free_rotor(self):
+        """Set up a few identity matrices."""
+
+        # The order identity matrix for the free rotors.
+        data = [[0, 0,  0.5],
+                [1, 1,  0.5],
+                [3, 3,  0.5],
+                [4, 4,  0.5],
+                [0, 4,  0.5],
+                [4, 0,  0.5],
+                [1, 3, -0.5],
+                [3, 1, -0.5],
+                [8, 8,  1.0]]
+        self.I_order_free_rotor = zeros((9, 9), float64)
+        for i, j, val in data:
+            self.I_order_free_rotor[i, j] = val
+
+        # The disorder identity matrix for the free rotors.
+        data = [[0, 0,  0.25],
+                [1, 1,  0.125],
+                [3, 3,  0.125],
+                [4, 4,  0.25],
+                [0, 4,  0.25],
+                [4, 0,  0.25],
+                [1, 3, -0.125],
+                [3, 1, -0.125],
+                [0, 8,  0.5],
+                [8, 0,  0.5],
+                [4, 8,  0.5],
+                [8, 4,  0.5]]
+        self.I_disorder_free_rotor = zeros((9, 9), float64)
+        for i, j, val in data:
+            self.I_disorder_free_rotor[i, j] = val
+
+
+    def test_compile_2nd_matrix_iso_cone_disorder(self):
+        """Check if compile_2nd_matrix_iso_cone() can return the identity 
matrix for disorder."""
+
+        # Init.
+        R = eye(3)
+        z_axis = array([0, 0, 1], float64)
+        cone_axis = zeros(3, float64)
+
+        # Calculate the frame order matrix.
+        f2 = compile_2nd_matrix_iso_cone(self.f2_temp, R, 0.0, 0.0, 0.0, pi, 
pi)
+
+        # Print outs.
+        print_frame_order_2nd_degree(self.I_disorder, "Identity for 
disorder")
+        print_frame_order_2nd_degree(f2, "Compiled frame order")
+
+        # Check the values.
+        for i in range(9):
+            for j in range(9):
+                print "Element %s, %s." % (i, j)
+                self.assertAlmostEqual(f2[i, j], self.I_disorder[i, j])
+
+
+    def test_compile_2nd_matrix_iso_cone_order(self):
+        """Check if compile_2nd_matrix_iso_cone() can return the identity 
matrix for order."""
+
+        # Init.
+        R = eye(3)
+        z_axis = array([0, 0, 1], float64)
+        cone_axis = zeros(3, float64)
+
+        # Calculate the frame order matrix.
+        f2 = compile_2nd_matrix_iso_cone(self.f2_temp, R, 0.0, 0.0, 0.0, 
1e-5, 1e-10)
+
+        # Print outs.
+        print_frame_order_2nd_degree(self.I_order, "Identity for order")
+        print_frame_order_2nd_degree(f2, "Compiled frame order")
+
+        # Check the values.
+        for i in range(9):
+            for j in range(9):
+                print "Element %s, %s." % (i, j)
+                self.assertAlmostEqual(f2[i, j], self.I_order[i, j])
+
+
+    def test_compile_2nd_matrix_iso_cone_free_rotor_disorder(self):
+        """Check if compile_2nd_matrix_iso_cone_free_rotor() can return the 
identity matrix for disorder."""
+
+        # Init.
+        R = eye(3)
+        z_axis = array([0, 0, 1], float64)
+        cone_axis = zeros(3, float64)
+
+        # Calculate the frame order matrix.
+        f2 = compile_2nd_matrix_iso_cone_free_rotor(self.f2_temp, R, z_axis, 
cone_axis, 0.0, 1.0, -0.5)
+
+        # Print outs.
+        print_frame_order_2nd_degree(self.I_disorder_free_rotor, "Free rotor 
identity for disorder")
+        print_frame_order_2nd_degree(f2, "Compiled frame order")
+
+        # Check the values.
+        for i in range(9):
+            for j in range(9):
+                print "Element %s, %s." % (i, j)
+                self.assertAlmostEqual(f2[i, j], 
self.I_disorder_free_rotor[i, j])
+
+
+    def test_compile_2nd_matrix_iso_cone_free_rotor_order(self):
+        """Check if compile_2nd_matrix_iso_cone_free_rotor() can return the 
identity matrix for order."""
+
+        # Init.
+        R = eye(3)
+        z_axis = array([0, 0, 1], float64)
+        cone_axis = zeros(3, float64)
+
+        # Calculate the frame order matrix.
+        f2 = compile_2nd_matrix_iso_cone_free_rotor(self.f2_temp, R, z_axis, 
cone_axis, 0.0, 1.0, 1.0)
+
+        # Print outs.
+        print_frame_order_2nd_degree(self.I_order_free_rotor, "Free rotor 
identity for order")
+        print_frame_order_2nd_degree(f2, "Compiled frame order")
+
+        # Check the values.
+        for i in range(9):
+            for j in range(9):
+                print "Element %s, %s." % (i, j)
+                self.assertAlmostEqual(f2[i, j], self.I_order_free_rotor[i, 
j])
+
+
+    def xest_compile_2nd_matrix_pseudo_ellipse(self):
         """Check the operation of the compile_2nd_matrix_pseudo_ellipse() 
function."""
 
         # The real 2nd degree frame order matrix.




Related Messages


Powered by MHonArc, Updated Mon Aug 09 10:40:02 2010