[yt-svn] commit/yt: 3 new changesets
commits-noreply at bitbucket.org
commits-noreply at bitbucket.org
Sat May 3 19:08:21 PDT 2014
3 new commits in yt:
https://bitbucket.org/yt_analysis/yt/commits/d91c608430b2/
Changeset: d91c608430b2
Branch: yt-3.0
User: hegan
Date: 2014-05-03 02:12:37
Summary: annotate halos with text and removed xdict references
Affected #: 1 file
diff -r 893a689ff45f9d951b367be0f3b6a8ebb9a74b18 -r d91c608430b2eee5ff41faac1ed7dc14115125a1 yt/visualization/plot_modifications.py
--- a/yt/visualization/plot_modifications.py
+++ b/yt/visualization/plot_modifications.py
@@ -866,12 +866,18 @@
region = None
_descriptor = None
- def __init__(self, halo_catalog, col='white', alpha =1, width = None):
+ def __init__(self, halo_catalog, col='white', alpha =1,
+ width = None, annotate_field = False, text_format_spec = '',
+ font_kwargs = None):
+
PlotCallback.__init__(self)
self.halo_catalog = halo_catalog
self.color = col
self.alpha = alpha
self.width = width
+ self.annotate_field = annotate_field
+ self.format_spec = text_format_spec
+ self.font_kwargs = font_kwargs
def __call__(self, plot):
data = plot.data
@@ -881,8 +887,11 @@
yy0, yy1 = plot._axes.get_ylim()
halo_data= self.halo_catalog.halos_pf.all_data()
- field_x = "particle_position_%s" % axis_names[x_dict[data.axis]]
- field_y = "particle_position_%s" % axis_names[y_dict[data.axis]]
+ axis_names = plot.data.pf.coordinates.axis_name
+ xax = plot.data.pf.coordinates.x_axis[data.axis]
+ yax = plot.data.pf.coordinates.y_axis[data.axis]
+ field_x = "particle_position_%s" % axis_names[xax]
+ field_y = "particle_position_%s" % axis_names[yax]
field_z = "particle_position_%s" % axis_names[data.axis]
plot._axes.hold(True)
@@ -922,6 +931,12 @@
plot._axes.set_ylim(yy0,yy1)
plot._axes.hold(False)
+ if self.annotate_field:
+ annotate_dat = halo_data[self.annotate_field]
+ texts = ['{0}'.format(dat) for dat in annotate_dat]
+ for pos_x, pos_y, t in zip(px, py, texts):
+ plot._axes.text(pos_x, pos_y, t, **self.font_kwargs)
+
class ParticleCallback(PlotCallback):
"""
https://bitbucket.org/yt_analysis/yt/commits/15a6ee7b7d8a/
Changeset: 15a6ee7b7d8a
Branch: yt-3.0
User: hegan
Date: 2014-05-03 02:20:14
Summary: removed unnecessary text_format_spec arg
Affected #: 1 file
diff -r d91c608430b2eee5ff41faac1ed7dc14115125a1 -r 15a6ee7b7d8a6fdec764bb5e6d86d4459b8f1b5e yt/visualization/plot_modifications.py
--- a/yt/visualization/plot_modifications.py
+++ b/yt/visualization/plot_modifications.py
@@ -867,8 +867,7 @@
_descriptor = None
def __init__(self, halo_catalog, col='white', alpha =1,
- width = None, annotate_field = False, text_format_spec = '',
- font_kwargs = None):
+ width = None, annotate_field = False, font_kwargs = None):
PlotCallback.__init__(self)
self.halo_catalog = halo_catalog
https://bitbucket.org/yt_analysis/yt/commits/148e82200398/
Changeset: 148e82200398
Branch: yt-3.0
User: MatthewTurk
Date: 2014-05-04 04:08:15
Summary: Merged in hegan/yt/yt-3.0 (pull request #868)
Added text labeling to annotate_halos callback
Affected #: 1 file
diff -r c05e890f48672898e8afd3f6a4c9d81a8a28b892 -r 148e82200398be3eaec221d639b0e7d7ed6cb6e2 yt/visualization/plot_modifications.py
--- a/yt/visualization/plot_modifications.py
+++ b/yt/visualization/plot_modifications.py
@@ -866,12 +866,17 @@
region = None
_descriptor = None
- def __init__(self, halo_catalog, col='white', alpha =1, width = None):
+ def __init__(self, halo_catalog, col='white', alpha =1,
+ width = None, annotate_field = False, font_kwargs = None):
+
PlotCallback.__init__(self)
self.halo_catalog = halo_catalog
self.color = col
self.alpha = alpha
self.width = width
+ self.annotate_field = annotate_field
+ self.format_spec = text_format_spec
+ self.font_kwargs = font_kwargs
def __call__(self, plot):
data = plot.data
@@ -881,8 +886,11 @@
yy0, yy1 = plot._axes.get_ylim()
halo_data= self.halo_catalog.halos_pf.all_data()
- field_x = "particle_position_%s" % axis_names[x_dict[data.axis]]
- field_y = "particle_position_%s" % axis_names[y_dict[data.axis]]
+ axis_names = plot.data.pf.coordinates.axis_name
+ xax = plot.data.pf.coordinates.x_axis[data.axis]
+ yax = plot.data.pf.coordinates.y_axis[data.axis]
+ field_x = "particle_position_%s" % axis_names[xax]
+ field_y = "particle_position_%s" % axis_names[yax]
field_z = "particle_position_%s" % axis_names[data.axis]
plot._axes.hold(True)
@@ -922,6 +930,12 @@
plot._axes.set_ylim(yy0,yy1)
plot._axes.hold(False)
+ if self.annotate_field:
+ annotate_dat = halo_data[self.annotate_field]
+ texts = ['{0}'.format(dat) for dat in annotate_dat]
+ for pos_x, pos_y, t in zip(px, py, texts):
+ plot._axes.text(pos_x, pos_y, t, **self.font_kwargs)
+
class ParticleCallback(PlotCallback):
"""
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