Hi Henry, Welcome to yt! Thanks for bringing this up. I've had some code lying around uncommitted for quite some time that allows for this type of annotation of the grids/domains, and this has motivated me to revive it and push it along. I currently have a pull request open to incorporate these changes, and they will likely be accepted soon ( https://bitbucket.org/yt_analysis/yt/pull-request/406/draw-domain-boundary-a... ). Once it is accepted, you should be able to update (to the development brach), and do: im = cam.snapshot("volume_rendered%s.png" % num) cam.draw_domain(im) write_bitmap(im, 'volume_rendered%s_with_domain.png" % num) Once the functionality is added, I will send an email to the users list announcing it as a feature and asking for folks to test it out. Best, Sam On Tue, Jan 22, 2013 at 6:29 AM, henry wasker <henry.wasker@gmail.com>wrote:
Hello,
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 num='70' 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, col_bounds=(mi,ma),colormap='jet') # Create the camera object cam = pf.h.camera(c, L, W, (N,N), transfer_function=tf, north_vector=up, no_ghost=True) 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.
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org