<div dir="ltr">good by me.  I like this as a verification test of the orientation and handedness.</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Jul 31, 2014 at 2:02 PM, Nathan Goldbaum <span dir="ltr"><<a href="mailto:nathan12343@gmail.com" target="_blank">nathan12343@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Once the bug you mention gets fixed (seems like an straightforward patch for write_png?), we could probably add this as an answer test.  We do some image comparison tests already in the tests for PlotWindow plots.</div>


<div class="gmail_extra"><br><br><div class="gmail_quote"><div><div class="h5">On Thu, Jul 31, 2014 at 10:57 AM, Michael Zingale <span dir="ltr"><<a href="mailto:michael.zingale@stonybrook.edu" target="_blank">michael.zingale@stonybrook.edu</a>></span> wrote:<br>


</div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5"><div dir="ltr">To help with understanding the volume rendering orientation issues, here's a self-contained test that I've been using.<div>


<br></div><div>This puts a single cube on +x, two cubes on +y, and three cubes on +z.  North is set to +z.</div>
<div><br></div><div>The save_annotated image has the right orientation and handedness.</div><div><br></div><div>The write_png image is upside down.</div><div><br></div><div>I found this data very helpful in understanding and testing orientations.</div>



<div><br></div><div>Mike</div><div><br></div><div><br></div><div>------</div><div><br></div><div><br></div><div><div>import pylab</div><div>import yt</div><div>import numpy as np</div><div><br></div><div>N = 128</div><div>



<br></div><div>xmin = ymin = zmin = -1.0</div><div>xmax = ymax = zmax = 1.0</div><div><br></div><div>arr = np.zeros((N,N,N), dtype=np.float64)</div><div>arr[:,:,:] = 1.e-4</div><div><br></div><div>bbox = np.array([ [xmin, xmax], [ymin, ymax], [zmin, zmax] ])</div>



<div><br></div><div># coordinates -- in the notation data[i, j, k]</div><div>x = (np.arange(N) + 0.5)*(xmax - xmin)/N + xmin</div><div>y = (np.arange(N) + 0.5)*(ymax - ymin)/N + ymin</div><div>z = (np.arange(N) + 0.5)*(zmax - zmin)/N + zmin</div>



<div><br></div><div>x3d, y3d, z3d = np.meshgrid(x, y, z, indexing="ij")</div><div><br></div><div># single cube on +x</div><div>xc = 0.75</div><div>dx = 0.05</div><div>idx = np.logical_and(np.logical_and(x3d > xc-dx, x3d < xc+dx),</div>



<div>                     np.logical_and(np.logical_and(y3d > -dx, y3d < dx),</div><div>                                    np.logical_and(z3d > -dx, z3d < dx)) )</div><div><br></div><div>arr[idx] = 1.0</div>


<div>
<br></div><div><br></div><div># two cubes on +y</div><div>dy = 0.05</div><div>for yc in [0.65, 0.85]:</div><div><br></div><div>    idx = np.logical_and(np.logical_and(y3d > yc-dy, y3d < yc+dy),</div><div>                         np.logical_and(np.logical_and(x3d > -dy, x3d < dy),</div>



<div>                                        np.logical_and(z3d > -dy, z3d < dy)) )</div><div><br></div><div>    arr[idx] = 0.8</div><div><br></div><div># three cubes on +z</div><div>dz = 0.05</div><div>for zc in [0.5, 0.7, 0.9]:</div>



<div><br></div><div>    idx = np.logical_and(np.logical_and(z3d > zc-dz, z3d < zc+dz),</div><div>                         np.logical_and(np.logical_and(x3d > -dz, x3d < dz),</div><div>                                        np.logical_and(y3d > -dz, y3d < dz)) )</div>



<div><br></div><div>    arr[idx] = 0.6</div><div><br></div><div><br></div><div><br></div><div><br></div><div>data = dict(Density = arr)</div><div>ds = yt.load_uniform_grid(data, arr.shape, bbox=bbox)</div><div><br></div>


<div>
import yt.visualization.volume_rendering.api as vr</div><div><br></div><div>c = np.array([0, 0, 0])</div><div>L = np.array([1.0, 1.0, 1.0])</div><div>W = 2.0*ds.domain_width</div><div>N = 720</div><div><br></div><div>north = np.array([0, 0, 1])</div>



<div><br></div><div>tf = vr.ColorTransferFunction((0.1,1.0))</div><div>tf.sample_colormap(1.0, 0.05, colormap="coolwarm")</div><div>tf.sample_colormap(0.8, 0.05, colormap="coolwarm")</div><div>tf.sample_colormap(0.6, 0.05, colormap="coolwarm")</div>



<div><br></div><div>cam = vr.Camera(c, L, W, N, transfer_function=tf, </div><div>                north_vector = north, </div><div>                ds=ds, fields=[('gas', 'Density')], </div><div>                log_fields=[False])</div>



<div><br></div><div><br></div><div>im = cam.snapshot()</div><div>nim = cam.draw_domain(im)</div><div><br></div><div>nim.write_png("test.png")</div><div><br></div><div>cam.save_annotated("test_annotated.png", nim)</div>



</div><div><br></div><div>------</div><span><font color="#888888"><div><br clear="all"><div><br></div>-- <br><div>Michael Zingale</div><div>Associate Professor</div><div><br></div><div>Dept. of Physics & Astronomy • Stony Brook University • Stony Brook, NY 11794-3800</div>



<div><i>phone</i>:  <a href="tel:631-632-8225" value="+16316328225" target="_blank">631-632-8225</a></div><div><i>e-mail</i>: <a href="mailto:Michael.Zingale@stonybrook.edu" target="_blank">Michael.Zingale@stonybrook.edu</a></div>


<div><i>web</i>: <a href="http://www.astro.sunysb.edu/mzingale" target="_blank">http://www.astro.sunysb.edu/mzingale</a></div>

</div></font></span></div>
<br></div></div>_______________________________________________<br>
yt-dev mailing list<br>
<a href="mailto:yt-dev@lists.spacepope.org" target="_blank">yt-dev@lists.spacepope.org</a><br>
<a href="http://lists.spacepope.org/listinfo.cgi/yt-dev-spacepope.org" target="_blank">http://lists.spacepope.org/listinfo.cgi/yt-dev-spacepope.org</a><br>
<br></blockquote></div><br></div>
<br>_______________________________________________<br>
yt-dev mailing list<br>
<a href="mailto:yt-dev@lists.spacepope.org">yt-dev@lists.spacepope.org</a><br>
<a href="http://lists.spacepope.org/listinfo.cgi/yt-dev-spacepope.org" target="_blank">http://lists.spacepope.org/listinfo.cgi/yt-dev-spacepope.org</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div>Michael Zingale</div><div>Associate Professor</div><div><br></div><div>Dept. of Physics & Astronomy • Stony Brook University • Stony Brook, NY 11794-3800</div>
<div><i>phone</i>:  631-632-8225</div><div><i>e-mail</i>: <a href="mailto:Michael.Zingale@stonybrook.edu" target="_blank">Michael.Zingale@stonybrook.edu</a></div><div><i>web</i>: <a href="http://www.astro.sunysb.edu/mzingale" target="_blank">http://www.astro.sunysb.edu/mzingale</a></div>

</div>