[Yt-svn] commit/yt: Cameron Hummels: Modifying function: _scale_image. Adding notes and changing name to be a scale_image and modifying all references in codebase.
Bitbucket
commits-noreply at bitbucket.org
Thu May 26 14:08:05 PDT 2011
1 new changeset in yt:
http://bitbucket.org/yt_analysis/yt/changeset/d003d51b4788/
changeset: r4291:d003d51b4788
branch: yt
user: Cameron Hummels
date: 2011-05-26 22:57:54
summary: Modifying function: _scale_image. Adding notes and changing name to be a scale_image and modifying all references in codebase.
affected #: 3 files (245 bytes)
--- a/yt/mods.py Wed May 25 21:51:04 2011 -0700
+++ b/yt/mods.py Thu May 26 16:57:54 2011 -0400
@@ -96,7 +96,7 @@
PlotCollection, PlotCollectionInteractive, \
get_multi_plot, FixedResolutionBuffer, ObliqueFixedResolutionBuffer, \
callback_registry, write_bitmap, write_image, annotate_image, \
- apply_colormap, _scale_image
+ apply_colormap, scale_image
from yt.visualization.volume_rendering.api import \
ColorTransferFunction, PlanckTransferFunction, ProjectionTransferFunction, \
--- a/yt/visualization/api.py Wed May 25 21:51:04 2011 -0700
+++ b/yt/visualization/api.py Thu May 26 16:57:54 2011 -0400
@@ -49,7 +49,7 @@
splat_points, \
annotate_image, \
apply_colormap, \
- _scale_image
+ scale_image
from plot_modifications import \
PlotCallback, \
--- a/yt/visualization/image_writer.py Wed May 25 21:51:04 2011 -0700
+++ b/yt/visualization/image_writer.py Thu May 26 16:57:54 2011 -0400
@@ -29,7 +29,19 @@
import _colormap_data as cmd
import yt.utilities.amr_utils as au
-def _scale_image(image):
+def scale_image(image):
+ r"""Scale an image ([NxNxM] where M = 1-4) to be uint8 and values scaled
+ from [0,255].
+
+ Parameters
+ ----------
+ image : array_like or tuple of image info
+
+ Examples
+ --------
+
+ >>> image = scale_image(image)
+ """
if isinstance(image, na.ndarray) and image.dtype == na.uint8:
return image
if isinstance(image, (types.TupleType, types.ListType)):
@@ -86,16 +98,16 @@
>>> multi_image_composite("multi_channel1.png", red_channel, blue_channel)
"""
- red_channel = _scale_image(red_channel)
- blue_channel = _scale_image(blue_channel)
+ red_channel = scale_image(red_channel)
+ blue_channel = scale_image(blue_channel)
if green_channel is None:
green_channel = na.zeros(red_channel.shape, dtype='uint8')
else:
- green_channel = _scale_image(green_channel)
+ green_channel = scale_image(green_channel)
if alpha_channel is None:
alpha_channel = na.zeros(red_channel.shape, dtype='uint8') + 255
else:
- alpha_channel = _scale_image(alpha_channel)
+ alpha_channel = scale_image(alpha_channel)
image = na.array([red_channel, green_channel, blue_channel, alpha_channel])
image = image.transpose().copy() # Have to make sure it's contiguous
au.write_png(image, fn)
Repository URL: https://bitbucket.org/yt_analysis/yt/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
More information about the yt-svn
mailing list