Author: tlinnet Date: Tue May 20 22:29:35 2014 New Revision: 23268 URL: http://svn.gna.org/viewcvs/relax?rev=23268&view=rev Log: Fix for commit 23246. http://svn.gna.org/viewcvs/relax?view=revision&revision=23246 The testing taking a value to a power was performed wrong. This made systemtest Relax_disp.test_hansen_cpmg_data_auto_analysis_numeric not working. Modified: branches/disp_speed/lib/dispersion/ns_cpmg_2site_expanded.py Modified: branches/disp_speed/lib/dispersion/ns_cpmg_2site_expanded.py URL: http://svn.gna.org/viewcvs/relax/branches/disp_speed/lib/dispersion/ns_cpmg_2site_expanded.py?rev=23268&r1=23267&r2=23268&view=diff ============================================================================== --- branches/disp_speed/lib/dispersion/ns_cpmg_2site_expanded.py (original) +++ branches/disp_speed/lib/dispersion/ns_cpmg_2site_expanded.py Tue May 20 22:29:35 2014 @@ -235,7 +235,7 @@ """ # Python module imports. -from numpy import array, exp, isfinite, power, log, min, sqrt, sum +from numpy import array, argmax, exp, isfinite, power, log, min, sqrt, sum # relax module imports. from lib.float import isNaN @@ -340,10 +340,24 @@ t118 = 1.0/t112 t120 = t97_nt99 + t112 + # Catch math domain error of coming power(half_t97_t99_m_t112, NR). + # This is when power function calculate above 1.e300 or under -1.e300 or represented as less than 1.-e300. half_t97_t99_m_t112 = 0.5*(t97_t99 - t112) - # Catch math domain error of power(val < 1.e-7, 40). - # This is when abs(half_t97_t99_m_t112) < 1.e-7. - if min(abs(half_t97_t99_m_t112.real)) < 1.e-7: + + # First find the index with the highest power. + index_max_t115 = argmax(t115) + + # Store the power. + max_t115 = t115[index_max_t115] + + # Match the value from half_t97_t99_m_t112. + val_half_t97_t99_m_t112 = half_t97_t99_m_t112[index_max_t115] + + # Calculate lowest positive val, which raised to the power will not be represented less than 1.-e300. + low_pos_rep = power(1.e-300, 1./max_t115) + + # Now test if value in array at the power position is less than this value. + if val_half_t97_t99_m_t112 < low_pos_rep: R2eff = array([1e100]*num_points) return R2eff