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

Bitbucket commits-noreply at bitbucket.org
Mon Sep 3 11:06:37 PDT 2012


3 new commits in yt:


https://bitbucket.org/yt_analysis/yt/changeset/3abe9786ac49/
changeset:   3abe9786ac49
branch:      yt
user:        ngoldbaum
date:        2012-09-03 16:18:55
summary:     Adding a universal grid ID field which I use to see whether grids overlap with a plot window.
affected #:  2 files

diff -r 487adfd5ee1d935938f33afb872dd829e4c49a45 -r 3abe9786ac4961a02f6bfd38630fa051c693fcf0 yt/data_objects/universal_fields.py
--- a/yt/data_objects/universal_fields.py
+++ b/yt/data_objects/universal_fields.py
@@ -107,6 +107,12 @@
           validators=[ValidateGridType(),
                       ValidateSpatial(0)])
 
+def _GridID(field, data):
+    return na.ones(data.ActiveDimensions)*(data.id)
+add_field("GridID", function=_GridID,
+          validators=[ValidateGridType(),
+                      ValidateSpatial(0)])
+
 def _GridIndices(field, data):
     return na.ones(data["Ones"].shape)*(data.id-data._id_offset)
 add_field("GridIndices", function=_GridIndices,


diff -r 487adfd5ee1d935938f33afb872dd829e4c49a45 -r 3abe9786ac4961a02f6bfd38630fa051c693fcf0 yt/visualization/plot_modifications.py
--- a/yt/visualization/plot_modifications.py
+++ b/yt/visualization/plot_modifications.py
@@ -352,13 +352,13 @@
             if self.draw_ids:
                 visible_ids =  ( xpix * (right_edge_x - left_edge_x) / (xx1 - xx0) > self.min_pix_ids ) & \
                                ( ypix * (right_edge_y - left_edge_y) / (yy1 - yy0) > self.min_pix_ids )
-                for i, g in enumerate(plot.data._grids[visible_ids]):
-                    if na.any(g.child_mask):
-                        gid = na.where(visible_ids)[0][i]
-                        plot._axes.text(
-                                left_edge_x[gid] + (2 * (xx1 - xx0) / xpix),
-                                left_edge_y[gid] + (2 * (yy1 - yy0) / ypix),
-                                g.id, clip_on=True)
+                id_mask = plot.data['GridID']
+                active_ids = na.where(na.histogram(id_mask, bins=(id_mask.max()+1),range=(0,id_mask.max()+1))[0])[0] 
+                for i in na.where(visible_ids)[0]:
+                    plot._axes.text(
+                        left_edge_x[i] + (2 * (xx1 - xx0) / xpix),
+                        left_edge_y[i] + (2 * (yy1 - yy0) / ypix),
+                        active_ids[i], clip_on=True)
             plot._axes.hold(False)
 
 class StreamlineCallback(PlotCallback):



https://bitbucket.org/yt_analysis/yt/changeset/8fbe7d0e5642/
changeset:   8fbe7d0e5642
branch:      yt
user:        ngoldbaum
date:        2012-09-03 16:32:32
summary:     Removing GridID since it is wrong and redundant (Thanks MatthewTurk!).
Also using na.unique to find the active grid ids and forcing the IDs
to be formatted as strings.
affected #:  2 files

diff -r 3abe9786ac4961a02f6bfd38630fa051c693fcf0 -r 8fbe7d0e56429dbd3bd0bd2f81f15f4188c79c6c yt/data_objects/universal_fields.py
--- a/yt/data_objects/universal_fields.py
+++ b/yt/data_objects/universal_fields.py
@@ -107,12 +107,6 @@
           validators=[ValidateGridType(),
                       ValidateSpatial(0)])
 
-def _GridID(field, data):
-    return na.ones(data.ActiveDimensions)*(data.id)
-add_field("GridID", function=_GridID,
-          validators=[ValidateGridType(),
-                      ValidateSpatial(0)])
-
 def _GridIndices(field, data):
     return na.ones(data["Ones"].shape)*(data.id-data._id_offset)
 add_field("GridIndices", function=_GridIndices,


diff -r 3abe9786ac4961a02f6bfd38630fa051c693fcf0 -r 8fbe7d0e56429dbd3bd0bd2f81f15f4188c79c6c yt/visualization/plot_modifications.py
--- a/yt/visualization/plot_modifications.py
+++ b/yt/visualization/plot_modifications.py
@@ -352,13 +352,12 @@
             if self.draw_ids:
                 visible_ids =  ( xpix * (right_edge_x - left_edge_x) / (xx1 - xx0) > self.min_pix_ids ) & \
                                ( ypix * (right_edge_y - left_edge_y) / (yy1 - yy0) > self.min_pix_ids )
-                id_mask = plot.data['GridID']
-                active_ids = na.where(na.histogram(id_mask, bins=(id_mask.max()+1),range=(0,id_mask.max()+1))[0])[0] 
+                active_ids = na.unique(plot.data['GridIndices'])
                 for i in na.where(visible_ids)[0]:
                     plot._axes.text(
                         left_edge_x[i] + (2 * (xx1 - xx0) / xpix),
                         left_edge_y[i] + (2 * (yy1 - yy0) / ypix),
-                        active_ids[i], clip_on=True)
+                        "%d" % active_ids[i], clip_on=True)
             plot._axes.hold(False)
 
 class StreamlineCallback(PlotCallback):



https://bitbucket.org/yt_analysis/yt/changeset/3e35b1adb541/
changeset:   3e35b1adb541
branch:      yt
user:        MatthewTurk
date:        2012-09-03 20:06:36
summary:     Merged in ngoldbaum/yt-cleancopy (pull request #262)
affected #:  2 files



diff -r 15008795b7351ee3024db8fa4506abde8d502b89 -r 3e35b1adb541c3f1412d3381d57bb5c0f83e3bf2 yt/visualization/plot_modifications.py
--- a/yt/visualization/plot_modifications.py
+++ b/yt/visualization/plot_modifications.py
@@ -352,13 +352,12 @@
             if self.draw_ids:
                 visible_ids =  ( xpix * (right_edge_x - left_edge_x) / (xx1 - xx0) > self.min_pix_ids ) & \
                                ( ypix * (right_edge_y - left_edge_y) / (yy1 - yy0) > self.min_pix_ids )
-                for i, g in enumerate(plot.data._grids[visible_ids]):
-                    if na.any(g.child_mask):
-                        gid = na.where(visible_ids)[0][i]
-                        plot._axes.text(
-                                left_edge_x[gid] + (2 * (xx1 - xx0) / xpix),
-                                left_edge_y[gid] + (2 * (yy1 - yy0) / ypix),
-                                g.id, clip_on=True)
+                active_ids = na.unique(plot.data['GridIndices'])
+                for i in na.where(visible_ids)[0]:
+                    plot._axes.text(
+                        left_edge_x[i] + (2 * (xx1 - xx0) / xpix),
+                        left_edge_y[i] + (2 * (yy1 - yy0) / ypix),
+                        "%d" % active_ids[i], clip_on=True)
             plot._axes.hold(False)
 
 class StreamlineCallback(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