[yt-svn] commit/yt: samskillman: Only test the FieldValues once, not once for each projection direction. Swap out

Bitbucket commits-noreply at bitbucket.org
Wed Nov 14 10:19:35 PST 2012


1 new commit in yt:


https://bitbucket.org/yt_analysis/yt/changeset/e2d94c653c5a/
changeset:   e2d94c653c5a
branch:      yt
user:        samskillman
date:        2012-11-14 19:18:30
summary:     Only test the FieldValues once, not once for each projection direction. Swap out
the assert_rel_equal to the more forgiving (of comparing zeros) numpy.testing.assert_allclose.
affected #:  2 files

diff -r 6021af872bc06755516426d6fc8f3acc8e49c81d -r e2d94c653c5ac243017f361ff4d20fb1c0522e57 yt/frontends/enzo/answer_testing_support.py
--- a/yt/frontends/enzo/answer_testing_support.py
+++ b/yt/frontends/enzo/answer_testing_support.py
@@ -62,14 +62,14 @@
     for field in fields:
         yield GridValuesTest(pf_fn, field)
         if 'particle' in field: continue
-        for axis in [0, 1, 2]:
-            for ds in dso:
+        for ds in dso:
+            for axis in [0, 1, 2]:
                 for weight_field in [None, "Density"]:
                     yield ProjectionValuesTest(
                         pf_fn, axis, field, weight_field,
                         ds, decimals=3)
-                yield FieldValuesTest(
-                        pf_fn, field, ds, decimals=3)
+            yield FieldValuesTest(
+                    pf_fn, field, ds, decimals=3)
                     
 class ShockTubeTest(object):
     def __init__(self, data_file, solution_file, fields, 


diff -r 6021af872bc06755516426d6fc8f3acc8e49c81d -r e2d94c653c5ac243017f361ff4d20fb1c0522e57 yt/utilities/answer_testing/framework.py
--- a/yt/utilities/answer_testing/framework.py
+++ b/yt/utilities/answer_testing/framework.py
@@ -309,7 +309,7 @@
             assert_equal(new_result, old_result, 
                          err_msg=err_msg, verbose=True)
         else:
-            assert_rel_equal(new_result, old_result, self.decimals,
+            assert_allclose(new_result, old_result, 10.**(-self.decimals),
                              err_msg=err_msg, verbose=True)
 
 class AllFieldValuesTest(AnswerTestingTest):
@@ -370,8 +370,8 @@
                 assert_equal(new_result[k], old_result[k],
                              err_msg=err_msg)
             else:
-                assert_rel_equal(new_result[k], old_result[k], 
-                                 self.decimals, err_msg=err_msg)
+                assert_allclose(new_result[k], old_result[k], 
+                                 10.**-(self.decimals), err_msg=err_msg)
 
 class PixelizedProjectionValuesTest(AnswerTestingTest):
     _type_name = "PixelizedProjectionValues"

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