mailr4883 - /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:34:
Author: bugman
Date: Mon Jan 21 17:34:28 2008
New Revision: 4883

URL: http://svn.gna.org/viewcvs/relax?rev=4883&view=rev
Log:
Wrote a forth 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=4883&r1=4882&r2=4883&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:34:28 2008
@@ -119,4 +119,33 @@
             self.assertAlmostEqual(chi2, 0.0)
 
 
+    def test_func4(self):
+        """Unit test 4 of the func() method.
 
+        The number of states is 2 and the number of tensors is 3.  All 
states are equi-probable with
+        Euler rotations of {90, 0, 0} for only the first.  The target 
function is designed to be
+        zero.
+        """
+
+        # Init vals.
+        N = 2
+        init_params = array([0.5, 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.75, 0.75, 0.0, 0.0, 0.0, 0.75, 0.75, 0.0, 0.0, 
0.0, 0.75, 0.75, 0.0, 0.5, 0.5], 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 Tue Jan 22 17:20:09 2008