[yt-svn] commit/yt: xarthisius: Merged in atmyers/yt (pull request #2000)
commits-noreply at bitbucket.org
commits-noreply at bitbucket.org
Wed Feb 24 14:18:43 PST 2016
1 new commit in yt:
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