<div dir="ltr"><div><div>Hi,<br><br></div>I have just upgraded from Squeeze Debian to Wheezy. After the installation of yt dev and a "yt update && yt update --all", I  can't get now to draw a box on volume rendering with draw_domain.<br>
<br></div>Here's the script :<br><br>------------------------------------------------------------------------------------------<br><br>from yt.mods import *<br>from yt.utilities.amr_kdtree.api import AMRKDTree<br>from time import time<br>
import matplotlib.colorbar as cb<br>from yt.visualization.eps_writer import * <br>import pyx<br><br># Load up your dataset<br>num='70'<br>pf = load('RD00'+num+'/RedshiftOutput00'+num)<br>c = [0.5]*3 # Center<br>
L = [1.0,1.0,1.0] # Viewpoint<br>W = na.sqrt(3) # Width<br>N = 768 # Pixels (512^2)<br>up = [0.,0.,1.]<br># Get density min, max<br># These might take a long time, so I'd suggest hand-coding mi, ma so<br># that you don't have to find the maxima and minima each time you<br>
# test. Note that mi, ma, should be a log value since we are<br># rendering the log of density.<br>mi, ma = pf.h.all_data().quantities['Extrema']('Density')[0]<br>mi, ma = na.log10(mi), na.log10(ma)<br>print mi, ma<br>
#mi, ma = -31.0, -26.0<br># Construct transfer function, pad the TF space by a bit so that<br># gaussians sampling the data range don't hit the edge.<br>tf = ColorTransferFunction((mi-10, ma+10), nbins=1024)<br># Sample transfer function with 20 gaussians. Use col_bounds keyword<br>
# to restrict color mapping to true data range.<br>tf.add_layers(20, w=0.001,<br>        col_bounds=(mi,ma),colormap='jet')<br># Create the camera object<br>cam = pf.h.camera(c, L, W, (N,N), transfer_function=tf, north_vector=up,<br>
        no_ghost=True)<br><br>cam.rotate(na.pi*105/200,[1, 1, 0])<br>im = cam.snapshot("volume_rendered%s.png" % num, clip_ratio=8.0)<br>cam.draw_domain(im)<br>write_bitmap(im, "volume_rendered%s_with_domain.png" % num)<br>
<br><div>------------------------------------------------------------------------------------------<br><br></div><div>It produces the following figure :<br><br><a href="http://i.imgur.com/C9nutUh.png">http://i.imgur.com/C9nutUh.png</a><br>
<br></div><div>as you can see, the borders are not drawn<br></div><div><div><div><br></div><div>Anyone could see what's wrong ?<br><br></div><div>Thanks<br></div><div><br><br><div class="gmail_quote">---------- Forwarded message ----------<br>
From: <b class="gmail_sendername">henry wasker</b> <span dir="ltr"><<a href="mailto:henry.wasker@gmail.com">henry.wasker@gmail.com</a>></span><br>Date: 2013/1/22<br>Subject: need to plot a box with borders<br>To: <a href="mailto:yt-users@lists.spacepope.org">yt-users@lists.spacepope.org</a><br>
<br><br>Hello,<br><br>I am new to yt and I am interesting in plotting a volume rendering with output file from enzo cosmology simulation.<br><br><span lang="en"><span>For the time being</span></span>, I get to plot a box ; here's the result :<br>


<br><a href="http://imgur.com/dPwSQEh" target="_blank">http://imgur.com/dPwSQEh</a><br><br>I would like now to plot borders of this box too like on this image :<br><br><a href="http://imgur.com/bJ25I0l" target="_blank">http://imgur.com/bJ25I0l</a><br>

<br>
Here's the yt script I use :<br><br>------------------------------------------------------------------------------------------------------------<br><br>from yt.mods import *<br>from yt.utilities.amr_kdtree.api import AMRKDTree<br>


from time import time<br>import matplotlib.colorbar as cb<br><br># Load up your dataset<br>num='70'<br>pf = load('RD00'+num+'/RedshiftOutput00'+num)<br>c = [0.5]*3 # Center<br>L = [1.0,1.0,1.0] # Viewpoint<br>


W = na.sqrt(3) # Width<br>N = 768 # Pixels (512^2)<br>up = [0.,0.,1.]<br># Get density min, max<br># These might take a long time, so I'd suggest hand-coding mi, ma so<br># that you don't have to find the maxima and minima each time you<br>


# test. Note that mi, ma, should be a log value since we are<br># rendering the log of density.<br>mi, ma = pf.h.all_data().quantities['Extrema']('Density')[0]<br>mi, ma = na.log10(mi), na.log10(ma)<br>print mi, ma<br>


#mi, ma = -31.0, -26.0<br># Construct transfer function, pad the TF space by a bit so that<br># gaussians sampling the data range don't hit the edge.<br>tf = ColorTransferFunction((mi-10, ma+10), nbins=1024)<br># Sample transfer function with 20 gaussians. Use col_bounds keyword<br>


# to restrict color mapping to true data range.<br>tf.add_layers(20, w=0.001,<br>        col_bounds=(mi,ma),colormap='jet')<br># Create the camera object<br>cam = pf.h.camera(c, L, W, (N,N), transfer_function=tf, north_vector=up,<br>


        no_ghost=True)<br>cam.snapshot("volume_rendered%s.png" % num, clip_ratio=8.0)<br><br>------------------------------------------------------------------------------------------------------------<br><br>Is there an option for 'camera" or "snapshot" which allows to add the borders for this box ?<br>


<br>Any help would be really appreciated.<br><br><br><br>
</div><br></div></div></div></div>