mailr4881 - /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:16:
Author: bugman
Date: Mon Jan 21 17:16:21 2008
New Revision: 4881

URL: http://svn.gna.org/viewcvs/relax?rev=4881&view=rev
Log:
Wrote another 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=4881&r1=4880&r2=4881&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:16:21 2008
@@ -58,3 +58,32 @@
 
             # Test that the chi2 value is zero each time!
             self.assertEqual(chi2, 0.0)
+
+
+    def test_func2(self):
+        """Unit test 2 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 {0, 0, 0}, hence the reduced tensors should be 
the same size as the full
+        tensors.  The target function is designed to be one.
+        """
+
+        # Init vals.
+        N = 2
+        init_params = array([0.5, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], float64)
+        full_tensors = array([[[1.0, 0.0, 0.0], [0.0, 0.0, 0.0], [0.0, 0.0, 
-1.0]],
+                              [[1.0, 1.0, 0.0], [1.0, 0.0, 0.0], [0.0, 0.0, 
-1.0]],
+                              [[1.0, 0.0, 1.0], [0.0, 0.0, 0.0], [1.0, 0.0, 
-1.0]]], float64)
+        red_data = array([1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 1.0, 1.0, 0.0, 
1.0, 0.0, 0.0, 1.0, 0.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.assertEqual(chi2, 1.0)




Related Messages


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