Hi Troels,

As I mentioned previously
(http://article.gmane.org/gmane.science.nmr.relax.devel/5938), the
R1rho value checking in these unit tests contains a bug.

Regards,

Edward



On 26 May 2014 23:09,  <[email protected]> wrote:
> Author: tlinnet
> Date: Mon May 26 23:09:45 2014
> New Revision: 23440
>
> URL: http://svn.gna.org/viewcvs/relax?rev=23440&view=rev
> Log:
> Added 8 unit tests demonstrating edge case 'no Rex' failures of the model 
> 'MP05'.
>
> 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_mp05.py
>
> Modified: 
> branches/disp_speed/test_suite/unit_tests/_lib/_dispersion/test_mp05.py
> URL: 
> http://svn.gna.org/viewcvs/relax/branches/disp_speed/test_suite/unit_tests/_lib/_dispersion/test_mp05.py?rev=23440&r1=23439&r2=23440&view=diff
> ==============================================================================
> --- branches/disp_speed/test_suite/unit_tests/_lib/_dispersion/test_mp05.py   
>   (original)
> +++ branches/disp_speed/test_suite/unit_tests/_lib/_dispersion/test_mp05.py   
>   Mon May 26 23:09:45 2014
> @@ -25,11 +25,11 @@
>  from unittest import TestCase
>
>  # relax module imports.
> -from lib.dispersion.dpl94 import r1rho_DPL94
> +from lib.dispersion.mp05 import r1rho_MP05
>
>
> -class Test_dpl94(TestCase):
> -    """Unit tests for the lib.dispersion.dpl94 relax module."""
> +class Test_mp05(TestCase):
> +    """Unit tests for the lib.dispersion.mp05 relax module."""
>
>      def setUp(self):
>          """Set up for all unit tests."""
> @@ -38,7 +38,12 @@
>
>
>          # The R1rho_prime parameter value (R1rho with no exchange).
> -        self.r1rho_prime = 2.5
> +        self.r1rho_prime = 5.0
> +        # The chemical shifts in rad/s.  This is only used for off-resonance 
> R1rho models.
> +        self.omega = -35670.44192
> +        # The structure of spin-lock or hard pulse offsets in rad/s.
> +        self.offset = -35040.3526693
> +
>          # Population of ground state.
>          self.pA = 0.9
>          # The chemical exchange difference between states A and B in ppm.
> @@ -48,8 +53,6 @@
>          self.r1 = 1.0
>          # The spin-lock field strengths in Hertz.
>          self.spin_lock_nu1 = array([ 1000., 1500., 2000., 2500., 3000., 
> 3500., 4000., 4500., 5000., 5500., 6000.])
> -        # The rotating frame tilt angles for each dispersion point.
> -        self.theta = array([1.5707963267948966, 1.5707963267948966, 
> 1.5707963267948966, 1.5707963267948966, 1.5707963267948966, 
> 1.5707963267948966, 1.5707963267948966, 1.5707963267948966, 
> 1.5707963267948966, 1.5707963267948966, 1.5707963267948966])
>
>          # The spin Larmor frequencies.
>          self.sfrq = 599.8908617*1E6
> @@ -62,14 +65,19 @@
>          """Calculate and check the R1rho values."""
>
>          # Parameter conversions.
> -        phi_ex_scaled, spin_lock_omega1_squared = 
> self.param_conversion(pA=self.pA, dw=self.dw, sfrq=self.sfrq, 
> spin_lock_nu1=self.spin_lock_nu1)
> +        pB, dw_frq, spin_lock_omega1, spin_lock_omega1_squared = 
> self.param_conversion(pA=self.pA, dw=self.dw, sfrq=self.sfrq, 
> spin_lock_nu1=self.spin_lock_nu1)
>
>          # Calculate the R1rho values.
> -        R1rho = r1rho_DPL94(r1rho_prime=self.r1rho_prime, 
> phi_ex=phi_ex_scaled, kex=self.kex, theta=self.theta, R1=self.r1, 
> spin_lock_fields2=spin_lock_omega1_squared, num_points=self.num_points)
> +        R1rho = r1rho_MP05(r1rho_prime=self.r1rho_prime, omega=self.omega, 
> offset=self.offset, pA=self.pA, pB=pB, dw=dw_frq, kex=self.kex, R1=self.r1, 
> spin_lock_fields=spin_lock_omega1, 
> spin_lock_fields2=spin_lock_omega1_squared, num_points=self.num_points)
> +
>
>          # Check all R1rho values.
> -        for i in range(self.num_points):
> -            self.assertAlmostEqual(R1rho[i], self.r1rho_prime)
> +        if self.kex > 1.e5:
> +            for i in range(self.num_points):
> +                self.assertAlmostEqual(R1rho[i], self.r1, 6)
> +        else:
> +            for i in range(self.num_points):
> +                self.assertAlmostEqual(R1rho[i], self.r1rho_prime)
>
>
>      def param_conversion(self, pA=None, dw=None, sfrq=None, 
> spin_lock_nu1=None):
> @@ -83,7 +91,7 @@
>          @type sfrq:             float
>          @keyword spin_lock_nu1: The spin-lock field strengths in Hertz.
>          @type spin_lock_nu1:    float
> -        @return:                The parameters {phi_ex_scaled, k_BA}.
> +        @return:                The parameters {pB, dw_frq, 
> spin_lock_omega1, spin_lock_omega1_squared}.
>          @rtype:                 tuple of float
>          """
>
> @@ -93,21 +101,21 @@
>          # Calculate spin Larmor frequencies in 2pi.
>          frqs = sfrq * 2 * pi
>
> -        # The phi_ex parameter value (pA * pB * delta_omega^2).
> -        phi_ex = pA * pB * dw**2
> +        # Convert dw from ppm to rad/s.
> +        dw_frq = dw * frqs
>
> -        # Convert phi_ex from ppm^2 to (rad/s)^2.
> -        phi_ex_scaled = phi_ex * frqs**2
> +        # The R1rho spin-lock field strengths (in rad.s-1).
> +        spin_lock_omega1 = (2. * pi * spin_lock_nu1)
>
>          # The R1rho spin-lock field strengths squared (in rad^2.s^-2).
> -        spin_lock_omega1_squared = (2. * pi * spin_lock_nu1)**2
> +        spin_lock_omega1_squared = spin_lock_omega1**2
>
>          # Return all values.
> -        return phi_ex_scaled, spin_lock_omega1_squared
> +        return pB, dw_frq, spin_lock_omega1, spin_lock_omega1_squared
>
>
> -    def test_dpl94_no_rex1(self):
> -        """Test the r1rho_dpl94() function for no exchange when dw = 0.0."""
> +    def test_mp05_no_rex1(self):
> +        """Test the r1rho_mp05() function for no exchange when dw = 0.0."""
>
>          # Parameter reset.
>          self.dw = 0.0
> @@ -116,8 +124,8 @@
>          self.calc_r1rho()
>
>
> -    def test_dpl94_no_rex2(self):
> -        """Test the r1rho_dpl94() function for no exchange when pA = 1.0."""
> +    def test_mp05_no_rex2(self):
> +        """Test the r1rho_mp05() function for no exchange when pA = 1.0."""
>
>          # Parameter reset.
>          self.pA = 1.0
> @@ -126,8 +134,8 @@
>          self.calc_r1rho()
>
>
> -    def test_dpl94_no_rex3(self):
> -        """Test the r1rho_dpl94() function for no exchange when kex = 0.0."""
> +    def test_mp05_no_rex3(self):
> +        """Test the r1rho_mp05() function for no exchange when kex = 0.0."""
>
>          # Parameter reset.
>          self.kex = 0.0
> @@ -136,8 +144,8 @@
>          self.calc_r1rho()
>
>
> -    def test_dpl94_no_rex4(self):
> -        """Test the r1rho_dpl94() function for no exchange when dw = 0.0 and 
> pA = 1.0."""
> +    def test_mp05_no_rex4(self):
> +        """Test the r1rho_mp05() function for no exchange when dw = 0.0 and 
> pA = 1.0."""
>
>          # Parameter reset.
>          self.pA = 1.0
> @@ -147,8 +155,8 @@
>          self.calc_r1rho()
>
>
> -    def test_dpl94_no_rex5(self):
> -        """Test the r1rho_dpl94() function for no exchange when dw = 0.0 and 
> kex = 0.0."""
> +    def test_mp05_no_rex5(self):
> +        """Test the r1rho_mp05() function for no exchange when dw = 0.0 and 
> kex = 0.0."""
>
>          # Parameter reset.
>          self.dw = 0.0
> @@ -158,8 +166,8 @@
>          self.calc_r1rho()
>
>
> -    def test_dpl94_no_rex6(self):
> -        """Test the r1rho_dpl94() function for no exchange when pA = 1.0 and 
> kex = 0.0."""
> +    def test_mp05_no_rex6(self):
> +        """Test the r1rho_mp05() function for no exchange when pA = 1.0 and 
> kex = 0.0."""
>
>          # Parameter reset.
>          self.pA = 1.0
> @@ -169,8 +177,8 @@
>          self.calc_r1rho()
>
>
> -    def test_dpl94_no_rex7(self):
> -        """Test the r1rho_dpl94() function for no exchange when dw = 0.0, pA 
> = 1.0, and kex = 0.0."""
> +    def test_mp05_no_rex7(self):
> +        """Test the r1rho_mp05() function for no exchange when dw = 0.0, pA 
> = 1.0, and kex = 0.0."""
>
>          # Parameter reset.
>          self.dw = 0.0
> @@ -178,3 +186,13 @@
>
>          # Calculate and check the R1rho values.
>          self.calc_r1rho()
> +
> +
> +    def test_mp05_no_rex8(self):
> +        """Test the r1rho_mp05() function for no exchange when kex = 1e20."""
> +
> +        # Parameter reset.
> +        self.kex = 1e20
> +
> +        # Calculate and check the R2eff values.
> +        self.calc_r1rho()
>
>
> _______________________________________________
> relax (http://www.nmr-relax.com)
>
> This is the relax-commits mailing list
> [email protected]
>
> To unsubscribe from this list, get a password
> reminder, or change your subscription options,
> visit the list information page at
> https://mail.gna.org/listinfo/relax-commits

_______________________________________________
relax (http://www.nmr-relax.com)

This is the relax-devel mailing list
[email protected]

To unsubscribe from this list, get a password
reminder, or change your subscription options,
visit the list information page at
https://mail.gna.org/listinfo/relax-devel

Reply via email to