[yt-users] need to plot a box with borders

henry wasker henry.wasker at gmail.com
Tue Jan 22 06:29:05 PST 2013


I am new to yt and I am interesting in plotting a volume rendering with
output file from enzo cosmology simulation.

For the time being, I get to plot a box ; here's the result :


I would like now to plot borders of this box too like on this image :


Here's the yt script I use :


from yt.mods import *
from yt.utilities.amr_kdtree.api import AMRKDTree
from time import time
import matplotlib.colorbar as cb

# Load up your dataset
pf = load('RD00'+num+'/RedshiftOutput00'+num)
c = [0.5]*3 # Center
L = [1.0,1.0,1.0] # Viewpoint
W = na.sqrt(3) # Width
N = 768 # Pixels (512^2)
up = [0.,0.,1.]
# Get density min, max
# These might take a long time, so I'd suggest hand-coding mi, ma so
# that you don't have to find the maxima and minima each time you
# test. Note that mi, ma, should be a log value since we are
# rendering the log of density.
mi, ma = pf.h.all_data().quantities['Extrema']('Density')[0]
mi, ma = na.log10(mi), na.log10(ma)
print mi, ma
#mi, ma = -31.0, -26.0
# Construct transfer function, pad the TF space by a bit so that
# gaussians sampling the data range don't hit the edge.
tf = ColorTransferFunction((mi-10, ma+10), nbins=1024)
# Sample transfer function with 20 gaussians. Use col_bounds keyword
# to restrict color mapping to true data range.
tf.add_layers(20, w=0.001,
# Create the camera object
cam = pf.h.camera(c, L, W, (N,N), transfer_function=tf, north_vector=up,
cam.snapshot("volume_rendered%s.png" % num, clip_ratio=8.0)


Is there an option for 'camera" or "snapshot" which allows to add the
borders for this box ?

Any help would be really appreciated.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.spacepope.org/pipermail/yt-users-spacepope.org/attachments/20130122/c9d01be5/attachment.htm>

More information about the yt-users mailing list