mailr22452 - /trunk/test_suite/unit_tests/_specific_analyses/_relax_disp/test_disp_data.py


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

Header


Content

Posted by tlinnet on March 12, 2014 - 09:29:
Author: tlinnet
Date: Wed Mar 12 09:29:20 2014
New Revision: 22452

URL: http://svn.gna.org/viewcvs/relax?rev=22452&view=rev
Log:
Added unit test for use of value.write to write theta values calculated from 
calc_rotating_frame_params().

Regarding sr #3124, (https://gna.org/support/index.php?3124) - Grace graphs 
production for R1rho analysis with R2_eff as function of Omega_eff.

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=22452&r1=22451&r2=22452&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  
      Wed Mar 12 09:29:20 2014
@@ -21,12 +21,12 @@
 
###############################################################################
 
 # Python module imports.
-from os import sep
+from os import F_OK, access, sep
 
 # relax module imports.
 from data_store import Relax_data_store; ds = Relax_data_store()
 from math import atan, pi
-from pipe_control import state
+from pipe_control import state, value
 from pipe_control.mol_res_spin import get_spin_ids, return_spin
 from specific_analyses.relax_disp.checks import get_times
 from specific_analyses.relax_disp.disp_data import 
calc_rotating_frame_params, count_relax_times, find_intensity_keys, 
get_curve_type, has_exponential_exp_type, loop_exp_frq, loop_exp_frq_offset, 
loop_exp_frq_offset_point, loop_exp_frq_offset_point_time, loop_time, 
return_offset_data, return_spin_lock_nu1
@@ -767,3 +767,49 @@
                     self.assertEqual(tilt_angles[ei][si][mi][oi][di], 
c_theta)
 
 
+    def test_value_write_calc_rotating_frame_params(self):
+        """Unit test of the value.write function to write return values from 
calc_rotating_frame_params() function for R1rho setup.
+
+        This uses the data of the saved state attached to U{bug 
#21344<https://gna.org/bugs/?21344>}.
+        """
+
+        # Load the state.
+        statefile = 
status.install_path+sep+'test_suite'+sep+'shared_data'+sep+'dispersion'+sep+'bug_21344_trunc.bz2'
+        state.load_state(statefile, force=True)
+
+        # Set filepath.
+        thetafilepath = ds.tmpdir+sep+'theta.out'
+
+        # Write out the parameter file
+        value.write(param='theta', file='theta.out', dir=ds.tmpdir, 
scaling=1.0, force=True)
+
+        # Test the file exists.
+        self.assert_(access(thetafilepath, F_OK))
+
+        # Open the file for testing.
+        thetafile = open(thetafilepath, 'r')
+
+        # Loop over the file to test values.
+        for line in thetafile:
+            # Skip lines starting with #.
+            if line[0] == "#":
+                continue
+            # Print lines, not including newline character.
+            print(line[:-1])
+
+            # Split the line
+            linesplit = line.split()
+
+            # Assume values
+            if linesplit[0] == "None" and linesplit[1] == "5" and 
linesplit[2] == "I":
+                self.assert_(linesplit[5] != "None")
+            elif linesplit[0] == "None" and linesplit[1] == "6" and 
linesplit[2] == "S":
+                self.assert_(linesplit[5] != "None")
+            elif linesplit[0] == "None" and linesplit[1] == "8" and 
linesplit[2] == "S":
+                self.assert_(linesplit[5] != "None")
+            elif linesplit[0] == "None" and linesplit[1] == "9" and 
linesplit[2] == "A":
+                self.assert_(linesplit[5] != "None")
+            elif linesplit[0] == "None" and linesplit[1] == "10" and 
linesplit[2] == "L":
+                self.assert_(linesplit[5] != "None")
+
+




Related Messages


Powered by MHonArc, Updated Wed Mar 12 10:40:03 2014