[yt-svn] commit/yt: ngoldbaum: Merged in mzingale/yt-mz (pull request #2012)
commits-noreply at bitbucket.org
commits-noreply at bitbucket.org
Tue Mar 29 08:21:20 PDT 2016
1 new commit in yt:
https://bitbucket.org/yt_analysis/yt/commits/b6dad5b69998/
Changeset: b6dad5b69998
Branch: yt
User: ngoldbaum
Date: 2016-03-29 15:21:08+00:00
Summary: Merged in mzingale/yt-mz (pull request #2012)
add a new function, fake_vr_orientation_test_ds() that creates a
Affected #: 3 files
diff -r 86db031f1f56a6f396d4440188707f1fdb8e6bfa -r b6dad5b69998cff732a5c3ea7847a4b01092ffc8 tests/tests_2.7.yaml
--- a/tests/tests_2.7.yaml
+++ b/tests/tests_2.7.yaml
@@ -42,7 +42,7 @@
local_tipsy_270:
- yt/frontends/tipsy/tests/test_outputs.py
- local_varia_272:
+ local_varia_273:
- yt/analysis_modules/radmc3d_export
- yt/frontends/moab/tests/test_c5.py
- yt/analysis_modules/photon_simulator/tests/test_spectra.py
diff -r 86db031f1f56a6f396d4440188707f1fdb8e6bfa -r b6dad5b69998cff732a5c3ea7847a4b01092ffc8 yt/testing.py
--- a/yt/testing.py
+++ b/yt/testing.py
@@ -317,7 +317,75 @@
return ds
+def fake_vr_orientation_test_ds(N = 96):
+ """
+ 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.
+
+ This dataset allows you to easily explore orientations and
+ handiness in VR and other renderings
+
+ """
+ from yt.frontends.stream.api import load_uniform_grid
+
+ xmin = ymin = zmin = -1.0
+ xmax = ymax = zmax = 1.0
+
+ dcoord = (xmax - xmin)/N
+
+ arr = np.zeros((N,N,N), dtype=np.float64)
+ arr[:,:,:] = 1.e-4
+
+ bbox = np.array([ [xmin, xmax], [ymin, ymax], [zmin, zmax] ])
+
+ # coordinates -- in the notation data[i, j, k]
+ x = (np.arange(N) + 0.5)*dcoord + xmin
+ y = (np.arange(N) + 0.5)*dcoord + ymin
+ z = (np.arange(N) + 0.5)*dcoord + zmin
+
+ x3d, y3d, z3d = np.meshgrid(x, y, z, indexing="ij")
+
+ # sphere at the origin
+ c = np.array( [0.5*(xmin + xmax), 0.5*(ymin + ymax), 0.5*(zmin + zmax) ] )
+ r = np.sqrt((x3d - c[0])**2 + (y3d - c[1])**2 + (z3d - c[2])**2)
+ arr[r < 0.05] = 1.0
+
+ arr[abs(x3d - xmin) < 2*dcoord] = 0.3
+ arr[abs(y3d - ymin) < 2*dcoord] = 0.3
+ arr[abs(z3d - zmin) < 2*dcoord] = 0.3
+
+ # single cube on +x
+ xc = 0.75
+ dx = 0.05
+ 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]:
+ 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]:
+ 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.6
+
+ data = dict(density = (arr, "g/cm**3"))
+ ds = load_uniform_grid(data, arr.shape, bbox=bbox)
+ return ds
+
def expand_keywords(keywords, full=False):
+
"""
expand_keywords is a means for testing all possible keyword
arguments in the nosetests. Simply pass it a dictionary of all the
diff -r 86db031f1f56a6f396d4440188707f1fdb8e6bfa -r b6dad5b69998cff732a5c3ea7847a4b01092ffc8 yt/visualization/volume_rendering/tests/test_vr_orientation.py
--- a/yt/visualization/volume_rendering/tests/test_vr_orientation.py
+++ b/yt/visualization/volume_rendering/tests/test_vr_orientation.py
@@ -12,8 +12,7 @@
import numpy as np
-
-from yt import load_uniform_grid
+from yt import testing
from yt.utilities.answer_testing.framework import \
requires_answer_testing, \
VRImageComparisonTest, \
@@ -25,75 +24,9 @@
off_axis_projection
-def setup_ds():
-
- N = 96
-
- xmin = ymin = zmin = -1.0
- xmax = ymax = zmax = 1.0
-
- dcoord = (xmax - xmin)/N
-
- arr = np.zeros((N, N, N), dtype=np.float64)
- arr[:, :, :] = 1.e-4
-
- bbox = 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 + xmin
- y = (np.arange(N) + 0.5)*(ymax - ymin)/N + ymin
- z = (np.arange(N) + 0.5)*(zmax - zmin)/N + zmin
-
- x3d, y3d, z3d = np.meshgrid(x, y, z, indexing="ij")
-
- # sphere at the origin
- c = np.array([0.5*(xmin + xmax), 0.5*(ymin + ymax), 0.5*(zmin + zmax)])
-
- r = np.sqrt((x3d - c[0])**2 + (y3d - c[1])**2 + (z3d - c[2])**2)
- arr[r < 0.05] = 1.0
-
- arr[abs(x3d - xmin) < 2*dcoord] = 0.3
- arr[abs(y3d - ymin) < 2*dcoord] = 0.3
- arr[abs(z3d - zmin) < 2*dcoord] = 0.3
-
- # single cube on +x
- xc = 0.75
- dx = 0.05
- 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]:
-
- 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]:
-
- 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.6
-
- data = dict(density=(arr, "g/cm**3"))
- ds = load_uniform_grid(data, arr.shape, bbox=bbox)
-
- return ds
-
-
@requires_answer_testing()
def test_orientation():
- ds = setup_ds()
+ ds = testing.fake_vr_orientation_test_ds()
sc = Scene()
@@ -113,7 +46,7 @@
for lens_type in ['plane-parallel', 'perspective']:
frame = 0
- cam = sc.add_camera(ds, lens_type='plane-parallel')
+ cam = sc.add_camera(ds, lens_type=lens_type)
cam.resolution = (1000, 1000)
cam.position = ds.arr(np.array([-4., 0., 0.]), 'code_length')
cam.switch_orientation(normal_vector=[1., 0., 0.],
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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.spacepope.org/pipermail/yt-svn-spacepope.org/attachments/20160329/61307d18/attachment-0001.htm>
More information about the yt-svn
mailing list