Author: bugman Date: Mon Jul 2 12:21:06 2012 New Revision: 17118 URL: http://svn.gna.org/viewcvs/relax?rev=17118&view=rev Log: Merged revisions 17114-17116 via svnmerge from svn+ssh://bugman@xxxxxxxxxxx/svn/relax/trunk ........ r17114 | bugman | 2012-07-02 11:14:28 +0200 (Mon, 02 Jul 2012) | 5 lines Created a system test to replicate Romel Bobby's bug #19887. This is the bug report at https://gna.org/bugs/?19887. ........ r17115 | bugman | 2012-07-02 12:03:02 +0200 (Mon, 02 Jul 2012) | 11 lines Partial fix for bug #19887 (https://gna.org/bugs/?19887). The problem is that the number of peak height values was not the same for all spins! The error message was being caused by the math_fns.relax_fit C object 'setup' function being feed in incorrect values, causing relax to fail directly after the setup() call in specific_fns.relax_fit.minimise(). The number of points was being taken from cdp.relax_times, but in the Relax_fit.test_bug_19887_curvefit_fail system test, one of the 3 spins has 4 points rather than 5. Now the correct number is sent into setup(). ........ r17116 | bugman | 2012-07-02 12:17:23 +0200 (Mon, 02 Jul 2012) | 6 lines 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. ........ Added: branches/interatomic/test_suite/shared_data/peak_lists/bug_19887/ - copied from r17116, trunk/test_suite/shared_data/peak_lists/bug_19887/ branches/interatomic/test_suite/system_tests/scripts/curve_fitting/bug_19887_curvefit_fail.py - copied unchanged from r17116, trunk/test_suite/system_tests/scripts/curve_fitting/bug_19887_curvefit_fail.py Modified: branches/interatomic/ (props changed) branches/interatomic/specific_fns/relax_fit.py branches/interatomic/test_suite/system_tests/relax_fit.py Propchange: branches/interatomic/ ------------------------------------------------------------------------------ --- svnmerge-integrated (original) +++ svnmerge-integrated Mon Jul 2 12:21:06 2012 @@ -1,1 +1,1 @@ -/trunk:1-17044 +/trunk:1-17117 Modified: branches/interatomic/specific_fns/relax_fit.py URL: http://svn.gna.org/viewcvs/relax/branches/interatomic/specific_fns/relax_fit.py?rev=17118&r1=17117&r2=17118&view=diff ============================================================================== --- branches/interatomic/specific_fns/relax_fit.py (original) +++ branches/interatomic/specific_fns/relax_fit.py Mon Jul 2 12:21:06 2012 @@ -707,7 +707,7 @@ # The relaxation times. times.append(cdp.relax_times[key]) - setup(num_params=len(spin.params), num_times=len(cdp.relax_times), values=values, sd=errors, relax_times=times, scaling_matrix=scaling_matrix.tolist()) + setup(num_params=len(spin.params), num_times=len(values), values=values, sd=errors, relax_times=times, scaling_matrix=scaling_matrix.tolist()) # Setup the minimisation algorithm when constraints are present. @@ -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: branches/interatomic/test_suite/system_tests/relax_fit.py URL: http://svn.gna.org/viewcvs/relax/branches/interatomic/test_suite/system_tests/relax_fit.py?rev=17118&r1=17117&r2=17118&view=diff ============================================================================== --- branches/interatomic/test_suite/system_tests/relax_fit.py (original) +++ branches/interatomic/test_suite/system_tests/relax_fit.py Mon Jul 2 12:21:06 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() @@ -140,6 +141,18 @@ self.assertNotEqual(float(lines[index+1][2]), 0.0) + def test_bug_19887_curvefit_fail(self): + """Test for the failure of relaxation curve-fitting, replicating bug #19887.""" + + # Execute the script. + 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): """Test the relaxation curve fitting C modules."""