[yt-svn] commit/yt: MatthewTurk: Adding display of central point to metadata in Reason plotwindow widget.

Bitbucket commits-noreply at bitbucket.org
Tue Feb 14 14:25:24 PST 2012


1 new commit in yt:


https://bitbucket.org/yt_analysis/yt/changeset/b165f4dc9df3/
changeset:   b165f4dc9df3
branch:      yt
user:        MatthewTurk
date:        2012-02-14 23:25:17
summary:     Adding display of central point to metadata in Reason plotwindow widget.
Closes #358.
affected #:  1 file

diff -r d8351691e667f8cc19eb8ea6867caeabf7a472aa -r b165f4dc9df3d776ea1770aaf873316683569835 yt/visualization/plot_window.py
--- a/yt/visualization/plot_window.py
+++ b/yt/visualization/plot_window.py
@@ -36,6 +36,11 @@
 
 from yt.funcs import *
 from yt.utilities.amr_utils import write_png_to_string
+from yt.utilities.definitions import \
+    x_dict, x_names, \
+    y_dict, y_names, \
+    axis_names, \
+    axis_labels
 
 def invalidate_data(f):
     @wraps(f)
@@ -309,7 +314,11 @@
 <br>
 Field of View:  %(x_width)0.3f %(unit)s<br>
 Minimum Value:  %(mi)0.3e %(units)s<br>
-Maximum Value:  %(ma)0.3e %(units)s
+Maximum Value:  %(ma)0.3e %(units)s<br>
+Central Point:  (data coords)<br>
+   %(xc)0.14f<br>
+   %(yc)0.14f<br>
+   %(zc)0.14f
 """
 
 class PWViewerExtJS(PWViewer):
@@ -402,11 +411,21 @@
         y_width = self.ylim[1] - self.ylim[0]
         unit = get_smallest_appropriate_unit(x_width, self._frb.pf)
         units = self.get_field_units(field)
+        center = getattr(self._frb.data_source, "center", None)
+        if center is None or self._frb.axis == 4:
+            xc, yc, zc = -999, -999, -999
+        else:
+            center[x_dict[self._frb.axis]] = 0.5 * (
+                self.xlim[0] + self.xlim[1])
+            center[y_dict[self._frb.axis]] = 0.5 * (
+                self.ylim[0] + self.ylim[1])
+            xc, yc, zc = center
         md = _metadata_template % dict(
                 pf = self._frb.pf,
                 x_width = x_width*self._frb.pf[unit],
                 y_width = y_width*self._frb.pf[unit],
-                unit = unit, units = units, mi = mi, ma = ma)
+                unit = unit, units = units, mi = mi, ma = ma,
+                xc = xc, yc = yc, zc = zc)
         return md
 
     def image_recenter(self, img_x, img_y, img_size_x, img_size_y):

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