[yt-svn] commit/yt: 8 new changesets
commits-noreply at bitbucket.org
commits-noreply at bitbucket.org
Mon May 12 04:47:50 PDT 2014
8 new commits in yt:
https://bitbucket.org/yt_analysis/yt/commits/168aeba08797/
Changeset: 168aeba08797
Branch: yt-3.0
User: ngoldbaum
Date: 2014-05-11 22:29:03
Summary: Fixing the aligned_cutting_plane recipe. Closes #838
Affected #: 2 files
diff -r 788d2640d9f4ba392b0fb20d95a1da3085192355 -r 168aeba0879714a7e47365238c440ec394a16ff3 doc/source/cookbook/aligned_cutting_plane.py
--- a/doc/source/cookbook/aligned_cutting_plane.py
+++ b/doc/source/cookbook/aligned_cutting_plane.py
@@ -3,10 +3,10 @@
# Load the dataset.
ds = yt.load("IsolatedGalaxy/galaxy0030/galaxy0030")
-# Create a 1 kpc radius sphere, centered on the max density. Note that this
-# sphere is very small compared to the size of our final plot, and it has a
-# non-axially aligned L vector.
-sp = ds.sphere("center", (15.0, "kpc"))
+# Create a 1 kpc radius sphere, centered on the maximum gas density. Note
+# that this sphere is very small compared to the size of our final plot,
+# and it has a non-axially aligned L vector.
+sp = ds.sphere("m", (1.0, "kpc"))
# Get the angular momentum vector for the sphere.
L = sp.quantities.angular_momentum_vector()
@@ -14,5 +14,5 @@
print "Angular momentum vector: {0}".format(L)
# Create an OffAxisSlicePlot on the object with the L vector as its normal
-p = yt.OffAxisSlicePlot(ds, L, "density", sp.center, (25, "kpc"))
+p = yt.OffAxisSlicePlot(ds, L, "density", sp.center, (15, "kpc"))
p.save()
diff -r 788d2640d9f4ba392b0fb20d95a1da3085192355 -r 168aeba0879714a7e47365238c440ec394a16ff3 yt/visualization/plot_window.py
--- a/yt/visualization/plot_window.py
+++ b/yt/visualization/plot_window.py
@@ -180,8 +180,8 @@
elif pf.geometry == "spherical":
if axis == 0:
width = pf.domain_width[1], pf.domain_width[2]
- center = 0.5*(pf.domain_left_edge +
- pf.domain_right_edge).in_units("code_length")
+ center = 0.5*(pf.domain_left_edge + pf.domain_right_edge)
+ center.convert_to_units("code_length")
else:
# Our default width here is the full domain
width = [pf.domain_right_edge[0]*2.0, pf.domain_right_edge[0]*2.0]
@@ -217,7 +217,8 @@
mat = np.transpose(np.column_stack((perp1,perp2,normal)))
center = np.dot(mat,center)
- bounds = tuple( ( (2*(i%2))-1)*width[i//2]/2 for i in range(len(width)*2))
+ w = tuple(el.in_units('unitary') for el in width)
+ bounds = tuple(((2*(i % 2))-1)*w[i//2]/2 for i in range(len(w)*2))
return (bounds, center)
https://bitbucket.org/yt_analysis/yt/commits/edf458c036bf/
Changeset: edf458c036bf
Branch: yt-3.0
User: ngoldbaum
Date: 2014-05-11 22:29:49
Summary: Making _set_center a bit more flexible when passed string arguments.
Affected #: 1 file
diff -r 168aeba0879714a7e47365238c440ec394a16ff3 -r edf458c036bfd196610c01cbc5969a56b9e0b74c yt/data_objects/data_containers.py
--- a/yt/data_objects/data_containers.py
+++ b/yt/data_objects/data_containers.py
@@ -139,12 +139,14 @@
return
elif isinstance(center, (types.ListType, types.TupleType, np.ndarray)):
center = self.pf.arr(center, 'code_length')
- elif center in ("c", "center"):
- center = self.pf.domain_center
- elif center == ("max"): # is this dangerous for race conditions?
- center = self.pf.h.find_max("density")[1]
- elif center.startswith("max_"):
- center = self.pf.h.find_max(center[4:])[1]
+ elif isinstance(center, basestring):
+ # is this dangerous for race conditions?
+ if center.lower() in ("c", "center"):
+ center = self.pf.domain_center
+ elif center.lower() in ("max", "m"):
+ center = self.pf.h.find_max(("gas", "density"))[1]
+ elif center.startswith("max_"):
+ center = self.pf.h.find_max(center[4:])[1]
else:
center = np.array(center, dtype='float64')
self.center = self.pf.arr(center, 'code_length')
https://bitbucket.org/yt_analysis/yt/commits/59ad32b4489b/
Changeset: 59ad32b4489b
Branch: yt-3.0
User: ngoldbaum
Date: 2014-05-11 22:31:34
Summary: Renaming and moving assert_valid_width_tuple to resolve a name collision.
Affected #: 3 files
diff -r edf458c036bfd196610c01cbc5969a56b9e0b74c -r 59ad32b4489b6a34439d3d1c4e3772749252c34f yt/data_objects/selection_data_containers.py
--- a/yt/data_objects/selection_data_containers.py
+++ b/yt/data_objects/selection_data_containers.py
@@ -447,12 +447,12 @@
>>> write_image(np.log10(frb["Density"]), 'density_1pc.png')
"""
if iterable(width):
- assert_valid_width_tuple(width)
+ validate_width_tuple(width)
width = self.pf.quan(width[0], width[1])
if height is None:
height = width
elif iterable(height):
- assert_valid_width_tuple(height)
+ validate_width_tuple(height)
height = self.pf.quan(height[0], height[1])
if not iterable(resolution):
resolution = (resolution, resolution)
diff -r edf458c036bfd196610c01cbc5969a56b9e0b74c -r 59ad32b4489b6a34439d3d1c4e3772749252c34f yt/funcs.py
--- a/yt/funcs.py
+++ b/yt/funcs.py
@@ -660,17 +660,14 @@
if not os.path.exists(path):
only_on_root(os.makedirs, path)
return path
-
-def assert_valid_width_tuple(width):
- try:
- assert iterable(width) and len(width) == 2, \
- "width (%s) is not a two element tuple" % width
- valid = isinstance(width[0], numeric_type) and isinstance(width[1], str)
+
+def validate_width_tuple(width):
+ if not iterable(width) or len(width) != 2:
+ raise YTInvalidWidthError("width (%s) is not a two element tuple" % width)
+ if not isinstance(width[0], numeric_type) and isinstance(width[1], basestring):
msg = "width (%s) is invalid. " % str(width)
msg += "Valid widths look like this: (12, 'au')"
- assert valid, msg
- except AssertionError, e:
- raise YTInvalidWidthError(e)
+ raise YTInvalidWidthError(msg)
def camelcase_to_underscore(name):
s1 = re.sub('(.)([A-Z][a-z]+)', r'\1_\2', name)
diff -r edf458c036bfd196610c01cbc5969a56b9e0b74c -r 59ad32b4489b6a34439d3d1c4e3772749252c34f yt/visualization/plot_window.py
--- a/yt/visualization/plot_window.py
+++ b/yt/visualization/plot_window.py
@@ -82,18 +82,10 @@
else:
return u
-def assert_valid_width_tuple(width):
- if not iterable(width) or len(width) != 2:
- raise YTInvalidWidthError("width (%s) is not a two element tuple" % width)
- if not isinstance(width[0], Number) and isinstance(width[1], basestring):
- msg = "width (%s) is invalid. " % str(width)
- msg += "Valid widths look like this: (12, 'au')"
- raise YTInvalidWidthError(msg)
-
def validate_iterable_width(width, pf, unit=None):
if isinstance(width[0], tuple) and isinstance(width[1], tuple):
- assert_valid_width_tuple(width[0])
- assert_valid_width_tuple(width[1])
+ validate_width_tuple(width[0])
+ validate_width_tuple(width[1])
return (pf.quan(width[0][0], fix_unitary(width[0][1])),
pf.quan(width[1][0], fix_unitary(width[1][1])))
elif isinstance(width[0], Number) and isinstance(width[1], Number):
@@ -102,11 +94,11 @@
elif isinstance(width[0], YTQuantity) and isinstance(width[1], YTQuantity):
return (pf.quan(width[0]), pf.quan(width[1]))
else:
- assert_valid_width_tuple(width)
+ validate_width_tuple(width)
# If width and unit are both valid width tuples, we
# assume width controls x and unit controls y
try:
- assert_valid_width_tuple(unit)
+ validate_width_tuple(unit)
return (pf.quan(width[0], fix_unitary(width[1])),
pf.quan(unit[0], fix_unitary(unit[1])))
except YTInvalidWidthError:
@@ -137,7 +129,7 @@
raise YTInvalidWidthError(width)
if depth is not None:
if iterable(depth):
- assert_valid_width_tuple(depth)
+ validate_width_tuple(depth)
depth = (pf.quan(depth[0], fix_unitary(depth[1])), )
elif isinstance(depth, Number):
depth = (pf.quan(depth, 'code_length',
https://bitbucket.org/yt_analysis/yt/commits/e62b521880c9/
Changeset: e62b521880c9
Branch: yt-3.0
User: ngoldbaum
Date: 2014-05-11 22:36:27
Summary: Fixing errors in plot_window.py caught by flake8
Affected #: 1 file
diff -r 59ad32b4489b6a34439d3d1c4e3772749252c34f -r e62b521880c9aacea23bb29b5bed9915874aab9f yt/visualization/plot_window.py
--- a/yt/visualization/plot_window.py
+++ b/yt/visualization/plot_window.py
@@ -17,8 +17,6 @@
import matplotlib
import types
import sys
-import os
-from yt.extern.six.moves import builtins, StringIO
import warnings
from matplotlib.delaunay.triangulate import Triangulation as triang
@@ -39,12 +37,19 @@
ImagePlotContainer, log_transform, linear_transform, \
invalidate_data, invalidate_plot, apply_callback
+from yt.data_objects.time_series import \
+ DatasetSeries
+from yt.extern.six.moves import \
+ StringIO
from yt.funcs import \
mylog, iterable, ensure_list, \
- fix_axis, assert_valid_width_tuple
-from yt.units.unit_object import Unit
+ fix_axis, validate_width_tuple
+from yt.units.unit_object import \
+ Unit
from yt.units.unit_registry import \
- UnitParseError
+ UnitParseError
+from yt.units.yt_array import \
+ YTArray, YTQuantity
from yt.utilities.png_writer import \
write_png_to_string
from yt.utilities.definitions import \
@@ -57,10 +62,6 @@
YTCannotParseUnitDisplayName, \
YTUnitConversionError
-from yt.data_objects.time_series import \
- DatasetSeries
-from yt.units.yt_array import YTArray, YTQuantity
-
# Some magic for dealing with pyparsing being included or not
# included in matplotlib (not in gentoo, yes in everything else)
# Also accounting for the fact that in 1.2.0, pyparsing got renamed.
@@ -336,10 +337,9 @@
bounds = self.xlim+self.ylim
if self._frb_generator is ObliqueFixedResolutionBuffer:
bounds = np.array(bounds)
- self.frb = self._frb_generator(self.data_source,
- bounds, self.buff_size,
- self.antialias,
- periodic=self._periodic)
+
+ self.frb = self._frb_generator(self.data_source, bounds, self.buff_size,
+ self.antialias, periodic=self._periodic)
if old_fields is None:
self.frb._get_data_source_fields()
else:
@@ -393,8 +393,7 @@
if len(deltas) != 2:
raise RuntimeError(
"The pan function accepts a two-element sequence.\n"
- "Received %s." % (deltas, )
- )
+ "Received %s." % (deltas, ))
if isinstance(deltas[0], Number) and isinstance(deltas[1], Number):
deltas = (self.pf.quan(deltas[0], 'code_length'),
self.pf.quan(deltas[1], 'code_length'))
@@ -406,8 +405,7 @@
else:
raise RuntimeError(
"The arguments of the pan function must be a sequence of floats,\n"
- "quantities, or (float, unit) tuples. Received %s." % (deltas, )
- )
+ "quantities, or (float, unit) tuples. Received %s." % (deltas, ))
self.xlim = (self.xlim[0] + deltas[0], self.xlim[1] + deltas[0])
self.ylim = (self.ylim[0] + deltas[1], self.ylim[1] + deltas[1])
return self
@@ -473,10 +471,10 @@
self.ylim = tuple(bounds[2:4])
if len(bounds) == 6:
self.zlim = tuple(bounds[4:6])
- mylog.info("xlim = %f %f" %self.xlim)
- mylog.info("ylim = %f %f" %self.ylim)
+ mylog.info("xlim = %f %f" % self.xlim)
+ mylog.info("ylim = %f %f" % self.ylim)
if hasattr(self,'zlim'):
- mylog.info("zlim = %f %f" %self.zlim)
+ mylog.info("zlim = %f %f" % self.zlim)
@invalidate_data
def set_width(self, width, unit = None):
@@ -627,12 +625,11 @@
Examples
--------
- >>> p = ProjectionPlot(pf, "y", "density")
- >>> p.show()
+ >>> from yt import load
+ >>> ds = load("IsolatedGalaxy/galaxy0030/galaxy0030")
+ >>> p = ProjectionPlot(ds, "y", "Density")
>>> p.set_axes_unit("kpc")
- >>> p.show()
- >>> p.set_axes_unit(None)
- >>> p.show()
+
"""
# blind except because it could be in conversion_factors or units
if unit_name is not None:
@@ -687,8 +684,8 @@
xllim, xrlim = self.xlim
yllim, yrlim = self.ylim
elif origin[2] == 'domain':
- xax = pf.coordinates.x_axis[axis_index]
- yax = pf.coordinates.y_axis[axis_index]
+ xax = self.pf.coordinates.x_axis[axis_index]
+ yax = self.pf.coordinates.y_axis[axis_index]
xllim = self.pf.domain_left_edge[xax]
xrlim = self.pf.domain_right_edge[xax]
yllim = self.pf.domain_left_edge[yax]
@@ -699,8 +696,8 @@
else:
mylog.warn("origin = {0}".format(origin))
msg = \
- ('origin keyword "{0}" not recognized, must declare "domain" '
- 'or "center" as the last term in origin.').format(self.origin)
+ ('origin keyword "{0}" not recognized, must declare "domain" '
+ 'or "center" as the last term in origin.').format(self.origin)
raise RuntimeError(msg)
if origin[0] == 'lower':
@@ -749,7 +746,8 @@
# This will likely be replaced at some point by the coordinate handler
# setting plot aspect.
if self.aspect is None:
- self.aspect = np.float64(self.pf.quan(1.0, unit_y)/(self.pf.quan(1.0, unit_x)))
+ self.aspect = np.float64(self.pf.quan(1.0, unit_y) /
+ self.pf.quan(1.0, unit_x))
extentx = [(self.xlim[i] - xc).in_units(unit_x) for i in (0, 1)]
extenty = [(self.ylim[i] - yc).in_units(unit_y) for i in (0, 1)]
@@ -764,11 +762,10 @@
image = self.frb[f]
if image.max() == image.min():
- if self._field_transform[f] == log_transform:
- mylog.warning("Plot image for field %s has zero dynamic " \
- "range. Min = Max = %d." % \
- (f, image.max()))
- mylog.warning("Switching to linear colorbar scaling.")
+ if self._field_transform[f] == log_transform:
+ mylog.warning("Plot image for field %s has zero dynamic "
+ "range. Min = Max = %d." % (f, image.max()))
+ mylog.warning("Switching to linear colorbar scaling.")
self._field_transform[f] = linear_transform
fp = self._font_properties
@@ -886,10 +883,9 @@
if self._font_color is not None:
ax = self.plots[f].axes
cbax = self.plots[f].cb.ax
- labels = \
- ax.xaxis.get_ticklabels() + ax.yaxis.get_ticklabels() + \
- cbax.yaxis.get_ticklabels() + \
- [ax.xaxis.label, ax.yaxis.label, cbax.yaxis.label]
+ labels = ax.xaxis.get_ticklabels() + ax.yaxis.get_ticklabels()
+ labels += cbax.yaxis.get_ticklabels()
+ labels += [ax.xaxis.label, ax.yaxis.label, cbax.yaxis.label]
for label in labels:
label.set_color(self._font_color)
@@ -1006,8 +1002,9 @@
This will save an image the the file 'sliceplot_Density
- >>> pf = load('galaxy0030/galaxy0030')
- >>> p = SlicePlot(pf,2,'Density','c',(20,'kpc'))
+ >>> from yt import load
+ >>> ds = load('IsolatedGalaxy/galaxy0030/galaxy0030')
+ >>> p = SlicePlot(ds, 2, 'density', 'c', (20, 'kpc'))
>>> p.save('sliceplot')
"""
@@ -1131,11 +1128,12 @@
Examples
--------
- This is a very simple way of creating a projection plot.
+ Create a projection plot with a width of 20 kiloparsecs centered on the
+ center of the simulation box:
- >>> pf = load('galaxy0030/galaxy0030')
- >>> p = ProjectionPlot(pf,2,'Density','c',(20,'kpc'))
- >>> p.save('sliceplot')
+ >>> from yt import load
+ >>> ds = load('IsolateGalaxygalaxy0030/galaxy0030')
+ >>> p = ProjectionPlot(ds, "z", "density", width=(20, "kpc"))
"""
_plot_type = 'Projection'
@@ -1152,8 +1150,8 @@
(bounds, center) = get_window_parameters(axis, center, width, pf)
if field_parameters is None: field_parameters = {}
proj = pf.proj(fields, axis, weight_field=weight_field,
- center=center, data_source=data_source,
- field_parameters = field_parameters, style = proj_style)
+ center=center, data_source=data_source,
+ field_parameters = field_parameters, style = proj_style)
PWViewerMPL.__init__(self, proj, bounds, fields=fields, origin=origin,
fontsize=fontsize, window_size=window_size, aspect=aspect)
if axes_unit is None:
@@ -1402,14 +1400,14 @@
else:
fields = self.frb.data.keys()
addl_keys = {}
- if self._colorbar_valid == False:
+ if self._colorbar_valid is False:
addl_keys['colorbar_image'] = self._get_cbar_image()
self._colorbar_valid = True
min_zoom = 200*self.pf.index.get_smallest_dx() * self.pf['unitary']
for field in fields:
to_plot = apply_colormap(self.frb[field],
- func = self._field_transform[field],
- cmap_name = self._colormaps[field])
+ func = self._field_transform[field],
+ cmap_name = self._colormaps[field])
pngs = self._apply_modifications(to_plot)
img_data = base64.b64encode(pngs)
# We scale the width between 200*min_dx and 1.0
@@ -1475,7 +1473,7 @@
nx = self.frb.buff_size[0]/skip
ny = self.frb.buff_size[1]/skip
new_frb = FixedResolutionBuffer(self.frb.data_source,
- self.frb.bounds, (nx,ny))
+ self.frb.bounds, (nx,ny))
axis = self.frb.data_source.axis
xax = self.frb.data_source.pf.coordinates.x_axis[axis]
@@ -1536,17 +1534,16 @@
self.set_center((new_x, new_y))
def get_field_units(self, field, strip_mathml = True):
- ds = self.frb.data_source
- pf = self.pf
+ source = self.data_source
field = self._check_field(field)
- finfo = self.data_source.pf._get_field_info(*field)
- if ds._type_name in ("slice", "cutting"):
+ finfo = source.pf._get_field_info(*field)
+ if source._type_name in ("slice", "cutting"):
units = finfo.get_units()
- elif ds._type_name == "proj" and (ds.weight_field is not None or
- ds.proj_style == "mip"):
- units = finfo.get_units()
- elif ds._type_name == "proj":
- units = finfo.get_projected_units()
+ elif source._type_name == "proj":
+ if source.weight_field is not None or source.proj_style in ("mip", "sum"):
+ units = finfo.get_units()
+ else:
+ units = finfo.get_projected_units()
else:
units = ""
if strip_mathml:
@@ -1679,7 +1676,7 @@
axis : int or one of 'x', 'y', 'z'
An int corresponding to the axis to slice along (0=x, 1=y, 2=z)
or the axis name itself. If specified, this will replace normal.
-
+
The following are nominally keyword arguments passed onto the respective
slice plot objects generated by this function.
@@ -1765,10 +1762,12 @@
Examples
--------
- >>> slc = SlicePlot(pf, "x", "Density", center=[0.2,0.3,0.4])
- >>> slc = SlicePlot(pf, 2, "Temperature")
- >>> slc = SlicePlot(pf, [0.4,0.2,-0.1], "Pressure",
- north_vector=[0.2,-0.3,0.1])
+ >>> from yt import load
+ >>> ds = load("IsolatedGalaxy/galaxy0030/galaxy0030")
+ >>> slc = SlicePlot(ds, "x", "density", center=[0.2,0.3,0.4])
+ >>>
+ >>> slc = SlicePlot(ds, [0.4, 0.2, -0.1], "pressure",
+ ... north_vector=[0.2,-0.3,0.1])
"""
# Make sure we are passed a normal
@@ -1790,23 +1789,23 @@
else:
normal = np.array(normal)
np.divide(normal, np.dot(normal,normal), normal)
-
+
# by now the normal should be properly set to get either a On/Off Axis plot
if iterable(normal) and not isinstance(normal, basestring):
# OffAxisSlicePlot has hardcoded origin; remove it if in kwargs
- if 'origin' in kwargs:
+ if 'origin' in kwargs:
msg = "Ignoring 'origin' keyword as it is ill-defined for " \
"an OffAxisSlicePlot object."
mylog.warn(msg)
del kwargs['origin']
-
+
return OffAxisSlicePlot(pf, normal, fields, *args, **kwargs)
else:
# north_vector not used in AxisAlignedSlicePlots; remove it if in kwargs
- if 'north_vector' in kwargs:
+ if 'north_vector' in kwargs:
msg = "Ignoring 'north_vector' keyword as it is ill-defined for " \
"an AxisAlignedSlicePlot object."
mylog.warn(msg)
del kwargs['north_vector']
-
+
return AxisAlignedSlicePlot(pf, normal, fields, *args, **kwargs)
https://bitbucket.org/yt_analysis/yt/commits/e0324535d564/
Changeset: e0324535d564
Branch: yt-3.0
User: ngoldbaum
Date: 2014-05-11 23:41:33
Summary: Adding a license blurb to plot_container.py
Affected #: 1 file
diff -r e62b521880c9aacea23bb29b5bed9915874aab9f -r e0324535d564b7e1c0e14d13905b4d22e40b10c8 yt/visualization/plot_container.py
--- a/yt/visualization/plot_container.py
+++ b/yt/visualization/plot_container.py
@@ -1,3 +1,17 @@
+"""
+A base class for "image" plots with colorbars.
+
+
+
+"""
+
+#-----------------------------------------------------------------------------
+# Copyright (c) 2013, yt Development Team.
+#
+# Distributed under the terms of the Modified BSD License.
+#
+# The full license is in the file COPYING.txt, distributed with this software.
+#-----------------------------------------------------------------------------
import __builtin__
import base64
import numpy as np
https://bitbucket.org/yt_analysis/yt/commits/2e2bd6020cb4/
Changeset: 2e2bd6020cb4
Branch: yt-3.0
User: ngoldbaum
Date: 2014-05-11 23:42:00
Summary: Making PhasePlot work correctly with set_zlim.
Affected #: 1 file
diff -r e0324535d564b7e1c0e14d13905b4d22e40b10c8 -r 2e2bd6020cb46604229bc078a31dc727391ff7fb yt/visualization/profile_plotter.py
--- a/yt/visualization/profile_plotter.py
+++ b/yt/visualization/profile_plotter.py
@@ -16,6 +16,7 @@
import __builtin__
import base64
+import os
import types
from functools import wraps
@@ -230,7 +231,8 @@
The output file keyword.
"""
- if not self._plot_valid: self._setup_plots()
+ if not self._plot_valid:
+ self._setup_plots()
unique = set(self.figures.values())
if len(unique) < len(self.figures):
figiter = izip(xrange(len(unique)), sorted(unique))
@@ -677,9 +679,11 @@
cax = None
draw_colorbar = True
draw_axes = True
+ zlim = (None, None)
if f in self.plots:
draw_colorbar = self.plots[f]._draw_colorbar
draw_axes = self.plots[f]._draw_axes
+ zlim = (self.plots[f].zmin, self.plots[f].zmax)
if self.plots[f].figure is not None:
fig = self.plots[f].figure
axes = self.plots[f].axes
@@ -688,13 +692,14 @@
x_scale, y_scale, z_scale = self._get_field_log(f, self.profile)
x_title, y_title, z_title = self._get_field_title(f, self.profile)
- if z_scale == 'log':
- zmin = data[data > 0.0].min()
- self._field_transform[f] = log_transform
- else:
- zmin = data.min()
- self._field_transform[f] = linear_transform
- zlim = [zmin, data.max()]
+ if zlim == (None, None):
+ if z_scale == 'log':
+ zmin = data[data > 0.0].min()
+ self._field_transform[f] = log_transform
+ else:
+ zmin = data.min()
+ self._field_transform[f] = linear_transform
+ zlim = [zmin, data.max()]
fp = self._font_properties
f = self.profile.data_source._determine_fields(f)[0]
https://bitbucket.org/yt_analysis/yt/commits/5126cd10a6e6/
Changeset: 5126cd10a6e6
Branch: yt-3.0
User: ngoldbaum
Date: 2014-05-11 23:42:22
Summary: Making PhasePlot.save() more flexible, matching the behavior of PlotWindow.
Affected #: 1 file
diff -r 2e2bd6020cb46604229bc078a31dc727391ff7fb -r 5126cd10a6e68a6ded14a6b5b52b925cb51da930 yt/visualization/profile_plotter.py
--- a/yt/visualization/profile_plotter.py
+++ b/yt/visualization/profile_plotter.py
@@ -745,9 +745,11 @@
>>> plot.save(mpl_kwargs={'bbox_inches':'tight'})
"""
-
- if not self._plot_valid: self._setup_plots()
- if mpl_kwargs is None: mpl_kwargs = {}
+ names = []
+ if not self._plot_valid:
+ self._setup_plots()
+ if mpl_kwargs is None:
+ mpl_kwargs = {}
xfn = self.profile.x_field
yfn = self.profile.y_field
if isinstance(xfn, types.TupleType):
@@ -756,17 +758,25 @@
yfn = yfn[1]
for f in self.profile.field_data:
_f = f
- if isinstance(f, types.TupleType): _f = _f[1]
+ if isinstance(f, types.TupleType):
+ _f = _f[1]
middle = "2d-Profile_%s_%s_%s" % (xfn, yfn, _f)
if name is None:
prefix = self.profile.pf
- name = "%s.png" % prefix
+ if name[-1] == os.sep and not os.path.isdir(name):
+ os.mkdir(name)
+ if os.path.isdir(name) and name != str(self.pf):
+ prefix = name + (os.sep if name[-1] != os.sep else '') + str(self.pf)
suffix = get_image_suffix(name)
- prefix = name[:name.rfind(suffix)]
+ if suffix != '':
+ for k, v in self.plots.iteritems():
+ names.append(v.save(name, mpl_kwargs))
+ return names
+
fn = "%s_%s%s" % (prefix, middle, suffix)
- if not suffix:
- suffix = ".png"
+ names.append(fn)
self.plots[f].save(fn, mpl_kwargs)
+ return names
@invalidate_plot
def set_title(self, field, title):
https://bitbucket.org/yt_analysis/yt/commits/80b6a3399f45/
Changeset: 80b6a3399f45
Branch: yt-3.0
User: ngoldbaum
Date: 2014-05-12 08:15:18
Summary: This comment should be on this line, although I'm not 100% sure if it still applies.
Affected #: 1 file
diff -r 5126cd10a6e68a6ded14a6b5b52b925cb51da930 -r 80b6a3399f45da6e13828a947813cbe0e057f63d yt/data_objects/data_containers.py
--- a/yt/data_objects/data_containers.py
+++ b/yt/data_objects/data_containers.py
@@ -140,9 +140,9 @@
elif isinstance(center, (types.ListType, types.TupleType, np.ndarray)):
center = self.pf.arr(center, 'code_length')
elif isinstance(center, basestring):
- # is this dangerous for race conditions?
if center.lower() in ("c", "center"):
center = self.pf.domain_center
+ # is this dangerous for race conditions?
elif center.lower() in ("max", "m"):
center = self.pf.h.find_max(("gas", "density"))[1]
elif center.startswith("max_"):
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