[yt-svn] commit/yt: 2 new changesets
Bitbucket
commits-noreply at bitbucket.org
Mon Jul 30 11:09:20 PDT 2012
2 new commits in yt:
https://bitbucket.org/yt_analysis/yt/changeset/cbf1386c7658/
changeset: cbf1386c7658
branch: yt
user: MatthewTurk
date: 2012-07-30 19:41:59
summary: Adding a to_pw call to 2D data objects. Fixing "mip" units.
affected #: 2 files
diff -r 9e9c1bfe9e8ea9fbbb0c163439f2dab8b27860d6 -r cbf1386c76580f1937d4b64540f35c436346964a yt/data_objects/data_containers.py
--- a/yt/data_objects/data_containers.py
+++ b/yt/data_objects/data_containers.py
@@ -913,6 +913,26 @@
frb = FixedResolutionBuffer(self, bounds, resolution)
return frb
+ def to_pw(self):
+ r"""Create a :class:`~yt.visualization.plot_window.PlotWindow` from this
+ object.
+
+ This is a bare-bones mechanism of creating a plot window from this
+ object, which can then be moved around, zoomed, and on and on. All
+ behavior of the plot window is relegated to that routine.
+ """
+ axis = self.axis
+ center = self.get_field_parameter("center")
+ if center is None:
+ center = (self.pf.domain_right_edge
+ + self.pf.domain_left_edge)/2.0
+ width = (1.0, 'unitary')
+ from yt.visualization.plot_window import \
+ PWViewerMPL, GetBoundsAndCenter
+ (bounds, center) = GetBoundsAndCenter(axis, center, width, pf)
+ pw = PWViewerMPL(self, bounds)
+ return pw
+
def interpolate_discretize(self, LE, RE, field, side, log_spacing=True):
"""
This returns a uniform grid of points between *LE* and *RE*,
diff -r 9e9c1bfe9e8ea9fbbb0c163439f2dab8b27860d6 -r cbf1386c76580f1937d4b64540f35c436346964a yt/visualization/plot_window.py
--- a/yt/visualization/plot_window.py
+++ b/yt/visualization/plot_window.py
@@ -544,8 +544,10 @@
def get_field_units(self, field, strip_mathml = True):
ds = self._frb.data_source
pf = self.pf
- if ds._type_name in ("slice", "cutting") or \
- (ds._type_name == "proj" and ds.weight_field is not None):
+ if ds._type_name in ("slice", "cutting"):
+ units = pf.field_info[field].get_units()
+ if ds._type_name == "proj" and (ds.weight_field is not None or
+ ds.proj_style == "mip"):
units = pf.field_info[field].get_units()
elif ds._type_name == "proj":
units = pf.field_info[field].get_projected_units()
@@ -768,9 +770,9 @@
"""
axis = fix_axis(axis)
- (bounds,center) = GetBoundsAndCenter(axis,center,width,pf)
- slice = pf.h.slice(axis,center[axis],fields=fields)
- PWViewerMPL.__init__(self,slice,bounds,origin=origin)
+ (bounds,center) = GetBoundsAndCenter(axis, center, width, pf)
+ slc = pf.h.slc(axis, center[axis], fields=fields)
+ PWViewerMPL.__init__(self, slc, bounds, origin=origin)
class ProjectionPlot(PWViewerMPL):
def __init__(self, pf, axis, fields, center='c', width=(1,'unitary'),
@@ -870,7 +872,6 @@
# aren't well-defined for off-axis data objects
PWViewerMPL.__init__(self,cutting,bounds,origin='center-window',periodic=False,oblique=True)
-
_metadata_template = """
%(pf)s<br><br>
https://bitbucket.org/yt_analysis/yt/changeset/aceb4f9032b7/
changeset: aceb4f9032b7
branch: yt
user: MatthewTurk
date: 2012-07-30 19:46:15
summary: Fixing a name error bug
affected #: 1 file
diff -r cbf1386c76580f1937d4b64540f35c436346964a -r aceb4f9032b71e1b22e75c9900b2ad3f1d5705dc yt/data_objects/data_containers.py
--- a/yt/data_objects/data_containers.py
+++ b/yt/data_objects/data_containers.py
@@ -929,7 +929,7 @@
width = (1.0, 'unitary')
from yt.visualization.plot_window import \
PWViewerMPL, GetBoundsAndCenter
- (bounds, center) = GetBoundsAndCenter(axis, center, width, pf)
+ (bounds, center) = GetBoundsAndCenter(axis, center, width, self.pf)
pw = PWViewerMPL(self, bounds)
return pw
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