[yt-svn] commit/yt: 10 new changesets
commits-noreply at bitbucket.org
commits-noreply at bitbucket.org
Fri May 23 21:13:37 PDT 2014
10 new commits in yt:
https://bitbucket.org/yt_analysis/yt/commits/3aa06e74c1a3/
Changeset: 3aa06e74c1a3
Branch: yt-3.0
User: ngoldbaum
Date: 2014-05-22 04:01:20
Summary: Adding set_xlim and set_ylim to ProfilePlot and PhasePlot.
Affected #: 2 files
diff -r 72c8fdbc3b92675a74f1e9136350cf1c6c4c46fa -r 3aa06e74c1a36fbb0cb66f10cf33c6216366aff8 yt/visualization/plot_container.py
--- a/yt/visualization/plot_container.py
+++ b/yt/visualization/plot_container.py
@@ -241,7 +241,7 @@
if field is 'all':
fields = self.plots.keys()
else:
- fields = [field]
+ fields = ensure_list(field)
for field in self.data_source._determine_fields(fields):
myzmin = zmin
myzmax = zmax
diff -r 72c8fdbc3b92675a74f1e9136350cf1c6c4c46fa -r 3aa06e74c1a36fbb0cb66f10cf33c6216366aff8 yt/visualization/profile_plotter.py
--- a/yt/visualization/profile_plotter.py
+++ b/yt/visualization/profile_plotter.py
@@ -69,7 +69,7 @@
class FigureContainer(dict):
def __init__(self):
- super(dict, self).__init__()
+ super(FigureContainer, self).__init__()
def __missing__(self, key):
figure = mpl.matplotlib.figure.Figure((10, 8))
@@ -79,13 +79,20 @@
class AxesContainer(dict):
def __init__(self, fig_container):
self.fig_container = fig_container
- super(dict, self).__init__()
+ self.xlim = {}
+ self.ylim = {}
+ super(AxesContainer, self).__init__()
def __missing__(self, key):
figure = self.fig_container[key]
self[key] = figure.add_subplot(111)
return self[key]
+ def __setitem__(self, key, value):
+ super(AxesContainer, self).__setitem__(key, value)
+ self.xlim[key] = (None, None)
+ self.ylim[key] = (None, None)
+
def sanitize_label(label, nprofiles):
label = ensure_list(label)
@@ -218,7 +225,9 @@
self.plot_spec = [dict() for p in self.profiles]
if not isinstance(self.plot_spec, list):
self.plot_spec = [self.plot_spec.copy() for p in self.profiles]
-
+
+ self.figures = FigureContainer()
+ self.axes = AxesContainer(self.figures)
self._setup_plots()
def save(self, name=None):
@@ -290,7 +299,6 @@
else:
raise YTNotInsideNotebook
-
def _repr_html_(self):
"""Return an html representation of the plot object. Will display as a
png for each WindowPlotMPL instance in self.plots"""
@@ -310,14 +318,11 @@
return ret
def _setup_plots(self):
- self.figures = FigureContainer()
- self.axes = AxesContainer(self.figures)
for i, profile in enumerate(self.profiles):
for field, field_data in profile.items():
- self.axes[field].plot(np.array(profile.x),
- np.array(field_data),
- label=self.label[i],
- **self.plot_spec[i])
+ if field not in self.axes:
+ self.axes[field].plot(np.array(profile.x), np.array(field_data),
+ label=self.label[i], **self.plot_spec[i])
# This relies on 'profile' leaking
for fname, axes in self.axes.items():
@@ -327,6 +332,14 @@
axes.set_yscale(yscale)
axes.set_xlabel(xtitle)
axes.set_ylabel(ytitle)
+ if self.axes.xlim[fname] == (None, None):
+ axes.autoscale(axis='x')
+ else:
+ axes.set_xlim(*self.axes.xlim[fname])
+ if self.axes.ylim[fname] == (None, None):
+ axes.autoscale(axis='y')
+ else:
+ axes.set_ylim(*self.axes.ylim[fname])
if any(self.label):
axes.legend(loc="best")
self._plot_valid = True
@@ -460,6 +473,28 @@
raise KeyError("Field %s not in profile plot!" % (field))
return self
+ @invalidate_plot
+ def set_xlim(self, xmin, xmax):
+ fields = self.axes.keys()
+ for field in fields:
+ self.axes.xlim[field] = (xmin, xmax)
+ return self
+
+ @invalidate_plot
+ def set_ylim(self, field, ymin, ymax):
+ if field is 'all':
+ fields = self.axes.keys()
+ else:
+ fields = ensure_list(field)
+ for profile in self.profiles:
+ for field in profile.data_source._determine_fields(fields):
+ if field in profile.field_map:
+ field = profile.field_map[field]
+ self.axes.ylim[field] = (ymin, ymax)
+ # Continue on to the next profile.
+ break
+ return self
+
def _get_field_log(self, field_y, profile):
pf = profile.data_source.pf
yf, = profile.data_source._determine_fields([field_y])
@@ -508,7 +543,6 @@
self._get_field_label(field_y, yfi, y_unit, fractional)
return (x_title, y_title)
-
class PhasePlot(ImagePlotContainer):
r"""
@@ -679,10 +713,14 @@
cax = None
draw_colorbar = True
draw_axes = True
+ xlim = (None, None)
+ ylim = (None, None)
zlim = (None, None)
if f in self.plots:
draw_colorbar = self.plots[f]._draw_colorbar
draw_axes = self.plots[f]._draw_axes
+ xlim = (self.plots[f].xmin, self.plots[f].xmax)
+ ylim = (self.plots[f].ymin, self.plots[f].ymax)
zlim = (self.plots[f].zmin, self.plots[f].zmax)
if self.plots[f].figure is not None:
fig = self.plots[f].figure
@@ -706,7 +744,7 @@
self.plots[f] = PhasePlotMPL(self.profile.x, self.profile.y, data,
x_scale, y_scale, z_scale,
- self._colormaps[f], np.array(zlim),
+ self._colormaps[f], xlim, ylim, zlim,
self.figure_size, fp.get_size(),
fig, axes, cax)
@@ -856,6 +894,18 @@
raise KeyError("Field %s not in phase plot!" % (field))
return self
+ @invalidate_plot
+ def set_xlim(self, xmin, xmax):
+ for p in self.plots.values():
+ p.xmin, p.xmax = xmin, xmax
+ return self
+
+ @invalidate_plot
+ def set_ylim(self, ymin, ymax):
+ for p in self.plots.values():
+ p.ymin, p.ymax = ymin, ymax
+ return self
+
def run_callbacks(self, *args):
raise NotImplementedError
def setup_callbacks(self, *args):
@@ -864,7 +914,7 @@
class PhasePlotMPL(ImagePlotMPL):
def __init__(self, x_data, y_data, data,
- x_scale, y_scale, z_scale, cmap,
+ x_scale, y_scale, z_scale, cmap, xlim, ylim,
zlim, figure_size, fontsize, figure, axes, cax):
self._initfinished = False
self._draw_colorbar = True
@@ -883,6 +933,9 @@
size, axrect, caxrect = self._get_best_layout()
+ self.xmin, self.xmax = xlim
+ self.ymin, self.ymax = ylim
+
super(PhasePlotMPL, self).__init__(size, axrect, caxrect, zlim,
figure, axes, cax)
@@ -900,13 +953,15 @@
norm = matplotlib.colors.Normalize(zlim[0], zlim[1])
self.image = None
self.cb = None
- self.image = self.axes.pcolormesh(np.array(x_data),
- np.array(y_data),
+ self.image = self.axes.pcolormesh(np.array(x_data),
+ np.array(y_data),
np.array(image_data.T),
- norm=norm,
+ norm=norm,
cmap=cmap)
self.axes.set_xscale(x_scale)
+ self.axes.set_xlim(self.xmin, self.xmax)
self.axes.set_yscale(y_scale)
+ self.axes.set_ylim(self.ymin, self.ymax)
self.cb = self.figure.colorbar(self.image, self.cax)
if z_scale == 'linear':
self.cb.formatter.set_scientific(True)
https://bitbucket.org/yt_analysis/yt/commits/021959973333/
Changeset: 021959973333
Branch: yt-3.0
User: ngoldbaum
Date: 2014-05-22 07:57:08
Summary: When setting the xlim and ylim, rebin where appropriate.
Affected #: 3 files
diff -r 3aa06e74c1a36fbb0cb66f10cf33c6216366aff8 -r 0219599733339d517be223292c501b0b2dd0c029 yt/data_objects/profiles.py
--- a/yt/data_objects/profiles.py
+++ b/yt/data_objects/profiles.py
@@ -1154,7 +1154,10 @@
for bin_field in bin_fields:
bf_units = data_source.pf._get_field_info(bin_field[0],
bin_field[1]).units
- field_ex = list(extrema[bin_field[-1]])
+ try:
+ field_ex = list(extrema[bin_field[-1]])
+ except KeyError:
+ field_ex = list(extrema[bin_field])
if iterable(field_ex[0]):
field_ex[0] = data_source.pf.quan(field_ex[0][0], field_ex[0][1])
field_ex[0] = field_ex[0].in_units(bf_units)
diff -r 3aa06e74c1a36fbb0cb66f10cf33c6216366aff8 -r 0219599733339d517be223292c501b0b2dd0c029 yt/visualization/plot_container.py
--- a/yt/visualization/plot_container.py
+++ b/yt/visualization/plot_container.py
@@ -30,10 +30,10 @@
from yt.funcs import \
defaultdict, get_image_suffix, \
- get_ipython_api_version, iterable
+ get_ipython_api_version, iterable, \
+ ensure_list
from yt.utilities.exceptions import \
YTNotInsideNotebook
-from ._mpl_imports import FigureCanvasAgg
def invalidate_data(f):
@wraps(f)
diff -r 3aa06e74c1a36fbb0cb66f10cf33c6216366aff8 -r 0219599733339d517be223292c501b0b2dd0c029 yt/visualization/profile_plotter.py
--- a/yt/visualization/profile_plotter.py
+++ b/yt/visualization/profile_plotter.py
@@ -79,7 +79,6 @@
class AxesContainer(dict):
def __init__(self, fig_container):
self.fig_container = fig_container
- self.xlim = {}
self.ylim = {}
super(AxesContainer, self).__init__()
@@ -90,7 +89,6 @@
def __setitem__(self, key, value):
super(AxesContainer, self).__setitem__(key, value)
- self.xlim[key] = (None, None)
self.ylim[key] = (None, None)
def sanitize_label(label, nprofiles):
@@ -320,9 +318,10 @@
def _setup_plots(self):
for i, profile in enumerate(self.profiles):
for field, field_data in profile.items():
- if field not in self.axes:
- self.axes[field].plot(np.array(profile.x), np.array(field_data),
- label=self.label[i], **self.plot_spec[i])
+ if field in self.axes:
+ self.axes[field].cla()
+ self.axes[field].plot(np.array(profile.x), np.array(field_data),
+ label=self.label[i], **self.plot_spec[i])
# This relies on 'profile' leaking
for fname, axes in self.axes.items():
@@ -332,10 +331,6 @@
axes.set_yscale(yscale)
axes.set_xlabel(xtitle)
axes.set_ylabel(ytitle)
- if self.axes.xlim[fname] == (None, None):
- axes.autoscale(axis='x')
- else:
- axes.set_xlim(*self.axes.xlim[fname])
if self.axes.ylim[fname] == (None, None):
axes.autoscale(axis='y')
else:
@@ -474,25 +469,41 @@
return self
@invalidate_plot
- def set_xlim(self, xmin, xmax):
- fields = self.axes.keys()
- for field in fields:
- self.axes.xlim[field] = (xmin, xmax)
+ def set_xlim(self, xmin=None, xmax=None):
+ for i, p in enumerate(self.profiles):
+ if xmin is None:
+ xmi = p.x_bins.min()
+ else:
+ xmi = xmin
+ if xmax is None:
+ xma = p.x_bins.max()
+ else:
+ xma = xmax
+ extrema = {p.x_field: (xmi, xma)}
+ self.profiles[i] = \
+ create_profile(p.data_source, p.x_field,
+ n_bins=len(p.x_bins)-2,
+ fields=p.field_map.values(),
+ weight_field=p.weight_field,
+ accumulation=p.accumulation,
+ fractional=p.fractional,
+ extrema=extrema)
return self
@invalidate_plot
- def set_ylim(self, field, ymin, ymax):
- if field is 'all':
- fields = self.axes.keys()
- else:
- fields = ensure_list(field)
- for profile in self.profiles:
- for field in profile.data_source._determine_fields(fields):
- if field in profile.field_map:
- field = profile.field_map[field]
- self.axes.ylim[field] = (ymin, ymax)
- # Continue on to the next profile.
- break
+ def set_ylim(self, field, ymin=None, ymax=None):
+ for i, p in enumerate(self.profiles):
+ if field is 'all':
+ fields = self.axes.keys()
+ else:
+ fields = ensure_list(field)
+ for profile in self.profiles:
+ for field in profile.data_source._determine_fields(fields):
+ if field in profile.field_map:
+ field = profile.field_map[field]
+ self.axes.ylim[field] = (ymin, ymax)
+ # Continue on to the next profile.
+ break
return self
def _get_field_log(self, field_y, profile):
@@ -713,14 +724,10 @@
cax = None
draw_colorbar = True
draw_axes = True
- xlim = (None, None)
- ylim = (None, None)
zlim = (None, None)
if f in self.plots:
draw_colorbar = self.plots[f]._draw_colorbar
draw_axes = self.plots[f]._draw_axes
- xlim = (self.plots[f].xmin, self.plots[f].xmax)
- ylim = (self.plots[f].ymin, self.plots[f].ymax)
zlim = (self.plots[f].zmin, self.plots[f].zmax)
if self.plots[f].figure is not None:
fig = self.plots[f].figure
@@ -744,7 +751,7 @@
self.plots[f] = PhasePlotMPL(self.profile.x, self.profile.y, data,
x_scale, y_scale, z_scale,
- self._colormaps[f], xlim, ylim, zlim,
+ self._colormaps[f], zlim,
self.figure_size, fp.get_size(),
fig, axes, cax)
@@ -895,15 +902,41 @@
return self
@invalidate_plot
- def set_xlim(self, xmin, xmax):
- for p in self.plots.values():
- p.xmin, p.xmax = xmin, xmax
+ def set_xlim(self, xmin=None, xmax=None):
+ p = self.profile
+ if xmin is None:
+ xmin = p.x_bins.min()
+ if xmax is None:
+ xmax = p.x_bins.max()
+ self.profile = create_profile(
+ p.data_source,
+ [p.x_field, p.y_field],
+ p.field_map.values(),
+ n_bins=[len(p.x_bins)-2, len(p.y_bins)-2],
+ weight_field=p.weight_field,
+ accumulation=p.accumulation,
+ fractional=p.fractional,
+ extrema={p.x_field: (xmin, xmax),
+ p.y_field: (p.y_bins.min(), p.y_bins.max())})
return self
@invalidate_plot
- def set_ylim(self, ymin, ymax):
- for p in self.plots.values():
- p.ymin, p.ymax = ymin, ymax
+ def set_ylim(self, ymin=None, ymax=None):
+ p = self.profile
+ if ymin is None:
+ ymin = p.y_bins.min()
+ if ymax is None:
+ ymax = p.y_bins.max()
+ self.profile = create_profile(
+ p.data_source,
+ [p.x_field, p.y_field],
+ p.field_map.values(),
+ n_bins=[len(p.x_bins), len(p.y_bins)],
+ weight_field=p.weight_field,
+ accumulation=p.accumulation,
+ fractional=p.fractional,
+ extrema={p.x_field: (p.x_bins.min(), p.x_bins.max()),
+ p.y_field: (ymin, ymax)})
return self
def run_callbacks(self, *args):
@@ -914,7 +947,7 @@
class PhasePlotMPL(ImagePlotMPL):
def __init__(self, x_data, y_data, data,
- x_scale, y_scale, z_scale, cmap, xlim, ylim,
+ x_scale, y_scale, z_scale, cmap,
zlim, figure_size, fontsize, figure, axes, cax):
self._initfinished = False
self._draw_colorbar = True
@@ -933,9 +966,6 @@
size, axrect, caxrect = self._get_best_layout()
- self.xmin, self.xmax = xlim
- self.ymin, self.ymax = ylim
-
super(PhasePlotMPL, self).__init__(size, axrect, caxrect, zlim,
figure, axes, cax)
@@ -959,9 +989,7 @@
norm=norm,
cmap=cmap)
self.axes.set_xscale(x_scale)
- self.axes.set_xlim(self.xmin, self.xmax)
self.axes.set_yscale(y_scale)
- self.axes.set_ylim(self.ymin, self.ymax)
self.cb = self.figure.colorbar(self.image, self.cax)
if z_scale == 'linear':
self.cb.formatter.set_scientific(True)
https://bitbucket.org/yt_analysis/yt/commits/a35f731bac88/
Changeset: a35f731bac88
Branch: yt-3.0
User: ngoldbaum
Date: 2014-05-22 08:08:48
Summary: Removing autoscale to make PhasePlot and ProfilePlot symmetric in behavior.
Affected #: 1 file
diff -r 0219599733339d517be223292c501b0b2dd0c029 -r a35f731bac880f7845436206c6df21694e5f1414 yt/visualization/profile_plotter.py
--- a/yt/visualization/profile_plotter.py
+++ b/yt/visualization/profile_plotter.py
@@ -331,10 +331,7 @@
axes.set_yscale(yscale)
axes.set_xlabel(xtitle)
axes.set_ylabel(ytitle)
- if self.axes.ylim[fname] == (None, None):
- axes.autoscale(axis='y')
- else:
- axes.set_ylim(*self.axes.ylim[fname])
+ axes.set_ylim(*self.axes.ylim[fname])
if any(self.label):
axes.legend(loc="best")
self._plot_valid = True
https://bitbucket.org/yt_analysis/yt/commits/14e78a853030/
Changeset: 14e78a853030
Branch: yt-3.0
User: ngoldbaum
Date: 2014-05-22 09:42:10
Summary: Adding docstrings for set_xlim and set_ylim.
Taking the opportunity to clean up the docstrings and fix a few minor issues
elsewhere.
Affected #: 1 file
diff -r a35f731bac880f7845436206c6df21694e5f1414 -r 14e78a853030fff08d8d7d69c50541825715b072 yt/visualization/profile_plotter.py
--- a/yt/visualization/profile_plotter.py
+++ b/yt/visualization/profile_plotter.py
@@ -24,7 +24,6 @@
import matplotlib
import numpy as np
import cStringIO
-import __builtin__
from .base_plot_types import ImagePlotMPL
@@ -161,16 +160,17 @@
This creates profiles of a single dataset.
- >>> pf = load("enzo_tiny_cosmology/DD0046/DD0046")
- >>> ad = pf.h.all_data()
+ >>> import yt
+ >>> ds = yt.load("enzo_tiny_cosmology/DD0046/DD0046")
+ >>> ad = ds.all_data()
>>> plot = ProfilePlot(ad, "density", ["temperature", "velocity_x"],
- weight_field="cell_mass",
- plot_spec=dict(color='red', linestyle="--"))
+ ... weight_field="cell_mass",
+ ... plot_spec=dict(color='red', linestyle="--"))
>>> plot.save()
This creates profiles from a time series object.
-
- >>> es = simulation("AMRCosmology.enzo", "Enzo")
+
+ >>> es = yt.simulation("AMRCosmology.enzo", "Enzo")
>>> es.get_time_series()
>>> profiles = []
@@ -242,7 +242,7 @@
self._setup_plots()
unique = set(self.figures.values())
if len(unique) < len(self.figures):
- figiter = izip(xrange(len(unique)), sorted(unique))
+ iters = izip(xrange(len(unique)), sorted(unique))
else:
iters = self.figures.iteritems()
if name is None:
@@ -263,8 +263,7 @@
if isinstance(uid, types.TupleType):
uid = uid[1]
canvas = canvas_cls(fig)
- fn = "%s_1d-Profile_%s_%s%s" % \
- (prefix, xfn, uid, suffix)
+ fn = "%s_1d-Profile_%s_%s%s" % (prefix, xfn, uid, suffix)
mylog.info("Saving %s", fn)
canvas.print_figure(fn)
return self
@@ -283,8 +282,10 @@
Examples
--------
- >>> slc = SlicePlot(pf, "x", ["Density", "VelocityMagnitude"])
- >>> slc.show()
+ >>> import yt
+ >>> ds = yt.load('IsolatedGalaxy/galaxy0030/galaxy0030')
+ >>> pp = ProfilePlot(ds.all_data(), 'density', 'temperature')
+ >>> pp.show()
"""
if "__IPYTHON__" in dir(__builtin__):
@@ -303,7 +304,7 @@
ret = ''
unique = set(self.figures.values())
if len(unique) < len(self.figures):
- figiter = izip(xrange(len(unique)), sorted(unique))
+ iters = izip(xrange(len(unique)), sorted(unique))
else:
iters = self.figures.iteritems()
for uid, fig in iters:
@@ -448,7 +449,7 @@
def set_unit(self, field, unit):
"""Sets a new unit for the requested field
- parameters
+ Parameters
----------
field : string
The name of the field that is to be changed.
@@ -467,6 +468,31 @@
@invalidate_plot
def set_xlim(self, xmin=None, xmax=None):
+ """Sets the limits of the bin field
+
+ Parameters
+ ----------
+
+ xmin : float or None
+
+ The new x minimum. Defaults to None, which leaves the xmin
+ unchanged.
+
+ xmax : float or None
+
+ The new x maximum. Defaults to None, which leaves the xmax
+ unchanged.
+
+ Examples
+ --------
+
+ >>> import yt
+ >>> ds = yt.load('IsolatedGalaxy/galaxy0030/galaxy0030')
+ >>> pp = yt.ProfilePlot(ds.all_data(), 'density', 'temperature')
+ >>> pp.set_xlim(1e-29, 1e-24)
+ >>> pp.save()
+
+ """
for i, p in enumerate(self.profiles):
if xmin is None:
xmi = p.x_bins.min()
@@ -489,6 +515,35 @@
@invalidate_plot
def set_ylim(self, field, ymin=None, ymax=None):
+ """Sets the plot limits for the specified field we are binning.
+
+ Parameters
+ ----------
+
+ field : string or field tuple
+
+ The field that we want to adjust the plot limits for.
+
+ ymin : float or None
+
+ The new y minimum. Defaults to None, which leaves the xmin
+ unchanged.
+
+ ymax : float or None
+
+ The new y maximum. Defaults to None, which leaves the xmax
+ unchanged.
+
+ Examples
+ --------
+
+ >>> import yt
+ >>> ds = yt.load('IsolatedGalaxy/galaxy0030/galaxy0030')
+ >>> pp = yt.ProfilePlot(ds.all_data(), 'density', ['temperature', 'x-velocity'])
+ >>> pp.set_ylim('temperature', 1e4, 1e6)
+ >>> pp.save()
+
+ """
for i, p in enumerate(self.profiles):
if field is 'all':
fields = self.axes.keys()
@@ -612,10 +667,11 @@
Examples
--------
- >>> pf = load("enzo_tiny_cosmology/DD0046/DD0046")
+ >>> import yt
+ >>> pf = yt.load("enzo_tiny_cosmology/DD0046/DD0046")
>>> ad = pf.h.all_data()
>>> plot = PhasePlot(ad, "density", "temperature", ["cell_mass"],
- weight_field=None)
+ ... weight_field=None)
>>> plot.save()
>>> # Change plot properties.
@@ -900,6 +956,31 @@
@invalidate_plot
def set_xlim(self, xmin=None, xmax=None):
+ """Sets the limits of the x bin field
+
+ Parameters
+ ----------
+
+ xmin : float or None
+
+ The new x minimum. Defaults to None, which leaves the xmin
+ unchanged.
+
+ xmax : float or None
+
+ The new x maximum. Defaults to None, which leaves the xmax
+ unchanged.
+
+ Examples
+ --------
+
+ >>> import yt
+ >>> ds = yt.load('IsolatedGalaxy/galaxy0030/galaxy0030')
+ >>> pp = yt.PhasePlot(ds.all_data(), 'density', 'temperature', 'cell_mass')
+ >>> pp.set_xlim(1e-29, 1e-24)
+ >>> pp.save()
+
+ """
p = self.profile
if xmin is None:
xmin = p.x_bins.min()
@@ -919,6 +1000,31 @@
@invalidate_plot
def set_ylim(self, ymin=None, ymax=None):
+ """Sets the plot limits for the y bin field.
+
+ Parameters
+ ----------
+
+ ymin : float or None
+
+ The new y minimum. Defaults to None, which leaves the xmin
+ unchanged.
+
+ ymax : float or None
+
+ The new y maximum. Defaults to None, which leaves the xmax
+ unchanged.
+
+ Examples
+ --------
+
+ >>> import yt
+ >>> ds = yt.load('IsolatedGalaxy/galaxy0030/galaxy0030')
+ >>> pp = yt.PhasePlot(ds.all_data(), 'density', 'temperature', 'cell_mass')
+ >>> pp.set_ylim(1e4, 1e6)
+ >>> pp.save()
+
+ """
p = self.profile
if ymin is None:
ymin = p.y_bins.min()
https://bitbucket.org/yt_analysis/yt/commits/1846f2481e29/
Changeset: 1846f2481e29
Branch: yt-3.0
User: ngoldbaum
Date: 2014-05-22 22:43:01
Summary: Fixing a docstring typo, adjusting docstring formatting.
Affected #: 1 file
diff -r 14e78a853030fff08d8d7d69c50541825715b072 -r 1846f2481e29dd04f0444f638ea42a9dde49cd3e yt/visualization/profile_plotter.py
--- a/yt/visualization/profile_plotter.py
+++ b/yt/visualization/profile_plotter.py
@@ -474,14 +474,12 @@
----------
xmin : float or None
-
- The new x minimum. Defaults to None, which leaves the xmin
- unchanged.
+ The new x minimum. Defaults to None, which leaves the xmin
+ unchanged.
xmax : float or None
-
- The new x maximum. Defaults to None, which leaves the xmax
- unchanged.
+ The new x maximum. Defaults to None, which leaves the xmax
+ unchanged.
Examples
--------
@@ -525,14 +523,12 @@
The field that we want to adjust the plot limits for.
ymin : float or None
-
- The new y minimum. Defaults to None, which leaves the xmin
- unchanged.
+ The new y minimum. Defaults to None, which leaves the ymin
+ unchanged.
ymax : float or None
-
- The new y maximum. Defaults to None, which leaves the xmax
- unchanged.
+ The new y maximum. Defaults to None, which leaves the ymax
+ unchanged.
Examples
--------
@@ -962,14 +958,12 @@
----------
xmin : float or None
-
- The new x minimum. Defaults to None, which leaves the xmin
- unchanged.
+ The new x minimum. Defaults to None, which leaves the xmin
+ unchanged.
xmax : float or None
-
- The new x maximum. Defaults to None, which leaves the xmax
- unchanged.
+ The new x maximum. Defaults to None, which leaves the xmax
+ unchanged.
Examples
--------
@@ -1006,14 +1000,12 @@
----------
ymin : float or None
-
- The new y minimum. Defaults to None, which leaves the xmin
- unchanged.
+ The new y minimum. Defaults to None, which leaves the ymin
+ unchanged.
ymax : float or None
-
- The new y maximum. Defaults to None, which leaves the xmax
- unchanged.
+ The new y maximum. Defaults to None, which leaves the ymax
+ unchanged.
Examples
--------
https://bitbucket.org/yt_analysis/yt/commits/0c5854f11d4e/
Changeset: 0c5854f11d4e
Branch: yt-3.0
User: ngoldbaum
Date: 2014-05-23 02:14:45
Summary: Need to cache the units when setting the x and y limits.
Affected #: 1 file
diff -r 1846f2481e29dd04f0444f638ea42a9dde49cd3e -r 0c5854f11d4ef0b53d2da34d401ecdee1411b3f2 yt/visualization/profile_plotter.py
--- a/yt/visualization/profile_plotter.py
+++ b/yt/visualization/profile_plotter.py
@@ -500,7 +500,10 @@
xma = p.x_bins.max()
else:
xma = xmax
- extrema = {p.x_field: (xmi, xma)}
+ extrema = {p.x_field: ((xmi, str(p.x.units)), (xma, str(p.x.units)))}
+ units = {p.x_field: str(p.x.units)}
+ for field in p.field_map.values():
+ units[field] = str(p.field_data[field].units)
self.profiles[i] = \
create_profile(p.data_source, p.x_field,
n_bins=len(p.x_bins)-2,
@@ -508,7 +511,7 @@
weight_field=p.weight_field,
accumulation=p.accumulation,
fractional=p.fractional,
- extrema=extrema)
+ extrema=extrema, units=units)
return self
@invalidate_plot
@@ -980,6 +983,8 @@
xmin = p.x_bins.min()
if xmax is None:
xmax = p.x_bins.max()
+ units = {p.x_field: str(p.x.units),
+ p.y_field: str(p.y.units)}
self.profile = create_profile(
p.data_source,
[p.x_field, p.y_field],
@@ -988,8 +993,10 @@
weight_field=p.weight_field,
accumulation=p.accumulation,
fractional=p.fractional,
- extrema={p.x_field: (xmin, xmax),
- p.y_field: (p.y_bins.min(), p.y_bins.max())})
+ units=units,
+ extrema={p.x_field: ((xmin, str(p.x.units)), (xmax, str(p.x.units))),
+ p.y_field: ((p.y_bins.min(), str(p.y.units)),
+ (p.y_bins.max(), str(p.y.units)))})
return self
@invalidate_plot
@@ -1022,6 +1029,8 @@
ymin = p.y_bins.min()
if ymax is None:
ymax = p.y_bins.max()
+ units = {p.x_field: str(p.x.units),
+ p.y_field: str(p.y.units)}
self.profile = create_profile(
p.data_source,
[p.x_field, p.y_field],
@@ -1030,8 +1039,11 @@
weight_field=p.weight_field,
accumulation=p.accumulation,
fractional=p.fractional,
- extrema={p.x_field: (p.x_bins.min(), p.x_bins.max()),
- p.y_field: (ymin, ymax)})
+ units=units,
+ extrema={p.x_field: ((p.x_bins.min(), str(p.x.units)),
+ (p.x_bins.max(), str(p.x.units))),
+ p.y_field: ((ymin, str(p.y.units)), (ymax, str(p.y.units)))})
+
return self
def run_callbacks(self, *args):
https://bitbucket.org/yt_analysis/yt/commits/55a01346d838/
Changeset: 55a01346d838
Branch: yt-3.0
User: ngoldbaum
Date: 2014-05-23 19:18:24
Summary: Now that we're cahching units, set_unit needs to adjust the zlim units as well.
Affected #: 1 file
diff -r 0c5854f11d4ef0b53d2da34d401ecdee1411b3f2 -r 55a01346d8389afe5626541b95235d19d06926a7 yt/visualization/profile_plotter.py
--- a/yt/visualization/profile_plotter.py
+++ b/yt/visualization/profile_plotter.py
@@ -949,6 +949,8 @@
self.profile.set_y_unit(unit)
elif field in fields:
self.profile.set_field_unit(field, unit)
+ self.plots[field].zmin.convert_to_units(unit)
+ self.plots[field].zmax.convert_to_units(unit)
else:
raise KeyError("Field %s not in phase plot!" % (field))
return self
https://bitbucket.org/yt_analysis/yt/commits/1cd4d300524a/
Changeset: 1cd4d300524a
Branch: yt-3.0
User: ngoldbaum
Date: 2014-05-23 19:22:58
Summary: Merging with mainline.
Affected #: 3 files
diff -r 6f681b19224faa0da84c74735a03c144f78ef641 -r 1cd4d300524a7dddec2ede6588d2739fdf54e7ee yt/data_objects/profiles.py
--- a/yt/data_objects/profiles.py
+++ b/yt/data_objects/profiles.py
@@ -1154,7 +1154,10 @@
for bin_field in bin_fields:
bf_units = data_source.pf._get_field_info(bin_field[0],
bin_field[1]).units
- field_ex = list(extrema[bin_field[-1]])
+ try:
+ field_ex = list(extrema[bin_field[-1]])
+ except KeyError:
+ field_ex = list(extrema[bin_field])
if iterable(field_ex[0]):
field_ex[0] = data_source.pf.quan(field_ex[0][0], field_ex[0][1])
field_ex[0] = field_ex[0].in_units(bf_units)
diff -r 6f681b19224faa0da84c74735a03c144f78ef641 -r 1cd4d300524a7dddec2ede6588d2739fdf54e7ee yt/visualization/plot_container.py
--- a/yt/visualization/plot_container.py
+++ b/yt/visualization/plot_container.py
@@ -30,10 +30,10 @@
from yt.funcs import \
defaultdict, get_image_suffix, \
- get_ipython_api_version, iterable
+ get_ipython_api_version, iterable, \
+ ensure_list
from yt.utilities.exceptions import \
YTNotInsideNotebook
-from ._mpl_imports import FigureCanvasAgg
def invalidate_data(f):
@wraps(f)
@@ -241,7 +241,7 @@
if field is 'all':
fields = self.plots.keys()
else:
- fields = [field]
+ fields = ensure_list(field)
for field in self.data_source._determine_fields(fields):
myzmin = zmin
myzmax = zmax
diff -r 6f681b19224faa0da84c74735a03c144f78ef641 -r 1cd4d300524a7dddec2ede6588d2739fdf54e7ee yt/visualization/profile_plotter.py
--- a/yt/visualization/profile_plotter.py
+++ b/yt/visualization/profile_plotter.py
@@ -24,7 +24,6 @@
import matplotlib
import numpy as np
import cStringIO
-import __builtin__
from .base_plot_types import ImagePlotMPL
@@ -69,7 +68,7 @@
class FigureContainer(dict):
def __init__(self):
- super(dict, self).__init__()
+ super(FigureContainer, self).__init__()
def __missing__(self, key):
figure = mpl.matplotlib.figure.Figure((10, 8))
@@ -79,13 +78,18 @@
class AxesContainer(dict):
def __init__(self, fig_container):
self.fig_container = fig_container
- super(dict, self).__init__()
+ self.ylim = {}
+ super(AxesContainer, self).__init__()
def __missing__(self, key):
figure = self.fig_container[key]
self[key] = figure.add_subplot(111)
return self[key]
+ def __setitem__(self, key, value):
+ super(AxesContainer, self).__setitem__(key, value)
+ self.ylim[key] = (None, None)
+
def sanitize_label(label, nprofiles):
label = ensure_list(label)
@@ -156,16 +160,17 @@
This creates profiles of a single dataset.
- >>> pf = load("enzo_tiny_cosmology/DD0046/DD0046")
- >>> ad = pf.h.all_data()
+ >>> import yt
+ >>> ds = yt.load("enzo_tiny_cosmology/DD0046/DD0046")
+ >>> ad = ds.all_data()
>>> plot = ProfilePlot(ad, "density", ["temperature", "velocity_x"],
- weight_field="cell_mass",
- plot_spec=dict(color='red', linestyle="--"))
+ ... weight_field="cell_mass",
+ ... plot_spec=dict(color='red', linestyle="--"))
>>> plot.save()
This creates profiles from a time series object.
-
- >>> es = simulation("AMRCosmology.enzo", "Enzo")
+
+ >>> es = yt.simulation("AMRCosmology.enzo", "Enzo")
>>> es.get_time_series()
>>> profiles = []
@@ -218,7 +223,9 @@
self.plot_spec = [dict() for p in self.profiles]
if not isinstance(self.plot_spec, list):
self.plot_spec = [self.plot_spec.copy() for p in self.profiles]
-
+
+ self.figures = FigureContainer()
+ self.axes = AxesContainer(self.figures)
self._setup_plots()
def save(self, name=None):
@@ -235,7 +242,7 @@
self._setup_plots()
unique = set(self.figures.values())
if len(unique) < len(self.figures):
- figiter = izip(xrange(len(unique)), sorted(unique))
+ iters = izip(xrange(len(unique)), sorted(unique))
else:
iters = self.figures.iteritems()
if name is None:
@@ -256,8 +263,7 @@
if isinstance(uid, types.TupleType):
uid = uid[1]
canvas = canvas_cls(fig)
- fn = "%s_1d-Profile_%s_%s%s" % \
- (prefix, xfn, uid, suffix)
+ fn = "%s_1d-Profile_%s_%s%s" % (prefix, xfn, uid, suffix)
mylog.info("Saving %s", fn)
canvas.print_figure(fn)
return self
@@ -276,8 +282,10 @@
Examples
--------
- >>> slc = SlicePlot(pf, "x", ["Density", "VelocityMagnitude"])
- >>> slc.show()
+ >>> import yt
+ >>> ds = yt.load('IsolatedGalaxy/galaxy0030/galaxy0030')
+ >>> pp = ProfilePlot(ds.all_data(), 'density', 'temperature')
+ >>> pp.show()
"""
if "__IPYTHON__" in dir(__builtin__):
@@ -290,14 +298,13 @@
else:
raise YTNotInsideNotebook
-
def _repr_html_(self):
"""Return an html representation of the plot object. Will display as a
png for each WindowPlotMPL instance in self.plots"""
ret = ''
unique = set(self.figures.values())
if len(unique) < len(self.figures):
- figiter = izip(xrange(len(unique)), sorted(unique))
+ iters = izip(xrange(len(unique)), sorted(unique))
else:
iters = self.figures.iteritems()
for uid, fig in iters:
@@ -310,14 +317,12 @@
return ret
def _setup_plots(self):
- self.figures = FigureContainer()
- self.axes = AxesContainer(self.figures)
for i, profile in enumerate(self.profiles):
for field, field_data in profile.items():
- self.axes[field].plot(np.array(profile.x),
- np.array(field_data),
- label=self.label[i],
- **self.plot_spec[i])
+ if field in self.axes:
+ self.axes[field].cla()
+ self.axes[field].plot(np.array(profile.x), np.array(field_data),
+ label=self.label[i], **self.plot_spec[i])
# This relies on 'profile' leaking
for fname, axes in self.axes.items():
@@ -327,6 +332,7 @@
axes.set_yscale(yscale)
axes.set_xlabel(xtitle)
axes.set_ylabel(ytitle)
+ axes.set_ylim(*self.axes.ylim[fname])
if any(self.label):
axes.legend(loc="best")
self._plot_valid = True
@@ -443,7 +449,7 @@
def set_unit(self, field, unit):
"""Sets a new unit for the requested field
- parameters
+ Parameters
----------
field : string
The name of the field that is to be changed.
@@ -460,6 +466,97 @@
raise KeyError("Field %s not in profile plot!" % (field))
return self
+ @invalidate_plot
+ def set_xlim(self, xmin=None, xmax=None):
+ """Sets the limits of the bin field
+
+ Parameters
+ ----------
+
+ xmin : float or None
+ The new x minimum. Defaults to None, which leaves the xmin
+ unchanged.
+
+ xmax : float or None
+ The new x maximum. Defaults to None, which leaves the xmax
+ unchanged.
+
+ Examples
+ --------
+
+ >>> import yt
+ >>> ds = yt.load('IsolatedGalaxy/galaxy0030/galaxy0030')
+ >>> pp = yt.ProfilePlot(ds.all_data(), 'density', 'temperature')
+ >>> pp.set_xlim(1e-29, 1e-24)
+ >>> pp.save()
+
+ """
+ for i, p in enumerate(self.profiles):
+ if xmin is None:
+ xmi = p.x_bins.min()
+ else:
+ xmi = xmin
+ if xmax is None:
+ xma = p.x_bins.max()
+ else:
+ xma = xmax
+ extrema = {p.x_field: ((xmi, str(p.x.units)), (xma, str(p.x.units)))}
+ units = {p.x_field: str(p.x.units)}
+ for field in p.field_map.values():
+ units[field] = str(p.field_data[field].units)
+ self.profiles[i] = \
+ create_profile(p.data_source, p.x_field,
+ n_bins=len(p.x_bins)-2,
+ fields=p.field_map.values(),
+ weight_field=p.weight_field,
+ accumulation=p.accumulation,
+ fractional=p.fractional,
+ extrema=extrema, units=units)
+ return self
+
+ @invalidate_plot
+ def set_ylim(self, field, ymin=None, ymax=None):
+ """Sets the plot limits for the specified field we are binning.
+
+ Parameters
+ ----------
+
+ field : string or field tuple
+
+ The field that we want to adjust the plot limits for.
+
+ ymin : float or None
+ The new y minimum. Defaults to None, which leaves the ymin
+ unchanged.
+
+ ymax : float or None
+ The new y maximum. Defaults to None, which leaves the ymax
+ unchanged.
+
+ Examples
+ --------
+
+ >>> import yt
+ >>> ds = yt.load('IsolatedGalaxy/galaxy0030/galaxy0030')
+ >>> pp = yt.ProfilePlot(ds.all_data(), 'density', ['temperature', 'x-velocity'])
+ >>> pp.set_ylim('temperature', 1e4, 1e6)
+ >>> pp.save()
+
+ """
+ for i, p in enumerate(self.profiles):
+ if field is 'all':
+ fields = self.axes.keys()
+ else:
+ fields = ensure_list(field)
+ for profile in self.profiles:
+ for field in profile.data_source._determine_fields(fields):
+ if field in profile.field_map:
+ field = profile.field_map[field]
+ self.axes.ylim[field] = (ymin, ymax)
+ # Continue on to the next profile.
+ break
+ return self
+
def _get_field_log(self, field_y, profile):
pf = profile.data_source.pf
yf, = profile.data_source._determine_fields([field_y])
@@ -508,7 +605,6 @@
self._get_field_label(field_y, yfi, y_unit, fractional)
return (x_title, y_title)
-
class PhasePlot(ImagePlotContainer):
r"""
@@ -570,10 +666,11 @@
Examples
--------
- >>> pf = load("enzo_tiny_cosmology/DD0046/DD0046")
+ >>> import yt
+ >>> pf = yt.load("enzo_tiny_cosmology/DD0046/DD0046")
>>> ad = pf.h.all_data()
>>> plot = PhasePlot(ad, "density", "temperature", ["cell_mass"],
- weight_field=None)
+ ... weight_field=None)
>>> plot.save()
>>> # Change plot properties.
@@ -706,7 +803,7 @@
self.plots[f] = PhasePlotMPL(self.profile.x, self.profile.y, data,
x_scale, y_scale, z_scale,
- self._colormaps[f], np.array(zlim),
+ self._colormaps[f], zlim,
self.figure_size, fp.get_size(),
fig, axes, cax)
@@ -852,11 +949,109 @@
self.profile.set_y_unit(unit)
elif field in fields:
self.profile.set_field_unit(field, unit)
+<<<<<<< local
self.plots[field].zmin, self.plots[field].zmax = (None, None)
+=======
+ self.plots[field].zmin.convert_to_units(unit)
+ self.plots[field].zmax.convert_to_units(unit)
+>>>>>>> other
else:
raise KeyError("Field %s not in phase plot!" % (field))
return self
+ @invalidate_plot
+ def set_xlim(self, xmin=None, xmax=None):
+ """Sets the limits of the x bin field
+
+ Parameters
+ ----------
+
+ xmin : float or None
+ The new x minimum. Defaults to None, which leaves the xmin
+ unchanged.
+
+ xmax : float or None
+ The new x maximum. Defaults to None, which leaves the xmax
+ unchanged.
+
+ Examples
+ --------
+
+ >>> import yt
+ >>> ds = yt.load('IsolatedGalaxy/galaxy0030/galaxy0030')
+ >>> pp = yt.PhasePlot(ds.all_data(), 'density', 'temperature', 'cell_mass')
+ >>> pp.set_xlim(1e-29, 1e-24)
+ >>> pp.save()
+
+ """
+ p = self.profile
+ if xmin is None:
+ xmin = p.x_bins.min()
+ if xmax is None:
+ xmax = p.x_bins.max()
+ units = {p.x_field: str(p.x.units),
+ p.y_field: str(p.y.units)}
+ self.profile = create_profile(
+ p.data_source,
+ [p.x_field, p.y_field],
+ p.field_map.values(),
+ n_bins=[len(p.x_bins)-2, len(p.y_bins)-2],
+ weight_field=p.weight_field,
+ accumulation=p.accumulation,
+ fractional=p.fractional,
+ units=units,
+ extrema={p.x_field: ((xmin, str(p.x.units)), (xmax, str(p.x.units))),
+ p.y_field: ((p.y_bins.min(), str(p.y.units)),
+ (p.y_bins.max(), str(p.y.units)))})
+ return self
+
+ @invalidate_plot
+ def set_ylim(self, ymin=None, ymax=None):
+ """Sets the plot limits for the y bin field.
+
+ Parameters
+ ----------
+
+ ymin : float or None
+ The new y minimum. Defaults to None, which leaves the ymin
+ unchanged.
+
+ ymax : float or None
+ The new y maximum. Defaults to None, which leaves the ymax
+ unchanged.
+
+ Examples
+ --------
+
+ >>> import yt
+ >>> ds = yt.load('IsolatedGalaxy/galaxy0030/galaxy0030')
+ >>> pp = yt.PhasePlot(ds.all_data(), 'density', 'temperature', 'cell_mass')
+ >>> pp.set_ylim(1e4, 1e6)
+ >>> pp.save()
+
+ """
+ p = self.profile
+ if ymin is None:
+ ymin = p.y_bins.min()
+ if ymax is None:
+ ymax = p.y_bins.max()
+ units = {p.x_field: str(p.x.units),
+ p.y_field: str(p.y.units)}
+ self.profile = create_profile(
+ p.data_source,
+ [p.x_field, p.y_field],
+ p.field_map.values(),
+ n_bins=[len(p.x_bins), len(p.y_bins)],
+ weight_field=p.weight_field,
+ accumulation=p.accumulation,
+ fractional=p.fractional,
+ units=units,
+ extrema={p.x_field: ((p.x_bins.min(), str(p.x.units)),
+ (p.x_bins.max(), str(p.x.units))),
+ p.y_field: ((ymin, str(p.y.units)), (ymax, str(p.y.units)))})
+
+ return self
+
def run_callbacks(self, *args):
raise NotImplementedError
def setup_callbacks(self, *args):
@@ -901,10 +1096,10 @@
norm = matplotlib.colors.Normalize(zlim[0], zlim[1])
self.image = None
self.cb = None
- self.image = self.axes.pcolormesh(np.array(x_data),
- np.array(y_data),
+ self.image = self.axes.pcolormesh(np.array(x_data),
+ np.array(y_data),
np.array(image_data.T),
- norm=norm,
+ norm=norm,
cmap=cmap)
self.axes.set_xscale(x_scale)
self.axes.set_yscale(y_scale)
https://bitbucket.org/yt_analysis/yt/commits/c0f32a058a33/
Changeset: c0f32a058a33
Branch: yt-3.0
User: ngoldbaum
Date: 2014-05-23 19:23:36
Summary: Fixing a broken merge.
Affected #: 1 file
diff -r 1cd4d300524a7dddec2ede6588d2739fdf54e7ee -r c0f32a058a335d2c6f955f05e171bf099ea4ec97 yt/visualization/profile_plotter.py
--- a/yt/visualization/profile_plotter.py
+++ b/yt/visualization/profile_plotter.py
@@ -949,12 +949,7 @@
self.profile.set_y_unit(unit)
elif field in fields:
self.profile.set_field_unit(field, unit)
-<<<<<<< local
self.plots[field].zmin, self.plots[field].zmax = (None, None)
-=======
- self.plots[field].zmin.convert_to_units(unit)
- self.plots[field].zmax.convert_to_units(unit)
->>>>>>> other
else:
raise KeyError("Field %s not in phase plot!" % (field))
return self
https://bitbucket.org/yt_analysis/yt/commits/4702092b7f7d/
Changeset: 4702092b7f7d
Branch: yt-3.0
User: ngoldbaum
Date: 2014-05-24 03:26:19
Summary: Need to cache the z units as well.
Affected #: 1 file
diff -r c0f32a058a335d2c6f955f05e171bf099ea4ec97 -r 4702092b7f7dd94137bc5efda428a62eb0532f04 yt/visualization/profile_plotter.py
--- a/yt/visualization/profile_plotter.py
+++ b/yt/visualization/profile_plotter.py
@@ -934,7 +934,7 @@
def set_unit(self, field, unit):
"""Sets a new unit for the requested field
- parameters
+ Parameters
----------
field : string
The name of the field that is to be changed.
@@ -986,6 +986,10 @@
xmax = p.x_bins.max()
units = {p.x_field: str(p.x.units),
p.y_field: str(p.y.units)}
+ zunits = dict((field, str(p.field_units[field])) for field in p.field_units)
+ extrema = {p.x_field: ((xmin, str(p.x.units)), (xmax, str(p.x.units))),
+ p.y_field: ((p.y_bins.min(), str(p.y.units)),
+ (p.y_bins.max(), str(p.y.units)))}
self.profile = create_profile(
p.data_source,
[p.x_field, p.y_field],
@@ -995,9 +999,9 @@
accumulation=p.accumulation,
fractional=p.fractional,
units=units,
- extrema={p.x_field: ((xmin, str(p.x.units)), (xmax, str(p.x.units))),
- p.y_field: ((p.y_bins.min(), str(p.y.units)),
- (p.y_bins.max(), str(p.y.units)))})
+ extrema=extrema)
+ for field in zunits:
+ self.profile.set_field_unit(field, zunits[field])
return self
@invalidate_plot
@@ -1032,6 +1036,10 @@
ymax = p.y_bins.max()
units = {p.x_field: str(p.x.units),
p.y_field: str(p.y.units)}
+ zunits = dict((field, str(p.field_units[field])) for field in p.field_units)
+ extrema = {p.x_field: ((p.x_bins.min(), str(p.x.units)),
+ (p.x_bins.max(), str(p.x.units))),
+ p.y_field: ((ymin, str(p.y.units)), (ymax, str(p.y.units)))}
self.profile = create_profile(
p.data_source,
[p.x_field, p.y_field],
@@ -1041,10 +1049,9 @@
accumulation=p.accumulation,
fractional=p.fractional,
units=units,
- extrema={p.x_field: ((p.x_bins.min(), str(p.x.units)),
- (p.x_bins.max(), str(p.x.units))),
- p.y_field: ((ymin, str(p.y.units)), (ymax, str(p.y.units)))})
-
+ extrema=extrema)
+ for field in zunits:
+ self.profile.set_field_unit(field, zunits[field])
return self
def run_callbacks(self, *args):
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