[yt-svn] commit/yt: chummels: Merged in jisuoqing/yt (pull request #1813)
commits-noreply at bitbucket.org
commits-noreply at bitbucket.org
Fri Oct 16 16:11:49 PDT 2015
1 new commit in yt:
https://bitbucket.org/yt_analysis/yt/commits/7880f2ac44ac/
Changeset: 7880f2ac44ac
Branch: yt
User: chummels
Date: 2015-10-16 23:11:40+00:00
Summary: Merged in jisuoqing/yt (pull request #1813)
[experimental] [bugfix] Fix unit inconsistance in project_to_plane for fisheye and spherical lenses
Affected #: 1 file
diff -r 6facab7ff3258b232346caaecd999be9f25ef139 -r 7880f2ac44ac6134cb5bdf614fd5ec26e9f25336 yt/visualization/volume_rendering/lens.py
--- a/yt/visualization/volume_rendering/lens.py
+++ b/yt/visualization/volume_rendering/lens.py
@@ -513,7 +513,7 @@
# vectors back onto the plane. arr_fisheye_vectors goes from px, py to
# vector, and we need the reverse.
# First, we transform lpos into *relative to the camera* coordinates.
- lpos = camera.position - pos
+ lpos = camera.position.d - pos
lpos = lpos.dot(self.rotation_matrix)
# lpos = lpos.dot(self.rotation_matrix)
mag = (lpos * lpos).sum(axis=1)**0.5
@@ -526,11 +526,13 @@
px = r * np.cos(phi)
py = r * np.sin(phi)
u = camera.focus.uq
+ length_unit = u / u.d
# dz is distance the ray would travel
px = (px + 1.0) * res[0] / 2.0
py = (py + 1.0) * res[1] / 2.0
- px = (u * np.rint(px)).astype("int64")
- py = (u * np.rint(py)).astype("int64")
+ # px and py should be dimensionless
+ px = (u * np.rint(px) / length_unit).astype("int64")
+ py = (u * np.rint(py) / length_unit).astype("int64")
return px, py, dz
@@ -610,7 +612,7 @@
res = camera.resolution
# Much of our setup here is the same as in the fisheye, except for the
# actual conversion back to the px, py values.
- lpos = camera.position - pos
+ lpos = camera.position.d - pos
# inv_mat = np.linalg.inv(self.rotation_matrix)
# lpos = lpos.dot(self.rotation_matrix)
mag = (lpos * lpos).sum(axis=1)**0.5
@@ -627,11 +629,13 @@
py = np.arcsin(lpos[:, 2])
dz = mag / self.radius
u = camera.focus.uq
+ length_unit = u / u.d
# dz is distance the ray would travel
px = ((-px + np.pi) / (2.0*np.pi)) * res[0]
py = ((-py + np.pi/2.0) / np.pi) * res[1]
- px = (u * np.rint(px)).astype("int64")
- py = (u * np.rint(py)).astype("int64")
+ # px and py should be dimensionless
+ px = (u * np.rint(px) / length_unit).astype("int64")
+ py = (u * np.rint(py) / length_unit).astype("int64")
return px, py, dz
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