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

Bitbucket commits-noreply at bitbucket.org
Fri Jul 6 15:31:33 PDT 2012


8 new commits in yt:


https://bitbucket.org/yt_analysis/yt/changeset/187ae2f16593/
changeset:   187ae2f16593
branch:      yt
user:        jzuhone
date:        2012-06-27 06:53:37
summary:     Hmmp.
affected #:  5 files

diff -r 38c76542e2a281ab9e280db2c8b860465dc13717 -r 187ae2f165935048a58b24623f95bc02c624d56e yt/analysis_modules/halo_profiler/multi_halo_profiler.py
--- a/yt/analysis_modules/halo_profiler/multi_halo_profiler.py
+++ b/yt/analysis_modules/halo_profiler/multi_halo_profiler.py
@@ -42,6 +42,8 @@
     centering_registry
 from yt.data_objects.field_info_container import \
     add_field
+from yt.data_objects.static_output import \
+    StaticOutput
 
 from yt.utilities.parallel_tools.parallel_analysis_interface import \
     ParallelAnalysisInterface, \
@@ -275,7 +277,10 @@
             return None
 
         # Create dataset object.
-        self.pf = load(self.dataset)
+        if isinstance(self.dataset, StaticOutput):
+            self.pf = self.dataset
+        else:
+            self.pf = load(self.dataset)
         self.pf.h
 
         # Figure out what max radius to use for profiling.
@@ -1011,6 +1016,9 @@
         lines = f.readlines()
         f.close()
 
+        if not lines:
+            return None
+
         # Get fields from header.
         header = lines.pop(0)
         header = header.strip()


diff -r 38c76542e2a281ab9e280db2c8b860465dc13717 -r 187ae2f165935048a58b24623f95bc02c624d56e yt/data_objects/data_containers.py
--- a/yt/data_objects/data_containers.py
+++ b/yt/data_objects/data_containers.py
@@ -3377,8 +3377,6 @@
             The left edge of the region to be extracted
         dims : array_like
             Number of cells along each axis of resulting covering_grid
-        right_edge : array_like, optional
-            The right edge of the region to be extracted
         fields : array_like, optional
             A list of fields that you'd like pre-generated for your object
 
@@ -3537,16 +3535,13 @@
         left_edge : array_like
             The left edge of the region to be extracted
         dims : array_like
-            Number of cells along each axis of resulting covering_grid
-        right_edge : array_like, optional
-            The right edge of the region to be extracted
+            Number of cells along each axis of resulting covering_grid.
         fields : array_like, optional
             A list of fields that you'd like pre-generated for your object
 
         Example
         -------
         cube = pf.h.smoothed_covering_grid(2, left_edge=[0.0, 0.0, 0.0], \
-                                  right_edge=[1.0, 1.0, 1.0],
                                   dims=[128, 128, 128])
         """
         self._base_dx = (
@@ -3585,10 +3580,16 @@
         for gi, grid in enumerate(self._grids):
             if self._use_pbar: pbar.update(gi)
             if grid.Level > last_level and grid.Level <= self.level:
+                mylog.debug("Updating level state to %s", last_level + 1)
                 self._update_level_state(last_level + 1)
                 self._refine(1, fields_to_get)
                 last_level = grid.Level
             self._get_data_from_grid(grid, fields_to_get)
+        while last_level < self.level:
+            mylog.debug("Grid-free refinement %s to %s", last_level, last_level + 1)
+            self._update_level_state(last_level + 1)
+            self._refine(1, fields_to_get)
+            last_level += 1
         if self.level > 0:
             for field in fields_to_get:
                 self[field] = self[field][1:-1,1:-1,1:-1]


diff -r 38c76542e2a281ab9e280db2c8b860465dc13717 -r 187ae2f165935048a58b24623f95bc02c624d56e yt/data_objects/hierarchy.py
--- a/yt/data_objects/hierarchy.py
+++ b/yt/data_objects/hierarchy.py
@@ -381,18 +381,18 @@
         """
         Prints out (stdout) relevant information about the simulation
         """
-        header = "%3s\t%6s\t%11s" % ("level","# grids", "# cells")
+        header = "%3s\t%6s\t%14s" % ("level","# grids", "# cells")
         print header
         print "%s" % (len(header.expandtabs())*"-")
         for level in xrange(MAXLEVEL):
             if (self.level_stats['numgrids'][level]) == 0:
                 break
-            print "% 3i\t% 6i\t% 11i" % \
+            print "% 3i\t% 6i\t% 14i" % \
                   (level, self.level_stats['numgrids'][level],
                    self.level_stats['numcells'][level])
             dx = self.select_grids(level)[0].dds[0]
         print "-" * 28
-        print "   \t% 6i\t% 11i" % (self.level_stats['numgrids'].sum(), self.level_stats['numcells'].sum())
+        print "   \t% 6i\t% 14i" % (self.level_stats['numgrids'].sum(), self.level_stats['numcells'].sum())
         print "\n"
         try:
             print "z = %0.8f" % (self["CosmologyCurrentRedshift"])


diff -r 38c76542e2a281ab9e280db2c8b860465dc13717 -r 187ae2f165935048a58b24623f95bc02c624d56e yt/frontends/enzo/io.py
--- a/yt/frontends/enzo/io.py
+++ b/yt/frontends/enzo/io.py
@@ -201,6 +201,8 @@
     _data_style = "enzo_packed_3d_gz"
 
     def modify(self, field):
+        if len(field.shape) < 3:
+            return field
         tr = field[3:-3,3:-3,3:-3].swapaxes(0,2)
         return tr.copy() # To ensure contiguous
 


diff -r 38c76542e2a281ab9e280db2c8b860465dc13717 -r 187ae2f165935048a58b24623f95bc02c624d56e yt/visualization/volume_rendering/camera.py
--- a/yt/visualization/volume_rendering/camera.py
+++ b/yt/visualization/volume_rendering/camera.py
@@ -226,8 +226,8 @@
                                      unit_vectors[1]*width[1],
                                      unit_vectors[2]*width[2]])
         self.origin = center - 0.5*na.dot(width,unit_vectors)
-        self.back_center =  center - 0.5*width[0]*unit_vectors[2]
-        self.front_center = center + 0.5*width[0]*unit_vectors[2]         
+        self.back_center =  center - 0.5*width[2]*unit_vectors[2]
+        self.front_center = center + 0.5*width[2]*unit_vectors[2]         
 
     def look_at(self, new_center, north_vector = None):
         r"""Change the view direction based on a new focal point.



https://bitbucket.org/yt_analysis/yt/changeset/2f5d41d4a041/
changeset:   2f5d41d4a041
branch:      yt
user:        jzuhone
date:        2012-06-27 07:04:18
summary:     Stuff
affected #:  191 files
Diff too large to display.

https://bitbucket.org/yt_analysis/yt/changeset/2204e6edaf50/
changeset:   2204e6edaf50
branch:      yt
user:        jzuhone
date:        2012-07-05 01:10:29
summary:     Fixing everything up
affected #:  2 files






https://bitbucket.org/yt_analysis/yt/changeset/02c4588b46a7/
changeset:   02c4588b46a7
branch:      yt
user:        jzuhone
date:        2012-07-06 20:29:55
summary:     1) Leaving "width" set as None sets the width to pf.domain_right_edge - pf.domain_left_edge by default. The next line checks if "width" is iterable, in order to use the (width, unit) combination. The problem is that the former operation results in a "width" that is also iterable, but not of the right shape. Changing the "if" to "elif" should give the ocorrect behavior.
2) Corrected misspelling of "find_max"
affected #:  1 file

diff -r 2204e6edaf5036bc4bd50babbca2d5ca2caf1c2b -r 02c4588b46a7d207236cec2d6f30303186f0fd98 yt/visualization/plot_window.py
--- a/yt/visualization/plot_window.py
+++ b/yt/visualization/plot_window.py
@@ -278,11 +278,11 @@
 def GetBoundsAndCenter(axis, center, width, pf):
     if width == None:
         width = (pf.domain_right_edge - pf.domain_left_edge)
-    if iterable(width):
+    elif iterable(width):
         w,u = width
         width = w/pf[u]
     if center == None:
-        v, center = pf.h.mind_max("Density")
+        v, center = pf.h.find_max("Density")
     elif center == "center" or center == "c":
         center = (pf.domain_right_edge + pf.domain_left_edge)/2.0
     bounds = [center[x_dict[axis]]-width/2,
@@ -294,7 +294,7 @@
 def GetOffAxisBoundsAndCenter(normal, center, width, pf):
     if width == None:
         width = (pf.domain_right_edge - pf.domain_left_edge)
-    if iterable(width):
+    elif iterable(width):
         w,u = width
         width = w/pf[u]
     if center == None:



https://bitbucket.org/yt_analysis/yt/changeset/aaea01c1f9cd/
changeset:   aaea01c1f9cd
branch:      yt
user:        ngoldbaum
date:        2012-07-06 21:05:29
summary:     Fixes for the set_log plot window modification.
affected #:  2 files

diff -r 02c4588b46a7d207236cec2d6f30303186f0fd98 -r aaea01c1f9cd1f5147d804cf3ecc8245c21255a9 yt/visualization/image_writer.py
--- a/yt/visualization/image_writer.py
+++ b/yt/visualization/image_writer.py
@@ -152,7 +152,7 @@
         bitmap_array = na.concatenate([bitmap_array, alpha_channel], axis=-1)
     if transpose:
         for channel in range(bitmap_array.shape[2]):
-            bitmap_array[:,:,channel] = bitmap_array[:,:,channel].T
+            bitmap_array[:,:,channel] = bitmap_array[:,:,channel].transpose()
     au.write_png(bitmap_array.copy(), filename)
     return bitmap_array
 


diff -r 02c4588b46a7d207236cec2d6f30303186f0fd98 -r aaea01c1f9cd1f5147d804cf3ecc8245c21255a9 yt/visualization/plot_window.py
--- a/yt/visualization/plot_window.py
+++ b/yt/visualization/plot_window.py
@@ -648,7 +648,7 @@
             extent.extend([self.xlim[i] - yc for i in (0,1)])
             extent = [el*self.pf[md['unit']] for el in extent]
 
-            self.plots[f] = WindowPlotMPL(self._frb[f], extent)
+            self.plots[f] = WindowPlotMPL(self._frb[f], extent, self._field_transform[f])
             
             cb = matplotlib.pyplot.colorbar(self.plots[f].image,cax = self.plots[f].cax)
 
@@ -858,7 +858,7 @@
             self._field_transform[field] = linear_transform
 
 class PlotMPL(object):
-    """A base class for all yt plots made using matplotlib.
+    """A base class for all yt plots made using matplotl5Bib.
 
     YtPlot and the classes that derive from it are *by design* limited
     and designed for rapid, production quality plot production, rather
@@ -885,13 +885,16 @@
     zmax = None
     zlabel = None
 
-    def __init__(self, data, extent, size=(9,8)):
+    def __init__(self, data, extent, field_transform, size=(9,8)):
         PlotMPL.__init__(self, data, size)
-        self.__init_image(data, extent)
+        self.__init_image(data, extent, field_transform)
 
-    def __init_image(self, data, extent):
-        self.image = self.axes.imshow(data,origin='lower',extent=extent,
-                                      norm=matplotlib.colors.LogNorm())
+    def __init_image(self, data, extent, field_transform):
+        if (field_transform.name == 'log10'):
+            self.image = self.axes.imshow(data,origin='lower',extent=extent,
+                                          norm=matplotlib.colors.LogNorm())
+        elif (field_transform.name == 'linear'):
+            self.image = self.axes.imshow(data,origin='lower',extent=extent)
 
     @invalidate_plot
     def set_zlim(self, zmin, zmax):



https://bitbucket.org/yt_analysis/yt/changeset/fe6f757f50f7/
changeset:   fe6f757f50f7
branch:      yt
user:        ngoldbaum
date:        2012-07-07 00:23:21
summary:     Fixing a few more of the plot modifications.
affected #:  1 file

diff -r aaea01c1f9cd1f5147d804cf3ecc8245c21255a9 -r fe6f757f50f73075c36055aeeca4a4ebd3a35c9f yt/visualization/plot_window.py
--- a/yt/visualization/plot_window.py
+++ b/yt/visualization/plot_window.py
@@ -517,7 +517,8 @@
 
     @invalidate_data
     def refresh(self):
-        self._setup_plots()
+        # invalidate_data will take care of everything
+        pass
 
 class PWViewer(PlotWindow):
     """A viewer for PlotWindows.
@@ -526,8 +527,10 @@
     def __init__(self, *args,**kwargs):
         setup = kwargs.pop("setup", True)
         PlotWindow.__init__(self, *args,**kwargs)
+        self._colormaps = defaultdict(lambda: 'algae')
+        self.zmin = None
+        self.zmax = None
         self._field_transform = {}
-        self._colormaps = defaultdict(lambda: 'algae')
         for field in self._frb.data.keys():
             if self.pf.field_info[field].take_log:
                 self._field_transform[field] = log_transform
@@ -565,8 +568,9 @@
         self._colormaps[field] = cmap_name
 
     @invalidate_plot
-    def set_zlim(self):
-        pass
+    def set_zlim(self, field, zmin, zmax):
+        self.zmin = zmin
+        self.zmax = zmax
 
     def get_metadata(self, field, strip_mathml = True, return_string = True):
         fval = self._frb[field]
@@ -648,7 +652,7 @@
             extent.extend([self.xlim[i] - yc for i in (0,1)])
             extent = [el*self.pf[md['unit']] for el in extent]
 
-            self.plots[f] = WindowPlotMPL(self._frb[f], extent, self._field_transform[f])
+            self.plots[f] = WindowPlotMPL(self._frb[f], extent, self._field_transform[f], zlim = (self.zmin,self.zmax))
             
             cb = matplotlib.pyplot.colorbar(self.plots[f].image,cax = self.plots[f].cax)
 
@@ -666,6 +670,9 @@
 
         self._plot_valid = True
 
+    def set_cmap(self, field, cmap):
+        self.plots[field].image.set_cmap(cmap)
+
     def save(self,name):
         for k,v in self.plots.iteritems():
             n = "%s_%s" % (name, k)
@@ -858,14 +865,7 @@
             self._field_transform[field] = linear_transform
 
 class PlotMPL(object):
-    """A base class for all yt plots made using matplotl5Bib.
-
-    YtPlot and the classes that derive from it are *by design* limited
-    and designed for rapid, production quality plot production, rather
-    than full generality. If you require more customization of the end
-    result, these objects are designed to return to you the basic data
-    so you the user can insert them into a matplotlib figure on your
-    own outside of the YtPlot class.
+    """A base class for all yt plots made using matplotlib.
 
     """
     datalabel = None
@@ -881,23 +881,14 @@
         self.figure.savefig('%s.png' % name)
 
 class WindowPlotMPL(PlotMPL):
-    zmin = None
-    zmax = None
-    zlabel = None
+    def __init__(self, data, extent, field_transform, size=(9,8), zlim = (None, None)):
+        PlotMPL.__init__(self, data, size)
+        self.__init_image(data, extent, field_transform, zlim)
 
-    def __init__(self, data, extent, field_transform, size=(9,8)):
-        PlotMPL.__init__(self, data, size)
-        self.__init_image(data, extent, field_transform)
-
-    def __init_image(self, data, extent, field_transform):
+    def __init_image(self, data, extent, field_transform, zlim):
         if (field_transform.name == 'log10'):
-            self.image = self.axes.imshow(data,origin='lower',extent=extent,
-                                          norm=matplotlib.colors.LogNorm())
+            norm = matplotlib.colors.LogNorm()
         elif (field_transform.name == 'linear'):
-            self.image = self.axes.imshow(data,origin='lower',extent=extent)
-
-    @invalidate_plot
-    def set_zlim(self, zmin, zmax):
-        self.zmin = zmin
-        self.zmax = zmax
-
+            norm = matplotlib.colors.Normalize()
+        self.image = self.axes.imshow(data,origin='lower',extent=extent,
+                                      norm=norm, vmin = zlim[0], vmax = zlim[1])



https://bitbucket.org/yt_analysis/yt/changeset/bbdf74750795/
changeset:   bbdf74750795
branch:      yt
user:        ngoldbaum
date:        2012-07-07 00:30:37
summary:     Reverting this to transpose()
affected #:  1 file

diff -r fe6f757f50f73075c36055aeeca4a4ebd3a35c9f -r bbdf747507950d710e067f930a46fbbd967e53b2 yt/visualization/image_writer.py
--- a/yt/visualization/image_writer.py
+++ b/yt/visualization/image_writer.py
@@ -152,7 +152,7 @@
         bitmap_array = na.concatenate([bitmap_array, alpha_channel], axis=-1)
     if transpose:
         for channel in range(bitmap_array.shape[2]):
-            bitmap_array[:,:,channel] = bitmap_array[:,:,channel].transpose()
+            bitmap_array[:,:,channel] = bitmap_array[:,:,channel].T
     au.write_png(bitmap_array.copy(), filename)
     return bitmap_array
 



https://bitbucket.org/yt_analysis/yt/changeset/f1271e0aa335/
changeset:   f1271e0aa335
branch:      yt
user:        MatthewTurk
date:        2012-07-07 00:31:30
summary:     Merged in ngoldbaum/yt-ngoldbaum (pull request #185)
affected #:  4 files





diff -r 849a9e46fe64e00ecb94efc9ea1e03775e5ebbff -r f1271e0aa335ff616afaf4d664a841b37108142c yt/visualization/plot_window.py
--- a/yt/visualization/plot_window.py
+++ b/yt/visualization/plot_window.py
@@ -278,11 +278,11 @@
 def GetBoundsAndCenter(axis, center, width, pf):
     if width == None:
         width = (pf.domain_right_edge - pf.domain_left_edge)
-    if iterable(width):
+    elif iterable(width):
         w,u = width
         width = w/pf[u]
     if center == None:
-        v, center = pf.h.mind_max("Density")
+        v, center = pf.h.find_max("Density")
     elif center == "center" or center == "c":
         center = (pf.domain_right_edge + pf.domain_left_edge)/2.0
     bounds = [center[x_dict[axis]]-width/2,
@@ -294,7 +294,7 @@
 def GetOffAxisBoundsAndCenter(normal, center, width, pf):
     if width == None:
         width = (pf.domain_right_edge - pf.domain_left_edge)
-    if iterable(width):
+    elif iterable(width):
         w,u = width
         width = w/pf[u]
     if center == None:
@@ -517,7 +517,8 @@
 
     @invalidate_data
     def refresh(self):
-        self._setup_plots()
+        # invalidate_data will take care of everything
+        pass
 
 class PWViewer(PlotWindow):
     """A viewer for PlotWindows.
@@ -526,8 +527,10 @@
     def __init__(self, *args,**kwargs):
         setup = kwargs.pop("setup", True)
         PlotWindow.__init__(self, *args,**kwargs)
+        self._colormaps = defaultdict(lambda: 'algae')
+        self.zmin = None
+        self.zmax = None
         self._field_transform = {}
-        self._colormaps = defaultdict(lambda: 'algae')
         for field in self._frb.data.keys():
             if self.pf.field_info[field].take_log:
                 self._field_transform[field] = log_transform
@@ -565,8 +568,9 @@
         self._colormaps[field] = cmap_name
 
     @invalidate_plot
-    def set_zlim(self):
-        pass
+    def set_zlim(self, field, zmin, zmax):
+        self.zmin = zmin
+        self.zmax = zmax
 
     def get_metadata(self, field, strip_mathml = True, return_string = True):
         fval = self._frb[field]
@@ -648,7 +652,7 @@
             extent.extend([self.xlim[i] - yc for i in (0,1)])
             extent = [el*self.pf[md['unit']] for el in extent]
 
-            self.plots[f] = WindowPlotMPL(self._frb[f], extent)
+            self.plots[f] = WindowPlotMPL(self._frb[f], extent, self._field_transform[f], zlim = (self.zmin,self.zmax))
             
             cb = matplotlib.pyplot.colorbar(self.plots[f].image,cax = self.plots[f].cax)
 
@@ -666,6 +670,9 @@
 
         self._plot_valid = True
 
+    def set_cmap(self, field, cmap):
+        self.plots[field].image.set_cmap(cmap)
+
     def save(self,name):
         for k,v in self.plots.iteritems():
             n = "%s_%s" % (name, k)
@@ -860,13 +867,6 @@
 class PlotMPL(object):
     """A base class for all yt plots made using matplotlib.
 
-    YtPlot and the classes that derive from it are *by design* limited
-    and designed for rapid, production quality plot production, rather
-    than full generality. If you require more customization of the end
-    result, these objects are designed to return to you the basic data
-    so you the user can insert them into a matplotlib figure on your
-    own outside of the YtPlot class.
-
     """
     datalabel = None
     figure = None
@@ -881,20 +881,14 @@
         self.figure.savefig('%s.png' % name)
 
 class WindowPlotMPL(PlotMPL):
-    zmin = None
-    zmax = None
-    zlabel = None
+    def __init__(self, data, extent, field_transform, size=(9,8), zlim = (None, None)):
+        PlotMPL.__init__(self, data, size)
+        self.__init_image(data, extent, field_transform, zlim)
 
-    def __init__(self, data, extent, size=(9,8)):
-        PlotMPL.__init__(self, data, size)
-        self.__init_image(data, extent)
-
-    def __init_image(self, data, extent):
+    def __init_image(self, data, extent, field_transform, zlim):
+        if (field_transform.name == 'log10'):
+            norm = matplotlib.colors.LogNorm()
+        elif (field_transform.name == 'linear'):
+            norm = matplotlib.colors.Normalize()
         self.image = self.axes.imshow(data,origin='lower',extent=extent,
-                                      norm=matplotlib.colors.LogNorm())
-
-    @invalidate_plot
-    def set_zlim(self, zmin, zmax):
-        self.zmin = zmin
-        self.zmax = zmax
-
+                                      norm=norm, vmin = zlim[0], vmax = zlim[1])

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