mailr3982 - /1.3/test_suite/unit_tests/diffusion_tensor_testing_base.py


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

Header


Content

Posted by edward on November 25, 2007 - 23:40:
Author: bugman
Date: Sun Nov 25 23:40:17 2007
New Revision: 3982

URL: http://svn.gna.org/viewcvs/relax?rev=3982&view=rev
Log:
Wrote 6 unit tests for the generic_fns.diffusion_tensor.copy() function.


Modified:
    1.3/test_suite/unit_tests/diffusion_tensor_testing_base.py

Modified: 1.3/test_suite/unit_tests/diffusion_tensor_testing_base.py
URL: 
http://svn.gna.org/viewcvs/relax/1.3/test_suite/unit_tests/diffusion_tensor_testing_base.py?rev=3982&r1=3981&r2=3982&view=diff
==============================================================================
--- 1.3/test_suite/unit_tests/diffusion_tensor_testing_base.py (original)
+++ 1.3/test_suite/unit_tests/diffusion_tensor_testing_base.py Sun Nov 25 
23:40:17 2007
@@ -54,6 +54,147 @@
         """Reset the relax data storage object."""
 
         relax_data_store.__reset__()
+
+
+    def test_copy_pull_ellipsoid(self):
+        """Test the copying of an ellipsoid diffusion tensor (pulling the 
data from another pipe).
+
+        The functions tested are both generic_fns.diffusion_tensor.copy() and
+        prompt.diffusion_tensor.copy().
+        """
+
+        # Initialise the tensor.
+        self.diffusion_tensor_fns.init(params=(13.9, 1.8, 0.7, 10.6, -23.3, 
0.34), time_scale=1e-9, d_scale=1e7, angle_units='rad', param_types=0, 
fixed=1)
+
+        # Change the current data pipe.
+        relax_data_store.current_pipe = 'test'
+
+        # Copy the tensor to the test pipe.
+        self.diffusion_tensor_fns.copy(pipe_from='orig')
+
+        # Test the diffusion tensor.
+        self.assertEqual(relax_data_store['test'].diff_tensor.type, 
'ellipsoid')
+        self.assertAlmostEqual(relax_data_store['test'].diff_tensor.tm * 
1e9, 13.9, 14)
+        self.assertEqual(relax_data_store['test'].diff_tensor.Da, 1.8e7)
+        self.assertEqual(relax_data_store['test'].diff_tensor.Dr, 0.7)
+        self.assertEqual(relax_data_store['test'].diff_tensor.alpha, 
1.1752220392306203)
+        self.assertEqual(relax_data_store['test'].diff_tensor.beta, 
1.8327412287183442)
+        self.assertEqual(relax_data_store['test'].diff_tensor.gamma, 0.34)
+        self.assertEqual(relax_data_store['test'].diff_tensor.fixed, 1)
+
+
+    def test_copy_pull_sphere(self):
+        """Test the copying of a spherical diffusion tensor (pulling the 
data from another pipe).
+
+        The functions tested are both generic_fns.diffusion_tensor.copy() and
+        prompt.diffusion_tensor.copy().
+        """
+
+        # Initialise the tensor.
+        self.diffusion_tensor_fns.init(params=1e-9)
+
+        # Change the current data pipe.
+        relax_data_store.current_pipe = 'test'
+
+        # Copy the tensor to the test pipe.
+        self.diffusion_tensor_fns.copy(pipe_from='orig')
+
+        # Test the diffusion tensor 
+        self.assertEqual(relax_data_store['test'].diff_tensor.type, 'sphere')
+        self.assertEqual(relax_data_store['test'].diff_tensor.tm, 1e-9)
+        self.assertEqual(relax_data_store['test'].diff_tensor.fixed, 1)
+
+
+    def test_copy_pull_spheroid(self):
+        """Test the copying of a spheroidal diffusion tensor (pulling the 
data from another pipe).
+
+        The functions tested are both generic_fns.diffusion_tensor.copy() and
+        prompt.diffusion_tensor.copy().
+        """
+
+        # Initialise the tensor.
+        self.diffusion_tensor_fns.init(params=(8.6, 1.3, 600, -20), 
time_scale=1e-9, d_scale=1e7, angle_units='deg', param_types=2, 
spheroid_type='prolate', fixed=0)
+
+        # Change the current data pipe.
+        relax_data_store.current_pipe = 'test'
+
+        # Copy the tensor to the test pipe.
+        self.diffusion_tensor_fns.copy(pipe_from='orig', pipe_to='test')
+
+        # Test the diffusion tensor.
+        self.assertEqual(relax_data_store['test'].diff_tensor.type, 
'spheroid')
+        self.assertEqual(relax_data_store['test'].diff_tensor.spheroid_type, 
'prolate')
+        self.assertAlmostEqual(relax_data_store['test'].diff_tensor.tm * 
1e9, 8.6, 14)
+        self.assertEqual(relax_data_store['test'].diff_tensor.Da, 
5.2854122621564493e6)
+        self.assertEqual(relax_data_store['test'].diff_tensor.theta, 
2.0943951023931948)
+        self.assertEqual(relax_data_store['test'].diff_tensor.phi, 
2.7925268031909276)
+        self.assertEqual(relax_data_store['test'].diff_tensor.fixed, 0)
+
+
+    def test_copy_push_ellipsoid(self):
+        """Test the copying of an ellipsoid diffusion tensor (pushing the 
data from another pipe).
+
+        The functions tested are both generic_fns.diffusion_tensor.copy() and
+        prompt.diffusion_tensor.copy().
+        """
+
+        # Initialise the tensor.
+        self.diffusion_tensor_fns.init(params=(13.9, 1.8, 0.7, 10.6, -23.3, 
0.34), time_scale=1e-9, d_scale=1e7, angle_units='rad', param_types=0, 
fixed=1)
+
+        # Copy the tensor to the test pipe.
+        self.diffusion_tensor_fns.copy('test')
+
+        # Test the diffusion tensor.
+        self.assertEqual(relax_data_store['test'].diff_tensor.type, 
'ellipsoid')
+        self.assertAlmostEqual(relax_data_store['test'].diff_tensor.tm * 
1e9, 13.9, 14)
+        self.assertEqual(relax_data_store['test'].diff_tensor.Da, 1.8e7)
+        self.assertEqual(relax_data_store['test'].diff_tensor.Dr, 0.7)
+        self.assertEqual(relax_data_store['test'].diff_tensor.alpha, 
1.1752220392306203)
+        self.assertEqual(relax_data_store['test'].diff_tensor.beta, 
1.8327412287183442)
+        self.assertEqual(relax_data_store['test'].diff_tensor.gamma, 0.34)
+        self.assertEqual(relax_data_store['test'].diff_tensor.fixed, 1)
+
+
+    def test_copy_push_sphere(self):
+        """Test the copying of a spherical diffusion tensor (pushing the 
data from another pipe).
+
+        The functions tested are both generic_fns.diffusion_tensor.copy() and
+        prompt.diffusion_tensor.copy().
+        """
+
+        # Initialise the tensor.
+        self.diffusion_tensor_fns.init(params=1e-9)
+
+        # Copy the tensor to the test pipe.
+        self.diffusion_tensor_fns.copy(pipe_to='test')
+
+        # Test the diffusion tensor 
+        self.assertEqual(relax_data_store['test'].diff_tensor.type, 'sphere')
+        self.assertEqual(relax_data_store['test'].diff_tensor.tm, 1e-9)
+        self.assertEqual(relax_data_store['test'].diff_tensor.fixed, 1)
+
+
+    def test_copy_push_spheroid(self):
+        """Test the copying of a spheroidal diffusion tensor (pushing the 
data from another pipe).
+
+        The functions tested are both generic_fns.diffusion_tensor.copy() and
+        prompt.diffusion_tensor.copy().
+        """
+
+        # Initialise the tensor.
+        self.diffusion_tensor_fns.init(params=(8.6, 1.3, 600, -20), 
time_scale=1e-9, d_scale=1e7, angle_units='deg', param_types=2, 
spheroid_type='prolate', fixed=0)
+
+        # Copy the tensor to the test pipe.
+        self.diffusion_tensor_fns.copy(pipe_from='orig', pipe_to='test')
+
+        # Test the diffusion tensor.
+        self.assertEqual(relax_data_store['test'].diff_tensor.type, 
'spheroid')
+        self.assertEqual(relax_data_store['test'].diff_tensor.spheroid_type, 
'prolate')
+        self.assertAlmostEqual(relax_data_store['test'].diff_tensor.tm * 
1e9, 8.6, 14)
+        self.assertEqual(relax_data_store['test'].diff_tensor.Da, 
5.2854122621564493e6)
+        self.assertEqual(relax_data_store['test'].diff_tensor.theta, 
2.0943951023931948)
+        self.assertEqual(relax_data_store['test'].diff_tensor.phi, 
2.7925268031909276)
+        self.assertEqual(relax_data_store['test'].diff_tensor.fixed, 0)
 
 
     def test_delete(self):




Related Messages


Powered by MHonArc, Updated Mon Nov 26 00:00:18 2007