[Yt-svn] commit/yt: 3 new changesets
Bitbucket
commits-noreply at bitbucket.org
Mon Oct 3 09:39:46 PDT 2011
3 new changesets in yt:
http://bitbucket.org/yt_analysis/yt/changeset/bc55596093c4/
changeset: bc55596093c4
branch: yt
user: chummels
date: 2011-09-16 07:13:56
summary: Added exponential flag to camera move function, so as to zoom exponentially instead of linearly.
affected #: 1 file (-1 bytes)
--- a/yt/visualization/volume_rendering/camera.py Sun Aug 28 17:41:36 2011 -0600
+++ b/yt/visualization/volume_rendering/camera.py Fri Sep 16 01:13:56 2011 -0400
@@ -413,7 +413,7 @@
self.zoom(f)
yield self.snapshot()
- def move_to(self, final, n_steps, final_width=None):
+ def move_to(self, final, n_steps, final_width=None, exponential=True):
r"""Loop over a look_at
This will yield `n_steps` snapshots until the current view has been
@@ -428,6 +428,9 @@
final_width: float or array_like, optional
Specifies the final width after `n_steps`. Useful for
moving and zooming at the same time.
+ exponential : boolean
+ Specifies whether the move/zoom transition follows an
+ exponential path toward the destination or linear
Examples
--------
@@ -437,13 +440,27 @@
"""
self.center = na.array(self.center)
dW = None
- if final_width is not None:
- if not iterable(final_width):
- width = na.array([final_width, final_width, final_width]) # front/back, left/right, top/bottom
- dW = (1.0*final_width-na.array(self.width))/n_steps
- dx = (na.array(final)-self.center)*1.0/n_steps
+ if exponential:
+ if final_width is not None:
+ if not iterable(final_width):
+ width = na.array([final_width, final_width, final_width])
+ # front/back, left/right, top/bottom
+ final_zoom = final_width/na.array(self.width)
+ dW = final_zoom**(1.0/n_steps)
+ position_diff = (na.array(final)/self.center)*1.0
+ dx = position_diff**(1.0/n_steps)
+ else:
+ if final_width is not None:
+ if not iterable(final_width):
+ width = na.array([final_width, final_width, final_width])
+ # front/back, left/right, top/bottom
+ dW = (1.0*final_width-na.array(self.width))/n_steps
+ dx = (na.array(final)-self.center)*1.0/n_steps
for i in xrange(n_steps):
- self.switch_view(center=self.center+dx, width=self.width+dW)
+ if exponential:
+ self.switch_view(center=self.center*dx, width=self.width*dW)
+ else:
+ self.switch_view(center=self.center+dx, width=self.width+dW)
yield self.snapshot()
def rotate(self, theta, rot_vector=None):
http://bitbucket.org/yt_analysis/yt/changeset/c51a92c26fab/
changeset: c51a92c26fab
branch: yt
user: chummels
date: 2011-10-03 18:39:03
summary: Adding additional parameter to new off_axis_projection helper function.
affected #: 1 file (-1 bytes)
--- a/yt/visualization/volume_rendering/camera.py Fri Sep 30 10:42:59 2011 -0400
+++ b/yt/visualization/volume_rendering/camera.py Mon Oct 03 12:39:03 2011 -0400
@@ -707,7 +707,7 @@
return (left_camera, right_camera)
def off_axis_projection(pf, center, normal_vector, width, resolution,
- field, weight = None):
+ field, weight = None, volume = None):
r"""Project through a parameter file, off-axis, and return the image plane.
This function will accept the necessary items to integrate through a volume
@@ -736,6 +736,9 @@
If supplied, the field will be pre-multiplied by this, then divided by
the integrated value of this field. This returns an average rather
than a sum.
+ volume : `yt.extensions.volume_rendering.HomogenizedVolume`, optional
+ The volume to ray cast through. Can be specified for finer-grained
+ control, but otherwise will be automatically generated.
Returns
-------
@@ -762,7 +765,8 @@
tf = ProjectionTransferFunction(n_fields = len(fields))
cam = pf.h.camera(center, normal_vector, width, resolution, tf,
fields = fields,
- log_fields = [False] * len(fields))
+ log_fields = [False] * len(fields),
+ volume = volume)
vals = cam.snapshot()
image = vals[:,:,0]
if weight is None:
http://bitbucket.org/yt_analysis/yt/changeset/0888a58fb786/
changeset: 0888a58fb786
branch: yt
user: chummels
date: 2011-10-03 18:39:37
summary: Merging.
affected #: 1 file (-1 bytes)
--- a/yt/visualization/volume_rendering/camera.py Mon Oct 03 12:39:03 2011 -0400
+++ b/yt/visualization/volume_rendering/camera.py Mon Oct 03 12:39:37 2011 -0400
@@ -413,7 +413,7 @@
self.zoom(f)
yield self.snapshot()
- def move_to(self, final, n_steps, final_width=None):
+ def move_to(self, final, n_steps, final_width=None, exponential=True):
r"""Loop over a look_at
This will yield `n_steps` snapshots until the current view has been
@@ -428,6 +428,9 @@
final_width: float or array_like, optional
Specifies the final width after `n_steps`. Useful for
moving and zooming at the same time.
+ exponential : boolean
+ Specifies whether the move/zoom transition follows an
+ exponential path toward the destination or linear
Examples
--------
@@ -437,13 +440,27 @@
"""
self.center = na.array(self.center)
dW = None
- if final_width is not None:
- if not iterable(final_width):
- width = na.array([final_width, final_width, final_width]) # front/back, left/right, top/bottom
- dW = (1.0*final_width-na.array(self.width))/n_steps
- dx = (na.array(final)-self.center)*1.0/n_steps
+ if exponential:
+ if final_width is not None:
+ if not iterable(final_width):
+ width = na.array([final_width, final_width, final_width])
+ # front/back, left/right, top/bottom
+ final_zoom = final_width/na.array(self.width)
+ dW = final_zoom**(1.0/n_steps)
+ position_diff = (na.array(final)/self.center)*1.0
+ dx = position_diff**(1.0/n_steps)
+ else:
+ if final_width is not None:
+ if not iterable(final_width):
+ width = na.array([final_width, final_width, final_width])
+ # front/back, left/right, top/bottom
+ dW = (1.0*final_width-na.array(self.width))/n_steps
+ dx = (na.array(final)-self.center)*1.0/n_steps
for i in xrange(n_steps):
- self.switch_view(center=self.center+dx, width=self.width+dW)
+ if exponential:
+ self.switch_view(center=self.center*dx, width=self.width*dW)
+ else:
+ self.switch_view(center=self.center+dx, width=self.width+dW)
yield self.snapshot()
def rotate(self, theta, rot_vector=None):
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