Author: tlinnet Date: Tue Jun 10 01:02:02 2014 New Revision: 23767 URL: http://svn.gna.org/viewcvs/relax?rev=23767&view=rev Log: Very important fix, for only replacing part of data array which have Nan values. Before, all values were replaced, which was wrong. Task #7807 (https://gna.org/task/index.php?7807): Speed-up of dispersion models for Clustered analysis. Modified: branches/disp_spin_speed/lib/dispersion/cr72.py Modified: branches/disp_spin_speed/lib/dispersion/cr72.py URL: http://svn.gna.org/viewcvs/relax/branches/disp_spin_speed/lib/dispersion/cr72.py?rev=23767&r1=23766&r2=23767&view=diff ============================================================================== --- branches/disp_spin_speed/lib/dispersion/cr72.py (original) +++ branches/disp_spin_speed/lib/dispersion/cr72.py Tue Jun 10 01:02:02 2014 @@ -92,7 +92,7 @@ """ # Python module imports. -from numpy import allclose, arccosh, array, cos, cosh, isfinite, min, max, ndarray, ones, sqrt, sum, zeros +from numpy import allclose, arccosh, array, cos, cosh, isfinite, isnan, min, max, ndarray, ones, sqrt, sum, zeros # Repetitive calculations (to speed up calculations). eta_scale = 2.0**(-3.0/2.0) @@ -195,9 +195,8 @@ # Catch errors, taking a sum over array is the fastest way to check for # +/- inf (infinity) and nan (not a number). if not isfinite(sum(R2eff)): - if rank_1: - R2eff = array([1e100]*num_points) - else: - R2eff = ones(R2eff.shape) * 1e100 + # Find the data mask which has nan values, and replace. + mask = isnan(R2eff) + R2eff[mask] = 1e100 back_calc[:] = R2eff