mailr23363 - in /branches/disp_speed: ./ lib/structure/internal/ test_suite/ test_suite/system_tests/ test_suite/unit_tests/_lib...


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

Header


Content

Posted by tlinnet on May 22, 2014 - 21:28:
Author: tlinnet
Date: Thu May 22 21:28:33 2014
New Revision: 23363

URL: http://svn.gna.org/viewcvs/relax?rev=23363&view=rev
Log:
Merged revisions 23336-23337,23340,23343,23345,23352,23360,23362 via svnmerge 
from 
svn+ssh://tlinnet@xxxxxxxxxxx/svn/relax/trunk

........
  r23336 | bugman | 2014-05-22 15:39:21 +0200 (Thu, 22 May 2014) | 6 lines
  
  Created the Structure.test_bug_22070_structure_superimpose_after_deletion 
system test.
  
  This is to catch bug #22070 (https://gna.org/bugs/index.php?22070), the 
failure of the
  structure.superimpose user function after deleting atoms with 
structure.delete.
........
  r23337 | bugman | 2014-05-22 16:09:50 +0200 (Thu, 22 May 2014) | 6 lines
  
  Added some checks to the 
Structure.test_bug_22070_structure_superimpose_after_deletion system test.
  
  These tests reveal the real problem - that the atoms of the second model 
have not been removed by
  the structure.delete user function.
........
  r23340 | bugman | 2014-05-22 17:21:05 +0200 (Thu, 22 May 2014) | 11 lines
  
  Important bug fix for the structure.delete user function when multiple 
models are present.
  
  This is to fix bug #22070 (https://gna.org/bugs/index.php?22070), the 
failure of the
  structure.superimpose user function after deleting atoms with 
structure.delete.
  
  The problem is that structure.delete was removing the atoms from the first 
model but none of the
  others.  This is because it was using the structural object atom_loop() 
method to find the atoms to
  be deleted, but this method operates on the first model.  So when the 
second model is reached, the
  atoms are already gone.
........
  r23343 | bugman | 2014-05-22 18:10:32 +0200 (Thu, 22 May 2014) | 4 lines
  
  Added git-svn support for the relax version information module.
  
  This allows the subversion revision number and repository URL to be 
displayed on program startup, so
  that it is stored in log files.  This is very useful for debugging purposes.
........
  r23345 | bugman | 2014-05-22 18:18:27 +0200 (Thu, 22 May 2014) | 3 lines
  
  Improvements for the git-svn support in the relax version module.
  
  Python 3 is now correctly handled and the URL is properly extracted from 
the git repository.
........
  r23352 | bugman | 2014-05-22 18:31:35 +0200 (Thu, 22 May 2014) | 3 lines
  
  Removed a debugging printout.
........
  r23360 | bugman | 2014-05-22 19:39:22 +0200 (Thu, 22 May 2014) | 6 lines
  
  Improvement for the unit test printouts when run with the --time command 
line option.
  
  The full unit test name is now printed out, reverting to the old behaviour 
(prior to r21965).
  However the shortened test names are preserved for the other test suite 
categories.
........
  r23362 | bugman | 2014-05-22 19:55:47 +0200 (Thu, 22 May 2014) | 9 lines
  
  Created the test_ns_cpmg_2site_expanded_no_rex8() relaxation dispersion 
unit test.
  
  This is a demonstration commit, showing the 'NS CPMG 2-site expanded' model 
with no exchange when
  kex = 1e5.  I.e. when the motion is too fast for exchange to be observed.  
This test should be used
  for all dispersion models to make sure that they model this edge case 
correctly as well.
  
  This follows from 
http://article.gmane.org/gmane.science.nmr.relax.devel/5906.
........

Modified:
    branches/disp_speed/   (props changed)
    branches/disp_speed/lib/structure/internal/object.py
    branches/disp_speed/test_suite/relax_test_runner.py
    branches/disp_speed/test_suite/system_tests/structure.py
    branches/disp_speed/test_suite/test_suite_runner.py
    
branches/disp_speed/test_suite/unit_tests/_lib/_dispersion/test_ns_cpmg_2site_expanded.py
    branches/disp_speed/version.py

Propchange: branches/disp_speed/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Thu May 22 21:28:33 2014
@@ -1 +1 @@
-/trunk:1-23331
+/trunk:1-23362

Modified: branches/disp_speed/lib/structure/internal/object.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/disp_speed/lib/structure/internal/object.py?rev=23363&r1=23362&r2=23363&view=diff
==============================================================================
--- branches/disp_speed/lib/structure/internal/object.py        (original)
+++ branches/disp_speed/lib/structure/internal/object.py        Thu May 22 
21:28:33 2014
@@ -1532,6 +1532,12 @@
             if atom_id:
                 sel_obj = Selection(atom_id)
 
+            # Loop over the atoms and find the indices of the atoms to 
delete.
+            indices = []
+            for i in self.atom_loop(atom_id=atom_id, index_flag=True):
+                indices.append(i)
+            indices.reverse()
+
             # Loop over the models.
             del_res_nums = []
             for model in self.model_loop():
@@ -1543,16 +1549,10 @@
                     if sel_obj and not sel_obj.contains_mol(mol.mol_name):
                         continue
 
-                    # Loop over the atoms.
-                    indices = []
-                    for i in self.atom_loop(atom_id=atom_id, 
model_num=model.num, index_flag=True):
-                        indices.append(i)
-
                     # Generate a residue data dictionary for the metadata 
trimming (prior to atom deletion).
                     res_data = self._residue_data(res_nums=mol.res_num, 
res_names=mol.res_name)
 
                     # Loop over the reverse indices and pop out the data.
-                    indices.reverse()
                     for i in indices:
                         mol.atom_num.pop(i)
                         mol.atom_name.pop(i)

Modified: branches/disp_speed/test_suite/relax_test_runner.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/disp_speed/test_suite/relax_test_runner.py?rev=23363&r1=23362&r2=23363&view=diff
==============================================================================
--- branches/disp_speed/test_suite/relax_test_runner.py (original)
+++ branches/disp_speed/test_suite/relax_test_runner.py Thu May 22 21:28:33 
2014
@@ -40,18 +40,21 @@
     prepend the output to the failure and error reports normally generated 
by TextTestRunner.
     """
 
-    def __init__(self, stream, descriptions, verbosity, timing=False):
+    def __init__(self, stream, descriptions, verbosity, timing=False, 
category=None):
         """Initialise the RelaxTestResult object with relax specific 
variables.
 
         @keyword timing:    A flag which if True will enable timing of 
individual tests.
         @type timing:       bool
+        @keyword category:  The type of test being performed, to allow the 
printouts to be changed.  This can be one of 'system', 'unit', 'gui', or 
'verification'. the printout.
+        @type category:     str
         """
 
         # Normal setup.
         super(RelaxTestResult, self).__init__(stream, descriptions, 
verbosity)
 
-        # Store the timing flag.
+        # Store the timing flag and category.
         self.timing_flag = timing
+        self.category = category
 
 
     def addError(self, test, err):
@@ -164,8 +167,9 @@
         self.time -= time()
 
         # Change the test name.
-        test_name = test_name.split('.')
-        test_name = "%s.%s" % (test_name[-2], test_name[-1])
+        if self.category != 'unit':
+            test_name = test_name.split('.')
+            test_name = "%s.%s" % (test_name[-2], test_name[-1])
 
         # The printout.
         self.stream.write('  %7.2f s for %s\n' % (-self.time, test_name))
@@ -195,6 +199,9 @@
     This runner is designed to catch STDOUT during the execution of each 
test and to prepend the
     output to the failure and error reports normally generated by 
TextTestRunner.
     """
+
+    # Variable for specifying the type of test being performed, to change 
the printout.
+    category = None
 
     def __init__(self, stream=sys.stderr, descriptions=True, verbosity=1, 
failfast=False, buffer=False, resultclass=None, timing=False):
         """Initialise the class, storing the timing flag.
@@ -216,7 +223,7 @@
     def _makeResult(self):
         """Override of the TextTestRunner._makeResult() method."""
 
-        return RelaxTestResult(self.stream, self.descriptions, 
self.verbosity, timing=self.timing_flag)
+        return RelaxTestResult(self.stream, self.descriptions, 
self.verbosity, timing=self.timing_flag, category=self.category)
 
 
 

Modified: branches/disp_speed/test_suite/system_tests/structure.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/disp_speed/test_suite/system_tests/structure.py?rev=23363&r1=23362&r2=23363&view=diff
==============================================================================
--- branches/disp_speed/test_suite/system_tests/structure.py    (original)
+++ branches/disp_speed/test_suite/system_tests/structure.py    Thu May 22 
21:28:33 2014
@@ -207,6 +207,28 @@
 
         # Delete the calciums.
         self.interpreter.structure.delete(atom_id='@CA')
+
+
+    def test_bug_22070_structure_superimpose_after_deletion(self):
+        """Catch U{bug #22070<https://gna.org/bugs/?22070>}, the failure of 
the structure.superimpose user function after deleting atoms with 
structure.delete."""
+
+        # Path of the structure file.
+        path = status.install_path + 
sep+'test_suite'+sep+'shared_data'+sep+'frame_order'+sep+'cam'
+
+        # Load the structures to superimpose.
+        self.interpreter.structure.read_pdb('1J7P_1st_NH.pdb', dir=path, 
set_mol_name='C-dom', set_model_num=1)
+        self.interpreter.structure.read_pdb('1J7P_1st_NH_rot.pdb', dir=path, 
set_mol_name='C-dom', set_model_num=2)
+
+        # Delete the calciums.
+        self.interpreter.structure.delete(atom_id='@CA')
+
+        # Check the deleted atoms of both models (the last atoms should now 
be the last ATOM record proton and not the HETATOM CA).
+        for i in range(2):
+            print("Checking the last atom of model %s." % i)
+            
self.assertEqual(cdp.structure.structural_data[i].mol[0].atom_name[-1], 'H')
+
+        # Superimpose.
+        self.interpreter.structure.superimpose(method='fit to first', 
centre_type='CoM')
 
 
     def test_delete_empty(self):

Modified: branches/disp_speed/test_suite/test_suite_runner.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/disp_speed/test_suite/test_suite_runner.py?rev=23363&r1=23362&r2=23363&view=diff
==============================================================================
--- branches/disp_speed/test_suite/test_suite_runner.py (original)
+++ branches/disp_speed/test_suite/test_suite_runner.py Thu May 22 21:28:33 
2014
@@ -134,6 +134,7 @@
 
             # Execute the GUI tests.
             gui_runner = GUI_test_runner()
+            self.runner.category = 'gui'
             self.gui_result = gui_runner.run(self.tests, runner=self.runner)
 
             # Clean up for the GUI, if not in GUI mode.
@@ -167,6 +168,7 @@
 
         # Run the tests.
         system_runner = System_test_runner()
+        self.runner.category = 'system'
         self.system_result = system_runner.run(self.tests, 
runner=self.runner)
 
         # Print out a summary of the test suite.
@@ -186,6 +188,7 @@
 
         # Run the tests.
         unit_runner = 
Unit_test_runner(root_path=status.install_path+os.sep+'test_suite'+os.sep+'unit_tests')
+        self.runner.category = 'unit'
         self.unit_result = unit_runner.run(runner=self.runner)
 
         # Print out a summary of the test suite.
@@ -205,6 +208,7 @@
 
         # Run the tests.
         verification_runner = Verification_test_runner()
+        self.runner.category = 'verification'
         self.verification_result = verification_runner.run(self.tests, 
runner=self.runner)
 
         # Print out a summary of the test suite.

Modified: 
branches/disp_speed/test_suite/unit_tests/_lib/_dispersion/test_ns_cpmg_2site_expanded.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/disp_speed/test_suite/unit_tests/_lib/_dispersion/test_ns_cpmg_2site_expanded.py?rev=23363&r1=23362&r2=23363&view=diff
==============================================================================
--- 
branches/disp_speed/test_suite/unit_tests/_lib/_dispersion/test_ns_cpmg_2site_expanded.py
   (original)
+++ 
branches/disp_speed/test_suite/unit_tests/_lib/_dispersion/test_ns_cpmg_2site_expanded.py
   Thu May 22 21:28:33 2014
@@ -53,11 +53,11 @@
         k_AB, k_BA = self.param_conversion(pA=self.pA, kex=self.kex)
 
         # Calculate the R2eff values.
-        R2eff = r2eff_ns_cpmg_2site_expanded(r20=self.r20, pA=self.pA, 
dw=self.dw, k_AB=k_AB, k_BA=k_BA, relax_time=0.3, inv_relax_time=1/0.3, 
tcp=self.tcp, num_points=self.num_points, num_cpmg=self.num_cpmg)
+        self.R2eff = r2eff_ns_cpmg_2site_expanded(r20=self.r20, pA=self.pA, 
dw=self.dw, k_AB=k_AB, k_BA=k_BA, relax_time=0.3, inv_relax_time=1/0.3, 
tcp=self.tcp, num_points=self.num_points, num_cpmg=self.num_cpmg)
 
         # Check all R2eff values.
         for i in range(self.num_points):
-            self.assertAlmostEqual(R2eff[i], self.r20)
+            self.assertAlmostEqual(self.R2eff[i], 2.0, 5)
 
 
     def param_conversion(self, pA=None, kex=None):
@@ -154,3 +154,13 @@
 
         # Calculate and check the R2eff values.
         self.calc_r2eff()
+
+
+    def test_ns_cpmg_2site_expanded_no_rex8(self):
+        """Test the r2eff_ns_cpmg_2site_expanded() function for no exchange 
when kex = 1e5."""
+
+        # Parameter reset.
+        self.kex = 1e5
+
+        # Calculate and check the R2eff values.
+        self.calc_r2eff()

Modified: branches/disp_speed/version.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/disp_speed/version.py?rev=23363&r1=23362&r2=23363&view=diff
==============================================================================
--- branches/disp_speed/version.py      (original)
+++ branches/disp_speed/version.py      Thu May 22 21:28:33 2014
@@ -1,6 +1,6 @@
 
###############################################################################
 #                                                                            
 #
-# Copyright (C) 2009-2013 Edward d'Auvergne                                  
 #
+# Copyright (C) 2009-2014 Edward d'Auvergne                                  
 #
 #                                                                            
 #
 # This file is part of the program relax (http://www.nmr-relax.com).         
 #
 #                                                                            
 #
@@ -27,6 +27,7 @@
 
 # Python module imports.
 from os import F_OK, access, sep
+from re import search
 PIPE, Popen = None, None
 if dep_check.subprocess_module:
     from subprocess import PIPE, Popen
@@ -46,32 +47,41 @@
     """
 
     # Does the base directory exist (i.e. is this a checked out copy).
-    if not access(status.install_path+sep+'.svn', F_OK):
+    if not access(status.install_path+sep+'.svn', F_OK) and not 
access(status.install_path+sep+'.git', F_OK):
         return
 
     # Python 2.3 and earlier.
     if Popen == None:
         return
 
-    # Try to run 'svn info'.
+    # Try to run 'svn info', reading the output if there are no errors.
     pipe = Popen('svn info %s' % status.install_path, shell=True, 
stdin=PIPE, stdout=PIPE, stderr=PIPE, close_fds=False)
+    if not pipe.stderr.readlines():
+        # Loop over the output lines.
+        for line in pipe.stdout.readlines():
+            # Decode Python 3 byte arrays.
+            if hasattr(line, 'decode'):
+                line = line.decode()
 
-    # Errors.
-    if pipe.stderr.readlines():
-        return
+            # Split up the line.
+            row = line.split()
 
-    # Loop over the output lines.
-    for line in pipe.stdout.readlines():
-        # Decode Python 3 byte arrays.
-        if hasattr(line, 'decode'):
-            line = line.decode()
+            # The revision.
+            if len(row) and row[0] == 'Revision:':
+                return str(row[1])
 
-        # Split up the line.
-        row = line.split()
+    # Try git-svn, reading the output if there are no errors.
+    pipe = Popen('git svn find-rev $(git rev-parse HEAD)', shell=True, 
stdin=PIPE, stdout=PIPE, stderr=PIPE, close_fds=False)
+    if not pipe.stderr.readlines():
+        # Loop over the output lines.
+        for line in pipe.stdout.readlines():
+            # Decode Python 3 byte arrays.
+            if hasattr(line, 'decode'):
+                line = line.decode()
 
-        # The revision.
-        if len(row) and row[0] == 'Revision:':
-            return str(row[1])
+            # The revision.
+            if search('^[0-9]', line):
+                return str(line[:-1])
 
 
 def url():
@@ -82,32 +92,44 @@
     """
 
     # Does the base directory exist (i.e. is this a checked out copy).
-    if not access(status.install_path+sep+'.svn', F_OK):
+    if not access(status.install_path+sep+'.svn', F_OK) and not 
access(status.install_path+sep+'.git', F_OK):
         return
 
     # Python 2.3 and earlier.
     if Popen == None:
         return
 
-    # Try to run 'svn info'.
+    # Try to run 'svn info', reading the output if there are no errors.
     pipe = Popen('svn info %s' % status.install_path, shell=True, 
stdin=PIPE, stdout=PIPE, stderr=PIPE, close_fds=False)
+    if not pipe.stderr.readlines():
+        # Loop over the output lines.
+        for line in pipe.stdout.readlines():
+            # Decode Python 3 byte arrays.
+            if hasattr(line, 'decode'):
+                line = line.decode()
 
-    # Errors.
-    if pipe.stderr.readlines():
-        return
+            # Split up the line.
+            row = line.split()
 
-    # Loop over the output lines.
-    for line in pipe.stdout.readlines():
-        # Decode Python 3 byte arrays.
-        if hasattr(line, 'decode'):
-            line = line.decode()
+            # The revision.
+            if len(row) and row[0] == 'URL:':
+                return str(row[1])
 
-        # Split up the line.
-        row = line.split()
+    # Try git-svn, reading the output if there are no errors.
+    pipe = Popen('cd %s; git svn info' % status.install_path, shell=True, 
stdin=PIPE, stdout=PIPE, stderr=PIPE, close_fds=False)
+    if not pipe.stderr.readlines():
+        # Loop over the output lines.
+        for line in pipe.stdout.readlines():
+            # Decode Python 3 byte arrays.
+            if hasattr(line, 'decode'):
+                line = line.decode()
 
-        # The revision.
-        if len(row) and row[0] == 'URL:':
-            return str(row[1])
+            # Split up the line.
+            row = line.split()
+
+            # The revision.
+            if len(row) and row[0] == 'URL:':
+                return str(row[1])
 
 
 def version_full():




Related Messages


Powered by MHonArc, Updated Thu May 22 22:40:02 2014