Author: tlinnet Date: Mon May 26 13:38:07 2014 New Revision: 23413 URL: http://svn.gna.org/viewcvs/relax?rev=23413&view=rev Log: Added 8 unit tests demonstrating edge case 'no Rex' failures of the model 'CR72'. 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 = 1e5, Modified: branches/disp_speed/test_suite/unit_tests/_lib/_dispersion/__init__.py branches/disp_speed/test_suite/unit_tests/_lib/_dispersion/test_cr72.py Modified: branches/disp_speed/test_suite/unit_tests/_lib/_dispersion/__init__.py URL: http://svn.gna.org/viewcvs/relax/branches/disp_speed/test_suite/unit_tests/_lib/_dispersion/__init__.py?rev=23413&r1=23412&r2=23413&view=diff ============================================================================== --- branches/disp_speed/test_suite/unit_tests/_lib/_dispersion/__init__.py (original) +++ branches/disp_speed/test_suite/unit_tests/_lib/_dispersion/__init__.py Mon May 26 13:38:07 2014 @@ -24,6 +24,7 @@ __all__ = [ 'test___init__', 'test_b14', + 'test_cr72', 'test_dpl94', 'test_lm63', 'test_ns_cpmg_2site_expanded' Modified: branches/disp_speed/test_suite/unit_tests/_lib/_dispersion/test_cr72.py URL: http://svn.gna.org/viewcvs/relax/branches/disp_speed/test_suite/unit_tests/_lib/_dispersion/test_cr72.py?rev=23413&r1=23412&r2=23413&view=diff ============================================================================== --- branches/disp_speed/test_suite/unit_tests/_lib/_dispersion/test_cr72.py (original) +++ branches/disp_speed/test_suite/unit_tests/_lib/_dispersion/test_cr72.py Mon May 26 13:38:07 2014 @@ -24,11 +24,11 @@ from unittest import TestCase # relax module imports. -from lib.dispersion.b14 import r2eff_B14 +from lib.dispersion.cr72 import r2eff_CR72 -class Test_b14(TestCase): - """Unit tests for the lib.dispersion.b14 relax module.""" +class Test_cr72(TestCase): + """Unit tests for the lib.dispersion.cr72 relax module.""" def setUp(self): """Set up for all unit tests.""" @@ -44,9 +44,7 @@ self.num_points = 7 self.ncyc = array([2, 4, 8, 10, 20, 40, 500]) relax_times = 0.04 - cpmg_frqs = self.ncyc / relax_times - self.inv_relax_times = 1.0 / relax_times - self.tau_cpmg = 0.25 / cpmg_frqs + self.cpmg_frqs = self.ncyc / relax_times # The spin Larmor frequencies. self.sfrq = 200. * 1E6 @@ -58,7 +56,7 @@ k_AB, k_BA, pB, dw_frq = self.param_conversion(pA=self.pA, kex=self.kex, dw=self.dw, sfrq=self.sfrq) # Calculate the R2eff values. - R2eff = r2eff_B14(r20a=self.r20a, r20b=self.r20b, pA=self.pA, pB=pB, dw=dw_frq, kex=self.kex, k_AB=k_AB, k_BA=k_BA, ncyc=self.ncyc, inv_tcpmg=self.inv_relax_times, tcp=self.tau_cpmg, num_points=self.num_points) + R2eff = r2eff_CR72(r20a=self.r20a, r20b=self.r20b, pA=self.pA, dw=dw_frq, kex=self.kex, cpmg_frqs=self.cpmg_frqs, num_points=self.num_points) # Check all R2eff values. for i in range(self.num_points): @@ -97,8 +95,8 @@ return k_AB, k_BA, pB, dw_frq - def test_b14_no_rex1(self): - """Test the r2eff_b14() function for no exchange when dw = 0.0.""" + def test_cr72_no_rex1(self): + """Test the r2eff_cr72() function for no exchange when dw = 0.0.""" # Parameter reset. self.dw = 0.0 @@ -107,8 +105,8 @@ self.calc_r2eff() - def test_b14_no_rex2(self): - """Test the r2eff_b14() function for no exchange when pA = 1.0.""" + def test_cr72_no_rex2(self): + """Test the r2eff_cr72() function for no exchange when pA = 1.0.""" # Parameter reset. self.pA = 1.0 @@ -117,8 +115,8 @@ self.calc_r2eff() - def test_b14_no_rex3(self): - """Test the r2eff_b14() function for no exchange when kex = 0.0.""" + def test_cr72_no_rex3(self): + """Test the r2eff_cr72() function for no exchange when kex = 0.0.""" # Parameter reset. self.kex = 0.0 @@ -127,8 +125,8 @@ self.calc_r2eff() - def test_b14_no_rex4(self): - """Test the r2eff_b14() function for no exchange when dw = 0.0 and pA = 1.0.""" + def test_cr72_no_rex4(self): + """Test the r2eff_cr72() function for no exchange when dw = 0.0 and pA = 1.0.""" # Parameter reset. self.pA = 1.0 @@ -138,8 +136,8 @@ self.calc_r2eff() - def test_b14_no_rex5(self): - """Test the r2eff_b14() function for no exchange when dw = 0.0 and kex = 0.0.""" + def test_cr72_no_rex5(self): + """Test the r2eff_cr72() function for no exchange when dw = 0.0 and kex = 0.0.""" # Parameter reset. self.dw = 0.0 @@ -149,8 +147,8 @@ self.calc_r2eff() - def test_b14_no_rex6(self): - """Test the r2eff_b14() function for no exchange when pA = 1.0 and kex = 0.0.""" + def test_cr72_no_rex6(self): + """Test the r2eff_cr72() function for no exchange when pA = 1.0 and kex = 0.0.""" # Parameter reset. self.pA = 1.0 @@ -160,8 +158,8 @@ self.calc_r2eff() - def test_b14_no_rex7(self): - """Test the r2eff_b14() function for no exchange when dw = 0.0, pA = 1.0, and kex = 0.0.""" + def test_cr72_no_rex7(self): + """Test the r2eff_cr72() function for no exchange when dw = 0.0, pA = 1.0, and kex = 0.0.""" # Parameter reset. self.dw = 0.0 @@ -169,3 +167,12 @@ # Calculate and check the R2eff values. self.calc_r2eff() + + def test_cr72_no_rex8(self): + """Test the r2eff_cr72() function for no exchange when kex = 1e5.""" + + # Parameter reset. + self.kex = 1e5 + + # Calculate and check the R2eff values. + self.calc_r2eff()