[yt-svn] commit/yt: xarthisius: Merged in ngoldbaum/yt (pull request #2276)
commits-noreply at bitbucket.org
commits-noreply at bitbucket.org
Sat Jul 16 08:47:53 PDT 2016
1 new commit in yt:
https://bitbucket.org/yt_analysis/yt/commits/a4348e453b3f/
Changeset: a4348e453b3f
Branch: yt
User: xarthisius
Date: 2016-07-16 15:47:23+00:00
Summary: Merged in ngoldbaum/yt (pull request #2276)
Ensure the positions of coordinate vector lines are in code units. Closes #1207
Affected #: 2 files
diff -r c0c922e7117a4300b3166331c69be33169a794e8 -r a4348e453b3f9121fb5abbd2322662d3a84caffc yt/testing.py
--- a/yt/testing.py
+++ b/yt/testing.py
@@ -324,21 +324,32 @@
return ds
-def fake_vr_orientation_test_ds(N = 96):
+def fake_vr_orientation_test_ds(N = 96, scale=1):
"""
create a toy dataset that puts a sphere at (0,0,0), a single cube
on +x, two cubes on +y, and three cubes on +z in a domain from
- [-1,1]**3. The lower planes (x = -1, y = -1, z = -1) are also
- given non-zero values.
+ [-1*scale,1*scale]**3. The lower planes
+ (x = -1*scale, y = -1*scale, z = -1*scale) are also given non-zero
+ values.
This dataset allows you to easily explore orientations and
handiness in VR and other renderings
+ Parameters:
+ -----------
+
+ N: integer
+ The number of cells along each direction
+
+ scale: float
+ A spatial scale, the domain boundaries will be multiplied by scale to
+ test datasets that have spatial different scales (e.g. data in CGS units)
+
"""
from yt.frontends.stream.api import load_uniform_grid
- xmin = ymin = zmin = -1.0
- xmax = ymax = zmax = 1.0
+ xmin = ymin = zmin = -1.0 * scale
+ xmax = ymax = zmax = 1.0 * scale
dcoord = (xmax - xmin)/N
@@ -364,24 +375,24 @@
arr[abs(z3d - zmin) < 2*dcoord] = 0.3
# single cube on +x
- xc = 0.75
- dx = 0.05
+ xc = 0.75 * scale
+ dx = 0.05 * scale
idx = 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 +y
- dy = 0.05
- for yc in [0.65, 0.85]:
+ dy = 0.05 * scale
+ for yc in [0.65 * scale, 0.85 * scale]:
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 +z
- dz = 0.05
- for zc in [0.5, 0.7, 0.9]:
+ dz = 0.05 * scale
+ for zc in [0.5 * scale, 0.7 * scale, 0.9 * scale]:
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)) )
diff -r c0c922e7117a4300b3166331c69be33169a794e8 -r a4348e453b3f9121fb5abbd2322662d3a84caffc yt/visualization/volume_rendering/render_source.py
--- a/yt/visualization/volume_rendering/render_source.py
+++ b/yt/visualization/volume_rendering/render_source.py
@@ -1105,7 +1105,7 @@
# Create vectors in the x,y,z directions
for i in range(3):
- positions[2*i+1, i] += camera.width.d[i] / 16.0
+ positions[2*i+1, i] += camera.width.in_units('code_length').d[i] / 16.0
# Project to the image plane
px, py, dz = camera.lens.project_to_plane(camera, positions)
Repository URL: https://bitbucket.org/yt_analysis/yt/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
More information about the yt-svn
mailing list