Author: tlinnet Date: Wed Jun 11 14:55:31 2014 New Revision: 23835 URL: http://svn.gna.org/viewcvs/relax?rev=23835&view=rev Log: Replaced isnan mask with function that catches all invalid values. 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=23835&r1=23834&r2=23835&view=diff ============================================================================== --- branches/disp_spin_speed/lib/dispersion/cr72.py (original) +++ branches/disp_spin_speed/lib/dispersion/cr72.py Wed Jun 11 14:55:31 2014 @@ -93,7 +93,7 @@ # Python module imports. from numpy import allclose, arccosh, array, cos, cosh, isfinite, isnan, fabs, min, max, ndarray, ones, sqrt, sum, zeros -from numpy.ma import masked_greater_equal, masked_less, masked_where +from numpy.ma import fix_invalid, masked_greater_equal, masked_less, masked_where # Repetitive calculations (to speed up calculations). eta_scale = 2.0**(-3.0/2.0) @@ -219,8 +219,7 @@ # 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)): - # Find the data mask which has nan values, and replace. - mask = isnan(R2eff) - R2eff[mask] = 1e100 + # Replaces nan, inf, etc. with fill value. + fix_invalid(R2eff, copy=False, fill_value=1e100) back_calc[:] = R2eff