From: <ef...@us...> - 2011-02-04 19:19:03
|
Revision: 8945 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8945&view=rev Author: efiring Date: 2011-02-04 19:18:57 +0000 (Fri, 04 Feb 2011) Log Message: ----------- Image generation no longer generates double-precision rgba; patch by C. Gohlke Image generation via color mapping was using doubles for rgba, after which the _image module was converting rgba to uint8; this patch saves time and memory by using the existing ability of the colormap to generate uint8 directly. Modified Paths: -------------- trunk/matplotlib/CHANGELOG trunk/matplotlib/lib/matplotlib/image.py Modified: trunk/matplotlib/CHANGELOG =================================================================== --- trunk/matplotlib/CHANGELOG 2011-02-01 17:57:23 UTC (rev 8944) +++ trunk/matplotlib/CHANGELOG 2011-02-04 19:18:57 UTC (rev 8945) @@ -1,3 +1,7 @@ +2011-02-04 Changed imshow to use rgba as uint8 from start to + finish, instead of going through an intermediate + step as double precision; thanks to Christoph Gohlke. - EF + 2011-01-13 Added zdir and offset arguments to contourf3d to bring contourf3d in feature parity with contour3d. - BVR @@ -8,7 +12,7 @@ 2011-01-03 Turn off tick labeling on interior subplots for pyplots.subplots when sharex/sharey is True. - JDH -2010-12-29 Implment axes_divider.HBox and VBox. -JJL +2010-12-29 Implement axes_divider.HBox and VBox. -JJL 2010-11-22 Fixed error with Hammer projection. - BVR Modified: trunk/matplotlib/lib/matplotlib/image.py =================================================================== --- trunk/matplotlib/lib/matplotlib/image.py 2011-02-01 17:57:23 UTC (rev 8944) +++ trunk/matplotlib/lib/matplotlib/image.py 2011-02-04 19:18:57 UTC (rev 8945) @@ -138,7 +138,7 @@ def _get_unsampled_image(self, A, image_extents, viewlim): """ convert numpy array A with given extents ([x1, x2, y1, y2] in - data coordinate) into the Image, given the vielim (should be a + data coordinate) into the Image, given the viewlim (should be a bbox instance). Image will be clipped if the extents is significantly larger than the viewlim. """ @@ -193,17 +193,17 @@ self._oldyslice = yslice if self._imcache is None: - if self._A.dtype == np.uint8 and len(self._A.shape) == 3: + if self._A.dtype == np.uint8 and self._A.ndim == 3: im = _image.frombyte(self._A[yslice,xslice,:], 0) im.is_grayscale = False else: if self._rgbacache is None: - x = self.to_rgba(self._A, self._alpha) + x = self.to_rgba(self._A, self._alpha, bytes=True) self._rgbacache = x else: x = self._rgbacache - im = _image.fromarray(x[yslice,xslice], 0) - if len(self._A.shape) == 2: + im = _image.frombyte(x[yslice,xslice,:], 0) + if self._A.ndim == 2: im.is_grayscale = self.cmap.is_gray() else: im.is_grayscale = False This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |