Revision: 8969 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8969&view=rev Author: efiring Date: 2011-02-10 07:37:05 +0000 (Thu, 10 Feb 2011)
Log Message: ----------- LogNorm: speed-up by dealing with mask explicitly Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/colors.py Modified: trunk/matplotlib/lib/matplotlib/colors.py =================================================================== --- trunk/matplotlib/lib/matplotlib/colors.py 2011-02-10 01:21:27 UTC (rev 8968) +++ trunk/matplotlib/lib/matplotlib/colors.py 2011-02-10 07:37:05 UTC (rev 8969) @@ -921,9 +921,17 @@ mask=mask) #result = (ma.log(result)-np.log(vmin))/(np.log(vmax)-np.log(vmin)) # in-place equivalent of above can be much faster - np.ma.log(result, result) - result -= np.log(vmin) - result /= (np.log(vmax) - np.log(vmin)) + resdat = result.data + mask = result.mask + if mask is np.ma.nomask: + mask = (resdat <= 0) + else: + mask |= resdat <= 0 + np.putmask(resdat, mask, 1) + np.log(resdat, resdat) + resdat -= np.log(vmin) + resdat /= (np.log(vmax) - np.log(vmin)) + result = np.ma.array(resdat, mask=mask, copy=False) if is_scalar: result = result[0] return result This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------------ The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE: Pinpoint memory and threading errors before they happen. Find and fix more than 250 security defects in the development cycle. Locate bottlenecks in serial and parallel code that limit performance. http://p.sf.net/sfu/intel-dev2devfeb _______________________________________________ Matplotlib-checkins mailing list Matplotlib-checkins@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins