Author: bugman
Date: Tue Mar 3 17:03:47 2015
New Revision: 27757
URL: http://svn.gna.org/viewcvs/relax?rev=27757&view=rev
Log:
Merged revisions 27753-27756 via svnmerge from
svn+ssh://[email protected]/svn/relax/trunk
........
r27753 | bugman | 2015-03-03 16:30:49 +0100 (Tue, 03 Mar 2015) | 3 lines
Added more checks to the three Pcs.test_pcs_copy* system tests.
........
r27754 | bugman | 2015-03-03 16:33:21 +0100 (Tue, 03 Mar 2015) | 3 lines
Added more checks to the three Rdc.test_rdc_copy* system tests.
........
r27755 | bugman | 2015-03-03 16:46:48 +0100 (Tue, 03 Mar 2015) | 7 lines
Created the Rdc.test_calc_q_factors_no_tensor system test.
This is to demonstrate a failure in the rdc.calc_q_factors user function when
no alignment tensor is
present. In addition, the test is also triggering an earlier problem of spin
isotope information
being missing. However the isotope is not required if the tensor is absent.
........
r27756 | bugman | 2015-03-03 16:49:03 +0100 (Tue, 03 Mar 2015) | 7 lines
Fixes for the rdc.calc_q_factors user function for when no alignment tensor
is present.
This was caught by the Rdc.test_calc_q_factors_no_tensor system test. Now if
no tensor is present,
a warning is given and the 2Da^2(4 + 3R)/5 normalised Q factor is skipped.
Also, if present but no
spin isotope information is present, then RelaxSpinTypeError errors are
raised.
........
Modified:
branches/frame_order_cleanup/ (props changed)
branches/frame_order_cleanup/pipe_control/rdc.py
branches/frame_order_cleanup/test_suite/system_tests/pcs.py
branches/frame_order_cleanup/test_suite/system_tests/rdc.py
Propchange: branches/frame_order_cleanup/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Tue Mar 3 17:03:47 2015
@@ -1 +1 @@
-/trunk:1-27751
+/trunk:1-27756
Modified: branches/frame_order_cleanup/pipe_control/rdc.py
URL:
http://svn.gna.org/viewcvs/relax/branches/frame_order_cleanup/pipe_control/rdc.py?rev=27757&r1=27756&r2=27757&view=diff
==============================================================================
--- branches/frame_order_cleanup/pipe_control/rdc.py (original)
+++ branches/frame_order_cleanup/pipe_control/rdc.py Tue Mar 3 17:03:47 2015
@@ -734,17 +734,29 @@
else:
D2_sum = D2_sum + interatom.rdc[align_id]**2
- # Gyromagnetic ratios.
- g1 = periodic_table.gyromagnetic_ratio(spin1.isotope)
- g2 = periodic_table.gyromagnetic_ratio(spin2.isotope)
+ # Skip the 2Da^2(4 + 3R)/5 normalised Q factor if no tensor is
present.
+ if norm2_flag and not hasattr(cdp, 'align_tensors'):
+ warn(RelaxWarning("No alignment tensors are present, skipping
the Q factor normalised with 2Da^2(4 + 3R)/5."))
+ norm2_flag = False
# Skip the 2Da^2(4 + 3R)/5 normalised Q factor if pseudo-atoms are
present.
- if norm2_flag and (is_pseudoatom(spin1) or is_pseudoatom(spin2)):
+ if norm2_flag and (is_pseudoatom(spin1) or is_pseudoatom(spin2)):
warn(RelaxWarning("Pseudo-atoms are present, skipping the Q
factor normalised with 2Da^2(4 + 3R)/5."))
norm2_flag = False
# Calculate the RDC dipolar constant (in Hertz, and the 3 comes
from the alignment tensor), and append it to the list.
if norm2_flag:
+ # Data checks.
+ if not hasattr(spin1, 'isotope'):
+ raise RelaxSpinTypeError(spin_id=interatom.spin_id1)
+ if not hasattr(spin2, 'isotope'):
+ raise RelaxSpinTypeError(spin_id=interatom.spin_id2)
+
+ # Gyromagnetic ratios.
+ g1 = periodic_table.gyromagnetic_ratio(spin1.isotope)
+ g2 = periodic_table.gyromagnetic_ratio(spin2.isotope)
+
+ # Calculate the dipolar constant.
dj_new = 3.0/(2.0*pi) * dipolar_constant(g1, g2, interatom.r)
if dj != None and dj_new != dj:
warn(RelaxWarning("The dipolar constant is not the same
for all RDCs, skipping the Q factor normalised with 2Da^2(4 + 3R)/5."))
Modified: branches/frame_order_cleanup/test_suite/system_tests/pcs.py
URL:
http://svn.gna.org/viewcvs/relax/branches/frame_order_cleanup/test_suite/system_tests/pcs.py?rev=27757&r1=27756&r2=27757&view=diff
==============================================================================
--- branches/frame_order_cleanup/test_suite/system_tests/pcs.py (original)
+++ branches/frame_order_cleanup/test_suite/system_tests/pcs.py Tue Mar 3
17:03:47 2015
@@ -29,6 +29,7 @@
from tempfile import mkdtemp
# relax module imports.
+from data_store import Relax_data_store; ds = Relax_data_store()
from pipe_control.mol_res_spin import count_spins, spin_loop
from status import Status; status = Status()
from test_suite.system_tests.base_classes import SystemTestCase
@@ -215,6 +216,10 @@
self.interpreter.pcs.copy(pipe_from='orig', align_id='tb')
# Checks.
+ self.assert_(hasattr(cdp, 'align_ids'))
+ self.assert_('tb' in cdp.align_ids)
+ self.assert_(hasattr(cdp, 'pcs_ids'))
+ self.assert_('tb' in cdp.pcs_ids)
self.assertEqual(count_spins(), 26)
self.assertEqual(len(cdp.interatomic), 0)
i = 0
@@ -256,6 +261,11 @@
[0.004, 0.008, 0.021, 0.029, 0.016, 0.010, 0.008, 0.003, 0.006,
0.003, 0.007, 0.005, 0.001, 0.070, None, 0.025, 0.098, 0.054, 0.075, 0.065,
None, 0.070, 0.015, 0.098, 0.120]
]
for i in range(2):
+ print("\nChecking data pipe '%s'." % pipes[i])
+ self.assert_(hasattr(ds[pipes[i]], 'align_ids'))
+ self.assert_('tb' in ds[pipes[i]].align_ids)
+ self.assert_(hasattr(ds[pipes[i]], 'pcs_ids'))
+ self.assert_('tb' in ds[pipes[i]].pcs_ids)
self.assertEqual(count_spins(), 25)
self.assertEqual(len(cdp.interatomic), 0)
j = 0
@@ -310,6 +320,11 @@
[0.004, 0.008, 0.021, 0.029, 0.016, 0.010, 0.008, 0.003, 0.006,
0.003, 0.007, 0.005, 0.001, 0.070, None, 0.025, 0.098, 0.054, 0.075, 0.065,
None, 0.070, 0.015, 0.098, 0.120]
]
for i in range(2):
+ print("\nChecking data pipe '%s'." % pipes[i])
+ self.assert_(hasattr(ds[pipes[i]], 'align_ids'))
+ self.assert_('tb' in ds[pipes[i]].align_ids)
+ self.assert_(hasattr(ds[pipes[i]], 'pcs_ids'))
+ self.assert_('tb' in ds[pipes[i]].pcs_ids)
self.assertEqual(count_spins(), 25)
self.assertEqual(len(cdp.interatomic), 0)
j = 0
Modified: branches/frame_order_cleanup/test_suite/system_tests/rdc.py
URL:
http://svn.gna.org/viewcvs/relax/branches/frame_order_cleanup/test_suite/system_tests/rdc.py?rev=27757&r1=27756&r2=27757&view=diff
==============================================================================
--- branches/frame_order_cleanup/test_suite/system_tests/rdc.py (original)
+++ branches/frame_order_cleanup/test_suite/system_tests/rdc.py Tue Mar 3
17:03:47 2015
@@ -27,6 +27,7 @@
from os import sep
# relax module imports.
+from data_store import Relax_data_store; ds = Relax_data_store()
from pipe_control.interatomic import interatomic_loop
from pipe_control.mol_res_spin import count_spins
from status import Status; status = Status()
@@ -36,8 +37,8 @@
class Rdc(SystemTestCase):
"""Class for testing RDC operations."""
- def test_rdc_copy(self):
- """Test the operation of the rdc.copy user function."""
+ def test_calc_q_factors_no_tensor(self):
+ """Test the operation of the rdc.calc_q_factors user function when no
alignment tensor is present."""
# Create a data pipe.
self.interpreter.pipe.create('orig', 'N-state')
@@ -54,6 +55,35 @@
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()
+ # Create back-calculated RDC values from the real values.
+ for interatom in interatomic_loop():
+ if hasattr(interatom, 'rdc'):
+ if not hasattr(interatom, 'rdc_bc'):
+ interatom.rdc_bc = {}
+ interatom.rdc_bc['tb'] = interatom.rdc['tb'] + 1.0
+
+ # Q factors.
+ self.interpreter.rdc.calc_q_factors()
+
+
+ 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]
@@ -68,6 +98,10 @@
self.interpreter.rdc.copy(pipe_from='orig', align_id='tb')
# Checks.
+ self.assert_(hasattr(cdp, 'align_ids'))
+ self.assert_('tb' in cdp.align_ids)
+ self.assert_(hasattr(cdp, 'rdc_ids'))
+ self.assert_('tb' in cdp.rdc_ids)
self.assertEqual(count_spins(), 16)
self.assertEqual(len(cdp.interatomic), 8)
i = 0
@@ -124,6 +158,11 @@
[ -26.2501958629, 9.93081766942, 7.26317614156, -1.24840526981,
5.31803314334, 14.0362909456, -1.6021670281]
]
for i in range(2):
+ print("\nChecking data pipe '%s'." % pipes[i])
+ self.assert_(hasattr(ds[pipes[i]], 'align_ids'))
+ self.assert_('tb' in ds[pipes[i]].align_ids)
+ self.assert_(hasattr(ds[pipes[i]], 'rdc_ids'))
+ self.assert_('tb' in ds[pipes[i]].rdc_ids)
self.interpreter.pipe.switch(pipe_name=pipes[i])
self.assertEqual(count_spins(), 14)
self.assertEqual(len(cdp.interatomic), 7)
@@ -192,6 +231,11 @@
[ -26.2501958629, 9.93081766942, 7.26317614156, -1.24840526981,
5.31803314334, 14.0362909456, -1.6021670281]
]
for i in range(2):
+ print("\nChecking data pipe '%s'." % pipes[i])
+ self.assert_(hasattr(ds[pipes[i]], 'align_ids'))
+ self.assert_('tb' in ds[pipes[i]].align_ids)
+ self.assert_(hasattr(ds[pipes[i]], 'rdc_ids'))
+ self.assert_('tb' in ds[pipes[i]].rdc_ids)
self.interpreter.pipe.switch(pipe_name=pipes[i])
self.assertEqual(count_spins(), 14)
self.assertEqual(len(cdp.interatomic), 7)
_______________________________________________
relax (http://www.nmr-relax.com)
This is the relax-commits mailing list
[email protected]
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