To help with understanding the volume rendering orientation issues, here's a self-contained test that I've been using.This puts a single cube on +x, two cubes on +y, and three cubes on +z. North is set to +z.The save_annotated image has the right orientation and handedness.The write_png image is upside down.I found this data very helpful in understanding and testing orientations.Mike------import pylabimport ytimport numpy as npN = 128xmin = ymin = zmin = -1.0xmax = ymax = zmax = 1.0arr = np.zeros((N,N,N), dtype=np.float64)arr[:,:,:] = 1.e-4bbox = np.array([ [xmin, xmax], [ymin, ymax], [zmin, zmax] ])# coordinates -- in the notation data[i, j, k]x = (np.arange(N) + 0.5)*(xmax - xmin)/N + xminy = (np.arange(N) + 0.5)*(ymax - ymin)/N + yminz = (np.arange(N) + 0.5)*(zmax - zmin)/N + zminx3d, y3d, z3d = np.meshgrid(x, y, z, indexing="ij")# single cube on +xxc = 0.75dx = 0.05idx = np.logical_and(np.logical_and(x3d > xc-dx, x3d < xc+dx),np.logical_and(np.logical_and(y3d > -dx, y3d < dx),np.logical_and(z3d > -dx, z3d < dx)) )arr[idx] = 1.0# two cubes on +ydy = 0.05for yc in [0.65, 0.85]:idx = np.logical_and(np.logical_and(y3d > yc-dy, y3d < yc+dy),np.logical_and(np.logical_and(x3d > -dy, x3d < dy),np.logical_and(z3d > -dy, z3d < dy)) )arr[idx] = 0.8# three cubes on +zdz = 0.05for zc in [0.5, 0.7, 0.9]:idx = np.logical_and(np.logical_and(z3d > zc-dz, z3d < zc+dz),np.logical_and(np.logical_and(x3d > -dz, x3d < dz),np.logical_and(y3d > -dz, y3d < dz)) )arr[idx] = 0.6data = dict(Density = arr)ds = yt.load_uniform_grid(data, arr.shape, bbox=bbox)import yt.visualization.volume_rendering.api as vrc = np.array([0, 0, 0])L = np.array([1.0, 1.0, 1.0])W = 2.0*ds.domain_widthN = 720north = np.array([0, 0, 1])tf = vr.ColorTransferFunction((0.1,1.0))tf.sample_colormap(1.0, 0.05, colormap="coolwarm")tf.sample_colormap(0.8, 0.05, colormap="coolwarm")tf.sample_colormap(0.6, 0.05, colormap="coolwarm")cam = vr.Camera(c, L, W, N, transfer_function=tf,north_vector = north,ds=ds, fields=[('gas', 'Density')],log_fields=[False])im = cam.snapshot()nim = cam.draw_domain(im)nim.write_png("test.png")cam.save_annotated("test_annotated.png", nim)--------Michael ZingaleAssociate ProfessorDept. of Physics & Astronomy • Stony Brook University • Stony Brook, NY 11794-3800phone: 631-632-8225e-mail: Michael.Zingale@stonybrook.edu
_______________________________________________
yt-dev mailing list
yt-dev@lists.spacepope.org
http://lists.spacepope.org/listinfo.cgi/yt-dev-spacepope.org