Author: tlinnet Date: Mon May 26 13:38:09 2014 New Revision: 23414 URL: http://svn.gna.org/viewcvs/relax?rev=23414&view=rev Log: Critical fix for the math domain catching of model CR72. This was discovered with the added 8 unit tests demonstrating edge case 'no Rex' failures. 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. When kex is large, ex: kex = 1e5, the values of: etapos = eta_scale * sqrt(Psi + sqrt_psi2_zeta2) / cpmg_frqs will exceed possible numerical representation. The cathing of these occurences needed to be re-written. Modified: branches/disp_speed/lib/dispersion/cr72.py Modified: branches/disp_speed/lib/dispersion/cr72.py URL: http://svn.gna.org/viewcvs/relax/branches/disp_speed/lib/dispersion/cr72.py?rev=23414&r1=23413&r2=23414&view=diff ============================================================================== --- branches/disp_speed/lib/dispersion/cr72.py (original) +++ branches/disp_speed/lib/dispersion/cr72.py Mon May 26 13:38:09 2014 @@ -128,9 +128,9 @@ k_BA = pA * kex k_AB = pB * kex - # Catch parameter values that will result in no exchange, returning flat R2eff = R20 lines. - if dw == 0.0 or pA == 1.0 or kex == 0.0: - return array([r20_kex]*num_points) + # Catch parameter values that will result in no exchange, returning flat R2eff = R20 lines (when kex = 0.0, k_AB = 0.0). + if dw == 0.0 or pA == 1.0 or k_AB == 0.0 or kex >= 1.e5: + return array([r20a]*num_points) # The Psi and zeta values. if r20a != r20b: @@ -156,16 +156,12 @@ # Catch math domain error of cosh(val > 710). # This is when etapos > 710. if max(etapos) > 700: - R2eff = array([1e100]*num_points) - - return R2eff + return array([r20a]*num_points) # The arccosh argument - catch invalid values. fact = Dpos * cosh(etapos) - Dneg * cos(etaneg) if min(fact) < 1.0: - R2eff = array([r20_kex]*num_points) - - return R2eff + return array([r20_kex]*num_points) # Calculate R2eff. R2eff = r20_kex - cpmg_frqs * arccosh( fact )