[Yt-svn] commit/yt: 2 new changesets
Bitbucket
commits-noreply at bitbucket.org
Thu Apr 14 21:48:43 PDT 2011
2 new changesets in yt:
http://bitbucket.org/yt_analysis/yt/changeset/2d62c694b8d9/
changeset: r4129:2d62c694b8d9
branch: yt
user: jsoishi
date: 2011-04-15 06:47:26
summary: added capability for plot_windows to center on maximum.
affected #: 1 file (980 bytes)
--- a/yt/visualization/plot_window.py Thu Apr 14 14:05:09 2011 -0400
+++ b/yt/visualization/plot_window.py Thu Apr 14 21:47:26 2011 -0700
@@ -28,6 +28,7 @@
import color_maps
from image_writer import \
write_image, apply_colormap
+from yt.funcs import *
from yt.utilities.amr_utils import write_png_to_file
from fixed_resolution import \
FixedResolutionBuffer
@@ -52,7 +53,7 @@
return newfunc
class PlotWindow(object):
- def __init__(self, data_source, bounds, buff_size=(800,800), antialias = True):
+ def __init__(self, data_source, bounds, buff_size=(800,800), antialias = True, periodic = True):
r"""
PlotWindow(data_source, bounds, buff_size=(800,800), antialias = True)
@@ -83,11 +84,15 @@
"""
self._initfinished = False
+ self.center = None
self.plots = {}
+ self._periodic = periodic
self.data_source = data_source
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)
self._initfinished = True
def __getitem__(self, item):
@@ -98,7 +103,7 @@
bounds = self.bounds
self._frb = FixedResolutionBuffer(self.data_source,
bounds, self.buff_size,
- self.antialias)
+ self.antialias, periodic=self._periodic)
except:
raise RuntimeError("Failed to repixelize.")
self._frb._get_data_source_fields()
@@ -171,9 +176,17 @@
@invalidate_data
def set_window(self, bounds):
- self.xlim = bounds[0:2]
- self.ylim = bounds[2:]
-
+ if self.center is not None:
+ dx = bounds[1] - bounds[0]
+ dy = bounds[3] - bounds[2]
+ self.xlim = (self.center[0] - dx/2., self.center[0] + dx/2.)
+ self.ylim = (self.center[1] - dy/2., self.center[1] + dy/2.)
+ mylog.info("xlim = %f %f" %self.xlim)
+ mylog.info("ylim = %f %f" %self.ylim)
+ else:
+ self.xlim = bounds[0:2]
+ self.ylim = bounds[2:]
+
@invalidate_data
def set_width(self, new_width):
"""set the width of the plot window
@@ -192,12 +205,24 @@
self.ylim[0] = centery - new_width/2.
self.ylim[1] = centery + new_width/2.
+ @invalidate_data
+ def set_center(self, new_center):
+ if new_center is None:
+ self.center = None
+ else:
+ self.center = new_center
+ self.set_window(self.bounds)
+
@property
def width(self):
Wx = self.xlim[1] - self.xlim[0]
Wy = self.ylim[1] - self.ylim[0]
return (Wx, Wy)
+ # @property
+ # def window(self):
+ # return self.xlim + self.ylim
+
@invalidate_data
def set_antialias(self,aa):
self.antialias = aa
@@ -218,6 +243,7 @@
if setup: self._setup_plots()
+ @invalidate_plot
def set_log(self,field,log):
"""set a field to log or linear.
http://bitbucket.org/yt_analysis/yt/changeset/b349c389a117/
changeset: r4130:b349c389a117
branch: yt
user: jsoishi
date: 2011-04-15 06:48:28
summary: made periodic the default on slices and projections
affected #: 1 file (34 bytes)
--- a/yt/gui/reason/extdirect_repl.py Thu Apr 14 21:47:26 2011 -0700
+++ b/yt/gui/reason/extdirect_repl.py Thu Apr 14 21:48:28 2011 -0700
@@ -310,7 +310,7 @@
_taxis = %(axis)s
_tfield = "%(field)s"
_tweight = %(weight)s
- _tsl = _tpf.h.proj(_taxis,_tfield, weight_field=_tweight)
+ _tsl = _tpf.h.proj(_taxis,_tfield, weight_field=_tweight, periodic = True)
_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
@@ -345,7 +345,7 @@
_tfield = "%(field)s"
_tcenter = %(center_string)s
_tcoord = _tcenter[_taxis]
- _tsl = _tpf.h.slice(_taxis, _tcoord, center = _tcenter)
+ _tsl = _tpf.h.slice(_taxis, _tcoord, center = _tcenter, periodic = True)
_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
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