mailr18143 - in /branches/frame_order_testing: ./ generic_fns/ prompt/ test_suite/system_tests/


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

Header


Content

Posted by edward on December 14, 2012 - 17:55:
Author: bugman
Date: Fri Dec 14 17:55:14 2012
New Revision: 18143

URL: http://svn.gna.org/viewcvs/relax?rev=18143&view=rev
Log:
Merged revisions 18138,18140-18142 via svnmerge from 
svn+ssh://bugman@xxxxxxxxxxx/svn/relax/trunk

........
  r18138 | bugman | 2012-12-14 16:45:06 +0100 (Fri, 14 Dec 2012) | 5 lines
  
  The RelaxErrors when calling user functions in the prompt/script interface 
are now more informative.
  
  The user function is now stated.  This is to better help the user work out 
where the problem is.
........
  r18140 | bugman | 2012-12-14 17:11:08 +0100 (Fri, 14 Dec 2012) | 3 lines
  
  Created the Rdc.test_rdc_copy system test to demonstrate the failure of the 
rdc.copy user function.
........
  r18141 | bugman | 2012-12-14 17:35:35 +0100 (Fri, 14 Dec 2012) | 6 lines
  
  Bug fix for the rdc.copy user function - it is now functional.
  
  The code was old and untested, and still assumed that the RDC values were 
held in spin containers
  rather than the interatomic data containers.
........
  r18142 | bugman | 2012-12-14 17:51:48 +0100 (Fri, 14 Dec 2012) | 5 lines
  
  Created the Pcs.test_pcs_load and Pcs.test_pcs_copy system tests to check 
some of the PCS user functions.
  
  The Pcs system test class is new, and these tests check untested areas of 
relax.
........

Added:
    branches/frame_order_testing/test_suite/system_tests/pcs.py
      - copied unchanged from r18142, trunk/test_suite/system_tests/pcs.py
Modified:
    branches/frame_order_testing/   (props changed)
    branches/frame_order_testing/generic_fns/rdc.py
    branches/frame_order_testing/prompt/uf_objects.py
    branches/frame_order_testing/test_suite/system_tests/__init__.py
    branches/frame_order_testing/test_suite/system_tests/rdc.py

Propchange: branches/frame_order_testing/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Fri Dec 14 17:55:14 2012
@@ -1,1 +1,1 @@
-/trunk:1-18136
+/trunk:1-18142

Modified: branches/frame_order_testing/generic_fns/rdc.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/frame_order_testing/generic_fns/rdc.py?rev=18143&r1=18142&r2=18143&view=diff
==============================================================================
--- branches/frame_order_testing/generic_fns/rdc.py (original)
+++ branches/frame_order_testing/generic_fns/rdc.py Fri Dec 14 17:55:14 2012
@@ -221,27 +221,27 @@
         if align_id in dp_from.rdc_ids and align_id not in dp_to.rdc_ids:
             dp_to.rdc_ids.append(align_id)
 
-        # Spin loop.
-        for mol_index, res_index, spin_index in spin_index_loop():
-            # Alias the spin containers.
-            spin_from = 
dp_from.mol[mol_index].res[res_index].spin[spin_index]
-            spin_to = dp_to.mol[mol_index].res[res_index].spin[spin_index]
+        # Loop over the interatomic data.
+        for i in range(len(dp_from.interatomic)):
+            # Alias the containers.
+            interatom_from = dp_from.interatomic[i]
+            interatom_to = dp_to.interatomic[i]
 
             # No data or errors.
-            if (not hasattr(spin_from, 'rdc') or not align_id in 
spin_from.rdc) and (not hasattr(spin_from, 'rdc_err') or not align_id in 
spin_from.rdc_err):
+            if (not hasattr(interatom_from, 'rdc') or not align_id in 
interatom_from.rdc) and (not hasattr(interatom_from, 'rdc_err') or not 
align_id in interatom_from.rdc_err):
                 continue
 
-            # Initialise the spin data if necessary.
-            if hasattr(spin_from, 'rdc') and not hasattr(spin_to, 'rdc'):
-                spin_to.rdc = {}
-            if hasattr(spin_from, 'rdc_err') and not hasattr(spin_to, 
'rdc_err'):
-                spin_to.rdc_err = {}
+            # Initialise the data structures if necessary.
+            if hasattr(interatom_from, 'rdc') and not hasattr(interatom_to, 
'rdc'):
+                interatom_to.rdc = {}
+            if hasattr(interatom_from, 'rdc_err') and not 
hasattr(interatom_to, 'rdc_err'):
+                interatom_to.rdc_err = {}
 
             # Copy the value and error from pipe_from.
-            if hasattr(spin_from, 'rdc'):
-                spin_to.rdc[align_id] = spin_from.rdc[align_id]
-            if hasattr(spin_from, 'rdc_err'):
-                spin_to.rdc_err[align_id] = spin_from.rdc_err[align_id]
+            if hasattr(interatom_from, 'rdc'):
+                interatom_to.rdc[align_id] = interatom_from.rdc[align_id]
+            if hasattr(interatom_from, 'rdc_err'):
+                interatom_to.rdc_err[align_id] = 
interatom_from.rdc_err[align_id]
 
 
 def corr_plot(format=None, file=None, dir=None, force=False):

Modified: branches/frame_order_testing/prompt/uf_objects.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/frame_order_testing/prompt/uf_objects.py?rev=18143&r1=18142&r2=18143&view=diff
==============================================================================
--- branches/frame_order_testing/prompt/uf_objects.py (original)
+++ branches/frame_order_testing/prompt/uf_objects.py Fri Dec 14 17:55:14 2012
@@ -118,7 +118,7 @@
         for name in keys:
             # Unknown keyword.
             if name not in self._karg_names:
-                raise RelaxError("The keyword argument '%s' is unknown." % 
name)
+                raise RelaxError("User function %s - the keyword argument 
'%s' is unknown." % (self._name, name))
 
         # Convert the args to keyword args if needed.
         num_args = len(uf_args)
@@ -127,7 +127,7 @@
             for i in range(num_args):
                 # Check if the keyword is already assigned.
                 if self._kargs[i]['name'] in keys:
-                    raise RelaxError("The argument '%s' and the keyword 
argument '%s' cannot both be supplied." % (uf_args[i], 
self._kargs[i]['name']))
+                    raise RelaxError("User function %s - the argument '%s' 
and the keyword argument '%s' cannot both be supplied." % (self._name, 
uf_args[i], self._kargs[i]['name']))
 
                 # Add the arg as a keyword arg.
                 uf_kargs[self._kargs[i]['name']] = uf_args[i]
@@ -213,7 +213,7 @@
             elif py_type == 'val_or_list':
                 arg_check.is_val_or_list(value, desc_short, size=dim, 
can_be_none=can_be_none, can_be_empty=can_be_empty)
             else:
-                raise RelaxError("The Python object type '%s' is unknown." % 
py_type)
+                raise RelaxError("User function %s - the Python object type 
'%s' is unknown." % (self._name, py_type))
 
         # Execute the functional code.
         self._backend(*new_args, **uf_kargs)

Modified: branches/frame_order_testing/test_suite/system_tests/__init__.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/frame_order_testing/test_suite/system_tests/__init__.py?rev=18143&r1=18142&r2=18143&view=diff
==============================================================================
--- branches/frame_order_testing/test_suite/system_tests/__init__.py 
(original)
+++ branches/frame_order_testing/test_suite/system_tests/__init__.py Fri Dec 
14 17:55:14 2012
@@ -52,6 +52,7 @@
 from test_suite.system_tests.noe import Noe
 from test_suite.system_tests.noe_restraints import Noe_restraints
 from test_suite.system_tests.palmer import Palmer
+from test_suite.system_tests.pcs import Pcs
 from test_suite.system_tests.peak_lists import Peak_lists
 from test_suite.system_tests.pipes import Pipes
 from test_suite.system_tests.rdc import Rdc
@@ -84,6 +85,7 @@
            'noe',
            'noe_restraints',
            'palmer',
+           'pcs'
            'peak_lists'
            'pipes',
            'rdc',
@@ -170,6 +172,7 @@
             suite_array.append(TestLoader().loadTestsFromTestCase(Noe))
             
suite_array.append(TestLoader().loadTestsFromTestCase(Noe_restraints))
             suite_array.append(TestLoader().loadTestsFromTestCase(Palmer))
+            suite_array.append(TestLoader().loadTestsFromTestCase(Pcs))
             
suite_array.append(TestLoader().loadTestsFromTestCase(Peak_lists))
             suite_array.append(TestLoader().loadTestsFromTestCase(Pipes))
             suite_array.append(TestLoader().loadTestsFromTestCase(Rdc))

Modified: branches/frame_order_testing/test_suite/system_tests/rdc.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/frame_order_testing/test_suite/system_tests/rdc.py?rev=18143&r1=18142&r2=18143&view=diff
==============================================================================
--- branches/frame_order_testing/test_suite/system_tests/rdc.py (original)
+++ branches/frame_order_testing/test_suite/system_tests/rdc.py Fri Dec 14 
17:55:14 2012
@@ -36,6 +36,46 @@
 class Rdc(SystemTestCase):
     """Class for testing RDC operations."""
 
+    def test_rdc_copy(self):
+        """Test the operation of the rdc.copy user function."""
+
+        # Create a data pipe.
+        self.interpreter.pipe.create('orig', 'N-state')
+
+        # Data directory.
+        dir = status.install_path + 
sep+'test_suite'+sep+'shared_data'+sep+'align_data'+sep
+
+        # Load the spins.
+        self.interpreter.sequence.read(file='tb.txt', dir=dir, spin_id_col=1)
+        self.interpreter.sequence.attach_protons()
+        self.interpreter.sequence.display()
+
+        # Load the RDCs.
+        self.interpreter.rdc.read(align_id='tb', file='tb.txt', dir=dir, 
spin_id1_col=1, spin_id2_col=2, data_col=3, error_col=4)
+        self.interpreter.sequence.display()
+
+        # The RDCs.
+        rdcs = [ -26.2501958629, 9.93081766942, 7.26317614156, 
-1.24840526981, 5.31803314334, 14.0362909456, 1.33652530397, -1.6021670281]
+
+        # Create a new data pipe by copying the old, then switch to it.
+        self.interpreter.pipe.copy(pipe_from='orig', pipe_to='new')
+        self.interpreter.pipe.switch(pipe_name='new')
+
+        # Delete the RDC data.
+        self.interpreter.rdc.delete()
+
+        # Copy the RDCs.
+        self.interpreter.rdc.copy(pipe_from='orig', align_id='tb')
+
+        # Checks.
+        self.assertEqual(count_spins(), 16)
+        self.assertEqual(len(cdp.interatomic), 8)
+        i = 0
+        for interatom in interatomic_loop():
+            self.assertAlmostEqual(rdcs[i], interatom.rdc['tb'])
+            i += 1
+
+
     def test_rdc_load(self):
         """Test for the loading of some RDC data with the spin ID format."""
 
@@ -64,4 +104,3 @@
         for interatom in interatomic_loop():
             self.assertAlmostEqual(rdcs[i], interatom.rdc['tb'])
             i += 1
-




Related Messages


Powered by MHonArc, Updated Mon Dec 17 10:40:02 2012