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

Bitbucket commits-noreply at bitbucket.org
Fri Jul 27 22:06:44 PDT 2012


4 new commits in yt:


https://bitbucket.org/yt_analysis/yt/changeset/c4678578c88b/
changeset:   c4678578c88b
branch:      yt
user:        MatthewTurk
date:        2012-07-28 06:25:34
summary:     An attempt to fix behavior in the Contour callback for FLASH datasets, where
data coordinates are 1e24 times bigger than plot coordinates.
affected #:  1 file

diff -r 1df752548a7a43afb617532f04537ceb698cc3aa -r c4678578c88b28638ab8db802a448678247ecf48 yt/visualization/plot_modifications.py
--- a/yt/visualization/plot_modifications.py
+++ b/yt/visualization/plot_modifications.py
@@ -240,8 +240,10 @@
         numPoints_x = plot.image._A.shape[0]
         numPoints_y = plot.image._A.shape[1]
         
+        # Multiply by dx and dy to go from data->plot
+        dx = (yy1 - yy0) / (y1-y0)
         dy = (xx1 - xx0) / (x1-x0)
-        dx = (yy1 - yy0) / (y1-y0)
+
         #dcollins Jan 11 2009.  Improved to allow for periodic shifts in the plot.
         #Now makes a copy of the position fields "px" and "py" and adds the
         #appropriate shift to the coppied field.  
@@ -261,23 +263,24 @@
             YShifted[ylim] += shift * dom_y
             AllX |= xlim
             AllY |= ylim
+        # At this point XShifted and YShifted are the shifted arrays of
+        # position data in data coordinates
         wI = (AllX & AllY)
 
-        xi, yi = na.mgrid[0:numPoints_x:numPoints_x/(self.factor*1j),\
-                          0:numPoints_y:numPoints_y/(self.factor*1j)]
-        xi = xi/xi.max()*(x1 - x0)
-        yi = yi/yi.max()*(y1 - y0)
+        # We want xi, yi in plot coordinates
+        xi, yi = na.mgrid[xx0:xx1:numPoints_x/(self.factor*1j),\
+                          yy0:yy1:numPoints_y/(self.factor*1j)]
 
-        x = (XShifted[wI]-x0)*dx 
-        y = (YShifted[wI]-y0)*dy
+        # This converts XShifted and YShifted into plot coordinates
+        x = (XShifted[wI]-x0)*dx + xx0
+        y = (YShifted[wI]-y0)*dy + yy0
         z = plot.data[self.field][wI]
         if self.take_log: z=na.log10(z)
 
+        # Both the input and output from the triangulator are in plot
+        # coordinates
         zi = self.triang(x,y).nn_interpolator(z)(xi,yi)
 
-        xi = xi/(x1 - x0)*dx + xx0
-        yi = yi/(y1 - y0)*dx + yy0
-
         plot._axes.contour(xi,yi,zi,self.ncont, **self.plot_args)
         plot._axes.set_xlim(xx0,xx1)
         plot._axes.set_ylim(yy0,yy1)



https://bitbucket.org/yt_analysis/yt/changeset/f625a5ce75bd/
changeset:   f625a5ce75bd
branch:      yt
user:        MatthewTurk
date:        2012-07-28 06:32:27
summary:     Fixing dx/dy flip
affected #:  1 file

diff -r c4678578c88b28638ab8db802a448678247ecf48 -r f625a5ce75bd57b13cf612ef093c470d524a9fed yt/visualization/plot_modifications.py
--- a/yt/visualization/plot_modifications.py
+++ b/yt/visualization/plot_modifications.py
@@ -241,8 +241,8 @@
         numPoints_y = plot.image._A.shape[1]
         
         # Multiply by dx and dy to go from data->plot
-        dx = (yy1 - yy0) / (y1-y0)
-        dy = (xx1 - xx0) / (x1-x0)
+        dx = (xx1 - xx0) / (x1-x0)
+        dy = (yy1 - yy0) / (y1-y0)
 
         #dcollins Jan 11 2009.  Improved to allow for periodic shifts in the plot.
         #Now makes a copy of the position fields "px" and "py" and adds the



https://bitbucket.org/yt_analysis/yt/changeset/0c8505765a8e/
changeset:   0c8505765a8e
branch:      yt
user:        ngoldbaum
date:        2012-07-28 06:58:30
summary:     contour callback detects if the plotted field is supposed to be logged
affected #:  1 file

diff -r f625a5ce75bd57b13cf612ef093c470d524a9fed -r 0c8505765a8e02d835beccf1ebc96a0eb08a5bc2 yt/visualization/plot_modifications.py
--- a/yt/visualization/plot_modifications.py
+++ b/yt/visualization/plot_modifications.py
@@ -205,7 +205,7 @@
 
 class ContourCallback(PlotCallback):
     _type_name = "contour"
-    def __init__(self, field, ncont=5, factor=4, take_log=False, clim=None,
+    def __init__(self, field, ncont=5, factor=4, clim=None,
                  plot_args = None):
         """
         annotate_contour(self, field, ncont=5, factor=4, take_log=False, clim=None,
@@ -220,11 +220,9 @@
         self.ncont = ncont
         self.field = field
         self.factor = factor
-        self.take_log = take_log
         from yt.utilities.delaunay.triangulate import Triangulation as triang
         self.triang = triang
-        if self.take_log and clim is not None: clim = (na.log10(clim[0]), na.log10(clim[1]))
-        if clim is not None: self.ncont = na.linspace(clim[0], clim[1], ncont)
+        self.clim = clim
         if plot_args is None: plot_args = {'colors':'k'}
         self.plot_args = plot_args
 
@@ -275,12 +273,18 @@
         x = (XShifted[wI]-x0)*dx + xx0
         y = (YShifted[wI]-y0)*dy + yy0
         z = plot.data[self.field][wI]
-        if self.take_log: z=na.log10(z)
+        if plot.pf.field_info[self.field].take_log: z=na.log10(z)
 
         # Both the input and output from the triangulator are in plot
         # coordinates
         zi = self.triang(x,y).nn_interpolator(z)(xi,yi)
-
+        
+        if plot.pf.field_info[self.field].take_log and self.clim is not None: 
+            self.clim = (na.log10(self.clim[0]), na.log10(self.clim[1]))
+        
+        if self.clim is not None: 
+            self.ncont = na.linspace(self.clim[0], self.clim[1], ncont)
+        
         plot._axes.contour(xi,yi,zi,self.ncont, **self.plot_args)
         plot._axes.set_xlim(xx0,xx1)
         plot._axes.set_ylim(yy0,yy1)



https://bitbucket.org/yt_analysis/yt/changeset/d1b963d7e0a7/
changeset:   d1b963d7e0a7
branch:      yt
user:        ngoldbaum
date:        2012-07-28 07:04:30
summary:     Fixing convert_to_plot.
affected #:  1 file

diff -r 0c8505765a8e02d835beccf1ebc96a0eb08a5bc2 -r d1b963d7e0a7749979fcfdc3c96474c37ae11bed yt/visualization/plot_modifications.py
--- a/yt/visualization/plot_modifications.py
+++ b/yt/visualization/plot_modifications.py
@@ -51,7 +51,10 @@
 
     def convert_to_plot(self, plot, coord, offset = True):
         # coord should be a 2 x ncoord array-like datatype.
-        ncoord = na.array(coord).shape[1]
+        try:
+            ncoord = na.array(coord).shape[1]
+        except IndexError:
+            ncoord = 1
 
         # Convert the data and plot limits to tiled numpy arrays so that
         # convert_to_plot is automatically vectorized.

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