mailr17116 - in /trunk: specific_fns/relax_fit.py test_suite/system_tests/relax_fit.py


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

Header


Content

Posted by edward on July 02, 2012 - 12:17:
Author: bugman
Date: Mon Jul  2 12:17:23 2012
New Revision: 17116

URL: http://svn.gna.org/viewcvs/relax?rev=17116&view=rev
Log:
A final fix for bug #19887 (https://gna.org/bugs/?19887).

Now a RelaxError is raised if the number of peak intensities is not the same 
for all spins.  This
occurs in the relaxation curve-fitting overfit_deselect() method.


Modified:
    trunk/specific_fns/relax_fit.py
    trunk/test_suite/system_tests/relax_fit.py

Modified: trunk/specific_fns/relax_fit.py
URL: 
http://svn.gna.org/viewcvs/relax/trunk/specific_fns/relax_fit.py?rev=17116&r1=17115&r2=17116&view=diff
==============================================================================
--- trunk/specific_fns/relax_fit.py (original)
+++ trunk/specific_fns/relax_fit.py Mon Jul  2 12:17:23 2012
@@ -824,11 +824,17 @@
             if not hasattr(spin, 'intensities'):
                 warn(RelaxDeselectWarning(spin_id, 'missing intensity data'))
                 spin.select = False
+                continue
 
             # Require 3 or more data points.
             elif len(spin.intensities) < 3:
                 warn(RelaxDeselectWarning(spin_id, 'insufficient data, 3 or 
more data points are required'))
                 spin.select = False
+                continue
+
+            # Check that the number of relaxation times is complete.
+            if len(spin.intensities) != len(cdp.relax_times):
+                raise RelaxError("The %s peak intensity points of the spin 
'%s' does not match the expected number of %s (the IDs %s do not match %s)." 
% (len(spin.intensities), spin_id, len(cdp.relax_times), 
spin.intensities.keys(), cdp.spectrum_ids))
 
 
     def return_data(self, spin):

Modified: trunk/test_suite/system_tests/relax_fit.py
URL: 
http://svn.gna.org/viewcvs/relax/trunk/test_suite/system_tests/relax_fit.py?rev=17116&r1=17115&r2=17116&view=diff
==============================================================================
--- trunk/test_suite/system_tests/relax_fit.py (original)
+++ trunk/test_suite/system_tests/relax_fit.py Mon Jul  2 12:17:23 2012
@@ -1,6 +1,6 @@
 
###############################################################################
 #                                                                            
 #
-# Copyright (C) 2006-2011 Edward d'Auvergne                                  
 #
+# Copyright (C) 2006-2012 Edward d'Auvergne                                  
 #
 #                                                                            
 #
 # This file is part of the program relax.                                    
 #
 #                                                                            
 #
@@ -31,6 +31,7 @@
 from data import Relax_data_store; ds = Relax_data_store()
 from generic_fns.mol_res_spin import spin_index_loop, spin_loop
 from generic_fns import pipes
+from relax_errors import RelaxError
 from status import Status; status = Status()
 
 
@@ -144,7 +145,12 @@
         """Test for the failure of relaxation curve-fitting, replicating bug 
#19887."""
 
         # Execute the script.
-        self.script_exec(status.install_path + 
sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'curve_fitting'+sep+'bug_19887_curvefit_fail.py')
+        try:
+            self.script_exec(status.install_path + 
sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'curve_fitting'+sep+'bug_19887_curvefit_fail.py')
+
+        # A RelaxError is expected (but assertRaises() does not work with 
the script_exec method).
+        except RelaxError:
+            pass
 
 
     def test_curve_fitting_height(self):




Related Messages


Powered by MHonArc, Updated Mon Jul 02 12:20:02 2012