[Yt-svn] yt: 2 new changesets
hg at spacepope.org
hg at spacepope.org
Mon Oct 18 07:29:48 PDT 2010
hg Repository: yt
details: yt/rev/2f1ffabbd661
changeset: 3449:2f1ffabbd661
user: Matthew Turk <matthewturk at gmail.com>
date:
Sun Oct 17 17:03:50 2010 -0500
description:
Adding a colormap creator for the transfer functions. Right now it's a bit
awkward to do, but you can use this to add a colormap to an image created with
the volume renderer:
tf = vr.ColorTransferFunction(na.log10(ex))
tf.add_layers(8)
cam = pf.h.camera([0.5, 0.5, 0.5], L, 1.0, 512, tf)
v = iw.write_bitmap(cam.snapshot(), "test1.png")[:,:,:3]
cm = tf.get_colormap_image(512, 40)
ts = na.concatenate([v, cm], axis=1)
iw.write_bitmap(ts, "test2.png")
hg Repository: yt
details: yt/rev/33bc244f64c0
changeset: 3450:33bc244f64c0
user: Matthew Turk <matthewturk at gmail.com>
date:
Mon Oct 18 09:27:17 2010 -0500
description:
Upgrading numpy and matplotlib to 1.5.0 and 1.0.0, respectively. Fixing typo
in some MPL commands.
diffstat:
doc/install_script.sh | 16 ++++++++--------
yt/visualization/image_writer.py | 1 +
yt/visualization/volume_rendering/transfer_functions.py | 10 ++++++++++
3 files changed, 19 insertions(+), 8 deletions(-)
diffs (74 lines):
diff -r e07f3656cdcf -r 33bc244f64c0 doc/install_script.sh
--- a/doc/install_script.sh Sat Oct 16 23:22:32 2010 -0700
+++ b/doc/install_script.sh Mon Oct 18 09:27:17 2010 -0500
@@ -229,8 +229,8 @@
[ $INST_BZLIB -eq 1 ] && get_enzotools bzip2-1.0.5.tar.gz
[ $INST_PNG -eq 1 ] && get_enzotools libpng-1.2.43.tar.gz
get_enzotools Python-2.6.3.tgz
-get_enzotools numpy-1.4.1.tar.gz
-get_enzotools matplotlib-0.99.3.tar.gz
+get_enzotools numpy-1.5.0.tar.gz
+get_enzotools matplotlib-1.0.0.tar.gz
get_enzotools mercurial-1.6.3.tar.gz
get_enzotools ipython-0.10.tar.gz
get_enzotools h5py-1.2.0.tar.gz
@@ -367,7 +367,7 @@
echo "Installing pip"
( ${DEST_DIR}/bin/easy_install-2.6 pip 2>&1 ) 1>> ${LOG_FILE} || do_exit
-do_setup_py numpy-1.4.1 ${NUMPY_ARGS}
+do_setup_py numpy-1.5.0 ${NUMPY_ARGS}
if [ -n "${MPL_SUPP_LDFLAGS}" ]
then
@@ -387,14 +387,14 @@
export CCFLAGS="${MPL_SUPP_CCFLAGS}"
echo "Setting CCFLAGS ${CCFLAGS}"
fi
-do_setup_py matplotlib-0.99.3
-if [-n "${OLD_LDFLAGS}" ]
+do_setup_py matplotlib-1.0.0
+if [ -n "${OLD_LDFLAGS}" ]
then
export LDFLAG=${OLD_LDFLAGS}
fi
-[-n "${OLD_LDFLAGS}" ] && export LDFLAGS=${OLD_LDFLAGS}
-[-n "${OLD_CXXFLAGS}" ] && export CXXFLAGS=${OLD_CXXFLAGS}
-[-n "${OLD_CCFLAGS}" ] && export CCFLAGS=${OLD_CCFLAGS}
+[ -n "${OLD_LDFLAGS}" ] && export LDFLAGS=${OLD_LDFLAGS}
+[ -n "${OLD_CXXFLAGS}" ] && export CXXFLAGS=${OLD_CXXFLAGS}
+[ -n "${OLD_CCFLAGS}" ] && export CCFLAGS=${OLD_CCFLAGS}
do_setup_py ipython-0.10
do_setup_py h5py-1.2.0
diff -r e07f3656cdcf -r 33bc244f64c0 yt/visualization/image_writer.py
--- a/yt/visualization/image_writer.py Sat Oct 16 23:22:32 2010 -0700
+++ b/yt/visualization/image_writer.py Mon Oct 18 09:27:17 2010 -0500
@@ -133,6 +133,7 @@
alpha_channel = 255*na.ones((s1,s2,1), dtype='uint8')
bitmap_array = na.concatenate([bitmap_array, alpha_channel], axis=-1)
au.write_png(bitmap_array.copy(), filename)
+ return bitmap_array
def write_image(image, filename, color_bounds = None, cmap_name = "algae"):
r"""Write out a floating point array directly to a PNG file, scaling it and
diff -r e07f3656cdcf -r 33bc244f64c0 yt/visualization/volume_rendering/transfer_functions.py
--- a/yt/visualization/volume_rendering/transfer_functions.py Sat Oct 16 23:22:32 2010 -0700
+++ b/yt/visualization/volume_rendering/transfer_functions.py Mon Oct 18 09:27:17 2010 -0500
@@ -534,6 +534,16 @@
for v, a in zip(na.mgrid[mi:ma:N*1j], alpha):
self.sample_colormap(v, w, a, colormap=colormap)
+ def get_colormap_image(self, height, width):
+ image = na.zeros((height, width, 3), dtype='uint8')
+ hvals = na.mgrid[self.x_bounds[0]:self.x_bounds[1]:height * 1j]
+ for i,f in enumerate(self.funcs[:3]):
+ vals = na.interp(hvals, f.x, f.y)
+ image[:,:,i] = (vals[:,None] * 255).astype('uint8')
+ image = image[::-1,:,:]
+ import pdb; pdb.set_trace()
+ return image
+
class ProjectionTransferFunction(MultiVariateTransferFunction):
def __init__(self, x_bounds = (-1e60, 1e60)):
r"""A transfer function that defines a simple projection.
More information about the yt-svn
mailing list