Author: tlinnet Date: Mon May 26 14:37:50 2014 New Revision: 23419 URL: http://svn.gna.org/viewcvs/relax?rev=23419&view=rev Log: Added the 8th unit tests demonstrating edge case 'no Rex' failures of the model 'LM63'. This follows from the ideas in the post http://article.gmane.org/gmane.science.nmr.relax.devel/5858. This is related to: task #7793: (https://gna.org/task/?7793) Speed-up of dispersion models. This is to implement catching of math domain errors, before they occur. These tests cover all parameter value combinations which result in no exchange: - dw = 0.0, - pA = 1.0, - kex = 0.0, - dw = 0.0 and pA = 1.0, - dw = 0.0 and kex = 0.0, - pA = 1.0 and kex = 0.0, - dw = 0.0, pA = 1.0, and kex = 0.0. - kex = 1e20, Modified: branches/disp_speed/test_suite/unit_tests/_lib/_dispersion/test_lm63.py Modified: branches/disp_speed/test_suite/unit_tests/_lib/_dispersion/test_lm63.py URL: http://svn.gna.org/viewcvs/relax/branches/disp_speed/test_suite/unit_tests/_lib/_dispersion/test_lm63.py?rev=23419&r1=23418&r2=23419&view=diff ============================================================================== --- branches/disp_speed/test_suite/unit_tests/_lib/_dispersion/test_lm63.py (original) +++ branches/disp_speed/test_suite/unit_tests/_lib/_dispersion/test_lm63.py Mon May 26 14:37:50 2014 @@ -45,8 +45,7 @@ # Required data structures. self.num_points = 3 - self.cpmg_frqs = array([[2.5, 1.25, 0.83]], float64) - self.R2eff = zeros(3, float64) + self.cpmg_frqs = array([2.5, 1.25, 0.83], float64) def calc_r2eff(self): @@ -57,9 +56,14 @@ # Calculate the R2eff values. R2eff = r2eff_LM63(r20=self.r20, phi_ex=phi_ex_scaled, kex=self.kex, cpmg_frqs=self.cpmg_frqs, num_points=self.num_points) + # Check all R2eff values. - for i in range(self.num_points): - self.assertAlmostEqual(R2eff[i], self.r20) + if self.kex > 1.e5: + for i in range(self.num_points): + self.assertAlmostEqual(R2eff[i], self.r20, 2) + else: + for i in range(self.num_points): + self.assertAlmostEqual(R2eff[i], self.r20) def param_conversion(self, pA=None, dw=None, sfrq=None): @@ -163,3 +167,13 @@ # Calculate and check the R2eff values. self.calc_r2eff() + + + def test_lm63_no_rex8(self): + """Test the r2eff_lm63() function for no exchange when kex = 1e20.""" + + # Parameter reset. + self.kex = 1e20 + + # Calculate and check the R2eff values. + self.calc_r2eff()