[Yt-svn] yt: Adding shape mismatch exception so that AMR caluculations wi...
hg at spacepope.org
hg at spacepope.org
Tue Jul 20 10:21:56 PDT 2010
hg Repository: yt
details: yt/rev/0ec56a2cb104
changeset: 1880:0ec56a2cb104
user: Sam Skillman <samuel.skillman at colorado.edu>
date:
Tue Jul 20 11:21:19 2010 -0600
description:
Adding shape mismatch exception so that AMR caluculations with mismatched array sizes raise an exception instead of failing.
diffstat:
yt/extensions/enzo_test/output_tests.py | 11 +++++++++++
1 files changed, 11 insertions(+), 0 deletions(-)
diffs (28 lines):
diff -r 5bfed664cf16 -r 0ec56a2cb104 yt/extensions/enzo_test/output_tests.py
--- a/yt/extensions/enzo_test/output_tests.py Mon Jul 19 22:36:08 2010 -0700
+++ b/yt/extensions/enzo_test/output_tests.py Tue Jul 20 11:21:19 2010 -0600
@@ -29,6 +29,15 @@
return "ArrayDelta: Delta %0.5e, max of %0.5e" % (
self.delta, self.acceptable)
+class ShapeMismatch(RegressionTestException):
+ def __init__(self, old_shape, current_shape):
+ self.old_shape = old_shape
+ self.current_shape = current_shape
+
+ def __repr__(self):
+ return "Shape Mismatch: old_buffer %s, current_buffer %0.5e" % (
+ self.old_shape, self.current_shape)
+
class RegressionTest(object):
name = None
result = None
@@ -79,6 +88,8 @@
greater than `acceptable` it is considered a failure and an appropriate
exception is raised.
"""
+ if a1.shape != a2.shape:
+ raise ShapeMismatch(a1, a2)
delta = na.abs(a1 - a2)/(a1 + a2)
if delta.max() > acceptable:
raise ArrayDelta(delta, acceptable)
More information about the yt-svn
mailing list