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

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Wed May 3 14:21:55 PDT 2017


2 new commits in yt:

https://bitbucket.org/yt_analysis/yt/commits/31293b6d0d06/
Changeset:   31293b6d0d06
User:        ngoldbaum
Date:        2017-05-02 02:14:14+00:00
Summary:     [BUG] plot the same field multiple times along with other fields in ProfilePlot
Affected #:  2 files

diff -r c8eac6c2ed9d64f40c75c56bac3568b22f7d9bce -r 31293b6d0d069ea60ef8f5cae911b6e4c0c7d708 yt/visualization/profile_plotter.py
--- a/yt/visualization/profile_plotter.py
+++ b/yt/visualization/profile_plotter.py
@@ -350,17 +350,19 @@
                 self.axes[field].plot(np.array(profile.x), np.array(field_data),
                                       label=self.label[i], **self.plot_spec[i])
 
-        for (fname, axes), profile in zip(self.axes.items(), self.profiles):
-            xscale, yscale = self._get_field_log(fname, profile)
-            xtitle, ytitle = self._get_field_title(fname, profile)
-            axes.set_xscale(xscale)
-            axes.set_yscale(yscale)
-            axes.set_xlabel(xtitle)
-            axes.set_ylabel(ytitle)
-            axes.set_ylim(*self.axes.ylim[fname])
-            axes.set_xlim(*self.axes.xlim)
-            if any(self.label):
-                axes.legend(loc="best")
+        for profile in self.profiles:
+            for fname in profile.keys():
+                axes = self.axes[fname]
+                xscale, yscale = self._get_field_log(fname, profile)
+                xtitle, ytitle = self._get_field_title(fname, profile)
+                axes.set_xscale(xscale)
+                axes.set_yscale(yscale)
+                axes.set_xlabel(xtitle)
+                axes.set_ylabel(ytitle)
+                axes.set_ylim(*self.axes.ylim[fname])
+                axes.set_xlim(*self.axes.xlim)
+                if any(self.label):
+                    axes.legend(loc="best")
         self._set_font_properties()
         self._plot_valid = True
 

diff -r c8eac6c2ed9d64f40c75c56bac3568b22f7d9bce -r 31293b6d0d069ea60ef8f5cae911b6e4c0c7d708 yt/visualization/tests/test_profile_plots.py
--- a/yt/visualization/tests/test_profile_plots.py
+++ b/yt/visualization/tests/test_profile_plots.py
@@ -16,12 +16,14 @@
 import tempfile
 import shutil
 import unittest
+import yt
 from yt.data_objects.profiles import create_profile
 from yt.extern.parameterized import\
     parameterized, param
 from yt.testing import \
     fake_random_ds, \
-    assert_array_almost_equal
+    assert_array_almost_equal, \
+    requires_file
 from yt.visualization.profile_plotter import \
     ProfilePlot, PhasePlot
 from yt.visualization.tests.test_plotwindow import \
@@ -143,3 +145,25 @@
     def test_ipython_repr(self):
         self.profiles[0]._repr_html_()
         self.phases[0]._repr_html_()
+
+
+ETC46 = "enzo_tiny_cosmology/DD0046/DD0046"
+
+ at requires_file(ETC46)
+def test_profile_plot_multiple_field_multiple_plot():
+    ds = yt.load("enzo_tiny_cosmology/DD0046/DD0046")
+    sphere = ds.sphere("max", (1.0, "Mpc"))
+    profiles = []
+    profiles.append(yt.create_profile(
+        sphere, ["radius"],
+        fields=["density"],n_bins=32))
+    profiles.append(yt.create_profile(
+        sphere, ["radius"],
+        fields=["density"],n_bins=64))
+    profiles.append(yt.create_profile(
+        sphere, ["radius"],
+        fields=["dark_matter_density"],n_bins=64))
+
+    plot = yt.ProfilePlot.from_profiles(profiles)
+    with tempfile.NamedTemporaryFile(suffix='png') as f:
+        plot.save(name=f.name)


https://bitbucket.org/yt_analysis/yt/commits/fd7d07194793/
Changeset:   fd7d07194793
User:        ngoldbaum
Date:        2017-05-03 21:21:45+00:00
Summary:     Merge pull request #1358 from ngoldbaum/particle-plot-fix

plot the same field multiple times along with other fields in ProfilePlot
Affected #:  2 files

diff -r b7d2eda68cece815b0332beb2aa42851b23f2dc4 -r fd7d0719479338e85549f96891d26ce9a7aaeffe yt/visualization/profile_plotter.py
--- a/yt/visualization/profile_plotter.py
+++ b/yt/visualization/profile_plotter.py
@@ -350,17 +350,19 @@
                 self.axes[field].plot(np.array(profile.x), np.array(field_data),
                                       label=self.label[i], **self.plot_spec[i])
 
-        for (fname, axes), profile in zip(self.axes.items(), self.profiles):
-            xscale, yscale = self._get_field_log(fname, profile)
-            xtitle, ytitle = self._get_field_title(fname, profile)
-            axes.set_xscale(xscale)
-            axes.set_yscale(yscale)
-            axes.set_xlabel(xtitle)
-            axes.set_ylabel(ytitle)
-            axes.set_ylim(*self.axes.ylim[fname])
-            axes.set_xlim(*self.axes.xlim)
-            if any(self.label):
-                axes.legend(loc="best")
+        for profile in self.profiles:
+            for fname in profile.keys():
+                axes = self.axes[fname]
+                xscale, yscale = self._get_field_log(fname, profile)
+                xtitle, ytitle = self._get_field_title(fname, profile)
+                axes.set_xscale(xscale)
+                axes.set_yscale(yscale)
+                axes.set_xlabel(xtitle)
+                axes.set_ylabel(ytitle)
+                axes.set_ylim(*self.axes.ylim[fname])
+                axes.set_xlim(*self.axes.xlim)
+                if any(self.label):
+                    axes.legend(loc="best")
         self._set_font_properties()
         self._plot_valid = True
 

diff -r b7d2eda68cece815b0332beb2aa42851b23f2dc4 -r fd7d0719479338e85549f96891d26ce9a7aaeffe yt/visualization/tests/test_profile_plots.py
--- a/yt/visualization/tests/test_profile_plots.py
+++ b/yt/visualization/tests/test_profile_plots.py
@@ -16,12 +16,14 @@
 import tempfile
 import shutil
 import unittest
+import yt
 from yt.data_objects.profiles import create_profile
 from yt.extern.parameterized import\
     parameterized, param
 from yt.testing import \
     fake_random_ds, \
-    assert_array_almost_equal
+    assert_array_almost_equal, \
+    requires_file
 from yt.visualization.profile_plotter import \
     ProfilePlot, PhasePlot
 from yt.visualization.tests.test_plotwindow import \
@@ -143,3 +145,25 @@
     def test_ipython_repr(self):
         self.profiles[0]._repr_html_()
         self.phases[0]._repr_html_()
+
+
+ETC46 = "enzo_tiny_cosmology/DD0046/DD0046"
+
+ at requires_file(ETC46)
+def test_profile_plot_multiple_field_multiple_plot():
+    ds = yt.load("enzo_tiny_cosmology/DD0046/DD0046")
+    sphere = ds.sphere("max", (1.0, "Mpc"))
+    profiles = []
+    profiles.append(yt.create_profile(
+        sphere, ["radius"],
+        fields=["density"],n_bins=32))
+    profiles.append(yt.create_profile(
+        sphere, ["radius"],
+        fields=["density"],n_bins=64))
+    profiles.append(yt.create_profile(
+        sphere, ["radius"],
+        fields=["dark_matter_density"],n_bins=64))
+
+    plot = yt.ProfilePlot.from_profiles(profiles)
+    with tempfile.NamedTemporaryFile(suffix='png') as f:
+        plot.save(name=f.name)

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