Author: tlinnet
Date: Mon Feb 24 10:59:16 2014
New Revision: 22269

URL: http://svn.gna.org/viewcvs/relax?rev=22269&view=rev
Log:
Merge branch 'bug'

Modified:
    trunk/test_suite/unit_tests/_specific_analyses/_relax_disp/test_disp_data.py

Modified: 
trunk/test_suite/unit_tests/_specific_analyses/_relax_disp/test_disp_data.py
URL: 
http://svn.gna.org/viewcvs/relax/trunk/test_suite/unit_tests/_specific_analyses/_relax_disp/test_disp_data.py?rev=22269&r1=22268&r2=22269&view=diff
==============================================================================
--- 
trunk/test_suite/unit_tests/_specific_analyses/_relax_disp/test_disp_data.py 
(original)
+++ 
trunk/test_suite/unit_tests/_specific_analyses/_relax_disp/test_disp_data.py 
Mon Feb 24 10:59:16 2014
@@ -25,7 +25,7 @@
 # relax module imports.
 from data_store import Relax_data_store; ds = Relax_data_store()
 from pipe_control import state
-from specific_analyses.relax_disp.disp_data import loop_exp_frq, 
loop_exp_frq_offset_point_time
+from specific_analyses.relax_disp.disp_data import loop_exp_frq, 
loop_exp_frq_offset, loop_exp_frq_offset_point, loop_exp_frq_offset_point_time
 from status import Status; status = Status()
 from test_suite.unit_tests.base_classes import UnitTestCase
 
@@ -84,6 +84,115 @@
 
             # Increment the data index.
             index += 1
+
+
+    def test_loop_exp_frq_offset(self):
+        """Unit test of the loop_exp_frq_offset() function.
+
+        This uses the data of the saved state attached to U{bug 
#21665<https://gna.org/bugs/?21665>}.
+        """
+
+        # Load the state.
+        statefile = status.install_path + 
sep+'test_suite'+sep+'shared_data'+sep+'dispersion'+sep+'bug_21665.bz2'
+        state.load_state(statefile, force=True)
+
+        # Original data (exp_type, frq, offset).
+        data = [
+            ['SQ CPMG', 499862140.0, 0],
+            ['SQ CPMG', 599890858.69999993, 0]
+        ]
+
+        # Original indices (ei, mi, oi).
+        indices = [
+            [0, 0, 0],
+            [0, 1, 0]
+        ]
+
+        # Check the number of iterations.
+        print("Checking the number of iterations of the loop.")
+        count = 0
+        for exp_type, frq, offset, ei, mi, oi in 
loop_exp_frq_offset(return_indices=True):
+            print exp_type, frq, offset, ei, mi, oi
+            count += 1
+        self.assertEqual(count, 2)
+
+        # Check the values.
+        print("Checking the values returned by the loop.")
+        index = 0
+        for exp_type, frq, offset, ei, mi, oi in 
loop_exp_frq_offset(return_indices=True):
+            # Check the experiment info.
+            self.assertEqual(exp_type, data[index][0])
+            self.assertEqual(ei, indices[index][0])
+
+            # Check the frequency info.
+            self.assertEqual(frq, data[index][1])
+            self.assertEqual(mi, indices[index][1])
+
+            # Check the offset info.
+            self.assertEqual(offset, data[index][2])
+            self.assertEqual(oi, indices[index][2])
+
+            # Increment the data index.
+            index += 1
+
+
+    def test_loop_exp_frq_offset_point(self):
+        """Unit test of the loop_exp_frq_offset_point() function.
+
+        This uses the data of the saved state attached to U{bug 
#21665<https://gna.org/bugs/?21665>}.
+        """
+
+        # Load the state.
+        statefile = status.install_path + 
sep+'test_suite'+sep+'shared_data'+sep+'dispersion'+sep+'bug_21665.bz2'
+        state.load_state(statefile, force=True)
+
+        # Original data (exp_type, frq, offset, point).
+        data = [
+            ['SQ CPMG', 499862140.0, 0, [50.0, 100.0, 150.0, 200.0, 250.0, 
300.0, 350.0, 400.0, 450.0, 500.0, 550.0, 600.0, 650.0, 700.0, 800.0, 900.0, 
1000.0]],
+            ['SQ CPMG', 599890858.69999993, 0, [33.3333, 66.666, 100.0, 
133.333, 166.666, 200.0, 233.333, 266.666, 300.0, 333.333, 366.666, 400.0, 
466.666, 533.333, 666.666, 866.666, 1000.0]]
+        ]
+
+        # Original indices (ei, mi, oi).
+        indices = [
+            [0, 0, 0, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 
16]],
+            [0, 1, 0, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 
16]]
+        ]
+
+        # Check the number of iterations.
+        print("Checking the number of iterations of the loop.")
+        count = 0
+        for exp_type, frq, offset, point, ei, mi, oi, di in 
loop_exp_frq_offset_point(return_indices=True):
+            print exp_type, frq, offset, point, ei, mi, oi, di
+            count += 1
+        self.assertEqual(count, 34)
+
+        # Check the values.
+        print("Checking the values returned by the loop.")
+        frq_index = 0
+        disp_index = 0
+        for exp_type, frq, offset, point, ei, mi, oi, di in 
loop_exp_frq_offset_point(return_indices=True):
+            # Check the experiment info.
+            self.assertEqual(exp_type, data[frq_index][0])
+            self.assertEqual(ei, indices[frq_index][0])
+
+            # Check the frequency info.
+            self.assertEqual(frq, data[frq_index][1])
+            self.assertEqual(mi, indices[frq_index][1])
+
+            # Check the offset info.
+            self.assertEqual(offset, data[frq_index][2])
+            self.assertEqual(oi, indices[frq_index][2])
+
+            # Check the dispersion point info.
+            self.assertAlmostEqual(point, data[frq_index][3][disp_index],2)
+            self.assertEqual(di, indices[frq_index][3][disp_index])
+
+            # Increment the data index.
+            if disp_index == 16:
+                frq_index += 1
+                disp_index = 0
+            else:
+                disp_index += 1
 
 
     def test_loop_exp_frq_offset_point_time(self):


_______________________________________________
relax (http://www.nmr-relax.com)

This is the relax-commits mailing list
relax-commits@gna.org

To unsubscribe from this list, get a password
reminder, or change your subscription options,
visit the list information page at
https://mail.gna.org/listinfo/relax-commits

Reply via email to