Author: bugman Date: Mon Dec 17 10:32:34 2012 New Revision: 18148 URL: http://svn.gna.org/viewcvs/relax?rev=18148&view=rev Log: Merged revisions 18144-18147 via svnmerge from svn+ssh://bugman@xxxxxxxxxxx/svn/relax/trunk ........ r18144 | bugman | 2012-12-17 10:28:27 +0100 (Mon, 17 Dec 2012) | 3 lines Created RelaxInteratomInconsistentError for when the data is inconsistent between two data pipes. ........ r18145 | bugman | 2012-12-17 10:29:12 +0100 (Mon, 17 Dec 2012) | 3 lines Created the generic_fns.interatomic.consistent_interatomic_data() function for checking data consistency. ........ r18146 | bugman | 2012-12-17 10:30:24 +0100 (Mon, 17 Dec 2012) | 5 lines The rdc.copy user function now uses the new consistent_interatomic_data() function prior to copying. To copy the RDC data, the interatomic data containers must be identical between the two data pipes. ........ r18147 | bugman | 2012-12-17 10:31:47 +0100 (Mon, 17 Dec 2012) | 5 lines Fix for the N_state_model.test_data_copying system test. The interatomic data is now copied prior to copying the RDC data. ........ Modified: branches/frame_order_testing/ (props changed) branches/frame_order_testing/generic_fns/interatomic.py branches/frame_order_testing/generic_fns/rdc.py branches/frame_order_testing/relax_errors.py branches/frame_order_testing/test_suite/system_tests/scripts/n_state_model/data_copying.py Propchange: branches/frame_order_testing/ ------------------------------------------------------------------------------ --- svnmerge-integrated (original) +++ svnmerge-integrated Mon Dec 17 10:32:34 2012 @@ -1,1 +1,1 @@ -/trunk:1-18142 +/trunk:1-18147 Modified: branches/frame_order_testing/generic_fns/interatomic.py URL: http://svn.gna.org/viewcvs/relax/branches/frame_order_testing/generic_fns/interatomic.py?rev=18148&r1=18147&r2=18148&view=diff ============================================================================== --- branches/frame_order_testing/generic_fns/interatomic.py (original) +++ branches/frame_order_testing/generic_fns/interatomic.py Mon Dec 17 10:32:34 2012 @@ -30,7 +30,7 @@ # relax module imports. from generic_fns import pipes from generic_fns.mol_res_spin import Selection, count_spins, return_spin, spin_loop -from relax_errors import RelaxError, RelaxInteratomError, RelaxNoInteratomError, RelaxNoSpinError +from relax_errors import RelaxError, RelaxInteratomError, RelaxInteratomInconsistentError, RelaxNoInteratomError, RelaxNoSpinError from relax_io import write_data @@ -115,6 +115,37 @@ write_data(out=sys.stdout, headings=["Spin_ID_1", "Spin_ID_2"], data=ids) +def consistent_interatomic_data(pipe1=None, pipe2=None): + """Check that the interatomic data is consistent between two data pipes. + + @keyword pipe1: The name of the first data pipe to compare. + @type pipe1: str + @keyword pipe2: The name of the second data pipe to compare. + @type pipe2: str + @raises RelaxError: If the data is inconsistent. + """ + + # Get the data pipes. + dp1 = pipes.get_pipe(pipe1) + dp2 = pipes.get_pipe(pipe2) + + # Check the data lengths. + if len(dp1.interatomic) != len(dp2.interatomic): + raise RelaxInteratomInconsistentError(pipe1, pipe2) + + # Loop over the interatomic data. + for i in range(len(dp1.interatomic)): + # Alias the containers. + interatom1 = dp1.interatomic[i] + interatom2 = dp2.interatomic[i] + + # Check the spin IDs. + if interatom1.spin_id1 != interatom2.spin_id1: + raise RelaxInteratomInconsistentError(pipe1, pipe2) + if interatom1.spin_id2 != interatom2.spin_id2: + raise RelaxInteratomInconsistentError(pipe1, pipe2) + + def create_interatom(spin_id1=None, spin_id2=None, pipe=None): """Create and return the interatomic data container for the two spins. 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=18148&r1=18147&r2=18148&view=diff ============================================================================== --- branches/frame_order_testing/generic_fns/rdc.py (original) +++ branches/frame_order_testing/generic_fns/rdc.py Mon Dec 17 10:32:34 2012 @@ -35,7 +35,7 @@ from float import nan from generic_fns import grace, pipes from generic_fns.align_tensor import get_tensor_index -from generic_fns.interatomic import create_interatom, interatomic_loop, return_interatom +from generic_fns.interatomic import consistent_interatomic_data, create_interatom, interatomic_loop, return_interatom from generic_fns.mol_res_spin import exists_mol_res_spin_data, generate_spin_id, return_spin, spin_index_loop, spin_loop from maths_fns.rdc import ave_rdc_tensor from physical_constants import dipolar_constant, return_gyromagnetic_ratio @@ -200,6 +200,9 @@ raise RelaxError("No RDC data exists.") elif align_id and align_id not in dp_from.rdc_ids: raise RelaxNoRDCError(align_id) + + # Test that the interatomic data is consistent between the two data pipe. + consistent_interatomic_data(pipe1=pipe_to, pipe2=pipe_from) # The IDs. if align_id == None: Modified: branches/frame_order_testing/relax_errors.py URL: http://svn.gna.org/viewcvs/relax/branches/frame_order_testing/relax_errors.py?rev=18148&r1=18147&r2=18148&view=diff ============================================================================== --- branches/frame_order_testing/relax_errors.py (original) +++ branches/frame_order_testing/relax_errors.py Mon Dec 17 10:32:34 2012 @@ -715,6 +715,11 @@ else: self.text = "The interatomic data for the data pipe " + repr(pipe) + " already exists." +# Inconsistency in the interatomic data. +class RelaxInteratomInconsistentError(BaseError): + def __init__(self, pipe1, pipe2): + self.text = "The interatomic data is inconsistent between the data pipes '%s' and '%s'." % (pipe1, pipe2) + # Spectral data errors. Modified: branches/frame_order_testing/test_suite/system_tests/scripts/n_state_model/data_copying.py URL: http://svn.gna.org/viewcvs/relax/branches/frame_order_testing/test_suite/system_tests/scripts/n_state_model/data_copying.py?rev=18148&r1=18147&r2=18148&view=diff ============================================================================== --- branches/frame_order_testing/test_suite/system_tests/scripts/n_state_model/data_copying.py (original) +++ branches/frame_order_testing/test_suite/system_tests/scripts/n_state_model/data_copying.py Mon Dec 17 10:32:34 2012 @@ -64,6 +64,7 @@ # Copy the data. self._execute_uf(uf_name='sequence.copy', pipe_from='orig', pipe_to='new') +self._execute_uf(uf_name='interatomic.copy', pipe_from='orig', pipe_to='new') self._execute_uf(uf_name='rdc.copy', pipe_from='orig', pipe_to='new') self._execute_uf(uf_name='pcs.copy', pipe_from='orig', pipe_to='new')