[yt-svn] commit/yt: ngoldbaum: Merged in krafczyk/yt (pull request #2492)

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Tue Jan 31 10:41:59 PST 2017


1 new commit in yt:

https://bitbucket.org/yt_analysis/yt/commits/12ab7e374fcb/
Changeset:   12ab7e374fcb
Branch:      yt
User:        ngoldbaum
Date:        2017-01-31 18:41:53+00:00
Summary:     Merged in krafczyk/yt (pull request #2492)

Correct coordinate problem when 'center' is used in plots.
Affected #:  1 file

diff -r dc439e4d8dbb93b261ebc8c064572523311d56ce -r 12ab7e374fcbdd45e56622c9bae43cd9dd334b2c yt/visualization/plot_modifications.py
--- a/yt/visualization/plot_modifications.py
+++ b/yt/visualization/plot_modifications.py
@@ -152,11 +152,11 @@
 
         # We need a special case for when we are only given one coordinate.
         if ccoord.shape == (2,):
-            return ((ccoord[0]-x0)/(x1-x0)*(xx1-xx0) + xx0,
-                    (ccoord[1]-y0)/(y1-y0)*(yy1-yy0) + yy0)
+            return (np.mod((ccoord[0]-x0)/(x1-x0), 1.0)*(xx1-xx0) + xx0,
+                    np.mod((ccoord[1]-y0)/(y1-y0), 1.0)*(yy1-yy0) + yy0)
         else:
-            return ((ccoord[0][:]-x0)/(x1-x0)*(xx1-xx0) + xx0,
-                    (ccoord[1][:]-y0)/(y1-y0)*(yy1-yy0) + yy0)
+            return (np.mod((ccoord[0][:]-x0)/(x1-x0), 1.0)*(xx1-xx0) + xx0,
+                    np.mod((ccoord[1][:]-y0)/(y1-y0), 1.0)*(yy1-yy0) + yy0)
 
     def sanitize_coord_system(self, plot, coord, coord_system):
         """
@@ -1480,22 +1480,21 @@
 
         # Set up scales for pixel size and original data
         pixel_scale = self.pixel_scale(plot)[0]
-        data_scale = data.ds.length_unit
-        units = data_scale.units
+        units = plot.xlim[0].units
 
         # Convert halo positions to code units of the plotted data
         # and then to units of the plotted window
-        px = halo_data[field_x][:].in_units(units) / data_scale
-        py = halo_data[field_y][:].in_units(units) / data_scale
+        px = halo_data[field_x][:].in_units(units)
+        py = halo_data[field_y][:].in_units(units)
+
         px, py = self.convert_to_plot(plot,[px,py])
 
         # Convert halo radii to a radius in pixels
         radius = halo_data[self.radius_field][:].in_units(units)
-        radius = np.array(radius*pixel_scale*self.factor/data_scale)
+        radius = np.array(radius*pixel_scale*self.factor)
 
         if self.width:
-            pz = halo_data[field_z][:].in_units(units)/data_scale
-            pz = data.ds.arr(pz, 'code_length')
+            pz = halo_data[field_z][:].in_units('code_length')
             c = data.center[data.axis]
 
             # I should catch an error here if width isn't in this form

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