mailr4882 - /branches/N_state_model/test_suite/unit_tests/_maths_fns/test_n_state_model.py


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

Header


Content

Posted by edward on January 21, 2008 - 17:26:
Author: bugman
Date: Mon Jan 21 17:26:08 2008
New Revision: 4882

URL: http://svn.gna.org/viewcvs/relax?rev=4882&view=rev
Log:
Wrote a third unit test for the maths_fns.n_state_model.func() optimisation 
target function.


Modified:
    
branches/N_state_model/test_suite/unit_tests/_maths_fns/test_n_state_model.py

Modified: 
branches/N_state_model/test_suite/unit_tests/_maths_fns/test_n_state_model.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/N_state_model/test_suite/unit_tests/_maths_fns/test_n_state_model.py?rev=4882&r1=4881&r2=4882&view=diff
==============================================================================
--- 
branches/N_state_model/test_suite/unit_tests/_maths_fns/test_n_state_model.py 
(original)
+++ 
branches/N_state_model/test_suite/unit_tests/_maths_fns/test_n_state_model.py 
Mon Jan 21 17:26:08 2008
@@ -21,6 +21,7 @@
 
###############################################################################
 
 # Python module imports.
+from math import pi
 from numpy import array, float64, ones
 from unittest import TestCase
 
@@ -87,3 +88,35 @@
 
             # Test that the chi2 value is zero each time!
             self.assertEqual(chi2, 1.0)
+
+
+    def test_func3(self):
+        """Unit test 3 of the func() method.
+
+        The number of states is 2 and the number of tensors is 3.  The first 
state has a prob of 1.0
+        with Euler rotations of {90, 0, 0}, hence the reduced tensors should 
be the same size as the full
+        tensors but rotated by 90 degrees.  The target function is designed 
to be zero.
+        """
+
+        # Init vals.
+        N = 2
+        init_params = array([1.0, pi/2.0, 0.0, 0.0, 0.0, 0.0, 0.0], float64)
+        full_tensors = array([[[1.0, 0.0, 0.0], [0.0, 0.5, 0.0], [0.0, 0.0, 
-1.5]],
+                              [[1.0, 1.0, 0.0], [1.0, 0.5, 0.0], [0.0, 0.0, 
-1.5]],
+                              [[1.0, 0.0, 1.0], [0.0, 0.5, 0.0], [1.0, 0.0, 
-1.5]]], float64)
+        red_data = array([0.5, 1.0, 0.0, 0.0, 0.0, 0.5, 1.0, -1.0, 0.0, 0.0, 
0.5, 1.0, 0.0, 0.0, 1.0], float64)
+        err = ones(3*5, float64)
+
+        # Set up the class.
+        model = N_state_opt(N=2, init_params=init_params, 
full_tensors=full_tensors, red_data=red_data, red_errors=err)
+
+        # Call the target function 3 times.
+        for i in xrange(3):
+            # Target function.
+            chi2 = model.func(init_params)
+
+            # Test that the chi2 value is zero each time!
+            self.assertAlmostEqual(chi2, 0.0)
+
+
+




Related Messages


Powered by MHonArc, Updated Mon Jan 21 17:40:08 2008