Author: tlinnet Date: Thu May 22 15:19:32 2014 New Revision: 23334 URL: http://svn.gna.org/viewcvs/relax?rev=23334&view=rev Log: Modified unit tests demonstrating edge case 'no Rex' failures of the model 'NS CPMG 2-site expanded'. This is to align with the current return of data in the disp_speed branch. 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. Modified: branches/disp_speed/lib/dispersion/ns_cpmg_2site_expanded.py branches/disp_speed/test_suite/unit_tests/_lib/_dispersion/test_ns_cpmg_2site_expanded.py Modified: branches/disp_speed/lib/dispersion/ns_cpmg_2site_expanded.py URL: http://svn.gna.org/viewcvs/relax/branches/disp_speed/lib/dispersion/ns_cpmg_2site_expanded.py?rev=23334&r1=23333&r2=23334&view=diff ============================================================================== --- branches/disp_speed/lib/dispersion/ns_cpmg_2site_expanded.py (original) +++ branches/disp_speed/lib/dispersion/ns_cpmg_2site_expanded.py Thu May 22 15:19:32 2014 @@ -271,9 +271,7 @@ # Catch parameter values that will result in no exchange, returning flat R2eff = R20 lines (when kex = 0.0, k_AB = 0.0). if dw == 0.0 or pA == 1.0 or k_AB == 0.0: - for i in range(num_points): - back_calc[i] = r20 - return + return array([r20]*num_points) # Repeditive calculations. half_tcp = 0.5 * tcp 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=23334&r1=23333&r2=23334&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 15:19:32 2014 @@ -53,11 +53,11 @@ k_AB, k_BA = self.param_conversion(pA=self.pA, kex=self.kex) # Calculate the R2eff values. - 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, back_calc=self.R2eff, num_points=self.num_points, num_cpmg=self.num_cpmg) + 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(self.R2eff[i], 2.0) + self.assertAlmostEqual(R2eff[i], self.r20) def param_conversion(self, pA=None, kex=None):