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

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Wed Apr 23 18:12:14 PDT 2014


4 new commits in yt:

https://bitbucket.org/yt_analysis/yt/commits/3b13e74fdf8a/
Changeset:   3b13e74fdf8a
Branch:      yt-3.0
User:        ngoldbaum
Date:        2014-04-24 00:04:25
Summary:     Updating the pan function to work correctly with units.
Affected #:  1 file

diff -r 2dd2d810e60cebaaab21688cf06e69580a3ad76d -r 3b13e74fdf8acc6d8e13176366fadfa2c7432842 yt/visualization/plot_window.py
--- a/yt/visualization/plot_window.py
+++ b/yt/visualization/plot_window.py
@@ -69,7 +69,7 @@
 
 def fix_unitary(u):
     if u is '1':
-        return 'code_length'
+        return 'unitary'
     else:
         return u
 
@@ -377,10 +377,30 @@
 
         Parameters
         ----------
-        deltas : sequence of floats
-            (delta_x, delta_y) in *absolute* code unit coordinates
+        deltas : Two-element sequence of floats, quantities, or (float, unit)
+                 tuples.
+            (delta_x, delta_y).  If a unit is not supplied the unit is assumed
+            to be code_length.
 
         """
+        if len(deltas) != 2:
+            raise RuntimeError(
+                "The pan function accepts a two-element sequence. "
+                "Received %s" % deltas
+                )
+        if isinstance(deltas[0], Number) and isinstance(deltas[1], Number):
+            deltas = (self.pf.quan(deltas[0], 'code_length'),
+                      self.pf.quan(deltas[1], 'code_length'))
+        elif isinstance(deltas[0], tuple) and isinstance(deltas[1], tuple):
+            deltas = (self.pf.quan(deltas[0][0], deltas[0][1]),
+                      self.pf.quan(deltas[1][0], deltas[1][1]))
+        elif isinstance(deltas[0], YTQuantity) and isinstance(deltas[1], YTQuanti
+            pass
+        else:
+            raise RuntimeError(
+                "The arguments of the pan function must be a sequence of floats "
+                "quantities, or (float, unit) tuples.  Received %s" % deltas
+                )
         self.xlim = (self.xlim[0] + deltas[0], self.xlim[1] + deltas[0])
         self.ylim = (self.ylim[0] + deltas[1], self.ylim[1] + deltas[1])
         return self


https://bitbucket.org/yt_analysis/yt/commits/1c60c5f5b317/
Changeset:   1c60c5f5b317
Branch:      yt-3.0
User:        ngoldbaum
Date:        2014-04-24 00:22:55
Summary:     Fixing a syntax error.
Affected #:  1 file

diff -r 3b13e74fdf8acc6d8e13176366fadfa2c7432842 -r 1c60c5f5b3177ecb79a973994df3c888eae5b91f yt/visualization/plot_window.py
--- a/yt/visualization/plot_window.py
+++ b/yt/visualization/plot_window.py
@@ -394,7 +394,7 @@
         elif isinstance(deltas[0], tuple) and isinstance(deltas[1], tuple):
             deltas = (self.pf.quan(deltas[0][0], deltas[0][1]),
                       self.pf.quan(deltas[1][0], deltas[1][1]))
-        elif isinstance(deltas[0], YTQuantity) and isinstance(deltas[1], YTQuanti
+        elif isinstance(deltas[0], YTQuantity) and isinstance(deltas[1], YTQuantity):
             pass
         else:
             raise RuntimeError(


https://bitbucket.org/yt_analysis/yt/commits/1d8d66c5c910/
Changeset:   1d8d66c5c910
Branch:      yt-3.0
User:        ngoldbaum
Date:        2014-04-24 03:06:58
Summary:     Fixing issues pointed out during code review.
Affected #:  1 file

diff -r 1c60c5f5b3177ecb79a973994df3c888eae5b91f -r 1d8d66c5c9101921d5aca0ef1ad4509c2cdf258a yt/visualization/plot_window.py
--- a/yt/visualization/plot_window.py
+++ b/yt/visualization/plot_window.py
@@ -68,7 +68,7 @@
     from pyparsing import ParseFatalException
 
 def fix_unitary(u):
-    if u is '1':
+    if u == '1':
         return 'unitary'
     else:
         return u
@@ -385,8 +385,8 @@
         """
         if len(deltas) != 2:
             raise RuntimeError(
-                "The pan function accepts a two-element sequence. "
-                "Received %s" % deltas
+                "The pan function accepts a two-element sequence.\n"
+                "Received %s." % (deltas, )
                 )
         if isinstance(deltas[0], Number) and isinstance(deltas[1], Number):
             deltas = (self.pf.quan(deltas[0], 'code_length'),
@@ -398,8 +398,8 @@
             pass
         else:
             raise RuntimeError(
-                "The arguments of the pan function must be a sequence of floats "
-                "quantities, or (float, unit) tuples.  Received %s" % deltas
+                "The arguments of the pan function must be a sequence of floats,\n"
+                "quantities, or (float, unit) tuples. Received %s." % (deltas, )
                 )
         self.xlim = (self.xlim[0] + deltas[0], self.xlim[1] + deltas[0])
         self.ylim = (self.ylim[0] + deltas[1], self.ylim[1] + deltas[1])


https://bitbucket.org/yt_analysis/yt/commits/0d7d60aa2739/
Changeset:   0d7d60aa2739
Branch:      yt-3.0
User:        MatthewTurk
Date:        2014-04-24 03:12:07
Summary:     Merged in ngoldbaum/yt/yt-3.0 (pull request #852)

Updating the pan function to work correctly with units.
Affected #:  1 file

diff -r 19845b557f86e2254f6a59cfbcf3641c062d9317 -r 0d7d60aa2739292524a230ee3b8cbb28d1d2808a yt/visualization/plot_window.py
--- a/yt/visualization/plot_window.py
+++ b/yt/visualization/plot_window.py
@@ -68,8 +68,8 @@
     from pyparsing import ParseFatalException
 
 def fix_unitary(u):
-    if u is '1':
-        return 'code_length'
+    if u == '1':
+        return 'unitary'
     else:
         return u
 
@@ -377,10 +377,30 @@
 
         Parameters
         ----------
-        deltas : sequence of floats
-            (delta_x, delta_y) in *absolute* code unit coordinates
+        deltas : Two-element sequence of floats, quantities, or (float, unit)
+                 tuples.
+            (delta_x, delta_y).  If a unit is not supplied the unit is assumed
+            to be code_length.
 
         """
+        if len(deltas) != 2:
+            raise RuntimeError(
+                "The pan function accepts a two-element sequence.\n"
+                "Received %s." % (deltas, )
+                )
+        if isinstance(deltas[0], Number) and isinstance(deltas[1], Number):
+            deltas = (self.pf.quan(deltas[0], 'code_length'),
+                      self.pf.quan(deltas[1], 'code_length'))
+        elif isinstance(deltas[0], tuple) and isinstance(deltas[1], tuple):
+            deltas = (self.pf.quan(deltas[0][0], deltas[0][1]),
+                      self.pf.quan(deltas[1][0], deltas[1][1]))
+        elif isinstance(deltas[0], YTQuantity) and isinstance(deltas[1], YTQuantity):
+            pass
+        else:
+            raise RuntimeError(
+                "The arguments of the pan function must be a sequence of floats,\n"
+                "quantities, or (float, unit) tuples. Received %s." % (deltas, )
+                )
         self.xlim = (self.xlim[0] + deltas[0], self.xlim[1] + deltas[0])
         self.ylim = (self.ylim[0] + deltas[1], self.ylim[1] + deltas[1])
         return self

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