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

Bitbucket commits-noreply at bitbucket.org
Tue Oct 11 12:59:58 PDT 2011


2 new changesets in yt:

http://bitbucket.org/yt_analysis/yt/changeset/726b86e92785/
changeset:   726b86e92785
branch:      yt
user:        MatthewTurk
date:        2011-10-11 13:59:23
summary:     After brainstorming a bit with Sam, we came up with this idea of adding to_frb
calls to the AMR2DData objects and storing weakrefs to plots in the hierarchy,
like we do for data objects.
affected #:  3 files (-1 bytes)

--- a/yt/data_objects/data_containers.py	Mon Oct 10 18:16:30 2011 -0400
+++ b/yt/data_objects/data_containers.py	Tue Oct 11 07:59:23 2011 -0400
@@ -829,6 +829,25 @@
         for grid in self._grids:
             temp = grid[field]
 
+    def to_frb(self, width, resolution, center = None):
+        if center is None:
+            center = self.get_field_parameter("center")
+            if center is None:
+                center = (self.pf.domain_right_edge
+                        + self.pf.domain_left_edge)/2.0
+        if iterable(width):
+            w, u = width
+            width = w/self.pf[u]
+        if not iterable(resolution):
+            resolution = (resolution, resolution)
+        from yt.visualization.fixed_resolution import FixedResolutionBuffer
+        xax = x_dict[self.axis]
+        yax = y_dict[self.axis]
+        bounds = (center[xax] - width/2.0, center[xax] + width/2.0,
+                  center[yax] - width/2.0, center[yax] + width/2.0)
+        frb = FixedResolutionBuffer(self, bounds, resolution)
+        return frb
+
     def interpolate_discretize(self, LE, RE, field, side, log_spacing=True):
         """
         This returns a uniform grid of points between *LE* and *RE*,


--- a/yt/data_objects/hierarchy.py	Mon Oct 10 18:16:30 2011 -0400
+++ b/yt/data_objects/hierarchy.py	Tue Oct 11 07:59:23 2011 -0400
@@ -120,6 +120,7 @@
         # Called by subclass
         self.object_types = []
         self.objects = []
+        self.plots = []
         for name, cls in sorted(data_object_registry.items()):
             cname = cls.__name__
             if cname.endswith("Base"): cname = cname[:-4]


--- a/yt/visualization/fixed_resolution.py	Mon Oct 10 18:16:30 2011 -0400
+++ b/yt/visualization/fixed_resolution.py	Tue Oct 11 07:59:23 2011 -0400
@@ -30,6 +30,7 @@
     axis_names
 import _MPL
 import numpy as na
+import weakref
 
 class FixedResolutionBuffer(object):
     def __init__(self, data_source, bounds, buff_size, antialias = True,
@@ -96,6 +97,10 @@
         self.axis = data_source.axis
         self.periodic = periodic
 
+        h = getattr(data_source, "hierarchy", None)
+        if h is not None:
+            h.plots.append(weakref.proxy(self))
+
         # Handle periodicity, just in case
         if self.data_source.axis < 3:
             DLE = self.pf.domain_left_edge


http://bitbucket.org/yt_analysis/yt/changeset/d2b180859c32/
changeset:   d2b180859c32
branch:      yt
user:        MatthewTurk
date:        2011-10-11 14:05:53
summary:     Adding a limits property to the FRB
affected #:  1 file (-1 bytes)

--- a/yt/visualization/fixed_resolution.py	Tue Oct 11 07:59:23 2011 -0400
+++ b/yt/visualization/fixed_resolution.py	Tue Oct 11 08:05:53 2011 -0400
@@ -278,6 +278,17 @@
         else: data=self[field]
         numdisplay.display(data)    
 
+    @property
+    def limits(self):
+        rv = dict(x = None, y = None, z = None)
+        xax = x_dict[self.axis]
+        yax = y_dict[self.axis]
+        xn = axis_names[xax]
+        yn = axis_names[yax]
+        rv[xn] = (self.bounds[0], self.bounds[1])
+        rv[yn] = (self.bounds[2], self.bounds[3])
+        return rv
+
 class ObliqueFixedResolutionBuffer(FixedResolutionBuffer):
     """
     This object is a subclass of :class:`yt.visualization.fixed_resolution.FixedResolutionBuffer`

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