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

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Thu Feb 22 08:28:14 PST 2018


3 new commits in yt:

https://bitbucket.org/yt_analysis/yt/commits/a0fe4ed153f7/
Changeset:   a0fe4ed153f7
User:        git-abhishek
Date:        2018-02-16 23:42:52+00:00
Summary:     Fix for Issue #1680
Affected #:  1 file

diff -r c75b3b80c9d59733349d085fd2d9fba88401761c -r a0fe4ed153f788068d91d4024bfc35e7e66ccb3c yt/visualization/particle_plots.py
--- a/yt/visualization/particle_plots.py
+++ b/yt/visualization/particle_plots.py
@@ -512,7 +512,8 @@
         ax_field_template = 'particle_position_%s'
         xf = ax_field_template % ds.coordinates.axis_name[xax]
         yf = ax_field_template % ds.coordinates.axis_name[yax]
-        if (x_field[1], y_field[1]) == (xf, yf):
+        if (x_field[1], y_field[1]) == (xf, yf) \
+                or (x_field[1], y_field[1]) == (yf, xf):
             direction = axis
             break
 


https://bitbucket.org/yt_analysis/yt/commits/a1bc8ae1800a/
Changeset:   a1bc8ae1800a
User:        git-abhishek
Date:        2018-02-17 05:05:13+00:00
Summary:     Fixed code review comment; Added unit test for ParticlePlot
Affected #:  2 files

diff -r a0fe4ed153f788068d91d4024bfc35e7e66ccb3c -r a1bc8ae1800afac3e60fbffcc1eedec66ad59a57 yt/visualization/particle_plots.py
--- a/yt/visualization/particle_plots.py
+++ b/yt/visualization/particle_plots.py
@@ -512,8 +512,7 @@
         ax_field_template = 'particle_position_%s'
         xf = ax_field_template % ds.coordinates.axis_name[xax]
         yf = ax_field_template % ds.coordinates.axis_name[yax]
-        if (x_field[1], y_field[1]) == (xf, yf) \
-                or (x_field[1], y_field[1]) == (yf, xf):
+        if (x_field[1], y_field[1]) in [(xf, yf), (yf, xf)]:
             direction = axis
             break
 

diff -r a0fe4ed153f788068d91d4024bfc35e7e66ccb3c -r a1bc8ae1800afac3e60fbffcc1eedec66ad59a57 yt/visualization/tests/test_particle_plot.py
--- a/yt/visualization/tests/test_particle_plot.py
+++ b/yt/visualization/tests/test_particle_plot.py
@@ -346,3 +346,26 @@
             [assert_array_almost_equal(px, x, 14) for px, x in zip(plot.xlim, xlim)]
             [assert_array_almost_equal(py, y, 14) for py, y in zip(plot.ylim, ylim)]
             [assert_array_almost_equal(pw, w, 14) for pw, w in zip(plot.width, pwidth)]
+
+def test_particle_plot_instance():
+    """
+    Tests the type of plot instance returned by ParticlePlot.
+
+    If x_field and y_field are any combination of valid particle_position in x,
+    y or z axis,then ParticleProjectionPlot instance is expected.
+
+
+    """
+    ds = fake_particle_ds()
+    x_field = ('all', 'particle_position_x')
+    y_field = ('all', 'particle_position_y')
+    z_field = ('all', 'particle_velocity_x')
+
+    plot = ParticlePlot(ds, x_field, y_field)
+    assert isinstance(plot, ParticleProjectionPlot)
+
+    plot = ParticlePlot(ds, y_field, x_field)
+    assert isinstance(plot, ParticleProjectionPlot)
+
+    plot = ParticlePlot(ds, x_field, z_field)
+    assert isinstance(plot, ParticlePhasePlot)


https://bitbucket.org/yt_analysis/yt/commits/f13e950937f0/
Changeset:   f13e950937f0
User:        ngoldbaum
Date:        2018-02-22 16:27:55+00:00
Summary:     Merge pull request #1697 from git-abhishek/particle_plots_fix_of_issue_1680

Updated PartilcePlot axis configuration (fix for Issue #1680)
Affected #:  2 files

diff -r c443c9296f07bfd4dee0822b094ba3de8739f716 -r f13e950937f099d722c60abacd8f2215c5f55741 yt/visualization/particle_plots.py
--- a/yt/visualization/particle_plots.py
+++ b/yt/visualization/particle_plots.py
@@ -512,7 +512,7 @@
         ax_field_template = 'particle_position_%s'
         xf = ax_field_template % ds.coordinates.axis_name[xax]
         yf = ax_field_template % ds.coordinates.axis_name[yax]
-        if (x_field[1], y_field[1]) == (xf, yf):
+        if (x_field[1], y_field[1]) in [(xf, yf), (yf, xf)]:
             direction = axis
             break
 

diff -r c443c9296f07bfd4dee0822b094ba3de8739f716 -r f13e950937f099d722c60abacd8f2215c5f55741 yt/visualization/tests/test_particle_plot.py
--- a/yt/visualization/tests/test_particle_plot.py
+++ b/yt/visualization/tests/test_particle_plot.py
@@ -346,3 +346,26 @@
             [assert_array_almost_equal(px, x, 14) for px, x in zip(plot.xlim, xlim)]
             [assert_array_almost_equal(py, y, 14) for py, y in zip(plot.ylim, ylim)]
             [assert_array_almost_equal(pw, w, 14) for pw, w in zip(plot.width, pwidth)]
+
+def test_particle_plot_instance():
+    """
+    Tests the type of plot instance returned by ParticlePlot.
+
+    If x_field and y_field are any combination of valid particle_position in x,
+    y or z axis,then ParticleProjectionPlot instance is expected.
+
+
+    """
+    ds = fake_particle_ds()
+    x_field = ('all', 'particle_position_x')
+    y_field = ('all', 'particle_position_y')
+    z_field = ('all', 'particle_velocity_x')
+
+    plot = ParticlePlot(ds, x_field, y_field)
+    assert isinstance(plot, ParticleProjectionPlot)
+
+    plot = ParticlePlot(ds, y_field, x_field)
+    assert isinstance(plot, ParticleProjectionPlot)
+
+    plot = ParticlePlot(ds, x_field, z_field)
+    assert isinstance(plot, ParticlePhasePlot)

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