[yt-svn] commit/yt: 3 new changesets

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Mon Nov 2 11:55:37 PST 2015


3 new commits in yt:

https://bitbucket.org/yt_analysis/yt/commits/16cd03ddd8c8/
Changeset:   16cd03ddd8c8
Branch:      yt
User:        jisuoqing
Date:        2015-10-22 08:21:12+00:00
Summary:     Annotation can be correctly displayed in stereo-perspective lens
Affected #:  2 files

diff -r 1d18fbb16ffdb55b98e4cd4b1feed099da4bb6c9 -r 16cd03ddd8c8e9856ad171b587b741153edf9443 yt/visualization/volume_rendering/lens.py
--- a/yt/visualization/volume_rendering/lens.py
+++ b/yt/visualization/volume_rendering/lens.py
@@ -372,9 +372,9 @@
         px_right, py_right, dz_right = self._get_px_py_dz(
             camera, pos, res, self.disparity)
 
-        px = np.hstack([px_left, px_right])
-        py = np.hstack([py_left, py_right])
-        dz = np.hstack([dz_left, dz_right])
+        px = np.vstack([px_left, px_right])
+        py = np.vstack([py_left, py_right])
+        dz = np.vstack([dz_left, dz_right])
 
         return px, py, dz
 
@@ -419,7 +419,10 @@
         dz = np.dot(pos - camera_position_shift, normal_vec_rot)
         
         # Transpose into image coords.
-        px = (res0_h * 0.5 + res0_h / camera.width[0].d * dx).astype('int')
+        if disparity > 0:
+            px = (res0_h * 0.5 + res0_h / camera.width[0].d * dx).astype('int')
+        else:
+            px = (res0_h * 1.5 + res0_h / camera.width[0].d * dx).astype('int')
         py = (res[1] * 0.5 + res[1] / camera.width[1].d * dy).astype('int')
 
         return px, py, dz

diff -r 1d18fbb16ffdb55b98e4cd4b1feed099da4bb6c9 -r 16cd03ddd8c8e9856ad171b587b741153edf9443 yt/visualization/volume_rendering/render_source.py
--- a/yt/visualization/volume_rendering/render_source.py
+++ b/yt/visualization/volume_rendering/render_source.py
@@ -634,7 +634,12 @@
             empty.shape = (camera.resolution[0], camera.resolution[1], 4)
             z.shape = (camera.resolution[0], camera.resolution[1])
 
-        zlines(empty, z, px.d, py.d, dz.d, self.colors, self.color_stride)
+        if len(px.shape) == 1:
+            zlines(empty, z, px.d, py.d, dz.d, self.colors, self.color_stride)
+        else:
+            # For stereo-lens, two sets of pos for each eye are contained in px...pz
+            zlines(empty, z, px.d[0,:], py.d[0,:], dz.d[0,:], self.colors, self.color_stride)
+            zlines(empty, z, px.d[1,:], py.d[1,:], dz.d[1,:], self.colors, self.color_stride)
 
         if 'plane-parallel' not in str(camera.lens):
             empty.shape = (camera.resolution[0] * camera.resolution[1], 1, 4)
@@ -880,19 +885,39 @@
 
         # Project to the image plane
         px, py, dz = camera.lens.project_to_plane(camera, positions)
-        dpx = px[1::2] - px[::2]
-        dpy = py[1::2] - py[::2]
 
-        # Set the center of the coordinates to be in the lower left of the image
-        lpx = camera.resolution[0] / 8
-        lpy = camera.resolution[1] - camera.resolution[1] / 8  # Upside-downsies
+        if len(px.shape) == 1:
 
-        # Offset the pixels according to the projections above
-        px[::2] = lpx
-        px[1::2] = lpx + dpx
-        py[::2] = lpy
-        py[1::2] = lpy + dpy
-        dz[:] = 0.0
+            dpx = px[1::2] - px[::2]
+            dpy = py[1::2] - py[::2]
+
+            # Set the center of the coordinates to be in the lower left of the image
+            lpx = camera.resolution[0] / 8
+            lpy = camera.resolution[1] - camera.resolution[1] / 8  # Upside-downsies
+
+            # Offset the pixels according to the projections above
+            px[::2] = lpx
+            px[1::2] = lpx + dpx
+            py[::2] = lpy
+            py[1::2] = lpy + dpy
+            dz[:] = 0.0
+
+        else:
+
+            # For stereo-lens, two sets of pos for each eye are contained in px...pz
+            dpx = px[:,1::2] - px[:,::2]
+            dpy = py[:,1::2] - py[:,::2]
+
+            lpx = camera.resolution[0] / 16
+            lpy = camera.resolution[1] - camera.resolution[1] / 8  # Upside-downsies
+
+            # Offset the pixels according to the projections above
+            px[:,::2] = lpx
+            px[:,1::2] = lpx + dpx
+            px[1,:] += camera.resolution[0] / 2
+            py[:,::2] = lpy
+            py[:,1::2] = lpy + dpy
+            dz[:,:] = 0.0
 
         # Create a zbuffer if needed
         if zbuffer is None:
@@ -913,7 +938,12 @@
             empty.shape = (camera.resolution[0], camera.resolution[1], 4)
             z.shape = (camera.resolution[0], camera.resolution[1])
 
-        zlines(empty, z, px.d, py.d, dz.d, self.colors, self.color_stride)
+        if len(px.shape) == 1:
+            zlines(empty, z, px.d, py.d, dz.d, self.colors, self.color_stride)
+        else:
+            # For stereo-lens, two sets of pos for each eye are contained in px...pz
+            zlines(empty, z, px.d[0,:], py.d[0,:], dz.d[0,:], self.colors, self.color_stride)
+            zlines(empty, z, px.d[1,:], py.d[1,:], dz.d[1,:], self.colors, self.color_stride)
 
         if 'plane-parallel' not in str(camera.lens):
             empty.shape = (camera.resolution[0] * camera.resolution[1], 1, 4)


https://bitbucket.org/yt_analysis/yt/commits/649e4d280c88/
Changeset:   649e4d280c88
Branch:      yt
User:        jisuoqing
Date:        2015-10-22 08:24:40+00:00
Summary:     Minor change
Affected #:  1 file

diff -r 16cd03ddd8c8e9856ad171b587b741153edf9443 -r 649e4d280c88e201ee3a9c64241d5b47ac5bd783 yt/visualization/volume_rendering/render_source.py
--- a/yt/visualization/volume_rendering/render_source.py
+++ b/yt/visualization/volume_rendering/render_source.py
@@ -887,7 +887,6 @@
         px, py, dz = camera.lens.project_to_plane(camera, positions)
 
         if len(px.shape) == 1:
-
             dpx = px[1::2] - px[::2]
             dpy = py[1::2] - py[::2]
 
@@ -901,9 +900,7 @@
             py[::2] = lpy
             py[1::2] = lpy + dpy
             dz[:] = 0.0
-
         else:
-
             # For stereo-lens, two sets of pos for each eye are contained in px...pz
             dpx = px[:,1::2] - px[:,::2]
             dpy = py[:,1::2] - py[:,::2]


https://bitbucket.org/yt_analysis/yt/commits/d19ea599033e/
Changeset:   d19ea599033e
Branch:      yt
User:        bwkeller
Date:        2015-11-02 19:55:29+00:00
Summary:     Merged in jisuoqing/yt (pull request #1829)

[experimental] [bugfix] Annotation can now be correctly displayed in stereo-perspective lens, fix #1130
Affected #:  2 files

diff -r 1ec53116113dff2c40682d7c6104ad7a232806e8 -r d19ea599033ec9e76ff3bcfd6634ea675b94d7f5 yt/visualization/volume_rendering/lens.py
--- a/yt/visualization/volume_rendering/lens.py
+++ b/yt/visualization/volume_rendering/lens.py
@@ -382,9 +382,9 @@
         px_right, py_right, dz_right = self._get_px_py_dz(
             camera, pos, res, self.disparity)
 
-        px = np.hstack([px_left, px_right])
-        py = np.hstack([py_left, py_right])
-        dz = np.hstack([dz_left, dz_right])
+        px = np.vstack([px_left, px_right])
+        py = np.vstack([py_left, py_right])
+        dz = np.vstack([dz_left, dz_right])
 
         return px, py, dz
 
@@ -429,7 +429,10 @@
         dz = np.dot(pos - camera_position_shift.d, normal_vec_rot)
         
         # Transpose into image coords.
-        px = (res0_h * 0.5 + res0_h / camera.width[0].d * dx).astype('int')
+        if disparity > 0:
+            px = (res0_h * 0.5 + res0_h / camera.width[0].d * dx).astype('int')
+        else:
+            px = (res0_h * 1.5 + res0_h / camera.width[0].d * dx).astype('int')
         py = (res[1] * 0.5 + res[1] / camera.width[1].d * dy).astype('int')
 
         return px, py, dz

diff -r 1ec53116113dff2c40682d7c6104ad7a232806e8 -r d19ea599033ec9e76ff3bcfd6634ea675b94d7f5 yt/visualization/volume_rendering/render_source.py
--- a/yt/visualization/volume_rendering/render_source.py
+++ b/yt/visualization/volume_rendering/render_source.py
@@ -634,7 +634,12 @@
             empty.shape = (camera.resolution[0], camera.resolution[1], 4)
             z.shape = (camera.resolution[0], camera.resolution[1])
 
-        zlines(empty, z, px.d, py.d, dz.d, self.colors, self.color_stride)
+        if len(px.shape) == 1:
+            zlines(empty, z, px.d, py.d, dz.d, self.colors, self.color_stride)
+        else:
+            # For stereo-lens, two sets of pos for each eye are contained in px...pz
+            zlines(empty, z, px.d[0,:], py.d[0,:], dz.d[0,:], self.colors, self.color_stride)
+            zlines(empty, z, px.d[1,:], py.d[1,:], dz.d[1,:], self.colors, self.color_stride)
 
         if 'plane-parallel' not in str(camera.lens):
             empty.shape = (camera.resolution[0] * camera.resolution[1], 1, 4)
@@ -880,19 +885,36 @@
 
         # Project to the image plane
         px, py, dz = camera.lens.project_to_plane(camera, positions)
-        dpx = px[1::2] - px[::2]
-        dpy = py[1::2] - py[::2]
 
-        # Set the center of the coordinates to be in the lower left of the image
-        lpx = camera.resolution[0] / 8
-        lpy = camera.resolution[1] - camera.resolution[1] / 8  # Upside-downsies
+        if len(px.shape) == 1:
+            dpx = px[1::2] - px[::2]
+            dpy = py[1::2] - py[::2]
 
-        # Offset the pixels according to the projections above
-        px[::2] = lpx
-        px[1::2] = lpx + dpx
-        py[::2] = lpy
-        py[1::2] = lpy + dpy
-        dz[:] = 0.0
+            # Set the center of the coordinates to be in the lower left of the image
+            lpx = camera.resolution[0] / 8
+            lpy = camera.resolution[1] - camera.resolution[1] / 8  # Upside-downsies
+
+            # Offset the pixels according to the projections above
+            px[::2] = lpx
+            px[1::2] = lpx + dpx
+            py[::2] = lpy
+            py[1::2] = lpy + dpy
+            dz[:] = 0.0
+        else:
+            # For stereo-lens, two sets of pos for each eye are contained in px...pz
+            dpx = px[:,1::2] - px[:,::2]
+            dpy = py[:,1::2] - py[:,::2]
+
+            lpx = camera.resolution[0] / 16
+            lpy = camera.resolution[1] - camera.resolution[1] / 8  # Upside-downsies
+
+            # Offset the pixels according to the projections above
+            px[:,::2] = lpx
+            px[:,1::2] = lpx + dpx
+            px[1,:] += camera.resolution[0] / 2
+            py[:,::2] = lpy
+            py[:,1::2] = lpy + dpy
+            dz[:,:] = 0.0
 
         # Create a zbuffer if needed
         if zbuffer is None:
@@ -913,7 +935,12 @@
             empty.shape = (camera.resolution[0], camera.resolution[1], 4)
             z.shape = (camera.resolution[0], camera.resolution[1])
 
-        zlines(empty, z, px.d, py.d, dz.d, self.colors, self.color_stride)
+        if len(px.shape) == 1:
+            zlines(empty, z, px.d, py.d, dz.d, self.colors, self.color_stride)
+        else:
+            # For stereo-lens, two sets of pos for each eye are contained in px...pz
+            zlines(empty, z, px.d[0,:], py.d[0,:], dz.d[0,:], self.colors, self.color_stride)
+            zlines(empty, z, px.d[1,:], py.d[1,:], dz.d[1,:], self.colors, self.color_stride)
 
         if 'plane-parallel' not in str(camera.lens):
             empty.shape = (camera.resolution[0] * camera.resolution[1], 1, 4)

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