mailRe: [task #7793] Speed-up of dispersion models


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by Troels Emtekær Linnet on May 28, 2014 - 13:04:
And the system tests are a gold mine of failing places.
If I set the numpy-raise on, I see:

E     0.02 s for Relax_disp.test_baldwin_synthetic
E     0.01 s for Relax_disp.test_baldwin_synthetic_full
E     0.10 s for Relax_disp.test_cpmg_synthetic_ns3d_to_b14
E     0.11 s for Relax_disp.test_hansen_cpmg_data_to_ns_cpmg_2site_star
E     0.08 s for Relax_disp.test_hansen_cpmg_data_to_ns_cpmg_2site_star_full
E     5.97 s for Relax_disp.test_ns_mmq_3site
E     5.82 s for Relax_disp.test_ns_mmq_3site_linear

Relax_disp.test_baldwin_synthetic
#############
Searching through 2197 grid nodes.
k: 0        xk: [      0.2008231,               0,             0.5,
      0.0001]    fk: 26709.2681152
k: 1        xk: [      0.2008231,    0.8333333333,             0.5,
      0.0001]    fk: 24779.5002961
k: 2        xk: [      0.2008231,     1.666666667,             0.5,
      0.0001]    fk: 23811.5470332
  File "/Users/tlinnet/software/disp_speed/lib/dispersion/b14.py",
line 231, in r2eff_B14
    Tog = 0.5 * (1. + y) + (1. - y) * v5 / (2. * v3 * N )
FloatingPointError: invalid value encountered in divide

That corresponds to:
r2                            2.008231
dw                           1.666666667
pA                           0.5
kex                       1.0

The print out shows:
    print r20a 2.008231
    print r20b 2.008231
    print pA 0.5
    print pB 0.5
    print dw 3141.59265359
    print kex 1.0

So, somewhere some forbidden steps are being performed.
We need to make sure, that this is protected!

Indeed when I add to: test_suite/unit_tests/_lib/_dispersion/test_b14.py

    def test_b14_no_rex9(self):
        """Test the r2eff_b14() function for weird cases"""

        self.r20a = 2.008231
        self.r20b = 2.008231
        self.pA = 0.5
        self.dw = 2.5
        self.kex = 1.0

        # Calculate and check the R2eff values.
        self.calc_r2eff()

It fails.

I can boil it down to:

        # Parameter reset.
        self.r20a = 2.00
        self.r20b = self.r20a
        self.pA = 0.5
        self.kex = 4.0 or under.


We need to make sure that we always survive these situations.

And I know, that you have turned of Grid search for many of the models
being tested in the test suite.
So, we don't know if they all perform well.

Best
Troels





2014-05-28 12:23 GMT+02:00 Troels Emtekær Linnet <tlinnet@xxxxxxxxxxxxx>:
Hi Edward.

The NS CPMG 2site extended is a good case.

It will make a underflow for kex as low as 1e4.

  File 
"/Users/tlinnet/software/disp_speed/test_suite/unit_tests/_lib/_dispersion/test_ns_cpmg_2site_expanded.py",
line 180, in test_ns_cpmg_2site_expanded_no_rex8
    self.calc_r2eff()
  File 
"/Users/tlinnet/software/disp_speed/test_suite/unit_tests/_lib/_dispersion/test_ns_cpmg_2site_expanded.py",
line 58, in calc_r2eff
    R2eff = r2eff_ns_cpmg_2site_expanded(r20=self.r20, pA=self.pA,
dw=dw_frq, 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)
  File 
"/Users/tlinnet/software/disp_speed/lib/dispersion/ns_cpmg_2site_expanded.py",
line 298, in r2eff_ns_cpmg_2site_expanded
    t28 = exp(-(t17 + k_AB_plus_k_BA_minus_t4) * half_tcp)
FloatingPointError: underflow encountered in exp

And, the test is extremely fast. So I would rather keep it, as a last
line of defence.

Best
Troels

2014-05-28 12:10 GMT+02:00 Edward d'Auvergne <edward@xxxxxxxxxxxxx>:
Hi,

Do you have an example where infinite or NaN values appear?  I think
that with the 'No Rex' checks, we now 100% avoid these.  So I believe
that all Inf and NaN values came from the parameter values dw == 0.0
or pA == 1.0 or kex == 0.0 or phi_ex = 0.0 causing a failure in the
original dispersion equations.  That is what this patch demonstrates -
for all cases in the test suite, there is no longer any Inf or NaN
values :)  At least for the models we check for no exchange
conditions.

Regards,

Edward





On 28 May 2014 12:01, Troels Emtekær Linnet <tlinnet@xxxxxxxxxxxxx> wrote:
Hi Edward.

I cannot accept the patch.

It removes all the isfinite(sum(R1rho)) tests I have put in.

Best
Troels


2014-05-28 11:53 GMT+02:00 Edward d  Auvergne
<NO-REPLY.INVALID-ADDRESS@xxxxxxx>:
Follow-up Comment #86, task #7793 (project relax):

I have modified the patch for the latest version of the disp_speed branch
(r23503).

(file #20827)
    _______________________________________________________

Additional Item Attachment:

File name: patch_check_removal2           Size:10 KB


    _______________________________________________________

Reply to this item at:

  <http://gna.org/task/?7793>

_______________________________________________
  Message sent via/by Gna!
  http://gna.org/




Related Messages


Powered by MHonArc, Updated Thu May 29 13:20:18 2014