[Yt-svn] yt: Making the two point functions a bit more tolerant of

hg at spacepope.org hg at spacepope.org
Tue Jun 29 15:45:34 PDT 2010


hg Repository: yt
details:   yt/rev/951d7dcdac25
changeset: 1841:951d7dcdac25
user:      Stephen Skory <stephenskory at yahoo.com>
date:
Tue Jun 29 15:45:27 2010 -0700
description:
Making the two point functions a bit more tolerant of
differences in funtions.

diffstat:

 yt/lagos/TwoPointFunctions.py |  9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

diffs (19 lines):

diff -r 2a148f628553 -r 951d7dcdac25 yt/lagos/TwoPointFunctions.py
--- a/yt/lagos/TwoPointFunctions.py	Tue Jun 29 12:30:16 2010 -0700
+++ b/yt/lagos/TwoPointFunctions.py	Tue Jun 29 15:45:27 2010 -0700
@@ -796,7 +796,14 @@
             for d1 in range(dim):
                 multi *= self.bin_edges[d1].size
             if dim == 0 and len(self.out_labels)==1:
-                digi = na.digitize(results, self.bin_edges[dim])
+                try:
+                    digi = na.digitize(results, self.bin_edges[dim])
+                except ValueError:
+                    # The user probably did something like 
+                    # return a * b rather than
+                    # return a[0] * b[0], which will only happen
+                    # for single field functions.
+                    digi = na.digitize(results[0], self.bin_edges[dim])
             else:
                 digi = na.digitize(results[:,dim], self.bin_edges[dim])
             too_low = (digi == 0)



More information about the yt-svn mailing list