Hi Ed.

In the last patch you send, you suggested to remove all tests of:
    if not isfinite(sum(R2eff)):
        R2eff = array([1e100]*num_points)

The unit test case I implemented, shows that the minimisation can come
into situations, where
you produce nan or inf values.

And that will make the minimisation goes to a halt.

This is a strong argument to keep this check.
    if not isfinite(sum(R2eff)):
        R2eff = array([1e100]*num_points)

Best
Troels



2014-05-28 17:29 GMT+02:00 Edward d'Auvergne <[email protected]>:
> Hi Troels,
>
> These two new tests are problematic in that they are no longer unit
> tests.  Unit tests for the lib.dispersion modules should only check
> the lib.dispersion module functions.  But here this is also checking
> the specific analysis parameter object API.  They are also problematic
> in that the lower grid search values in test_b14_no_rex9() will not
> correspond to no exchange as kex = 1.0.  What is the aim of the tests?
>  The aim of the grid search is to search over regions where exchange
> is present, as searching where there is no exchange is a waste of grid
> points - optimisation will quickly send the parameter to zero exchange
> values if there is no exchange.
>
> Regards,
>
> Edward
>
>
> On 28 May 2014 16:49,  <[email protected]> wrote:
>> Author: tlinnet
>> Date: Wed May 28 16:49:08 2014
>> New Revision: 23531
>>
>> URL: http://svn.gna.org/viewcvs/relax?rev=23531&view=rev
>> Log:
>> Added 9th and 10th unit test case for model B14.
>>
>> These tests are setup, to check how the function behaves under conditions of 
>> the grid-seach.
>>
>> Two tests are setup, which either use the default lower or upper bound of 
>> the parameters for the grid search.
>>
>> The return of the values are not checked, but the behaving of the function 
>> can be found when adding the --numpy-raise to run relax.
>>
>> This is related to: task #7793: (https://gna.org/task/?7793) Speed-up of 
>> dispersion models.
>>
>> These tests are implemented to show bug cases related to:
>> Bug #22032: (bug #22032: Minimisation explodes when using Grid_INC=None) 
>> Minimisation explodes when using Grid_INC=None
>>
>> The function can return nan or inf values, which are not handled by the 
>> minimisation algorithm, causing it to stop.
>> There needs to be mechanism to catch these cases.
>>
>> Modified:
>>     branches/disp_speed/test_suite/unit_tests/_lib/_dispersion/test_b14.py
>>
>> Modified: 
>> branches/disp_speed/test_suite/unit_tests/_lib/_dispersion/test_b14.py
>> URL: 
>> http://svn.gna.org/viewcvs/relax/branches/disp_speed/test_suite/unit_tests/_lib/_dispersion/test_b14.py?rev=23531&r1=23530&r2=23531&view=diff
>> ==============================================================================
>> --- branches/disp_speed/test_suite/unit_tests/_lib/_dispersion/test_b14.py   
>>    (original)
>> +++ branches/disp_speed/test_suite/unit_tests/_lib/_dispersion/test_b14.py   
>>    Wed May 28 16:49:08 2014
>> @@ -25,6 +25,7 @@
>>
>>  # relax module imports.
>>  from lib.dispersion.b14 import r2eff_B14
>> +from specific_analyses.relax_disp.parameter_object import Relax_disp_params
>>
>>
>>  class Test_b14(TestCase):
>> @@ -51,6 +52,9 @@
>>          # The spin Larmor frequencies.
>>          self.sfrq = 200. * 1E6
>>
>> +        # This is to test the default grid values.
>> +        self.test_val = True
>> +
>>
>>      def calc_r2eff(self):
>>          """Calculate and check the R2eff values."""
>> @@ -62,8 +66,9 @@
>>          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)
>>
>>          # Check all R2eff values.
>> -        for i in range(self.num_points):
>> -            self.assertAlmostEqual(R2eff[i], self.r20a)
>> +        if self.test_val:
>> +            for i in range(self.num_points):
>> +                self.assertAlmostEqual(R2eff[i], self.r20a)
>>
>>
>>      def param_conversion(self, pA=None, kex=None, dw=None, sfrq=None):
>> @@ -180,3 +185,38 @@
>>
>>          # Calculate and check the R2eff values.
>>          self.calc_r2eff()
>> +
>> +
>> +    def test_b14_no_rex9(self):
>> +        """Test the r2eff_b14() function for the default lower grid values. 
>>  This is to catch un-discovered numpy-raises in calculations. """
>> +
>> +        PARAMS = Relax_disp_params()
>> +
>> +        # Parameter reset.
>> +        self.r20a = PARAMS.grid_lower('r2a')
>> +        self.r20b = PARAMS.grid_lower('r2b')
>> +        self.pA =  PARAMS.grid_lower('pA')
>> +        self.kex = PARAMS.grid_lower('kex')
>> +
>> +        self.test_val = False
>> +
>> +        # Calculate and check the R2eff values.
>> +        self.calc_r2eff()
>> +
>> +
>> +    def test_b14_no_rex10(self):
>> +        """Test the r2eff_b14() function for the default lower grid values. 
>>  This is to catch un-discovered numpy-raises in calculations. """
>> +
>> +        PARAMS = Relax_disp_params()
>> +
>> +        # Parameter reset.
>> +        self.r20a = PARAMS.grid_upper('r2a')
>> +        self.r20b = PARAMS.grid_upper('r2b')
>> +        self.dw = PARAMS.grid_upper('dw')
>> +        self.pA =  PARAMS.grid_upper('pA')
>> +        self.kex = PARAMS.grid_upper('kex')
>> +
>> +        self.test_val = False
>> +
>> +        # Calculate and check the R2eff values.
>> +        self.calc_r2eff()
>>
>>
>> _______________________________________________
>> 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

_______________________________________________
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