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

Bitbucket commits-noreply at bitbucket.org
Sun Jun 12 14:05:29 PDT 2011


3 new changesets in yt:

http://bitbucket.org/yt_analysis/yt/changeset/00580b9b22eb/
changeset:   00580b9b22eb
branch:      yt
user:        MatthewTurk
date:        2011-06-12 22:33:26
summary:     Changing the default add_layers minimum alpha, and adding a clip_ratio
parameter to snapshot.
affected #:  2 files (297 bytes)

--- a/yt/visualization/volume_rendering/camera.py	Sun Jun 12 00:51:30 2011 -0700
+++ b/yt/visualization/volume_rendering/camera.py	Sun Jun 12 16:33:26 2011 -0400
@@ -318,7 +318,7 @@
                                       self.unit_vectors[1])
         return vector_plane
 
-    def snapshot(self, fn = None):
+    def snapshot(self, fn = None, clip_ratio = None):
         r"""Ray-cast the camera.
 
         This method instructs the camera to take a snapshot -- i.e., call the ray
@@ -329,6 +329,9 @@
         fn : string, optional
             If supplied, the image will be saved out to this before being
             returned.  Scaling will be to the maximum value.
+        clip_ratio : float, optional
+            If supplied, the 'max_val' argument to write_bitmap will be handed
+            clip_ratio * image.std()
 
         Returns
         -------
@@ -352,7 +355,10 @@
         pbar.finish()
 
         if self._mpi_get_rank() is 0 and fn is not None:
-            write_bitmap(image, fn)
+            if clip_ratio is not None:
+                write_bitmap(image, fn, clip_ratio*image.std())
+            else:
+                write_bitmap(image, fn)
 
         return image
 


--- a/yt/visualization/volume_rendering/transfer_functions.py	Sun Jun 12 00:51:30 2011 -0700
+++ b/yt/visualization/volume_rendering/transfer_functions.py	Sun Jun 12 16:33:26 2011 -0400
@@ -547,7 +547,7 @@
             if mi is None: mi = col_bounds[0] + dist/(10.0*N)
             if ma is None: ma = col_bounds[1] - dist/(10.0*N)
         if w is None: w = 0.001 * (ma-mi)/N
-        if alpha is None: alpha = na.logspace(-2.0, 0.0, N)
+        if alpha is None: alpha = na.logspace(-3.0, 0.0, N)
         for v, a in zip(na.mgrid[mi:ma:N*1j], alpha):
             self.sample_colormap(v, w, a, colormap=colormap, col_bounds=col_bounds)
 


http://bitbucket.org/yt_analysis/yt/changeset/9a5c38d80a93/
changeset:   9a5c38d80a93
branch:      yt
user:        MatthewTurk
date:        2011-06-12 22:52:15
summary:     Adding fn option to healpix camera for direct saving of images
affected #:  1 file (936 bytes)

--- a/yt/visualization/volume_rendering/camera.py	Sun Jun 12 16:33:26 2011 -0400
+++ b/yt/visualization/volume_rendering/camera.py	Sun Jun 12 16:52:15 2011 -0400
@@ -31,12 +31,14 @@
 from .transfer_functions import ProjectionTransferFunction
 
 from yt.utilities.amr_utils import TransferFunctionProxy, VectorPlane, \
-    arr_vec2pix_nest, arr_pix2vec_nest, AdaptiveRaySource
+    arr_vec2pix_nest, arr_pix2vec_nest, AdaptiveRaySource, \
+    arr_ang2pix_nest
 from yt.visualization.image_writer import write_bitmap
 from yt.data_objects.data_containers import data_object_registry
 from yt.utilities.parallel_tools.parallel_analysis_interface import \
     ParallelAnalysisInterface
 from yt.utilities.amr_kdtree.api import AMRKDTree
+from numpy import pi
 
 class Camera(ParallelAnalysisInterface):
     def __init__(self, center, normal_vector, width,
@@ -604,6 +606,22 @@
             pbar.update(total_cells)
         pbar.finish()
 
+        if self._mpi_get_rank() is 0 and fn is not None:
+            import matplotlib.figure
+            import matplotlib.backends.backend_agg
+            phi, theta = na.mgrid[0.0:2*pi:800j, 0:pi:800j]
+            pixi = arr_ang2pix_nest(self.nside, theta.ravel(), phi.ravel())
+            img = na.log10(image[:,0,0][pixi]).reshape((800,800))
+
+            fig = matplotlib.figure.Figure((10, 5))
+            ax = fig.add_subplot(1,1,1,projection='mollweide')
+            implot = ax.imshow(img, extent=(-pi,pi,-pi/2,pi/2), clip_on=False, aspect=0.5)
+            cb = fig.colorbar(implot, orientation='horizontal')
+            cb.set_label(r"$\mathrm{Column}\/\mathrm{Density}\/[\mathrm{g}/\mathrm{cm}^2]$")
+            ax.xaxis.set_ticks(())
+            ax.yaxis.set_ticks(())
+            canvas = matplotlib.backends.backend_agg.FigureCanvasAgg(fig)
+            canvas.print_figure(fn)
         return image
 
 


http://bitbucket.org/yt_analysis/yt/changeset/36f4ab696b5d/
changeset:   36f4ab696b5d
branch:      yt
user:        MatthewTurk
date:        2011-06-12 23:04:19
summary:     Assuming density in the healpix camera; multiply by cm
affected #:  1 file (123 bytes)

--- a/yt/visualization/volume_rendering/camera.py	Sun Jun 12 16:52:15 2011 -0400
+++ b/yt/visualization/volume_rendering/camera.py	Sun Jun 12 17:04:19 2011 -0400
@@ -607,10 +607,12 @@
         pbar.finish()
 
         if self._mpi_get_rank() is 0 and fn is not None:
+            # This assumes Density; this is a relatively safe assumption.
             import matplotlib.figure
             import matplotlib.backends.backend_agg
             phi, theta = na.mgrid[0.0:2*pi:800j, 0:pi:800j]
             pixi = arr_ang2pix_nest(self.nside, theta.ravel(), phi.ravel())
+            image *= self.radius * self.pf['cm']
             img = na.log10(image[:,0,0][pixi]).reshape((800,800))
 
             fig = matplotlib.figure.Figure((10, 5))

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