Author: bugman Date: Fri Jun 14 18:12:29 2013 New Revision: 20128 URL: http://svn.gna.org/viewcvs/relax?rev=20128&view=rev Log: Merged revisions 20125-20127 via svnmerge from svn+ssh://bugman@xxxxxxxxxxx/svn/relax/trunk ........ r20125 | bugman | 2013-06-14 18:05:28 +0200 (Fri, 14 Jun 2013) | 3 lines Added the j_coupling module to the pipe_control __all__ list. ........ r20126 | bugman | 2013-06-14 18:07:44 +0200 (Fri, 14 Jun 2013) | 5 lines Fix for the pipe_control.rdc.q_factors() for T = J+D type data. The Q factor normalisation was incorrect, as the J coupling should be subtracted from T first. ........ r20127 | bugman | 2013-06-14 18:12:11 +0200 (Fri, 14 Jun 2013) | 5 lines Unit test fixes for the N-state model. This is needed due to the recent package rearrangements. ........ Modified: branches/relax_disp/ (props changed) branches/relax_disp/pipe_control/__init__.py branches/relax_disp/pipe_control/rdc.py branches/relax_disp/test_suite/unit_tests/_specific_analyses/test_n_state_model.py Propchange: branches/relax_disp/ ------------------------------------------------------------------------------ --- svnmerge-integrated (original) +++ svnmerge-integrated Fri Jun 14 18:12:29 2013 @@ -1,1 +1,1 @@ -/trunk:1-20123 +/trunk:1-20127 Modified: branches/relax_disp/pipe_control/__init__.py URL: http://svn.gna.org/viewcvs/relax/branches/relax_disp/pipe_control/__init__.py?rev=20128&r1=20127&r2=20128&view=diff ============================================================================== --- branches/relax_disp/pipe_control/__init__.py (original) +++ branches/relax_disp/pipe_control/__init__.py Fri Jun 14 18:12:29 2013 @@ -35,6 +35,7 @@ 'fix', 'grace', 'interatomic', + 'j_coupling', 'minimise', 'model_selection', 'mol_res_spin', Modified: branches/relax_disp/pipe_control/rdc.py URL: http://svn.gna.org/viewcvs/relax/branches/relax_disp/pipe_control/rdc.py?rev=20128&r1=20127&r2=20128&view=diff ============================================================================== --- branches/relax_disp/pipe_control/rdc.py (original) +++ branches/relax_disp/pipe_control/rdc.py Fri Jun 14 18:12:29 2013 @@ -39,7 +39,7 @@ from pipe_control.mol_res_spin import exists_mol_res_spin_data, return_spin from lib.alignment.rdc import ave_rdc_tensor from lib.physical_constants import dipolar_constant, return_gyromagnetic_ratio -from lib.errors import RelaxError, RelaxNoAlignError, RelaxNoRDCError, RelaxNoSequenceError, RelaxSpinTypeError +from lib.errors import RelaxError, RelaxNoAlignError, RelaxNoJError, RelaxNoRDCError, RelaxNoSequenceError, RelaxSpinTypeError from lib.io import extract_data, open_write_file, strip, write_data from lib.warnings import RelaxWarning @@ -468,6 +468,11 @@ rdc_data = True if hasattr(interatom, 'rdc_bc') and align_id in interatom.rdc_bc: rdc_bc_data = True + j_flag = True + if align_id in cdp.rdc_data_types and cdp.rdc_data_types[align_id] == 'T': + j_flag = True + if not hasattr(interatom, 'j_coupling'): + raise RelaxNoJError # Skip containers without RDC data. if not hasattr(interatom, 'rdc') or not hasattr(interatom, 'rdc_bc') or not align_id in interatom.rdc or interatom.rdc[align_id] == None or not align_id in interatom.rdc_bc or interatom.rdc_bc[align_id] == None: @@ -481,7 +486,10 @@ sse = sse + (interatom.rdc[align_id] - interatom.rdc_bc[align_id])**2 # Sum the RDCs squared (for one type of normalisation). - D2_sum = D2_sum + interatom.rdc[align_id]**2 + if j_flag: + D2_sum = D2_sum + (interatom.rdc[align_id] - interatom.j_coupling)**2 + else: + D2_sum = D2_sum + interatom.rdc[align_id]**2 # Gyromagnetic ratios. g1 = return_gyromagnetic_ratio(spin1.isotope) Modified: branches/relax_disp/test_suite/unit_tests/_specific_analyses/test_n_state_model.py URL: http://svn.gna.org/viewcvs/relax/branches/relax_disp/test_suite/unit_tests/_specific_analyses/test_n_state_model.py?rev=20128&r1=20127&r2=20128&view=diff ============================================================================== --- branches/relax_disp/test_suite/unit_tests/_specific_analyses/test_n_state_model.py (original) +++ branches/relax_disp/test_suite/unit_tests/_specific_analyses/test_n_state_model.py Fri Jun 14 18:12:29 2013 @@ -24,7 +24,7 @@ from unittest import TestCase # relax module imports. -from specific_analyses import n_state_model +from specific_analyses.n_state_model import parameters from test_suite.unit_tests.n_state_model_testing_base import N_state_model_base_class @@ -32,11 +32,11 @@ """Unit tests for the functions of the 'specific_analyses.n_state_model' module.""" # Place the specific_analyses.n_state_model module into the class namespace. - n_state_model_fns = n_state_model.N_state_model() + n_state_model_fns = parameters - def test__assemble_param_vector(self): - """Test the operation of the specific_analyses.n_state_model._assemble_param_vector() method.""" + def test_assemble_param_vector(self): + """Test the operation of the specific_analyses.n_state_model.parameters.assemble_param_vector() method.""" # Set up the N, probabilities and Euler angles. cdp.N = 3 @@ -50,7 +50,7 @@ cdp.align_tensors = None # Get the parameter vector. - param_vector = self.n_state_model_fns._assemble_param_vector() + param_vector = self.n_state_model_fns.assemble_param_vector() # The correct result. vector_true = [0.1, 0.3, 0.0, pi/2, 1.0, pi/2, pi, 3*pi/2, pi, 3*pi/2, 2*pi] @@ -61,8 +61,8 @@ self.assertEqual(param_vector[i], vector_true[i]) - def test__disassemble_param_vector(self): - """Test the operation of the specific_analyses.n_state_model._disassemble_param_vector() method.""" + def test_disassemble_param_vector(self): + """Test the operation of the specific_analyses.n_state_model.parameters.disassemble_param_vector() method.""" # Set up the initial N, probabilities and Euler angles. cdp.N = 3 @@ -76,7 +76,7 @@ param_vector = [0.1, 0.3, 0.0, pi/2, 1.0, pi/2, pi, 3*pi/2, pi, 3*pi/2, 2*pi] # Disassemble the parameter vector. - self.n_state_model_fns._disassemble_param_vector(param_vector, data_types=['tensor']) + self.n_state_model_fns.disassemble_param_vector(param_vector, data_types=['tensor']) # Check the probabilities. self.assertEqual(cdp.probs, [0.1, 0.3, 0.6])