[yt-svn] commit/yt: 7 new changesets
commits-noreply at bitbucket.org
commits-noreply at bitbucket.org
Fri Apr 4 14:21:39 PDT 2014
7 new commits in yt:
https://bitbucket.org/yt_analysis/yt/commits/8206b449bbd1/
Changeset: 8206b449bbd1
Branch: yt-3.0
User: MatthewTurk
Date: 2014-04-04 19:58:48
Summary: Making the to_frb method work identically in cylindrical/polar coords.
Affected #: 1 file
diff -r 36f6b4794d39f28e68f02e2f9ce80bd516dd9f10 -r 8206b449bbd1ebda0f91e0625f9be4f8c8e3b352 yt/data_objects/data_containers.py
--- a/yt/data_objects/data_containers.py
+++ b/yt/data_objects/data_containers.py
@@ -793,8 +793,12 @@
if (self.pf.geometry == "cylindrical" and self.axis == 1) or \
(self.pf.geometry == "polar" and self.axis == 2):
+ if center is not None and center != (0.0, 0.0):
+ raise NotImplementedError
from yt.visualization.fixed_resolution import CylindricalFixedResolutionBuffer
- frb = CylindricalFixedResolutionBuffer(self, width, resolution)
+ if iterable(width): radius = max(width)
+ if iterable(resolution): resolution = max(resolution)
+ frb = CylindricalFixedResolutionBuffer(self, radius, resolution)
return frb
if center is None:
https://bitbucket.org/yt_analysis/yt/commits/94ed073fe5dd/
Changeset: 94ed073fe5dd
Branch: yt-3.0
User: MatthewTurk
Date: 2014-04-04 20:36:57
Summary: Making Cylindrical and Polar coordinates work with SlicePlot.
Affected #: 5 files
diff -r 8206b449bbd1ebda0f91e0625f9be4f8c8e3b352 -r 94ed073fe5dd5233daac5f8b6ad76cbc9e92654f yt/geometry/cartesian_coordinates.py
--- a/yt/geometry/cartesian_coordinates.py
+++ b/yt/geometry/cartesian_coordinates.py
@@ -19,6 +19,7 @@
CoordinateHandler, \
_unknown_coord, \
_get_coord_fields
+import yt.visualization._MPL as _MPL
class CartesianCoordinateHandler(CoordinateHandler):
@@ -46,19 +47,27 @@
("index", "x"), ("index", "y"), ("index", "z"),
("index", "cell_volume")])
- def pixelize(self, dimension, data_source, field, bounds, size, antialias = True):
+ def pixelize(self, dimension, data_source, field, bounds, size,
+ antialias = True, periodic = True):
if dimension < 3:
- return self._ortho_pixelize(data_source, field, bounds, size, antialias)
+ return self._ortho_pixelize(data_source, field, bounds, size,
+ antialias, dimension, periodic)
else:
- return self._oblique_pixelize(data_source, field, bounds, size, antialias)
+ return self._oblique_pixelize(data_source, field, bounds, size,
+ antialias)
- def _ortho_pixelize(self, data_source, field, bounds, size, antialias):
+ def _ortho_pixelize(self, data_source, field, bounds, size, antialias,
+ dim, periodic):
# We should be using fcoords
+ period = self.period[:2].copy() # dummy here
+ period[0] = self.period[self.x_axis[dim]]
+ period[1] = self.period[self.y_axis[dim]]
+ period = period.in_units("code_length").d
buff = _MPL.Pixelize(data_source['px'], data_source['py'],
data_source['pdx'], data_source['pdy'],
data_source[field], size[0], size[1],
bounds, int(antialias),
- True, self.period).transpose()
+ period, int(periodic)).transpose()
return buff
def _oblique_pixelize(self, data_source, field, bounds, size, antialias):
diff -r 8206b449bbd1ebda0f91e0625f9be4f8c8e3b352 -r 94ed073fe5dd5233daac5f8b6ad76cbc9e92654f yt/geometry/cylindrical_coordinates.py
--- a/yt/geometry/cylindrical_coordinates.py
+++ b/yt/geometry/cylindrical_coordinates.py
@@ -92,9 +92,9 @@
def _cyl_pixelize(self, data_source, field, bounds, size, antialias):
buff = pixelize_cylinder(data_source['r'],
- data_source['dr']/2.0,
+ data_source['dr'],
data_source['theta'],
- data_source['dtheta']/2.0,
+ data_source['dtheta'],
size[0], data_source[field], bounds[0])
return buff
diff -r 8206b449bbd1ebda0f91e0625f9be4f8c8e3b352 -r 94ed073fe5dd5233daac5f8b6ad76cbc9e92654f yt/geometry/polar_coordinates.py
--- a/yt/geometry/polar_coordinates.py
+++ b/yt/geometry/polar_coordinates.py
@@ -19,6 +19,8 @@
CoordinateHandler, \
_unknown_coord, \
_get_coord_fields
+from yt.utilities.lib.misc_utilities import \
+ pixelize_cylinder
class PolarCoordinateHandler(CoordinateHandler):
@@ -68,7 +70,7 @@
return self._ortho_pixelize(data_source, field, bounds, size,
antialias)
elif ax_name == "z":
- return self._cyl_pixelize(data_source, field, bounds, size,
+ return self._polar_pixelize(data_source, field, bounds, size,
antialias)
else:
# Pixelizing along a cylindrical surface is a bit tricky
@@ -84,11 +86,13 @@
return buff
def _polar_pixelize(self, data_source, field, bounds, size, antialias):
+ # Out bounds here will *always* be what plot window thinks are x0, x1,
+ # y0, y1, but which will actually be rmin, rmax, thetamin, thetamax.
buff = pixelize_cylinder(data_source['r'],
- data_source['dr']/2.0,
+ data_source['dr'],
data_source['theta'],
- data_source['dtheta']/2.0,
- size[0], data_source[field], bounds[0])
+ data_source['dtheta'],
+ size[0], data_source[field], bounds[1])
return buff
axis_name = { 0 : 'r', 1 : 'theta', 2 : 'z',
diff -r 8206b449bbd1ebda0f91e0625f9be4f8c8e3b352 -r 94ed073fe5dd5233daac5f8b6ad76cbc9e92654f yt/visualization/fixed_resolution.py
--- a/yt/visualization/fixed_resolution.py
+++ b/yt/visualization/fixed_resolution.py
@@ -124,15 +124,11 @@
if hasattr(b, "in_units"):
b = float(b.in_units("code_length"))
bounds.append(b)
- buff = _MPL.Pixelize(self.data_source['px'],
- self.data_source['py'],
- self.data_source['pdx'],
- self.data_source['pdy'],
- self.data_source[item],
- self.buff_size[0], self.buff_size[1],
- bounds, int(self.antialias),
- self._period, int(self.periodic),
- ).transpose()
+ buff = self.pf.coordinates.pixelize(self.data_source.axis,
+ self.data_source, item, bounds, self.buff_size,
+ int(self.antialias)).transpose()
+ # Need to add _period and self.periodic
+ # self._period, int(self.periodic)
ia = ImageArray(buff, input_units=self.data_source[item].units,
info=self._get_info(item))
self.data[item] = ia
diff -r 8206b449bbd1ebda0f91e0625f9be4f8c8e3b352 -r 94ed073fe5dd5233daac5f8b6ad76cbc9e92654f yt/visualization/plot_window.py
--- a/yt/visualization/plot_window.py
+++ b/yt/visualization/plot_window.py
@@ -161,8 +161,12 @@
return center
def get_window_parameters(axis, center, width, pf):
- width = get_sanitized_width(axis, width, None, pf)
- center = get_sanitized_center(center, pf)
+ if pf.geometry == "cartesian":
+ width = get_sanitized_width(axis, width, None, pf)
+ center = get_sanitized_center(center, pf)
+ elif pf.geometry in ("polar", "cylindrical"):
+ width = [pf.domain_right_edge[0]/2, pf.domain_right_edge[0]/2]
+ center = pf.arr([0.0, 0.0, 0.0], "code_length")
bounds = (center[x_dict[axis]]-width[0] / 2,
center[x_dict[axis]]+width[0] / 2,
center[y_dict[axis]]-width[1] / 2,
https://bitbucket.org/yt_analysis/yt/commits/b5dab7194c7c/
Changeset: b5dab7194c7c
Branch: yt-3.0
User: MatthewTurk
Date: 2014-04-04 20:48:30
Summary: We actually want 2*R for the width.
Affected #: 1 file
diff -r 94ed073fe5dd5233daac5f8b6ad76cbc9e92654f -r b5dab7194c7cce923415d7bb15534fc032ebed7e yt/visualization/plot_window.py
--- a/yt/visualization/plot_window.py
+++ b/yt/visualization/plot_window.py
@@ -165,7 +165,7 @@
width = get_sanitized_width(axis, width, None, pf)
center = get_sanitized_center(center, pf)
elif pf.geometry in ("polar", "cylindrical"):
- width = [pf.domain_right_edge[0]/2, pf.domain_right_edge[0]/2]
+ width = [pf.domain_right_edge[0]*2.0, pf.domain_right_edge[0]*2.0]
center = pf.arr([0.0, 0.0, 0.0], "code_length")
bounds = (center[x_dict[axis]]-width[0] / 2,
center[x_dict[axis]]+width[0] / 2,
https://bitbucket.org/yt_analysis/yt/commits/e4431bbd9a0f/
Changeset: e4431bbd9a0f
Branch: yt-3.0
User: MatthewTurk
Date: 2014-04-04 21:08:28
Summary: Adding explanatory text.
Affected #: 1 file
diff -r b5dab7194c7cce923415d7bb15534fc032ebed7e -r e4431bbd9a0f3dc1ad76527a461b6742042fdb83 yt/data_objects/data_containers.py
--- a/yt/data_objects/data_containers.py
+++ b/yt/data_objects/data_containers.py
@@ -794,7 +794,9 @@
if (self.pf.geometry == "cylindrical" and self.axis == 1) or \
(self.pf.geometry == "polar" and self.axis == 2):
if center is not None and center != (0.0, 0.0):
- raise NotImplementedError
+ raise NotImplementedError(
+ "Currently we only support images centered at R=0." +
+ "We plan to generalize this in the near future")
from yt.visualization.fixed_resolution import CylindricalFixedResolutionBuffer
if iterable(width): radius = max(width)
if iterable(resolution): resolution = max(resolution)
https://bitbucket.org/yt_analysis/yt/commits/0b2a92418809/
Changeset: 0b2a92418809
Branch: yt-3.0
User: MatthewTurk
Date: 2014-04-04 21:14:43
Summary: Adding space.
commit_count += 1
Affected #: 1 file
diff -r e4431bbd9a0f3dc1ad76527a461b6742042fdb83 -r 0b2a924188096c551d05f346568aab17018acc39 yt/data_objects/data_containers.py
--- a/yt/data_objects/data_containers.py
+++ b/yt/data_objects/data_containers.py
@@ -795,7 +795,7 @@
(self.pf.geometry == "polar" and self.axis == 2):
if center is not None and center != (0.0, 0.0):
raise NotImplementedError(
- "Currently we only support images centered at R=0." +
+ "Currently we only support images centered at R=0. " +
"We plan to generalize this in the near future")
from yt.visualization.fixed_resolution import CylindricalFixedResolutionBuffer
if iterable(width): radius = max(width)
https://bitbucket.org/yt_analysis/yt/commits/55ea797742b6/
Changeset: 55ea797742b6
Branch: yt-3.0
User: MatthewTurk
Date: 2014-04-04 21:44:35
Summary: Adding ability to pass geometry into some Stream datasets.
Note also that I've modified the hexahedral mesh calculations slightly for
masking of data to mesh with this.
Affected #: 4 files
diff -r 0b2a924188096c551d05f346568aab17018acc39 -r 55ea797742b6791787e4121ff2b8a464b3c343da yt/data_objects/unstructured_mesh.py
--- a/yt/data_objects/unstructured_mesh.py
+++ b/yt/data_objects/unstructured_mesh.py
@@ -161,7 +161,7 @@
mask = self._get_selector_mask(selector)
count = self.count(selector)
if count == 0: return 0
- dest[offset:offset+count] = source[mask]
+ dest[offset:offset+count] = source.flat[mask]
return count
def count(self, selector):
diff -r 0b2a924188096c551d05f346568aab17018acc39 -r 55ea797742b6791787e4121ff2b8a464b3c343da yt/frontends/stream/api.py
--- a/yt/frontends/stream/api.py
+++ b/yt/frontends/stream/api.py
@@ -22,6 +22,7 @@
load_amr_grids, \
load_particles, \
load_hexahedral_mesh, \
+ hexahedral_connectivity, \
load_octree, \
refine_amr
diff -r 0b2a924188096c551d05f346568aab17018acc39 -r 55ea797742b6791787e4121ff2b8a464b3c343da yt/frontends/stream/data_structures.py
--- a/yt/frontends/stream/data_structures.py
+++ b/yt/frontends/stream/data_structures.py
@@ -292,12 +292,14 @@
_field_info_class = StreamFieldInfo
_dataset_type = 'stream'
- def __init__(self, stream_handler, storage_filename = None):
+ def __init__(self, stream_handler, storage_filename = None,
+ geometry = "cartesian"):
#if parameter_override is None: parameter_override = {}
#self._parameter_override = parameter_override
#if conversion_override is None: conversion_override = {}
#self._conversion_override = conversion_override
+ self.geometry = geometry
self.stream_handler = stream_handler
name = "InMemoryParameterFile_%s" % (uuid.uuid4().hex)
from yt.data_objects.static_output import _cached_pfs
@@ -510,7 +512,8 @@
def load_uniform_grid(data, domain_dimensions, length_unit=None, bbox=None,
nprocs=1, sim_time=0.0, mass_unit=None, time_unit=None,
- velocity_unit=None, periodicity=(True, True, True)):
+ velocity_unit=None, periodicity=(True, True, True),
+ geometry = "cartesian"):
r"""Load a uniform grid of data into yt as a
:class:`~yt.frontends.stream.data_structures.StreamHandler`.
@@ -550,6 +553,8 @@
periodicity : tuple of booleans
Determines whether the data will be treated as periodic along
each axis
+ geometry : string
+ "cartesian", "cylindrical" or "polar"
Examples
--------
@@ -658,7 +663,7 @@
handler.simulation_time = sim_time
handler.cosmology_simulation = 0
- spf = StreamDataset(handler)
+ spf = StreamDataset(handler, geometry = geometry)
# Now figure out where the particles go
if number_of_particles > 0 :
@@ -678,7 +683,7 @@
def load_amr_grids(grid_data, domain_dimensions,
field_units=None, bbox=None, sim_time=0.0, length_unit=None,
mass_unit=None, time_unit=None, velocity_unit=None,
- periodicity=(True, True, True)):
+ periodicity=(True, True, True), geometry = "cartesian"):
r"""Load a set of grids of data into yt as a
:class:`~yt.frontends.stream.data_structures.StreamHandler`.
This should allow a sequence of grids of varying resolution of data to be
@@ -721,6 +726,8 @@
periodicity : tuple of booleans
Determines whether the data will be treated as periodic along
each axis
+ geometry : string
+ "cartesian", "cylindrical" or "polar"
Examples
--------
@@ -817,7 +824,7 @@
handler.simulation_time = sim_time
handler.cosmology_simulation = 0
- spf = StreamDataset(handler)
+ spf = StreamDataset(handler, geometry = geometry)
return spf
def refine_amr(base_pf, refinement_criteria, fluid_operators, max_level,
@@ -1123,7 +1130,8 @@
def load_hexahedral_mesh(data, connectivity, coordinates,
length_unit = None, bbox=None, sim_time=0.0,
mass_unit = None, time_unit = None,
- velocity_unit = None, periodicity=(True, True, True)):
+ velocity_unit = None, periodicity=(True, True, True),
+ geometry = "cartesian"):
r"""Load a hexahedral mesh of data into yt as a
:class:`~yt.frontends.stream.data_structures.StreamHandler`.
@@ -1157,6 +1165,8 @@
periodicity : tuple of booleans
Determines whether the data will be treated as periodic along
each axis
+ geometry : string
+ "cartesian", "cylindrical" or "polar"
"""
@@ -1214,7 +1224,7 @@
handler.simulation_time = sim_time
handler.cosmology_simulation = 0
- spf = StreamHexahedralDataset(handler)
+ spf = StreamHexahedralDataset(handler, geometry = geometry)
return spf
diff -r 0b2a924188096c551d05f346568aab17018acc39 -r 55ea797742b6791787e4121ff2b8a464b3c343da yt/geometry/cylindrical_coordinates.py
--- a/yt/geometry/cylindrical_coordinates.py
+++ b/yt/geometry/cylindrical_coordinates.py
@@ -20,6 +20,7 @@
CoordinateHandler, \
_unknown_coord, \
_get_coord_fields
+import yt.visualization._MPL as _MPL
#
# Cylindrical fields
#
https://bitbucket.org/yt_analysis/yt/commits/c08048dc7f10/
Changeset: c08048dc7f10
Branch: yt-3.0
User: ngoldbaum
Date: 2014-04-04 23:21:30
Summary: Merged in MatthewTurk/yt/yt-3.0 (pull request #798)
Beginning steps for PlotWindow with non-Cartesian coordinates
Affected #: 9 files
diff -r 918a6162882ffc2e6e16f8493e1d098119d9ed27 -r c08048dc7f10b4c23ce34322599988ad23fe1d45 yt/data_objects/data_containers.py
--- a/yt/data_objects/data_containers.py
+++ b/yt/data_objects/data_containers.py
@@ -793,8 +793,14 @@
if (self.pf.geometry == "cylindrical" and self.axis == 1) or \
(self.pf.geometry == "polar" and self.axis == 2):
+ if center is not None and center != (0.0, 0.0):
+ raise NotImplementedError(
+ "Currently we only support images centered at R=0. " +
+ "We plan to generalize this in the near future")
from yt.visualization.fixed_resolution import CylindricalFixedResolutionBuffer
- frb = CylindricalFixedResolutionBuffer(self, width, resolution)
+ if iterable(width): radius = max(width)
+ if iterable(resolution): resolution = max(resolution)
+ frb = CylindricalFixedResolutionBuffer(self, radius, resolution)
return frb
if center is None:
diff -r 918a6162882ffc2e6e16f8493e1d098119d9ed27 -r c08048dc7f10b4c23ce34322599988ad23fe1d45 yt/data_objects/unstructured_mesh.py
--- a/yt/data_objects/unstructured_mesh.py
+++ b/yt/data_objects/unstructured_mesh.py
@@ -161,7 +161,7 @@
mask = self._get_selector_mask(selector)
count = self.count(selector)
if count == 0: return 0
- dest[offset:offset+count] = source[mask]
+ dest[offset:offset+count] = source.flat[mask]
return count
def count(self, selector):
diff -r 918a6162882ffc2e6e16f8493e1d098119d9ed27 -r c08048dc7f10b4c23ce34322599988ad23fe1d45 yt/frontends/stream/api.py
--- a/yt/frontends/stream/api.py
+++ b/yt/frontends/stream/api.py
@@ -22,6 +22,7 @@
load_amr_grids, \
load_particles, \
load_hexahedral_mesh, \
+ hexahedral_connectivity, \
load_octree, \
refine_amr
diff -r 918a6162882ffc2e6e16f8493e1d098119d9ed27 -r c08048dc7f10b4c23ce34322599988ad23fe1d45 yt/frontends/stream/data_structures.py
--- a/yt/frontends/stream/data_structures.py
+++ b/yt/frontends/stream/data_structures.py
@@ -292,12 +292,14 @@
_field_info_class = StreamFieldInfo
_dataset_type = 'stream'
- def __init__(self, stream_handler, storage_filename = None):
+ def __init__(self, stream_handler, storage_filename = None,
+ geometry = "cartesian"):
#if parameter_override is None: parameter_override = {}
#self._parameter_override = parameter_override
#if conversion_override is None: conversion_override = {}
#self._conversion_override = conversion_override
+ self.geometry = geometry
self.stream_handler = stream_handler
name = "InMemoryParameterFile_%s" % (uuid.uuid4().hex)
from yt.data_objects.static_output import _cached_pfs
@@ -510,7 +512,8 @@
def load_uniform_grid(data, domain_dimensions, length_unit=None, bbox=None,
nprocs=1, sim_time=0.0, mass_unit=None, time_unit=None,
- velocity_unit=None, periodicity=(True, True, True)):
+ velocity_unit=None, periodicity=(True, True, True),
+ geometry = "cartesian"):
r"""Load a uniform grid of data into yt as a
:class:`~yt.frontends.stream.data_structures.StreamHandler`.
@@ -550,6 +553,8 @@
periodicity : tuple of booleans
Determines whether the data will be treated as periodic along
each axis
+ geometry : string
+ "cartesian", "cylindrical" or "polar"
Examples
--------
@@ -658,7 +663,7 @@
handler.simulation_time = sim_time
handler.cosmology_simulation = 0
- spf = StreamDataset(handler)
+ spf = StreamDataset(handler, geometry = geometry)
# Now figure out where the particles go
if number_of_particles > 0 :
@@ -678,7 +683,7 @@
def load_amr_grids(grid_data, domain_dimensions,
field_units=None, bbox=None, sim_time=0.0, length_unit=None,
mass_unit=None, time_unit=None, velocity_unit=None,
- periodicity=(True, True, True)):
+ periodicity=(True, True, True), geometry = "cartesian"):
r"""Load a set of grids of data into yt as a
:class:`~yt.frontends.stream.data_structures.StreamHandler`.
This should allow a sequence of grids of varying resolution of data to be
@@ -721,6 +726,8 @@
periodicity : tuple of booleans
Determines whether the data will be treated as periodic along
each axis
+ geometry : string
+ "cartesian", "cylindrical" or "polar"
Examples
--------
@@ -817,7 +824,7 @@
handler.simulation_time = sim_time
handler.cosmology_simulation = 0
- spf = StreamDataset(handler)
+ spf = StreamDataset(handler, geometry = geometry)
return spf
def refine_amr(base_pf, refinement_criteria, fluid_operators, max_level,
@@ -1123,7 +1130,8 @@
def load_hexahedral_mesh(data, connectivity, coordinates,
length_unit = None, bbox=None, sim_time=0.0,
mass_unit = None, time_unit = None,
- velocity_unit = None, periodicity=(True, True, True)):
+ velocity_unit = None, periodicity=(True, True, True),
+ geometry = "cartesian"):
r"""Load a hexahedral mesh of data into yt as a
:class:`~yt.frontends.stream.data_structures.StreamHandler`.
@@ -1157,6 +1165,8 @@
periodicity : tuple of booleans
Determines whether the data will be treated as periodic along
each axis
+ geometry : string
+ "cartesian", "cylindrical" or "polar"
"""
@@ -1214,7 +1224,7 @@
handler.simulation_time = sim_time
handler.cosmology_simulation = 0
- spf = StreamHexahedralDataset(handler)
+ spf = StreamHexahedralDataset(handler, geometry = geometry)
return spf
diff -r 918a6162882ffc2e6e16f8493e1d098119d9ed27 -r c08048dc7f10b4c23ce34322599988ad23fe1d45 yt/geometry/cartesian_coordinates.py
--- a/yt/geometry/cartesian_coordinates.py
+++ b/yt/geometry/cartesian_coordinates.py
@@ -19,6 +19,7 @@
CoordinateHandler, \
_unknown_coord, \
_get_coord_fields
+import yt.visualization._MPL as _MPL
class CartesianCoordinateHandler(CoordinateHandler):
@@ -46,19 +47,27 @@
("index", "x"), ("index", "y"), ("index", "z"),
("index", "cell_volume")])
- def pixelize(self, dimension, data_source, field, bounds, size, antialias = True):
+ def pixelize(self, dimension, data_source, field, bounds, size,
+ antialias = True, periodic = True):
if dimension < 3:
- return self._ortho_pixelize(data_source, field, bounds, size, antialias)
+ return self._ortho_pixelize(data_source, field, bounds, size,
+ antialias, dimension, periodic)
else:
- return self._oblique_pixelize(data_source, field, bounds, size, antialias)
+ return self._oblique_pixelize(data_source, field, bounds, size,
+ antialias)
- def _ortho_pixelize(self, data_source, field, bounds, size, antialias):
+ def _ortho_pixelize(self, data_source, field, bounds, size, antialias,
+ dim, periodic):
# We should be using fcoords
+ period = self.period[:2].copy() # dummy here
+ period[0] = self.period[self.x_axis[dim]]
+ period[1] = self.period[self.y_axis[dim]]
+ period = period.in_units("code_length").d
buff = _MPL.Pixelize(data_source['px'], data_source['py'],
data_source['pdx'], data_source['pdy'],
data_source[field], size[0], size[1],
bounds, int(antialias),
- True, self.period).transpose()
+ period, int(periodic)).transpose()
return buff
def _oblique_pixelize(self, data_source, field, bounds, size, antialias):
diff -r 918a6162882ffc2e6e16f8493e1d098119d9ed27 -r c08048dc7f10b4c23ce34322599988ad23fe1d45 yt/geometry/cylindrical_coordinates.py
--- a/yt/geometry/cylindrical_coordinates.py
+++ b/yt/geometry/cylindrical_coordinates.py
@@ -20,6 +20,7 @@
CoordinateHandler, \
_unknown_coord, \
_get_coord_fields
+import yt.visualization._MPL as _MPL
#
# Cylindrical fields
#
@@ -92,9 +93,9 @@
def _cyl_pixelize(self, data_source, field, bounds, size, antialias):
buff = pixelize_cylinder(data_source['r'],
- data_source['dr']/2.0,
+ data_source['dr'],
data_source['theta'],
- data_source['dtheta']/2.0,
+ data_source['dtheta'],
size[0], data_source[field], bounds[0])
return buff
diff -r 918a6162882ffc2e6e16f8493e1d098119d9ed27 -r c08048dc7f10b4c23ce34322599988ad23fe1d45 yt/geometry/polar_coordinates.py
--- a/yt/geometry/polar_coordinates.py
+++ b/yt/geometry/polar_coordinates.py
@@ -19,6 +19,8 @@
CoordinateHandler, \
_unknown_coord, \
_get_coord_fields
+from yt.utilities.lib.misc_utilities import \
+ pixelize_cylinder
class PolarCoordinateHandler(CoordinateHandler):
@@ -68,7 +70,7 @@
return self._ortho_pixelize(data_source, field, bounds, size,
antialias)
elif ax_name == "z":
- return self._cyl_pixelize(data_source, field, bounds, size,
+ return self._polar_pixelize(data_source, field, bounds, size,
antialias)
else:
# Pixelizing along a cylindrical surface is a bit tricky
@@ -84,11 +86,13 @@
return buff
def _polar_pixelize(self, data_source, field, bounds, size, antialias):
+ # Out bounds here will *always* be what plot window thinks are x0, x1,
+ # y0, y1, but which will actually be rmin, rmax, thetamin, thetamax.
buff = pixelize_cylinder(data_source['r'],
- data_source['dr']/2.0,
+ data_source['dr'],
data_source['theta'],
- data_source['dtheta']/2.0,
- size[0], data_source[field], bounds[0])
+ data_source['dtheta'],
+ size[0], data_source[field], bounds[1])
return buff
axis_name = { 0 : 'r', 1 : 'theta', 2 : 'z',
diff -r 918a6162882ffc2e6e16f8493e1d098119d9ed27 -r c08048dc7f10b4c23ce34322599988ad23fe1d45 yt/visualization/fixed_resolution.py
--- a/yt/visualization/fixed_resolution.py
+++ b/yt/visualization/fixed_resolution.py
@@ -124,15 +124,11 @@
if hasattr(b, "in_units"):
b = float(b.in_units("code_length"))
bounds.append(b)
- buff = _MPL.Pixelize(self.data_source['px'],
- self.data_source['py'],
- self.data_source['pdx'],
- self.data_source['pdy'],
- self.data_source[item],
- self.buff_size[0], self.buff_size[1],
- bounds, int(self.antialias),
- self._period, int(self.periodic),
- ).transpose()
+ buff = self.pf.coordinates.pixelize(self.data_source.axis,
+ self.data_source, item, bounds, self.buff_size,
+ int(self.antialias)).transpose()
+ # Need to add _period and self.periodic
+ # self._period, int(self.periodic)
ia = ImageArray(buff, input_units=self.data_source[item].units,
info=self._get_info(item))
self.data[item] = ia
diff -r 918a6162882ffc2e6e16f8493e1d098119d9ed27 -r c08048dc7f10b4c23ce34322599988ad23fe1d45 yt/visualization/plot_window.py
--- a/yt/visualization/plot_window.py
+++ b/yt/visualization/plot_window.py
@@ -161,8 +161,12 @@
return center
def get_window_parameters(axis, center, width, pf):
- width = get_sanitized_width(axis, width, None, pf)
- center = get_sanitized_center(center, pf)
+ if pf.geometry == "cartesian":
+ width = get_sanitized_width(axis, width, None, pf)
+ center = get_sanitized_center(center, pf)
+ elif pf.geometry in ("polar", "cylindrical"):
+ width = [pf.domain_right_edge[0]*2.0, pf.domain_right_edge[0]*2.0]
+ center = pf.arr([0.0, 0.0, 0.0], "code_length")
bounds = (center[x_dict[axis]]-width[0] / 2,
center[x_dict[axis]]+width[0] / 2,
center[y_dict[axis]]-width[1] / 2,
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