Author: bugman Date: Mon Jan 10 12:16:09 2011 New Revision: 12172 URL: http://svn.gna.org/viewcvs/relax?rev=12172&view=rev Log: Added a new system test for the prolate diffusion tensor, this time checking the diffusion type. A spherical tensor is sent in, triggering the bug found by Vitaly Vostri <vvostri att gmail dott com> (Message-id: <AANLkTinRO3ZCNwL6GeqWdx0uBvv=PQ=zw6vpdQQeruBW@xxxxxxxxxxxxxx> https://mail.gna.org/public/relax-users/2010-12/msg00014.html). The problem is that the prolate tensor is changed to an oblate one!?! Modified: 1.3/test_suite/system_tests/diffusion_tensor.py Modified: 1.3/test_suite/system_tests/diffusion_tensor.py URL: http://svn.gna.org/viewcvs/relax/1.3/test_suite/system_tests/diffusion_tensor.py?rev=12172&r1=12171&r2=12172&view=diff ============================================================================== --- 1.3/test_suite/system_tests/diffusion_tensor.py (original) +++ 1.3/test_suite/system_tests/diffusion_tensor.py Mon Jan 10 12:16:09 2011 @@ -190,7 +190,7 @@ self.assertAlmostEqual(cdp.diff_tensor.rotation[i, j], R[i, j]) - def check_spheroid(self, tm, Dpar, Dper, Diso, Da, Dratio, theta, phi, D, D_prime, R): + def check_spheroid(self, tm, Dpar, Dper, Diso, Da, Dratio, theta, phi, D, D_prime, R, spheroid_type=None): """Check if the spheroid in the cdp has the same values as given.""" # Print outs. @@ -231,6 +231,10 @@ # Compare projections. self.assertAlmostEqual(proj1, proj2) + # Check the type. + if spheroid_type: + self.assertEqual(spheroid_type, cdp.diff_tensor.spheroid_type) + def check_spheroid_as_ellipsoid(self, tm, Dx, Dy, Dz, Diso, Da, D, D_prime, R): """Check if the ellipsoid in the cdp has the same values as given spheroid.""" @@ -779,10 +783,27 @@ self.interpreter.pipe.create('spheroid2', 'mf') # Tensor initialization. - self.interpreter.diffusion_tensor.init((tm, Da, theta, phi), param_types=0, angle_units='rad') - - # Check the spheroid. - self.check_spheroid(tm, Dpar, Dper, Diso, Da, Dratio, theta, phi, D, D_prime, R) + self.interpreter.diffusion_tensor.init((tm, Da, theta, phi), spheroid_type='prolate', param_types=0, angle_units='rad') + + # Check the spheroid. + self.check_spheroid(tm, Dpar, Dper, Diso, Da, Dratio, theta, phi, D, D_prime, R) + + + def test_init_prolate_spheroid_param_types_0b(self): + """Test the initialisation of the prolate spheroid diffusion tensor using parameter set 0.""" + + # Get the spheroid data. + Dpar, Dper, theta, phi = 8e7, 8e7, 0.5, 1.0 + tm, Dx, Dy, Dz, Diso, Da, Dratio, D, D_prime, R = self.get_spheroid(Dpar=Dpar, Dper=Dper, theta=theta, phi=phi) + + # Create a new data pipe. + self.interpreter.pipe.create('spheroid2', 'mf') + + # Tensor initialization. + self.interpreter.diffusion_tensor.init((tm, Da, theta, phi), spheroid_type='prolate', param_types=0, angle_units='rad') + + # Check the spheroid. + self.check_spheroid(tm, Dpar, Dper, Diso, Da, Dratio, theta, phi, D, D_prime, R, spheroid_type='prolate') def test_init_prolate_spheroid_param_types_1(self):