[Yt-svn] commit/yt: jsoishi: fixed up centering for projections.
Bitbucket
commits-noreply at bitbucket.org
Thu Apr 14 21:55:58 PDT 2011
1 new changeset in yt:
http://bitbucket.org/yt_analysis/yt/changeset/9de7f31f27e9/
changeset: r4131:9de7f31f27e9
branch: yt
user: jsoishi
date: 2011-04-15 06:55:49
summary: fixed up centering for projections.
affected #: 2 files (283 bytes)
--- a/yt/gui/reason/extdirect_repl.py Thu Apr 14 21:48:28 2011 -0700
+++ b/yt/gui/reason/extdirect_repl.py Thu Apr 14 21:55:49 2011 -0700
@@ -305,12 +305,17 @@
def create_proj(self, pfname, axis, field, weight, onmax):
if weight == "None": weight = None
else: weight = "'%s'" % (weight)
+ if not onmax:
+ center_string = None
+ else:
+ center_string = "_tpf.h.find_max('Density')[1]"
funccall = """
_tpf = %(pfname)s
_taxis = %(axis)s
_tfield = "%(field)s"
_tweight = %(weight)s
- _tsl = _tpf.h.proj(_taxis,_tfield, weight_field=_tweight, periodic = True)
+ _tcen = %(center_string)s
+ _tsl = _tpf.h.proj(_taxis,_tfield, weight_field=_tweight, periodic = True, center=_tcen)
_txax, _tyax = x_dict[_taxis], y_dict[_taxis]
DLE, DRE = _tpf.domain_left_edge, _tpf.domain_right_edge
from yt.visualization.plot_window import PWViewerExtJS
@@ -323,6 +328,7 @@
""" % dict(pfname = pfname,
axis = inv_axis_names[axis],
weight = weight,
+ center_string = center_string,
field=field)
# There is a call to do this, but I have forgotten it ...
funccall = "\n".join((line.strip() for line in funccall.splitlines()))
--- a/yt/visualization/plot_window.py Thu Apr 14 21:48:28 2011 -0700
+++ b/yt/visualization/plot_window.py Thu Apr 14 21:55:49 2011 -0700
@@ -91,8 +91,9 @@
self.buff_size = buff_size
self.antialias = True
self.set_window(bounds) # this automatically updates the data and plot
- center = [self.data_source.center[i] for i in range(len(self.data_source.center)) if i != self.data_source.axis]
- self.set_center(center)
+ if self.data_source.center is not None:
+ center = [self.data_source.center[i] for i in range(len(self.data_source.center)) if i != self.data_source.axis]
+ self.set_center(center)
self._initfinished = True
def __getitem__(self, item):
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