[Yt-svn] commit/yt: 2 new changesets
Bitbucket
commits-noreply at bitbucket.org
Fri Jun 10 08:26:57 PDT 2011
2 new changesets in yt:
http://bitbucket.org/yt_analysis/yt/changeset/18548a50a168/
changeset: 18548a50a168
branch: yt
user: Cameron Hummels
date: 2011-06-10 17:26:44
summary: Allow explicit clipping with scale_image function.
affected #: 1 file (122 bytes)
--- a/yt/visualization/image_writer.py Thu Jun 09 14:06:56 2011 -0400
+++ b/yt/visualization/image_writer.py Fri Jun 10 11:26:44 2011 -0400
@@ -29,7 +29,7 @@
import _colormap_data as cmd
import yt.utilities.amr_utils as au
-def scale_image(image):
+def scale_image(image, min=None, max=None):
r"""Scale an image ([NxNxM] where M = 1-4) to be uint8 and values scaled
from [0,255].
@@ -41,14 +41,18 @@
--------
>>> image = scale_image(image)
+
+ >>> image = scale_image(image, min=0, max=1000)
"""
if isinstance(image, na.ndarray) and image.dtype == na.uint8:
return image
if isinstance(image, (types.TupleType, types.ListType)):
- image, mi, ma = image
- else:
- mi, ma = image.min(), image.max()
- image = (na.clip((image-mi)/(ma-mi) * 255, 0, 255)).astype('uint8')
+ image, min, max = image
+ if min is None:
+ min = image.min()
+ if max is None:
+ max = image.max()
+ image = (na.clip((image-min)/(max-min) * 255, 0, 255)).astype('uint8')
return image
def multi_image_composite(fn, red_channel, blue_channel,
http://bitbucket.org/yt_analysis/yt/changeset/31e62da1bb0e/
changeset: 31e62da1bb0e
branch: yt
user: Cameron Hummels
date: 2011-06-10 17:26:54
summary: Merging.
affected #: 2 files (160 bytes)
--- a/yt/funcs.py Fri Jun 10 11:26:44 2011 -0400
+++ b/yt/funcs.py Fri Jun 10 11:26:54 2011 -0400
@@ -435,6 +435,10 @@
# If we recognize one of the arguments on the command line as indicating a
# different mechanism for handling tracebacks, we attach one of those handlers
# and remove the argument from sys.argv.
+#
+# This fallback is for Paraview:
+if not hasattr(sys, 'argv') or sys.argv is None: sys.argv = []
+# Now, we check.
if "--paste" in sys.argv:
sys.excepthook = paste_traceback
del sys.argv[sys.argv.index("--paste")]
--- a/yt/utilities/command_line.py Fri Jun 10 11:26:44 2011 -0400
+++ b/yt/utilities/command_line.py Fri Jun 10 11:26:54 2011 -0400
@@ -556,7 +556,8 @@
"""
pf = _fix_pf(arg)
pf.h.print_stats()
- v, c = pf.h.find_max("Density")
+ if "Density" in pf.h.field_list:
+ v, c = pf.h.find_max("Density")
print "Maximum density: %0.5e at %s" % (v, c)
if opts.output is not None:
t = pf.current_time * pf['years']
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