[yt-svn] commit/yt: 15 new changesets
commits-noreply at bitbucket.org
commits-noreply at bitbucket.org
Mon Aug 8 16:01:32 PDT 2016
15 new commits in yt:
https://bitbucket.org/yt_analysis/yt/commits/8539fd3f6a2c/
Changeset: 8539fd3f6a2c
Branch: yt
User: a_gilbert
Date: 2016-08-02 20:32:08+00:00
Summary: enabling right-handed coordinate systems to be toggled
Affected #: 2 files
diff -r 2c73913367acd93482a88841daebdd6cece35d2c -r 8539fd3f6a2ca50a809eb41aa287258188e2cbc9 yt/visualization/plot_window.py
--- a/yt/visualization/plot_window.py
+++ b/yt/visualization/plot_window.py
@@ -13,7 +13,6 @@
#
# The full license is in the file COPYING.txt, distributed with this software.
#-----------------------------------------------------------------------------
-
import numpy as np
import matplotlib
import types
@@ -172,11 +171,15 @@
window_size : float
The size of the window on the longest axis (in units of inches),
including the margins but not the colorbar.
+ right_handed : boolean
+ Whether the implicit east vector for the image generated is set to make a right
+ handed coordinate system with a north vector and the normal vector, the
+ direction of the 'window' into the data.
"""
def __init__(self, data_source, bounds, buff_size=(800,800), antialias=True,
- periodic=True, origin='center-window', oblique=False,
- window_size=8.0, fields=None, fontsize=18, aspect=None,
+ periodic=True, origin='center-window', oblique=False, right_handed=True,
+ window_size=8.0, fields=None, fontsize=18, aspect=None,
setup=False):
if not hasattr(self, "ds"):
self.ds = data_source.ds
@@ -186,8 +189,10 @@
self.center = None
self._periodic = periodic
self.oblique = oblique
+ self._rh = right_handed
self.buff_size = buff_size
self.antialias = antialias
+
self.aspect = aspect
skip = list(FixedResolutionBuffer._exclude_fields) + data_source._key_fields
if fields is None:
@@ -619,6 +624,11 @@
self._axes_unit_names = unit_name
return self
+ @invalidate_plot
+ def toggle_right_handed(self):
+ self._rh = not self._rh
+
+
class PWViewerMPL(PlotWindow):
"""Viewer using matplotlib as a backend via the WindowPlotMPL.
@@ -794,9 +804,11 @@
color_tuple = to_rgba(self._splat_color)
ia[locs] = color_tuple
ia = ImageArray(ia)
+ print("hello world")
else:
ia = image
-
+ if not self._rh:
+ ia = np.fliplr(ia)
self.plots[f] = WindowPlotMPL(
ia, self._field_transform[f].name,
self._field_transform[f].func,
@@ -1213,6 +1225,10 @@
('{yloc}', '{space}') ('lower', 'window')
('{yloc}', '{xloc}', '{space}') ('lower', 'right', 'window')
================================== ============================
+ right_handed : boolean
+ Whether the implicit east vector for the image generated is set to make a right
+ handed coordinate system with a normal vector, the direction of the
+ 'window' into the data.
fontsize : integer
The size of the fonts for the axis, colorbar, and tick labels.
field_parameters : dictionary
@@ -1237,7 +1253,7 @@
_frb_generator = FixedResolutionBuffer
def __init__(self, ds, axis, fields, center='c', width=None, axes_unit=None,
- origin='center-window', fontsize=18, field_parameters=None,
+ origin='center-window', right_handed=True, fontsize=18, field_parameters=None,
window_size=8.0, aspect=None, data_source=None):
# this will handle time series data and controllers
ts = self._initialize_dataset(ds)
@@ -1262,7 +1278,7 @@
validate_mesh_fields(slc, fields)
PWViewerMPL.__init__(self, slc, bounds, origin=origin,
fontsize=fontsize, fields=fields,
- window_size=window_size, aspect=aspect)
+ window_size=window_size, aspect=aspect, right_handed=right_handed)
if axes_unit is None:
axes_unit = get_axes_unit(width, ds)
self.set_axes_unit(axes_unit)
@@ -1349,7 +1365,10 @@
('{yloc}', '{space}') ('lower', 'window')
('{yloc}', '{xloc}', '{space}') ('lower', 'right', 'window')
================================== ============================
-
+ right_handed : boolean
+ Whether the implicit east vector for the image generated is set to make a right
+ handed coordinate system with the direction of the
+ 'window' into the data.
data_source : YTSelectionContainer Object
Object to be used for data selection. Defaults to a region covering
the entire simulation.
@@ -1402,8 +1421,8 @@
def __init__(self, ds, axis, fields, center='c', width=None, axes_unit=None,
weight_field=None, max_level=None, origin='center-window',
- fontsize=18, field_parameters=None, data_source=None,
- method = "integrate", proj_style = None, window_size=8.0,
+ right_handed=True, fontsize=18, field_parameters=None, data_source=None,
+ method = "integrate", proj_style = None, window_size=8.0,
aspect=None):
ts = self._initialize_dataset(ds)
self.ts = ts
@@ -1438,7 +1457,7 @@
field_parameters=field_parameters, method=method,
max_level=max_level)
PWViewerMPL.__init__(self, proj, bounds, fields=fields, origin=origin,
- fontsize=fontsize, window_size=window_size,
+ right_handed=right_handed, fontsize=fontsize, window_size=window_size,
aspect=aspect)
if axes_unit is None:
axes_unit = get_axes_unit(width, ds)
@@ -1502,6 +1521,10 @@
A vector defining the 'up' direction in the plot. This
option sets the orientation of the slicing plane. If not
set, an arbitrary grid-aligned north-vector is chosen.
+ right_handed : boolean
+ Whether the implicit east vector for the image generated is set to make a right
+ handed coordinate system with the north vector and the normal, the direction of the
+ 'window' into the data.
fontsize : integer
The size of the fonts for the axis, colorbar, and tick labels.
field_parameters : dictionary
@@ -1516,7 +1539,7 @@
_frb_generator = ObliqueFixedResolutionBuffer
def __init__(self, ds, normal, fields, center='c', width=None,
- axes_unit=None, north_vector=None, fontsize=18,
+ axes_unit=None, north_vector=None, right_handed=True, fontsize=18,
field_parameters=None, data_source=None):
(bounds, center_rot) = get_oblique_window_parameters(normal,center,width,ds)
if field_parameters is None:
@@ -1536,7 +1559,7 @@
# aren't well-defined for off-axis data objects
PWViewerMPL.__init__(self, cutting, bounds, fields=fields,
origin='center-window',periodic=False,
- oblique=True, fontsize=fontsize)
+ right_handed=right_handed, oblique=True, fontsize=fontsize)
if axes_unit is None:
axes_unit = get_axes_unit(width, ds)
self.set_axes_unit(axes_unit)
@@ -1638,6 +1661,10 @@
A vector defining the 'up' direction in the plot. This
option sets the orientation of the slicing plane. If not
set, an arbitrary grid-aligned north-vector is chosen.
+ right_handed : boolean
+ Whether the implicit east vector for the image generated is set to make a right
+ handed coordinate system with the north vector and the normal, the direction of the
+ 'window' into the data.
fontsize : integer
The size of the fonts for the axis, colorbar, and tick labels.
method : string
@@ -1660,8 +1687,9 @@
def __init__(self, ds, normal, fields, center='c', width=None,
depth=(1, '1'), axes_unit=None, weight_field=None,
- max_level=None, north_vector=None, volume=None, no_ghost=False,
- le=None, re=None, interpolated=False, fontsize=18, method="integrate"):
+ max_level=None, north_vector=None, right_handed=True,
+ volume=None, no_ghost=False, le=None, re=None,
+ interpolated=False, fontsize=18, method="integrate"):
(bounds, center_rot) = \
get_oblique_window_parameters(normal,center,width,ds,depth=depth)
fields = ensure_list(fields)[:]
@@ -1687,7 +1715,8 @@
# aren't well-defined for off-axis data objects
PWViewerMPL.__init__(
self, OffAxisProj, bounds, fields=fields, origin='center-window',
- periodic=False, oblique=True, fontsize=fontsize)
+ periodic=False, oblique=True, right_handed=right_handed,
+ fontsize=fontsize)
if axes_unit is None:
axes_unit = get_axes_unit(width, ds)
self.set_axes_unit(axes_unit)
diff -r 2c73913367acd93482a88841daebdd6cece35d2c -r 8539fd3f6a2ca50a809eb41aa287258188e2cbc9 yt/visualization/tests/test_plotwindow.py
--- a/yt/visualization/tests/test_plotwindow.py
+++ b/yt/visualization/tests/test_plotwindow.py
@@ -91,7 +91,8 @@
"set_window_size": [((7.0, ), {})],
"set_zlim": [(('density', 1e-25, 1e-23), {}),
(('density', 1e-25, None), {'dynamic_range': 4})],
- "zoom": [((10, ), {})]}
+ "zoom": [((10, ), {})],
+ "toggle_right_handed": []}
CENTER_SPECS = (
@@ -442,3 +443,4 @@
for field_name_list in field_names:
assert_raises(
YTInvalidFieldType, object, ds, normal, field_name_list)
+
https://bitbucket.org/yt_analysis/yt/commits/bdb35783592e/
Changeset: bdb35783592e
Branch: yt
User: a_gilbert
Date: 2016-08-02 20:53:00+00:00
Summary: making new attribute explicit, removing a debugging feature.
Affected #: 1 file
diff -r 8539fd3f6a2ca50a809eb41aa287258188e2cbc9 -r bdb35783592e6bdf2cc2edbd7bbe653ad9f33174 yt/visualization/plot_window.py
--- a/yt/visualization/plot_window.py
+++ b/yt/visualization/plot_window.py
@@ -189,7 +189,7 @@
self.center = None
self._periodic = periodic
self.oblique = oblique
- self._rh = right_handed
+ self._right_handed = right_handed
self.buff_size = buff_size
self.antialias = antialias
@@ -804,7 +804,6 @@
color_tuple = to_rgba(self._splat_color)
ia[locs] = color_tuple
ia = ImageArray(ia)
- print("hello world")
else:
ia = image
if not self._rh:
https://bitbucket.org/yt_analysis/yt/commits/43ced2b9fbb3/
Changeset: 43ced2b9fbb3
Branch: yt
User: a_gilbert
Date: 2016-08-02 20:56:37+00:00
Summary: updating all references to _rh to _right_handed
Affected #: 1 file
diff -r bdb35783592e6bdf2cc2edbd7bbe653ad9f33174 -r 43ced2b9fbb3b7eb14fc453965bd0bacb3a73e8b yt/visualization/plot_window.py
--- a/yt/visualization/plot_window.py
+++ b/yt/visualization/plot_window.py
@@ -626,7 +626,7 @@
@invalidate_plot
def toggle_right_handed(self):
- self._rh = not self._rh
+ self._right_handed = not self._right_handed
class PWViewerMPL(PlotWindow):
https://bitbucket.org/yt_analysis/yt/commits/4bb71d2d3a88/
Changeset: 4bb71d2d3a88
Branch: yt
User: a_gilbert
Date: 2016-08-02 21:15:38+00:00
Summary: updating documentation.
Affected #: 1 file
diff -r 43ced2b9fbb3b7eb14fc453965bd0bacb3a73e8b -r 4bb71d2d3a88a789a28dd781bedc727e645a40b2 doc/source/visualizing/plots.rst
--- a/doc/source/visualizing/plots.rst
+++ b/doc/source/visualizing/plots.rst
@@ -519,6 +519,23 @@
slc.set_center((0.5, 0.503))
slc.save()
+Flipping the plot view axes
+~~~~~~~~~~~~~~~~~~~~~~~~~~~
+By default, all :class:`~yt.visualization.plot_window.PlotWindow` objects plot
+with the assumption that the eastern direction on the plot forms a right handed
+coordinate system with the ``normal`` and ``north_vector`` for the system, whether
+explicitly or implicitly defined. This setting can be toggled or explicitly defined
+by the user at initialization:
+
+.. python-script::
+
+ import yt
+ ds = yt.load("IsolatedGalaxy/galaxy0030/galaxy0030")
+ #slicing with non right-handed coordinates
+ slc = yt.SlicePlot(ds, 'x', 'density', right_handed=False)
+ #switching to right-handed coordinates
+ slc.toggle_right_handed()
+ slc.save()
.. _hiding-colorbar-and-axes:
@@ -686,6 +703,7 @@
slc.set_cbar_minorticks('all', 'off')
slc.save()
+
.. _matplotlib-customization:
Further customization via matplotlib
https://bitbucket.org/yt_analysis/yt/commits/1d785a644c94/
Changeset: 1d785a644c94
Branch: yt
User: a_gilbert
Date: 2016-08-02 21:24:00+00:00
Summary: making docs more robust
Affected #: 1 file
diff -r 4bb71d2d3a88a789a28dd781bedc727e645a40b2 -r 1d785a644c940f07a96b1a426cab38ecb609c7a8 doc/source/visualizing/plots.rst
--- a/doc/source/visualizing/plots.rst
+++ b/doc/source/visualizing/plots.rst
@@ -533,8 +533,11 @@
ds = yt.load("IsolatedGalaxy/galaxy0030/galaxy0030")
#slicing with non right-handed coordinates
slc = yt.SlicePlot(ds, 'x', 'density', right_handed=False)
+ slc.annotate_title('Not Right Handed')
+ slc.save()
#switching to right-handed coordinates
slc.toggle_right_handed()
+ slc.annotate_title('Right Handed')
slc.save()
.. _hiding-colorbar-and-axes:
https://bitbucket.org/yt_analysis/yt/commits/0ce7702985f9/
Changeset: 0ce7702985f9
Branch: yt
User: a_gilbert
Date: 2016-08-02 23:58:08+00:00
Summary: replacing _rh with appropriate name
Affected #: 1 file
diff -r 1d785a644c940f07a96b1a426cab38ecb609c7a8 -r 0ce7702985f9f1c8f1a1c55d3230e65ea178bb27 yt/visualization/plot_window.py
--- a/yt/visualization/plot_window.py
+++ b/yt/visualization/plot_window.py
@@ -806,7 +806,7 @@
ia = ImageArray(ia)
else:
ia = image
- if not self._rh:
+ if not self._r:
ia = np.fliplr(ia)
self.plots[f] = WindowPlotMPL(
ia, self._field_transform[f].name,
https://bitbucket.org/yt_analysis/yt/commits/2ba811ec4164/
Changeset: 2ba811ec4164
Branch: yt
User: a_gilbert
Date: 2016-08-03 00:03:51+00:00
Summary: name replacement
Affected #: 1 file
diff -r 0ce7702985f9f1c8f1a1c55d3230e65ea178bb27 -r 2ba811ec4164a643d0d02e38c1227f87055a7a25 yt/visualization/plot_window.py
--- a/yt/visualization/plot_window.py
+++ b/yt/visualization/plot_window.py
@@ -806,7 +806,7 @@
ia = ImageArray(ia)
else:
ia = image
- if not self._r:
+ if not self._right_handed:
ia = np.fliplr(ia)
self.plots[f] = WindowPlotMPL(
ia, self._field_transform[f].name,
https://bitbucket.org/yt_analysis/yt/commits/f646dc76aca7/
Changeset: f646dc76aca7
Branch: yt
User: a_gilbert
Date: 2016-08-03 17:15:34+00:00
Summary: revising documentation.
Affected #: 1 file
diff -r 2ba811ec4164a643d0d02e38c1227f87055a7a25 -r f646dc76aca7bd00a499a23f525a370b6585b947 doc/source/visualizing/plots.rst
--- a/doc/source/visualizing/plots.rst
+++ b/doc/source/visualizing/plots.rst
@@ -532,9 +532,12 @@
import yt
ds = yt.load("IsolatedGalaxy/galaxy0030/galaxy0030")
#slicing with non right-handed coordinates
- slc = yt.SlicePlot(ds, 'x', 'density', right_handed=False)
+ slc = yt.SlicePlot(ds, 'x', 'velocity_x', right_handed=False)
slc.annotate_title('Not Right Handed')
slc.save()
+
+.. python-script::
+
#switching to right-handed coordinates
slc.toggle_right_handed()
slc.annotate_title('Right Handed')
https://bitbucket.org/yt_analysis/yt/commits/e6e119712de7/
Changeset: e6e119712de7
Branch: yt
User: a_gilbert
Date: 2016-08-04 16:24:55+00:00
Summary: updating tests
Affected #: 1 file
diff -r f646dc76aca7bd00a499a23f525a370b6585b947 -r e6e119712de7885d04874630a0ebdfaff3111e34 yt/visualization/tests/test_plotwindow.py
--- a/yt/visualization/tests/test_plotwindow.py
+++ b/yt/visualization/tests/test_plotwindow.py
@@ -92,7 +92,7 @@
"set_zlim": [(('density', 1e-25, 1e-23), {}),
(('density', 1e-25, None), {'dynamic_range': 4})],
"zoom": [((10, ), {})],
- "toggle_right_handed": []}
+ "toggle_right_handed": [((),{})]}
CENTER_SPECS = (
https://bitbucket.org/yt_analysis/yt/commits/ac325b7dc98b/
Changeset: ac325b7dc98b
Branch: yt
User: a_gilbert
Date: 2016-08-04 18:51:52+00:00
Summary: updating yaml file to generate new answers.
Affected #: 1 file
diff -r e6e119712de7885d04874630a0ebdfaff3111e34 -r ac325b7dc98b45821735d76ba2ab7dc41bdf9905 tests/tests.yaml
--- a/tests/tests.yaml
+++ b/tests/tests.yaml
@@ -39,7 +39,7 @@
local_owls_000:
- yt/frontends/owls/tests/test_outputs.py
- local_pw_003:
+ local_pw_004:
- yt/visualization/tests/test_plotwindow.py:test_attributes
- yt/visualization/tests/test_plotwindow.py:test_attributes_wt
- yt/visualization/tests/test_profile_plots.py:test_phase_plot_attributes
https://bitbucket.org/yt_analysis/yt/commits/fb31ed8423af/
Changeset: fb31ed8423af
Branch: yt
User: a_gilbert
Date: 2016-08-04 19:43:43+00:00
Summary: setting additional number b/c pr conflict
Affected #: 1 file
diff -r ac325b7dc98b45821735d76ba2ab7dc41bdf9905 -r fb31ed8423afe995a7db787627ff27de12d14693 tests/tests.yaml
--- a/tests/tests.yaml
+++ b/tests/tests.yaml
@@ -39,7 +39,7 @@
local_owls_000:
- yt/frontends/owls/tests/test_outputs.py
- local_pw_004:
+ local_pw_005:
- yt/visualization/tests/test_plotwindow.py:test_attributes
- yt/visualization/tests/test_plotwindow.py:test_attributes_wt
- yt/visualization/tests/test_profile_plots.py:test_phase_plot_attributes
https://bitbucket.org/yt_analysis/yt/commits/9491feda8c1e/
Changeset: 9491feda8c1e
Branch: yt
User: a_gilbert
Date: 2016-08-04 21:59:43+00:00
Summary: updating script in docs
Affected #: 1 file
diff -r fb31ed8423afe995a7db787627ff27de12d14693 -r 9491feda8c1e9f2fc9c1a4fd0e0ba5a22716e9b7 doc/source/visualizing/plots.rst
--- a/doc/source/visualizing/plots.rst
+++ b/doc/source/visualizing/plots.rst
@@ -534,14 +534,12 @@
#slicing with non right-handed coordinates
slc = yt.SlicePlot(ds, 'x', 'velocity_x', right_handed=False)
slc.annotate_title('Not Right Handed')
- slc.save()
-
-.. python-script::
+ slc.save("NotRightHanded.png")
#switching to right-handed coordinates
slc.toggle_right_handed()
slc.annotate_title('Right Handed')
- slc.save()
+ slc.save("Standard.png")
.. _hiding-colorbar-and-axes:
https://bitbucket.org/yt_analysis/yt/commits/54272925a7d9/
Changeset: 54272925a7d9
Branch: yt
User: a_gilbert
Date: 2016-08-08 19:08:08+00:00
Summary: Updating from Nathan's diff.
Affected #: 1 file
diff -r 9491feda8c1e9f2fc9c1a4fd0e0ba5a22716e9b7 -r 54272925a7d9a181e79243afea1d813ab82cc7ff yt/visualization/plot_window.py
--- a/yt/visualization/plot_window.py
+++ b/yt/visualization/plot_window.py
@@ -806,8 +806,6 @@
ia = ImageArray(ia)
else:
ia = image
- if not self._right_handed:
- ia = np.fliplr(ia)
self.plots[f] = WindowPlotMPL(
ia, self._field_transform[f].name,
self._field_transform[f].func,
@@ -815,6 +813,10 @@
self.figure_size, font_size,
self.aspect, fig, axes, cax)
+ if not self._right_handed:
+ ax = self.plots[f].axes
+ ax.invert_xaxis()
+
axes_unit_labels = ['', '']
comoving = False
hinv = False
https://bitbucket.org/yt_analysis/yt/commits/026d8c2212dc/
Changeset: 026d8c2212dc
Branch: yt
User: a_gilbert
Date: 2016-08-08 20:48:59+00:00
Summary: updating yaml
Affected #: 1 file
diff -r 54272925a7d9a181e79243afea1d813ab82cc7ff -r 026d8c2212dcdb4e38a069797f8d726e7d0065cd tests/tests.yaml
--- a/tests/tests.yaml
+++ b/tests/tests.yaml
@@ -39,7 +39,7 @@
local_owls_000:
- yt/frontends/owls/tests/test_outputs.py
- local_pw_005:
+ local_pw_006:
- yt/visualization/tests/test_plotwindow.py:test_attributes
- yt/visualization/tests/test_plotwindow.py:test_attributes_wt
- yt/visualization/tests/test_profile_plots.py:test_phase_plot_attributes
https://bitbucket.org/yt_analysis/yt/commits/b1165fbb7bd2/
Changeset: b1165fbb7bd2
Branch: yt
User: ngoldbaum
Date: 2016-08-08 23:01:03+00:00
Summary: Merged in a_gilbert/yt (pull request #2318)
Enabling right-handed coordinate systems to be toggled: solving Issue #1231
Affected #: 4 files
diff -r 2ecca0373b9b24eb84bd4dbd1d5c874ad3a6d0bc -r b1165fbb7bd24dcdbf61093a685f540567a7de87 doc/source/visualizing/plots.rst
--- a/doc/source/visualizing/plots.rst
+++ b/doc/source/visualizing/plots.rst
@@ -537,6 +537,27 @@
slc.set_center((0.5, 0.503))
slc.save()
+Flipping the plot view axes
+~~~~~~~~~~~~~~~~~~~~~~~~~~~
+By default, all :class:`~yt.visualization.plot_window.PlotWindow` objects plot
+with the assumption that the eastern direction on the plot forms a right handed
+coordinate system with the ``normal`` and ``north_vector`` for the system, whether
+explicitly or implicitly defined. This setting can be toggled or explicitly defined
+by the user at initialization:
+
+.. python-script::
+
+ import yt
+ ds = yt.load("IsolatedGalaxy/galaxy0030/galaxy0030")
+ #slicing with non right-handed coordinates
+ slc = yt.SlicePlot(ds, 'x', 'velocity_x', right_handed=False)
+ slc.annotate_title('Not Right Handed')
+ slc.save("NotRightHanded.png")
+
+ #switching to right-handed coordinates
+ slc.toggle_right_handed()
+ slc.annotate_title('Right Handed')
+ slc.save("Standard.png")
.. _hiding-colorbar-and-axes:
@@ -704,6 +725,7 @@
slc.set_cbar_minorticks('all', 'off')
slc.save()
+
.. _matplotlib-customization:
Further customization via matplotlib
diff -r 2ecca0373b9b24eb84bd4dbd1d5c874ad3a6d0bc -r b1165fbb7bd24dcdbf61093a685f540567a7de87 tests/tests.yaml
--- a/tests/tests.yaml
+++ b/tests/tests.yaml
@@ -39,7 +39,7 @@
local_owls_000:
- yt/frontends/owls/tests/test_outputs.py
- local_pw_003:
+ local_pw_006:
- yt/visualization/tests/test_plotwindow.py:test_attributes
- yt/visualization/tests/test_plotwindow.py:test_attributes_wt
- yt/visualization/tests/test_profile_plots.py:test_phase_plot_attributes
diff -r 2ecca0373b9b24eb84bd4dbd1d5c874ad3a6d0bc -r b1165fbb7bd24dcdbf61093a685f540567a7de87 yt/visualization/plot_window.py
--- a/yt/visualization/plot_window.py
+++ b/yt/visualization/plot_window.py
@@ -13,7 +13,6 @@
#
# The full license is in the file COPYING.txt, distributed with this software.
#-----------------------------------------------------------------------------
-
import numpy as np
import matplotlib
import types
@@ -173,11 +172,15 @@
window_size : float
The size of the window on the longest axis (in units of inches),
including the margins but not the colorbar.
+ right_handed : boolean
+ Whether the implicit east vector for the image generated is set to make a right
+ handed coordinate system with a north vector and the normal vector, the
+ direction of the 'window' into the data.
"""
def __init__(self, data_source, bounds, buff_size=(800,800), antialias=True,
- periodic=True, origin='center-window', oblique=False,
- window_size=8.0, fields=None, fontsize=18, aspect=None,
+ periodic=True, origin='center-window', oblique=False, right_handed=True,
+ window_size=8.0, fields=None, fontsize=18, aspect=None,
setup=False):
if not hasattr(self, "ds"):
self.ds = data_source.ds
@@ -187,8 +190,10 @@
self.center = None
self._periodic = periodic
self.oblique = oblique
+ self._right_handed = right_handed
self.buff_size = buff_size
self.antialias = antialias
+
self.aspect = aspect
skip = list(FixedResolutionBuffer._exclude_fields) + data_source._key_fields
if fields is None:
@@ -620,6 +625,11 @@
self._axes_unit_names = unit_name
return self
+ @invalidate_plot
+ def toggle_right_handed(self):
+ self._right_handed = not self._right_handed
+
+
class PWViewerMPL(PlotWindow):
"""Viewer using matplotlib as a backend via the WindowPlotMPL.
@@ -797,7 +807,6 @@
ia = ImageArray(ia)
else:
ia = image
-
self.plots[f] = WindowPlotMPL(
ia, self._field_transform[f].name,
self._field_transform[f].func,
@@ -805,6 +814,10 @@
self.figure_size, font_size,
self.aspect, fig, axes, cax)
+ if not self._right_handed:
+ ax = self.plots[f].axes
+ ax.invert_xaxis()
+
axes_unit_labels = ['', '']
comoving = False
hinv = False
@@ -1214,6 +1227,10 @@
('{yloc}', '{space}') ('lower', 'window')
('{yloc}', '{xloc}', '{space}') ('lower', 'right', 'window')
================================== ============================
+ right_handed : boolean
+ Whether the implicit east vector for the image generated is set to make a right
+ handed coordinate system with a normal vector, the direction of the
+ 'window' into the data.
fontsize : integer
The size of the fonts for the axis, colorbar, and tick labels.
field_parameters : dictionary
@@ -1238,7 +1255,7 @@
_frb_generator = FixedResolutionBuffer
def __init__(self, ds, axis, fields, center='c', width=None, axes_unit=None,
- origin='center-window', fontsize=18, field_parameters=None,
+ origin='center-window', right_handed=True, fontsize=18, field_parameters=None,
window_size=8.0, aspect=None, data_source=None):
# this will handle time series data and controllers
ts = self._initialize_dataset(ds)
@@ -1263,7 +1280,7 @@
validate_mesh_fields(slc, fields)
PWViewerMPL.__init__(self, slc, bounds, origin=origin,
fontsize=fontsize, fields=fields,
- window_size=window_size, aspect=aspect)
+ window_size=window_size, aspect=aspect, right_handed=right_handed)
if axes_unit is None:
axes_unit = get_axes_unit(width, ds)
self.set_axes_unit(axes_unit)
@@ -1350,7 +1367,10 @@
('{yloc}', '{space}') ('lower', 'window')
('{yloc}', '{xloc}', '{space}') ('lower', 'right', 'window')
================================== ============================
-
+ right_handed : boolean
+ Whether the implicit east vector for the image generated is set to make a right
+ handed coordinate system with the direction of the
+ 'window' into the data.
data_source : YTSelectionContainer Object
Object to be used for data selection. Defaults to a region covering
the entire simulation.
@@ -1403,8 +1423,8 @@
def __init__(self, ds, axis, fields, center='c', width=None, axes_unit=None,
weight_field=None, max_level=None, origin='center-window',
- fontsize=18, field_parameters=None, data_source=None,
- method = "integrate", proj_style = None, window_size=8.0,
+ right_handed=True, fontsize=18, field_parameters=None, data_source=None,
+ method = "integrate", proj_style = None, window_size=8.0,
aspect=None):
ts = self._initialize_dataset(ds)
self.ts = ts
@@ -1439,7 +1459,7 @@
field_parameters=field_parameters, method=method,
max_level=max_level)
PWViewerMPL.__init__(self, proj, bounds, fields=fields, origin=origin,
- fontsize=fontsize, window_size=window_size,
+ right_handed=right_handed, fontsize=fontsize, window_size=window_size,
aspect=aspect)
if axes_unit is None:
axes_unit = get_axes_unit(width, ds)
@@ -1503,6 +1523,10 @@
A vector defining the 'up' direction in the plot. This
option sets the orientation of the slicing plane. If not
set, an arbitrary grid-aligned north-vector is chosen.
+ right_handed : boolean
+ Whether the implicit east vector for the image generated is set to make a right
+ handed coordinate system with the north vector and the normal, the direction of the
+ 'window' into the data.
fontsize : integer
The size of the fonts for the axis, colorbar, and tick labels.
field_parameters : dictionary
@@ -1517,7 +1541,7 @@
_frb_generator = ObliqueFixedResolutionBuffer
def __init__(self, ds, normal, fields, center='c', width=None,
- axes_unit=None, north_vector=None, fontsize=18,
+ axes_unit=None, north_vector=None, right_handed=True, fontsize=18,
field_parameters=None, data_source=None):
(bounds, center_rot) = get_oblique_window_parameters(normal,center,width,ds)
if field_parameters is None:
@@ -1537,7 +1561,7 @@
# aren't well-defined for off-axis data objects
PWViewerMPL.__init__(self, cutting, bounds, fields=fields,
origin='center-window',periodic=False,
- oblique=True, fontsize=fontsize)
+ right_handed=right_handed, oblique=True, fontsize=fontsize)
if axes_unit is None:
axes_unit = get_axes_unit(width, ds)
self.set_axes_unit(axes_unit)
@@ -1639,6 +1663,10 @@
A vector defining the 'up' direction in the plot. This
option sets the orientation of the slicing plane. If not
set, an arbitrary grid-aligned north-vector is chosen.
+ right_handed : boolean
+ Whether the implicit east vector for the image generated is set to make a right
+ handed coordinate system with the north vector and the normal, the direction of the
+ 'window' into the data.
fontsize : integer
The size of the fonts for the axis, colorbar, and tick labels.
method : string
@@ -1661,8 +1689,9 @@
def __init__(self, ds, normal, fields, center='c', width=None,
depth=(1, '1'), axes_unit=None, weight_field=None,
- max_level=None, north_vector=None, volume=None, no_ghost=False,
- le=None, re=None, interpolated=False, fontsize=18, method="integrate"):
+ max_level=None, north_vector=None, right_handed=True,
+ volume=None, no_ghost=False, le=None, re=None,
+ interpolated=False, fontsize=18, method="integrate"):
(bounds, center_rot) = \
get_oblique_window_parameters(normal,center,width,ds,depth=depth)
fields = ensure_list(fields)[:]
@@ -1688,7 +1717,8 @@
# aren't well-defined for off-axis data objects
PWViewerMPL.__init__(
self, OffAxisProj, bounds, fields=fields, origin='center-window',
- periodic=False, oblique=True, fontsize=fontsize)
+ periodic=False, oblique=True, right_handed=right_handed,
+ fontsize=fontsize)
if axes_unit is None:
axes_unit = get_axes_unit(width, ds)
self.set_axes_unit(axes_unit)
diff -r 2ecca0373b9b24eb84bd4dbd1d5c874ad3a6d0bc -r b1165fbb7bd24dcdbf61093a685f540567a7de87 yt/visualization/tests/test_plotwindow.py
--- a/yt/visualization/tests/test_plotwindow.py
+++ b/yt/visualization/tests/test_plotwindow.py
@@ -91,7 +91,8 @@
"set_window_size": [((7.0, ), {})],
"set_zlim": [(('density', 1e-25, 1e-23), {}),
(('density', 1e-25, None), {'dynamic_range': 4})],
- "zoom": [((10, ), {})]}
+ "zoom": [((10, ), {})],
+ "toggle_right_handed": [((),{})]}
CENTER_SPECS = (
@@ -442,3 +443,4 @@
for field_name_list in field_names:
assert_raises(
YTInvalidFieldType, object, ds, normal, field_name_list)
+
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