[yt-svn] commit/yt: 10 new changesets

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Mon Nov 13 16:53:35 PST 2017


10 new commits in yt:

https://bitbucket.org/yt_analysis/yt/commits/53b6ba03e35d/
Changeset:   53b6ba03e35d
User:        jisuoqing
Date:        2017-10-30 21:54:22+00:00
Summary:     enable a few plot modifications for 2D cylindrical data
Affected #:  1 file

diff -r 21be624bbb559f9f6ff0c47251e53397d8804f1b -r 53b6ba03e35d78525dde4cbd5ebbff585546a9ca yt/visualization/plot_modifications.py
--- a/yt/visualization/plot_modifications.py
+++ b/yt/visualization/plot_modifications.py
@@ -47,6 +47,9 @@
     @wraps(func)
     def _check_geometry(self, plot):
         geom = plot.data.ds.coordinates.name
+        dims = plot.data.ds.dimensionality
+        # append dimensionality info to cylindrical geometry
+        if geom == "cylindrical": geom = "%s-%dd" % (geom, dims)
         supp = self._supported_geometries
         cs = getattr(self, "coord_system", None)
         if supp is None or geom in supp:
@@ -286,7 +289,7 @@
     strength.
     """
     _type_name = "velocity"
-    _supported_geometries = ("cartesian", "spectral_cube")
+    _supported_geometries = ("cartesian", "spectral_cube", "cylindrical-2d")
     def __init__(self, factor=16, scale=None, scale_units=None, normalize=False):
         PlotCallback.__init__(self)
         self.factor = factor
@@ -332,7 +335,7 @@
     clearly seen for fields with substantial variation in field strength.
     """
     _type_name = "magnetic_field"
-    _supported_geometries = ("cartesian", "spectral_cube")
+    _supported_geometries = ("cartesian", "spectral_cube", "cylindrical-2d")
     def __init__(self, factor=16, scale=None, scale_units=None, normalize=False):
         PlotCallback.__init__(self)
         self.factor = factor
@@ -365,7 +368,7 @@
     (see matplotlib.axes.Axes.quiver for more info)
     """
     _type_name = "quiver"
-    _supported_geometries = ("cartesian", "spectral_cube")
+    _supported_geometries = ("cartesian", "spectral_cube", "cylindrical-2d")
     def __init__(self, field_x, field_y, factor=16, scale=None,
                  scale_units=None, normalize=False, bv_x=0, bv_y=0):
         PlotCallback.__init__(self)
@@ -435,7 +438,7 @@
     queried.
     """
     _type_name = "contour"
-    _supported_geometries = ("cartesian", "spectral_cube")
+    _supported_geometries = ("cartesian", "spectral_cube", "cylindrical-2d")
     def __init__(self, field, ncont=5, factor=4, clim=None,
                  plot_args=None, label=False, take_log=None,
                  label_args=None, text_args=None, data_source=None):
@@ -560,7 +563,7 @@
     can change the linewidth of the displayed grids.
     """
     _type_name = "grids"
-    _supported_geometries = ("cartesian", "spectral_cube")
+    _supported_geometries = ("cartesian", "spectral_cube", "cylindrical-2d")
 
     def __init__(self, alpha=0.7, min_pix=1, min_pix_ids=20, draw_ids=False,
                  periodic=True, min_level=None, max_level=None,
@@ -671,7 +674,7 @@
     *field_color* is a field to be used to colormap the streamlines.
     """
     _type_name = "streamlines"
-    _supported_geometries = ("cartesian", "spectral_cube")
+    _supported_geometries = ("cartesian", "spectral_cube", "cylindrical-2d")
     def __init__(self, field_x, field_y, factor=16,
                  density=1, field_color=None, plot_args=None):
         PlotCallback.__init__(self)
@@ -772,7 +775,7 @@
 
     """
     _type_name = "line"
-    _supported_geometries = ("cartesian", "spectral_cube")
+    _supported_geometries = ("cartesian", "spectral_cube", "cylindrical-2d")
     def __init__(self, p1, p2, data_coords=False, coord_system="data",
                  plot_args=None):
         PlotCallback.__init__(self)
@@ -809,7 +812,7 @@
 
     """
     _type_name = "image_line"
-    _supported_geometries = ("cartesian", "spectral_cube")
+    _supported_geometries = ("cartesian", "spectral_cube", "cylindrical-2d")
     def __init__(self, p1, p2, data_coords=False, coord_system='axis',
                  plot_args=None):
         super(ImageLineCallback, self).__init__(p1, p2, data_coords,
@@ -881,7 +884,7 @@
     Take a list of *clumps* and plot them as a set of contours.
     """
     _type_name = "clumps"
-    _supported_geometries = ("cartesian", "spectral_cube")
+    _supported_geometries = ("cartesian", "spectral_cube", "cylindrical-2d")
     def __init__(self, clumps, plot_args=None):
         self.clumps = clumps
         if plot_args is None: plot_args = {}
@@ -1003,7 +1006,7 @@
 
     """
     _type_name = "arrow"
-    _supported_geometries = ("cartesian", "spectral_cube")
+    _supported_geometries = ("cartesian", "spectral_cube", "cylindrical-2d")
     def __init__(self, pos, code_size=None, length=0.03, width=0.0001,
                  head_width=0.01, head_length=0.01,
                  starting_pos=None, coord_system='data', plot_args=None):
@@ -1115,7 +1118,7 @@
 
     """
     _type_name = "marker"
-    _supported_geometries = ("cartesian", "spectral_cube")
+    _supported_geometries = ("cartesian", "spectral_cube", "cylindrical-2d")
     def __init__(self, pos, marker='x', coord_system="data", plot_args=None):
         def_plot_args = {'color':'w', 's':50}
         self.pos = pos
@@ -1184,7 +1187,7 @@
 
     """
     _type_name = "sphere"
-    _supported_geometries = ("cartesian", "spectral_cube")
+    _supported_geometries = ("cartesian", "spectral_cube", "cylindrical-2d")
     def __init__(self, center, radius, circle_args=None,
                  text=None, coord_system='data', text_args=None):
         def_text_args = {'color':'white'}
@@ -1295,7 +1298,7 @@
     >>> s.save()
     """
     _type_name = "text"
-    _supported_geometries = ("cartesian", "spectral_cube")
+    _supported_geometries = ("cartesian", "spectral_cube", "cylindrical-2d")
     def __init__(self, pos, text, data_coords=False, coord_system='data',
                  text_args=None, inset_box_args=None):
         def_text_args = {'color':'white'}
@@ -1335,7 +1338,7 @@
 
     """
     _type_name = "point"
-    _supported_geometries = ("cartesian", "spectral_cube")
+    _supported_geometries = ("cartesian", "spectral_cube", "cylindrical-2d")
     def __init__(self, pos, text, data_coords=False, coord_system='data',
                  text_args=None, inset_box_args=None):
         super(PointAnnotateCallback, self).__init__(pos, text, data_coords,
@@ -1506,7 +1509,7 @@
     _type_name = "particles"
     region = None
     _descriptor = None
-    _supported_geometries = ("cartesian", "spectral_cube")
+    _supported_geometries = ("cartesian", "spectral_cube", "cylindrical-2d")
     def __init__(self, width, p_size=1.0, col='k', marker='o', stride=1,
                  ptype='all', minimum_mass=None, alpha=1.0):
         PlotCallback.__init__(self)
@@ -1818,7 +1821,7 @@
     >>> s.annotate_timestamp()
     """
     _type_name = "timestamp"
-    _supported_geometries = ("cartesian", "spectral_cube")
+    _supported_geometries = ("cartesian", "spectral_cube", "cylindrical-2d")
     def __init__(self, x_pos=None, y_pos=None, corner='lower_left', time=True,
                  redshift=False, time_format="t = {time:.1f} {units}",
                  time_unit=None, redshift_format="z = {redshift:.2f}",
@@ -2315,7 +2318,7 @@
                                              lim=(0.5,0.65))
     """
     _type_name = "line_integral_convolution"
-    _supported_geometries = ("cartesian", "spectral_cube")
+    _supported_geometries = ("cartesian", "spectral_cube", "cylindrical-2d")
     def __init__(self, field_x, field_y, texture=None, kernellen=50.,
                  lim=(0.5,0.6), cmap='binary', alpha=0.8, const_alpha=False):
         PlotCallback.__init__(self)
@@ -2411,7 +2414,7 @@
     >>> s.save()
     """
     _type_name = "cell_edges"
-    _supported_geometries = ("cartesian", "spectral_cube")
+    _supported_geometries = ("cartesian", "spectral_cube", "cylindrical-2d")
     def __init__(self, line_width=0.002, alpha = 1.0, color='black'):
         from matplotlib.colors import ColorConverter
         conv = ColorConverter()


https://bitbucket.org/yt_analysis/yt/commits/7bfe59b16356/
Changeset:   7bfe59b16356
User:        jisuoqing
Date:        2017-10-30 22:05:49+00:00
Summary:     minor change
Affected #:  1 file

diff -r 53b6ba03e35d78525dde4cbd5ebbff585546a9ca -r 7bfe59b16356a43c454da8ee56a292152dedfbe9 yt/visualization/plot_modifications.py
--- a/yt/visualization/plot_modifications.py
+++ b/yt/visualization/plot_modifications.py
@@ -49,7 +49,7 @@
         geom = plot.data.ds.coordinates.name
         dims = plot.data.ds.dimensionality
         # append dimensionality info to cylindrical geometry
-        if geom == "cylindrical": geom = "%s-%dd" % (geom, dims)
+        if geom is "cylindrical": geom = "%s-%dd" % (geom, dims)
         supp = self._supported_geometries
         cs = getattr(self, "coord_system", None)
         if supp is None or geom in supp:


https://bitbucket.org/yt_analysis/yt/commits/c1fef8cd08ac/
Changeset:   c1fef8cd08ac
User:        jisuoqing
Date:        2017-10-30 22:07:46+00:00
Summary:     minor changes
Affected #:  1 file

diff -r 7bfe59b16356a43c454da8ee56a292152dedfbe9 -r c1fef8cd08ac9566c13415b817a6656f66549b37 yt/visualization/plot_modifications.py
--- a/yt/visualization/plot_modifications.py
+++ b/yt/visualization/plot_modifications.py
@@ -47,9 +47,9 @@
     @wraps(func)
     def _check_geometry(self, plot):
         geom = plot.data.ds.coordinates.name
-        dims = plot.data.ds.dimensionality
         # append dimensionality info to cylindrical geometry
-        if geom is "cylindrical": geom = "%s-%dd" % (geom, dims)
+        if geom is "cylindrical":
+            geom = "%s-%dd" % (geom, plot.data.ds.dimensionality)
         supp = self._supported_geometries
         cs = getattr(self, "coord_system", None)
         if supp is None or geom in supp:


https://bitbucket.org/yt_analysis/yt/commits/21989a901cdf/
Changeset:   21989a901cdf
User:        jisuoqing
Date:        2017-10-30 22:43:36+00:00
Summary:     minor change
Affected #:  1 file

diff -r c1fef8cd08ac9566c13415b817a6656f66549b37 -r 21989a901cdf0e2c2b02d71144eda27bbe98b3cd yt/visualization/plot_modifications.py
--- a/yt/visualization/plot_modifications.py
+++ b/yt/visualization/plot_modifications.py
@@ -48,7 +48,7 @@
     def _check_geometry(self, plot):
         geom = plot.data.ds.coordinates.name
         # append dimensionality info to cylindrical geometry
-        if geom is "cylindrical":
+        if geom == "cylindrical":
             geom = "%s-%dd" % (geom, plot.data.ds.dimensionality)
         supp = self._supported_geometries
         cs = getattr(self, "coord_system", None)


https://bitbucket.org/yt_analysis/yt/commits/b36e22805bd3/
Changeset:   b36e22805bd3
User:        jisuoqing
Date:        2017-11-03 08:47:28+00:00
Summary:     Add callback test for 2d cylindrical data
Affected #:  1 file

diff -r 21989a901cdf0e2c2b02d71144eda27bbe98b3cd -r b36e22805bd3ae5b922be5e57e3e5ed8bb61c4ac yt/visualization/tests/test_callbacks.py
--- a/yt/visualization/tests/test_callbacks.py
+++ b/yt/visualization/tests/test_callbacks.py
@@ -65,6 +65,9 @@
 #  X ray
 #  X line_integral_convolution
 
+# 2D cylindrical data for callback test
+cyl_2d = "WDMerger_hdf5_chk_1000"
+
 @contextlib.contextmanager
 def _cleanup_fname():
     tmpdir = tempfile.mkdtemp()
@@ -342,6 +345,7 @@
                         text_args={'color':'red'})
         assert_fname(p.save(prefix)[0])
 
+ at requires_ds(cyl_2d)
 def test_velocity_callback():
     with _cleanup_fname() as prefix:
         ds = fake_amr_ds(fields =
@@ -364,6 +368,12 @@
         assert_fname(p.save(prefix)[0])
 
     with _cleanup_fname() as prefix:
+        ds = yt.load(cyl_2d)
+        slc = SlicePlot(ds, "theta", "density")
+        slc.annotate_velocity()
+        assert_fname(slc.save(prefix)[0])
+
+    with _cleanup_fname() as prefix:
         ds = fake_amr_ds(fields = 
             ("density", "velocity_r", "velocity_theta", "velocity_phi"),
             geometry="spherical")
@@ -371,6 +381,7 @@
         p.annotate_velocity(factor=40, normalize=True)
         assert_raises(YTDataTypeUnsupported, p.save, prefix)
 
+ at requires_ds(cyl_2d)
 def test_magnetic_callback():
     with _cleanup_fname() as prefix:
         ds = fake_amr_ds(fields = ("density", "magnetic_field_x",
@@ -393,6 +404,12 @@
         assert_fname(p.save(prefix)[0])
 
     with _cleanup_fname() as prefix:
+        ds = yt.load(cyl_2d)
+        slc = ProjectionPlot(ds, "theta", "density")
+        slc.annotate_magnetic_field()
+        assert_fname(slc.save(prefix)[0])
+
+    with _cleanup_fname() as prefix:
         ds = fake_amr_ds(fields = ("density", "magnetic_field_r",
           "magnetic_field_theta", "magnetic_field_phi"),
           geometry="spherical")
@@ -401,6 +418,7 @@
             scale_units="inches", normalize = True)
         assert_raises(YTDataTypeUnsupported, p.save, prefix)
 
+ at requires_ds(cyl_2d)
 def test_quiver_callback():
     with _cleanup_fname() as prefix:
         ds = fake_amr_ds(fields =
@@ -424,6 +442,12 @@
         assert_fname(p.save(prefix)[0])
 
     with _cleanup_fname() as prefix:
+        ds = yt.load(cyl_2d)
+        slc = SlicePlot(ds, "theta", "density")
+        slc.annotate_quiver("velocity_x", "velocity_y")
+        assert_fname(slc.save(prefix)[0])
+
+    with _cleanup_fname() as prefix:
         ds = fake_amr_ds(fields = 
             ("density", "velocity_x", "velocity_theta", "velocity_phi"),
             geometry="spherical")
@@ -434,6 +458,7 @@
             bv_y = 0.5 * u.cm / u.s)
         assert_raises(YTDataTypeUnsupported, p.save, prefix)
 
+ at requires_ds(cyl_2d)
 def test_contour_callback():
     with _cleanup_fname() as prefix:
         ds = fake_amr_ds(fields = ("density", "temperature"))
@@ -465,6 +490,19 @@
         p.save(prefix)
 
     with _cleanup_fname() as prefix:
+        ds = yt.load(cyl_2d)
+        slc = SlicePlot(ds, "theta", "plasma_beta")
+        slc.annotate_contour(field,
+                             ncont=2,
+                             factor=7.,
+                             take_log=False,
+                             clim=(1.e-1,1.e1),
+                             label=True, 
+                             plot_args={"colors": ("c","w"), "linewidths": 1},
+                             text_args={"fmt": "%1.1f"})
+        assert_fname(slc.save(prefix)[0])
+
+    with _cleanup_fname() as prefix:
         ds = fake_amr_ds(fields = ("density", "temperature"),
                          geometry="spherical")
         p = SlicePlot(ds, "r", "density")
@@ -475,6 +513,7 @@
         assert_raises(YTDataTypeUnsupported, p.save, prefix)
 
 
+ at requires_ds(cyl_2d)
 def test_grids_callback():
     with _cleanup_fname() as prefix:
         ds = fake_amr_ds(fields = ("density",))
@@ -496,6 +535,12 @@
         p.save(prefix)
 
     with _cleanup_fname() as prefix:
+        ds = yt.load(cyl_2d)
+        slc = SlicePlot(ds, "theta", "density")
+        slc.annotate_grids()
+        assert_fname(slc.save(prefix)[0])
+
+    with _cleanup_fname() as prefix:
         ds = fake_amr_ds(fields = ("density",), geometry="spherical")
         p = SlicePlot(ds, "r", "density")
         p.annotate_grids(alpha=0.7, min_pix=10, min_pix_ids=30,
@@ -504,6 +549,7 @@
         assert_raises(YTDataTypeUnsupported, p.save, prefix)
 
 
+ at requires_ds(cyl_2d)
 def test_cell_edges_callback():
     with _cleanup_fname() as prefix:
         ds = fake_amr_ds(fields = ("density",))
@@ -524,6 +570,12 @@
         p.save(prefix)
 
     with _cleanup_fname() as prefix:
+        ds = yt.load(cyl_2d)
+        slc = SlicePlot(ds, "theta", "density")
+        slc.annotate_cell_edges()
+        assert_fname(slc.save(prefix)[0])
+
+    with _cleanup_fname() as prefix:
         ds = fake_amr_ds(fields = ("density",), geometry="spherical")
         p = SlicePlot(ds, "r", "density")
         p.annotate_cell_edges()
@@ -545,6 +597,7 @@
             assert_fname(sl.save(prefix)[0])
                 
 
+ at requires_ds(cyl_2d)
 def test_line_integral_convolution_callback():
     with _cleanup_fname() as prefix:
         ds = fake_amr_ds(fields =
@@ -568,6 +621,12 @@
         p.save(prefix)
 
     with _cleanup_fname() as prefix:
+        ds = yt.load(cyl_2d)
+        slc = SlicePlot(ds, "theta", "density")
+        slc.annotate_line_integral_convolution("magnetic_field_r", "magnetic_field_z")
+        assert_fname(slc.save(prefix)[0])
+
+    with _cleanup_fname() as prefix:
         ds = fake_amr_ds(fields = 
             ("density", "velocity_r", "velocity_theta", "velocity_phi"),
             geometry="spherical")


https://bitbucket.org/yt_analysis/yt/commits/de56b9fe842d/
Changeset:   de56b9fe842d
User:        jisuoqing
Date:        2017-11-03 21:32:18+00:00
Summary:     Fix not import error and change to require_file
Affected #:  1 file

diff -r b36e22805bd3ae5b922be5e57e3e5ed8bb61c4ac -r de56b9fe842d2b3009343b1207121a9b9d034591 yt/visualization/tests/test_callbacks.py
--- a/yt/visualization/tests/test_callbacks.py
+++ b/yt/visualization/tests/test_callbacks.py
@@ -24,13 +24,15 @@
     fake_amr_ds, \
     fake_tetrahedral_ds, \
     fake_hexahedral_ds, \
-    assert_fname
+    assert_fname, \
+    requires_file
 import yt.units as u
 from yt.utilities.exceptions import \
     YTPlotCallbackError, \
     YTDataTypeUnsupported
 from yt.visualization.api import \
     SlicePlot, ProjectionPlot, OffAxisSlicePlot
+from yt.convenience import load
 import contextlib
 
 # These are a very simple set of tests that verify that each callback is or is
@@ -345,7 +347,7 @@
                         text_args={'color':'red'})
         assert_fname(p.save(prefix)[0])
 
- at requires_ds(cyl_2d)
+ at requires_file(cyl_2d)
 def test_velocity_callback():
     with _cleanup_fname() as prefix:
         ds = fake_amr_ds(fields =
@@ -368,7 +370,7 @@
         assert_fname(p.save(prefix)[0])
 
     with _cleanup_fname() as prefix:
-        ds = yt.load(cyl_2d)
+        ds = load(cyl_2d)
         slc = SlicePlot(ds, "theta", "density")
         slc.annotate_velocity()
         assert_fname(slc.save(prefix)[0])
@@ -381,7 +383,7 @@
         p.annotate_velocity(factor=40, normalize=True)
         assert_raises(YTDataTypeUnsupported, p.save, prefix)
 
- at requires_ds(cyl_2d)
+ at requires_file(cyl_2d)
 def test_magnetic_callback():
     with _cleanup_fname() as prefix:
         ds = fake_amr_ds(fields = ("density", "magnetic_field_x",
@@ -404,7 +406,7 @@
         assert_fname(p.save(prefix)[0])
 
     with _cleanup_fname() as prefix:
-        ds = yt.load(cyl_2d)
+        ds = load(cyl_2d)
         slc = ProjectionPlot(ds, "theta", "density")
         slc.annotate_magnetic_field()
         assert_fname(slc.save(prefix)[0])
@@ -418,7 +420,7 @@
             scale_units="inches", normalize = True)
         assert_raises(YTDataTypeUnsupported, p.save, prefix)
 
- at requires_ds(cyl_2d)
+ at requires_file(cyl_2d)
 def test_quiver_callback():
     with _cleanup_fname() as prefix:
         ds = fake_amr_ds(fields =
@@ -442,7 +444,7 @@
         assert_fname(p.save(prefix)[0])
 
     with _cleanup_fname() as prefix:
-        ds = yt.load(cyl_2d)
+        ds = load(cyl_2d)
         slc = SlicePlot(ds, "theta", "density")
         slc.annotate_quiver("velocity_x", "velocity_y")
         assert_fname(slc.save(prefix)[0])
@@ -458,7 +460,7 @@
             bv_y = 0.5 * u.cm / u.s)
         assert_raises(YTDataTypeUnsupported, p.save, prefix)
 
- at requires_ds(cyl_2d)
+ at requires_file(cyl_2d)
 def test_contour_callback():
     with _cleanup_fname() as prefix:
         ds = fake_amr_ds(fields = ("density", "temperature"))
@@ -490,7 +492,7 @@
         p.save(prefix)
 
     with _cleanup_fname() as prefix:
-        ds = yt.load(cyl_2d)
+        ds = load(cyl_2d)
         slc = SlicePlot(ds, "theta", "plasma_beta")
         slc.annotate_contour(field,
                              ncont=2,
@@ -513,7 +515,7 @@
         assert_raises(YTDataTypeUnsupported, p.save, prefix)
 
 
- at requires_ds(cyl_2d)
+ at requires_file(cyl_2d)
 def test_grids_callback():
     with _cleanup_fname() as prefix:
         ds = fake_amr_ds(fields = ("density",))
@@ -535,7 +537,7 @@
         p.save(prefix)
 
     with _cleanup_fname() as prefix:
-        ds = yt.load(cyl_2d)
+        ds = load(cyl_2d)
         slc = SlicePlot(ds, "theta", "density")
         slc.annotate_grids()
         assert_fname(slc.save(prefix)[0])
@@ -549,7 +551,7 @@
         assert_raises(YTDataTypeUnsupported, p.save, prefix)
 
 
- at requires_ds(cyl_2d)
+ at requires_file(cyl_2d)
 def test_cell_edges_callback():
     with _cleanup_fname() as prefix:
         ds = fake_amr_ds(fields = ("density",))
@@ -570,7 +572,7 @@
         p.save(prefix)
 
     with _cleanup_fname() as prefix:
-        ds = yt.load(cyl_2d)
+        ds = load(cyl_2d)
         slc = SlicePlot(ds, "theta", "density")
         slc.annotate_cell_edges()
         assert_fname(slc.save(prefix)[0])
@@ -597,7 +599,7 @@
             assert_fname(sl.save(prefix)[0])
                 
 
- at requires_ds(cyl_2d)
+ at requires_file(cyl_2d)
 def test_line_integral_convolution_callback():
     with _cleanup_fname() as prefix:
         ds = fake_amr_ds(fields =
@@ -621,7 +623,7 @@
         p.save(prefix)
 
     with _cleanup_fname() as prefix:
-        ds = yt.load(cyl_2d)
+        ds = load(cyl_2d)
         slc = SlicePlot(ds, "theta", "density")
         slc.annotate_line_integral_convolution("magnetic_field_r", "magnetic_field_z")
         assert_fname(slc.save(prefix)[0])


https://bitbucket.org/yt_analysis/yt/commits/628e6a5ea4d2/
Changeset:   628e6a5ea4d2
User:        jisuoqing
Date:        2017-11-03 22:27:55+00:00
Summary:     typo fix
Affected #:  1 file

diff -r de56b9fe842d2b3009343b1207121a9b9d034591 -r 628e6a5ea4d292ab11476fc4de66ac6c744a3316 yt/visualization/tests/test_callbacks.py
--- a/yt/visualization/tests/test_callbacks.py
+++ b/yt/visualization/tests/test_callbacks.py
@@ -494,7 +494,7 @@
     with _cleanup_fname() as prefix:
         ds = load(cyl_2d)
         slc = SlicePlot(ds, "theta", "plasma_beta")
-        slc.annotate_contour(field,
+        slc.annotate_contour("plasma_beta",
                              ncont=2,
                              factor=7.,
                              take_log=False,


https://bitbucket.org/yt_analysis/yt/commits/27e1250e8bb2/
Changeset:   27e1250e8bb2
User:        jisuoqing
Date:        2017-11-10 23:29:23+00:00
Summary:     Fix dataset path
Affected #:  1 file

diff -r 628e6a5ea4d292ab11476fc4de66ac6c744a3316 -r 27e1250e8bb2b599b1e838b15265bdf0319df276 yt/visualization/tests/test_callbacks.py
--- a/yt/visualization/tests/test_callbacks.py
+++ b/yt/visualization/tests/test_callbacks.py
@@ -68,7 +68,7 @@
 #  X line_integral_convolution
 
 # 2D cylindrical data for callback test
-cyl_2d = "WDMerger_hdf5_chk_1000"
+cyl_2d = "WDMerger_hdf5_chk_1000/WDMerger_hdf5_chk_1000.hdf5"
 
 @contextlib.contextmanager
 def _cleanup_fname():


https://bitbucket.org/yt_analysis/yt/commits/b9da60b4a7d2/
Changeset:   b9da60b4a7d2
User:        jisuoqing
Date:        2017-11-11 01:10:47+00:00
Summary:     due to the existing bug that no velocity_r is found in cylindrical data, let remove velocity callback for now
Affected #:  2 files

diff -r 27e1250e8bb2b599b1e838b15265bdf0319df276 -r b9da60b4a7d2674e729a53fdfe4a8c67c26fd66c yt/visualization/plot_modifications.py
--- a/yt/visualization/plot_modifications.py
+++ b/yt/visualization/plot_modifications.py
@@ -289,7 +289,7 @@
     strength.
     """
     _type_name = "velocity"
-    _supported_geometries = ("cartesian", "spectral_cube", "cylindrical-2d")
+    _supported_geometries = ("cartesian", "spectral_cube")
     def __init__(self, factor=16, scale=None, scale_units=None, normalize=False):
         PlotCallback.__init__(self)
         self.factor = factor

diff -r 27e1250e8bb2b599b1e838b15265bdf0319df276 -r b9da60b4a7d2674e729a53fdfe4a8c67c26fd66c yt/visualization/tests/test_callbacks.py
--- a/yt/visualization/tests/test_callbacks.py
+++ b/yt/visualization/tests/test_callbacks.py
@@ -347,7 +347,6 @@
                         text_args={'color':'red'})
         assert_fname(p.save(prefix)[0])
 
- at requires_file(cyl_2d)
 def test_velocity_callback():
     with _cleanup_fname() as prefix:
         ds = fake_amr_ds(fields =
@@ -370,12 +369,6 @@
         assert_fname(p.save(prefix)[0])
 
     with _cleanup_fname() as prefix:
-        ds = load(cyl_2d)
-        slc = SlicePlot(ds, "theta", "density")
-        slc.annotate_velocity()
-        assert_fname(slc.save(prefix)[0])
-
-    with _cleanup_fname() as prefix:
         ds = fake_amr_ds(fields = 
             ("density", "velocity_r", "velocity_theta", "velocity_phi"),
             geometry="spherical")


https://bitbucket.org/yt_analysis/yt/commits/54cd1adee59e/
Changeset:   54cd1adee59e
User:        atmyers
Date:        2017-11-14 00:53:22+00:00
Summary:     Merge pull request #1598 from jisuoqing/master

Enable a few plot modifications for 2D cylindrical geometry
Affected #:  2 files

diff -r f675aaf2e660adb7d92124a1481ec604f022475e -r 54cd1adee59e22c8dea3997c8c2626c64a563f84 yt/visualization/plot_modifications.py
--- a/yt/visualization/plot_modifications.py
+++ b/yt/visualization/plot_modifications.py
@@ -47,6 +47,9 @@
     @wraps(func)
     def _check_geometry(self, plot):
         geom = plot.data.ds.coordinates.name
+        # append dimensionality info to cylindrical geometry
+        if geom == "cylindrical":
+            geom = "%s-%dd" % (geom, plot.data.ds.dimensionality)
         supp = self._supported_geometries
         cs = getattr(self, "coord_system", None)
         if supp is None or geom in supp:
@@ -332,7 +335,7 @@
     clearly seen for fields with substantial variation in field strength.
     """
     _type_name = "magnetic_field"
-    _supported_geometries = ("cartesian", "spectral_cube")
+    _supported_geometries = ("cartesian", "spectral_cube", "cylindrical-2d")
     def __init__(self, factor=16, scale=None, scale_units=None, normalize=False):
         PlotCallback.__init__(self)
         self.factor = factor
@@ -365,7 +368,7 @@
     (see matplotlib.axes.Axes.quiver for more info)
     """
     _type_name = "quiver"
-    _supported_geometries = ("cartesian", "spectral_cube")
+    _supported_geometries = ("cartesian", "spectral_cube", "cylindrical-2d")
     def __init__(self, field_x, field_y, factor=16, scale=None,
                  scale_units=None, normalize=False, bv_x=0, bv_y=0):
         PlotCallback.__init__(self)
@@ -435,7 +438,7 @@
     queried.
     """
     _type_name = "contour"
-    _supported_geometries = ("cartesian", "spectral_cube")
+    _supported_geometries = ("cartesian", "spectral_cube", "cylindrical-2d")
     def __init__(self, field, ncont=5, factor=4, clim=None,
                  plot_args=None, label=False, take_log=None,
                  label_args=None, text_args=None, data_source=None):
@@ -560,7 +563,7 @@
     can change the linewidth of the displayed grids.
     """
     _type_name = "grids"
-    _supported_geometries = ("cartesian", "spectral_cube")
+    _supported_geometries = ("cartesian", "spectral_cube", "cylindrical-2d")
 
     def __init__(self, alpha=0.7, min_pix=1, min_pix_ids=20, draw_ids=False,
                  periodic=True, min_level=None, max_level=None,
@@ -671,7 +674,7 @@
     *field_color* is a field to be used to colormap the streamlines.
     """
     _type_name = "streamlines"
-    _supported_geometries = ("cartesian", "spectral_cube")
+    _supported_geometries = ("cartesian", "spectral_cube", "cylindrical-2d")
     def __init__(self, field_x, field_y, factor=16,
                  density=1, field_color=None, plot_args=None):
         PlotCallback.__init__(self)
@@ -772,7 +775,7 @@
 
     """
     _type_name = "line"
-    _supported_geometries = ("cartesian", "spectral_cube")
+    _supported_geometries = ("cartesian", "spectral_cube", "cylindrical-2d")
     def __init__(self, p1, p2, data_coords=False, coord_system="data",
                  plot_args=None):
         PlotCallback.__init__(self)
@@ -809,7 +812,7 @@
 
     """
     _type_name = "image_line"
-    _supported_geometries = ("cartesian", "spectral_cube")
+    _supported_geometries = ("cartesian", "spectral_cube", "cylindrical-2d")
     def __init__(self, p1, p2, data_coords=False, coord_system='axis',
                  plot_args=None):
         super(ImageLineCallback, self).__init__(p1, p2, data_coords,
@@ -881,7 +884,7 @@
     Take a list of *clumps* and plot them as a set of contours.
     """
     _type_name = "clumps"
-    _supported_geometries = ("cartesian", "spectral_cube")
+    _supported_geometries = ("cartesian", "spectral_cube", "cylindrical-2d")
     def __init__(self, clumps, plot_args=None):
         self.clumps = clumps
         if plot_args is None: plot_args = {}
@@ -1003,7 +1006,7 @@
 
     """
     _type_name = "arrow"
-    _supported_geometries = ("cartesian", "spectral_cube")
+    _supported_geometries = ("cartesian", "spectral_cube", "cylindrical-2d")
     def __init__(self, pos, code_size=None, length=0.03, width=0.0001,
                  head_width=0.01, head_length=0.01,
                  starting_pos=None, coord_system='data', plot_args=None):
@@ -1115,7 +1118,7 @@
 
     """
     _type_name = "marker"
-    _supported_geometries = ("cartesian", "spectral_cube")
+    _supported_geometries = ("cartesian", "spectral_cube", "cylindrical-2d")
     def __init__(self, pos, marker='x', coord_system="data", plot_args=None):
         def_plot_args = {'color':'w', 's':50}
         self.pos = pos
@@ -1184,7 +1187,7 @@
 
     """
     _type_name = "sphere"
-    _supported_geometries = ("cartesian", "spectral_cube")
+    _supported_geometries = ("cartesian", "spectral_cube", "cylindrical-2d")
     def __init__(self, center, radius, circle_args=None,
                  text=None, coord_system='data', text_args=None):
         def_text_args = {'color':'white'}
@@ -1295,7 +1298,7 @@
     >>> s.save()
     """
     _type_name = "text"
-    _supported_geometries = ("cartesian", "spectral_cube")
+    _supported_geometries = ("cartesian", "spectral_cube", "cylindrical-2d")
     def __init__(self, pos, text, data_coords=False, coord_system='data',
                  text_args=None, inset_box_args=None):
         def_text_args = {'color':'white'}
@@ -1335,7 +1338,7 @@
 
     """
     _type_name = "point"
-    _supported_geometries = ("cartesian", "spectral_cube")
+    _supported_geometries = ("cartesian", "spectral_cube", "cylindrical-2d")
     def __init__(self, pos, text, data_coords=False, coord_system='data',
                  text_args=None, inset_box_args=None):
         super(PointAnnotateCallback, self).__init__(pos, text, data_coords,
@@ -1506,7 +1509,7 @@
     _type_name = "particles"
     region = None
     _descriptor = None
-    _supported_geometries = ("cartesian", "spectral_cube")
+    _supported_geometries = ("cartesian", "spectral_cube", "cylindrical-2d")
     def __init__(self, width, p_size=1.0, col='k', marker='o', stride=1,
                  ptype='all', minimum_mass=None, alpha=1.0):
         PlotCallback.__init__(self)
@@ -1818,7 +1821,7 @@
     >>> s.annotate_timestamp()
     """
     _type_name = "timestamp"
-    _supported_geometries = ("cartesian", "spectral_cube")
+    _supported_geometries = ("cartesian", "spectral_cube", "cylindrical-2d")
     def __init__(self, x_pos=None, y_pos=None, corner='lower_left', time=True,
                  redshift=False, time_format="t = {time:.1f} {units}",
                  time_unit=None, redshift_format="z = {redshift:.2f}",
@@ -2315,7 +2318,7 @@
                                              lim=(0.5,0.65))
     """
     _type_name = "line_integral_convolution"
-    _supported_geometries = ("cartesian", "spectral_cube")
+    _supported_geometries = ("cartesian", "spectral_cube", "cylindrical-2d")
     def __init__(self, field_x, field_y, texture=None, kernellen=50.,
                  lim=(0.5,0.6), cmap='binary', alpha=0.8, const_alpha=False):
         PlotCallback.__init__(self)
@@ -2411,7 +2414,7 @@
     >>> s.save()
     """
     _type_name = "cell_edges"
-    _supported_geometries = ("cartesian", "spectral_cube")
+    _supported_geometries = ("cartesian", "spectral_cube", "cylindrical-2d")
     def __init__(self, line_width=0.002, alpha = 1.0, color='black'):
         from matplotlib.colors import ColorConverter
         conv = ColorConverter()

diff -r f675aaf2e660adb7d92124a1481ec604f022475e -r 54cd1adee59e22c8dea3997c8c2626c64a563f84 yt/visualization/tests/test_callbacks.py
--- a/yt/visualization/tests/test_callbacks.py
+++ b/yt/visualization/tests/test_callbacks.py
@@ -24,13 +24,15 @@
     fake_amr_ds, \
     fake_tetrahedral_ds, \
     fake_hexahedral_ds, \
-    assert_fname
+    assert_fname, \
+    requires_file
 import yt.units as u
 from yt.utilities.exceptions import \
     YTPlotCallbackError, \
     YTDataTypeUnsupported
 from yt.visualization.api import \
     SlicePlot, ProjectionPlot, OffAxisSlicePlot
+from yt.convenience import load
 import contextlib
 
 # These are a very simple set of tests that verify that each callback is or is
@@ -65,6 +67,9 @@
 #  X ray
 #  X line_integral_convolution
 
+# 2D cylindrical data for callback test
+cyl_2d = "WDMerger_hdf5_chk_1000/WDMerger_hdf5_chk_1000.hdf5"
+
 @contextlib.contextmanager
 def _cleanup_fname():
     tmpdir = tempfile.mkdtemp()
@@ -371,6 +376,7 @@
         p.annotate_velocity(factor=40, normalize=True)
         assert_raises(YTDataTypeUnsupported, p.save, prefix)
 
+ at requires_file(cyl_2d)
 def test_magnetic_callback():
     with _cleanup_fname() as prefix:
         ds = fake_amr_ds(fields = ("density", "magnetic_field_x",
@@ -393,6 +399,12 @@
         assert_fname(p.save(prefix)[0])
 
     with _cleanup_fname() as prefix:
+        ds = load(cyl_2d)
+        slc = ProjectionPlot(ds, "theta", "density")
+        slc.annotate_magnetic_field()
+        assert_fname(slc.save(prefix)[0])
+
+    with _cleanup_fname() as prefix:
         ds = fake_amr_ds(fields = ("density", "magnetic_field_r",
           "magnetic_field_theta", "magnetic_field_phi"),
           geometry="spherical")
@@ -401,6 +413,7 @@
             scale_units="inches", normalize = True)
         assert_raises(YTDataTypeUnsupported, p.save, prefix)
 
+ at requires_file(cyl_2d)
 def test_quiver_callback():
     with _cleanup_fname() as prefix:
         ds = fake_amr_ds(fields =
@@ -424,6 +437,12 @@
         assert_fname(p.save(prefix)[0])
 
     with _cleanup_fname() as prefix:
+        ds = load(cyl_2d)
+        slc = SlicePlot(ds, "theta", "density")
+        slc.annotate_quiver("velocity_x", "velocity_y")
+        assert_fname(slc.save(prefix)[0])
+
+    with _cleanup_fname() as prefix:
         ds = fake_amr_ds(fields = 
             ("density", "velocity_x", "velocity_theta", "velocity_phi"),
             geometry="spherical")
@@ -434,6 +453,7 @@
             bv_y = 0.5 * u.cm / u.s)
         assert_raises(YTDataTypeUnsupported, p.save, prefix)
 
+ at requires_file(cyl_2d)
 def test_contour_callback():
     with _cleanup_fname() as prefix:
         ds = fake_amr_ds(fields = ("density", "temperature"))
@@ -465,6 +485,19 @@
         p.save(prefix)
 
     with _cleanup_fname() as prefix:
+        ds = load(cyl_2d)
+        slc = SlicePlot(ds, "theta", "plasma_beta")
+        slc.annotate_contour("plasma_beta",
+                             ncont=2,
+                             factor=7.,
+                             take_log=False,
+                             clim=(1.e-1,1.e1),
+                             label=True, 
+                             plot_args={"colors": ("c","w"), "linewidths": 1},
+                             text_args={"fmt": "%1.1f"})
+        assert_fname(slc.save(prefix)[0])
+
+    with _cleanup_fname() as prefix:
         ds = fake_amr_ds(fields = ("density", "temperature"),
                          geometry="spherical")
         p = SlicePlot(ds, "r", "density")
@@ -475,6 +508,7 @@
         assert_raises(YTDataTypeUnsupported, p.save, prefix)
 
 
+ at requires_file(cyl_2d)
 def test_grids_callback():
     with _cleanup_fname() as prefix:
         ds = fake_amr_ds(fields = ("density",))
@@ -496,6 +530,12 @@
         p.save(prefix)
 
     with _cleanup_fname() as prefix:
+        ds = load(cyl_2d)
+        slc = SlicePlot(ds, "theta", "density")
+        slc.annotate_grids()
+        assert_fname(slc.save(prefix)[0])
+
+    with _cleanup_fname() as prefix:
         ds = fake_amr_ds(fields = ("density",), geometry="spherical")
         p = SlicePlot(ds, "r", "density")
         p.annotate_grids(alpha=0.7, min_pix=10, min_pix_ids=30,
@@ -504,6 +544,7 @@
         assert_raises(YTDataTypeUnsupported, p.save, prefix)
 
 
+ at requires_file(cyl_2d)
 def test_cell_edges_callback():
     with _cleanup_fname() as prefix:
         ds = fake_amr_ds(fields = ("density",))
@@ -524,6 +565,12 @@
         p.save(prefix)
 
     with _cleanup_fname() as prefix:
+        ds = load(cyl_2d)
+        slc = SlicePlot(ds, "theta", "density")
+        slc.annotate_cell_edges()
+        assert_fname(slc.save(prefix)[0])
+
+    with _cleanup_fname() as prefix:
         ds = fake_amr_ds(fields = ("density",), geometry="spherical")
         p = SlicePlot(ds, "r", "density")
         p.annotate_cell_edges()
@@ -545,6 +592,7 @@
             assert_fname(sl.save(prefix)[0])
                 
 
+ at requires_file(cyl_2d)
 def test_line_integral_convolution_callback():
     with _cleanup_fname() as prefix:
         ds = fake_amr_ds(fields =
@@ -568,6 +616,12 @@
         p.save(prefix)
 
     with _cleanup_fname() as prefix:
+        ds = load(cyl_2d)
+        slc = SlicePlot(ds, "theta", "density")
+        slc.annotate_line_integral_convolution("magnetic_field_r", "magnetic_field_z")
+        assert_fname(slc.save(prefix)[0])
+
+    with _cleanup_fname() as prefix:
         ds = fake_amr_ds(fields = 
             ("density", "velocity_r", "velocity_theta", "velocity_phi"),
             geometry="spherical")

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