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

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Wed Feb 24 14:18:46 PST 2016


5 new commits in yt:

https://bitbucket.org/yt_analysis/yt/commits/fce2b3e6e2e5/
Changeset:   fce2b3e6e2e5
Branch:      yt
User:        atmyers
Date:        2016-02-23 00:29:23+00:00
Summary:     make sure that the x and y fields used for particle pixelization match the type of the input field.
Affected #:  1 file

diff -r 658172e6838146e6eb47c1abd069dc82819f3992 -r fce2b3e6e2e52ebe27f980846215b8862f4e3598 yt/visualization/fixed_resolution.py
--- a/yt/visualization/fixed_resolution.py
+++ b/yt/visualization/fixed_resolution.py
@@ -615,8 +615,9 @@
                 b = float(b.in_units("code_length"))
             bounds.append(b)
 
-        x_data = self.data_source.dd[self.x_field]
-        y_data = self.data_source.dd[self.y_field]
+        ftype = item[0]
+        x_data = self.data_source.dd[ftype, self.x_field]
+        y_data = self.data_source.dd[ftype, self.y_field]
         data = self.data_source.dd[item]
 
         # convert to pixels


https://bitbucket.org/yt_analysis/yt/commits/87f95e92ffda/
Changeset:   87f95e92ffda
Branch:      yt
User:        atmyers
Date:        2016-02-23 00:30:20+00:00
Summary:     select 'spatial' particle plots for all field types, not just 'all'.
Affected #:  1 file

diff -r fce2b3e6e2e52ebe27f980846215b8862f4e3598 -r 87f95e92ffdaf6c5f6db1dd4a0dee5e58f06608a yt/visualization/particle_plots.py
--- a/yt/visualization/particle_plots.py
+++ b/yt/visualization/particle_plots.py
@@ -395,6 +395,10 @@
 
     """
 
+    ad = ds.all_data()
+    x_field = ad._determine_fields(x_field)[0]
+    y_field = ad._determine_fields(y_field)[0]
+
     direction = 3
     # try potential axes for a ParticleProjectionPlot:
     for axis in [0, 1, 2]:
@@ -403,7 +407,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, y_field) == (xf, yf):
+        if (x_field[1], y_field[1]) == (xf, yf):
             direction = axis
             break
 
@@ -415,5 +419,5 @@
     # Does not correspond to any valid PlotWindow-style plot,
     # use ParticlePhasePlot instead
     else:
-        return ParticlePhasePlot(ds.all_data(), x_field, y_field,
+        return ParticlePhasePlot(ad, x_field, y_field,
                                  z_fields, color, *args, **kwargs)


https://bitbucket.org/yt_analysis/yt/commits/7c51a826d791/
Changeset:   7c51a826d791
Branch:      yt
User:        atmyers
Date:        2016-02-23 01:11:02+00:00
Summary:     add a test for filter fields in particle plots
Affected #:  1 file

diff -r 87f95e92ffdaf6c5f6db1dd4a0dee5e58f06608a -r 7c51a826d791cb16a1210ebe2e2073742e4e56c0 yt/visualization/tests/test_particle_plot.py
--- a/yt/visualization/tests/test_particle_plot.py
+++ b/yt/visualization/tests/test_particle_plot.py
@@ -21,6 +21,7 @@
 from yt.extern.parameterized import parameterized, param
 from yt.visualization.tests.test_plotwindow import \
     assert_fname, WIDTH_SPECS, ATTR_ARGS
+from yt.data_objects.particle_filters import add_particle_filter
 from yt.testing import \
     fake_particle_ds, assert_array_almost_equal
 from yt.utilities.answer_testing.framework import \
@@ -108,6 +109,38 @@
 
 
 @requires_ds(g30, big_data=True)
+def test_particle_projection_filter():
+    '''
+
+    This tests particle projection plots for filter fields.
+    
+
+    '''
+
+    def formed_star(pfilter, data):
+        filter = data["all", "creation_time"] > 0
+        return filter
+
+    add_particle_filter("formed_star", function=formed_star, filtered_type='all',
+                        requires=["creation_time"])
+
+    plot_field = ('formed_star', 'particle_mass')
+
+    decimals = 12
+    ds = data_dir_load(g30)
+    ds.add_particle_filter('formed_star')
+    for ax in 'xyz':
+        attr_name = "set_log"
+        args = PROJ_ATTR_ARGS[attr_name]
+        test = PlotWindowAttributeTest(ds, plot_field, ax,
+                                       attr_name,
+                                       args, decimals,
+                                       'ParticleProjectionPlot')
+        test_particle_projection_filter.__name__ = test.description
+        yield test
+
+
+ at requires_ds(g30, big_data=True)
 def test_particle_phase_answers():
     '''
 


https://bitbucket.org/yt_analysis/yt/commits/3372ff5ade46/
Changeset:   3372ff5ade46
Branch:      yt
User:        atmyers
Date:        2016-02-24 21:38:49+00:00
Summary:     fixing test
Affected #:  1 file

diff -r 7c51a826d791cb16a1210ebe2e2073742e4e56c0 -r 3372ff5ade4664cba9ad25c7fa613ef04788598a yt/visualization/tests/test_particle_plot.py
--- a/yt/visualization/tests/test_particle_plot.py
+++ b/yt/visualization/tests/test_particle_plot.py
@@ -131,13 +131,13 @@
     ds.add_particle_filter('formed_star')
     for ax in 'xyz':
         attr_name = "set_log"
-        args = PROJ_ATTR_ARGS[attr_name]
-        test = PlotWindowAttributeTest(ds, plot_field, ax,
-                                       attr_name,
-                                       args, decimals,
-                                       'ParticleProjectionPlot')
-        test_particle_projection_filter.__name__ = test.description
-        yield test
+        for args in PROJ_ATTR_ARGS[attr_name]:
+            test = PlotWindowAttributeTest(ds, plot_field, ax,
+                                           attr_name,
+                                           args, decimals,
+                                           'ParticleProjectionPlot')
+            test_particle_projection_filter.__name__ = test.description
+            yield test
 
 
 @requires_ds(g30, big_data=True)


https://bitbucket.org/yt_analysis/yt/commits/0d84f831f09a/
Changeset:   0d84f831f09a
Branch:      yt
User:        xarthisius
Date:        2016-02-24 22:18:33+00:00
Summary:     Merged in atmyers/yt (pull request #2000)

Patch ParticlePlot to work with filtered fields. Closes #1172. Closes #1173.
Affected #:  3 files

diff -r dda193582d6c210518df5d127cef1a7294dca692 -r 0d84f831f09afe85d40dbb220b4eda18202eb958 yt/visualization/fixed_resolution.py
--- a/yt/visualization/fixed_resolution.py
+++ b/yt/visualization/fixed_resolution.py
@@ -615,8 +615,9 @@
                 b = float(b.in_units("code_length"))
             bounds.append(b)
 
-        x_data = self.data_source.dd[self.x_field]
-        y_data = self.data_source.dd[self.y_field]
+        ftype = item[0]
+        x_data = self.data_source.dd[ftype, self.x_field]
+        y_data = self.data_source.dd[ftype, self.y_field]
         data = self.data_source.dd[item]
 
         # convert to pixels

diff -r dda193582d6c210518df5d127cef1a7294dca692 -r 0d84f831f09afe85d40dbb220b4eda18202eb958 yt/visualization/particle_plots.py
--- a/yt/visualization/particle_plots.py
+++ b/yt/visualization/particle_plots.py
@@ -395,6 +395,10 @@
 
     """
 
+    ad = ds.all_data()
+    x_field = ad._determine_fields(x_field)[0]
+    y_field = ad._determine_fields(y_field)[0]
+
     direction = 3
     # try potential axes for a ParticleProjectionPlot:
     for axis in [0, 1, 2]:
@@ -403,7 +407,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, y_field) == (xf, yf):
+        if (x_field[1], y_field[1]) == (xf, yf):
             direction = axis
             break
 
@@ -415,5 +419,5 @@
     # Does not correspond to any valid PlotWindow-style plot,
     # use ParticlePhasePlot instead
     else:
-        return ParticlePhasePlot(ds.all_data(), x_field, y_field,
+        return ParticlePhasePlot(ad, x_field, y_field,
                                  z_fields, color, *args, **kwargs)

diff -r dda193582d6c210518df5d127cef1a7294dca692 -r 0d84f831f09afe85d40dbb220b4eda18202eb958 yt/visualization/tests/test_particle_plot.py
--- a/yt/visualization/tests/test_particle_plot.py
+++ b/yt/visualization/tests/test_particle_plot.py
@@ -21,6 +21,7 @@
 from yt.extern.parameterized import parameterized, param
 from yt.visualization.tests.test_plotwindow import \
     assert_fname, WIDTH_SPECS, ATTR_ARGS
+from yt.data_objects.particle_filters import add_particle_filter
 from yt.testing import \
     fake_particle_ds, assert_array_almost_equal
 from yt.utilities.answer_testing.framework import \
@@ -108,6 +109,38 @@
 
 
 @requires_ds(g30, big_data=True)
+def test_particle_projection_filter():
+    '''
+
+    This tests particle projection plots for filter fields.
+    
+
+    '''
+
+    def formed_star(pfilter, data):
+        filter = data["all", "creation_time"] > 0
+        return filter
+
+    add_particle_filter("formed_star", function=formed_star, filtered_type='all',
+                        requires=["creation_time"])
+
+    plot_field = ('formed_star', 'particle_mass')
+
+    decimals = 12
+    ds = data_dir_load(g30)
+    ds.add_particle_filter('formed_star')
+    for ax in 'xyz':
+        attr_name = "set_log"
+        for args in PROJ_ATTR_ARGS[attr_name]:
+            test = PlotWindowAttributeTest(ds, plot_field, ax,
+                                           attr_name,
+                                           args, decimals,
+                                           'ParticleProjectionPlot')
+            test_particle_projection_filter.__name__ = test.description
+            yield test
+
+
+ at requires_ds(g30, big_data=True)
 def test_particle_phase_answers():
     '''

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