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

Bitbucket commits-noreply at bitbucket.org
Mon Nov 19 20:54:18 PST 2012


2 new commits in yt:


https://bitbucket.org/yt_analysis/yt/changeset/08ce935c137a/
changeset:   08ce935c137a
branch:      yt
user:        samskillman
date:        2012-11-20 05:52:51
summary:     Adding an assertion wrapper, h/t to matt.  Now the names assigned to the shock
tests are not filled with the arrays themselves!
affected #:  2 files

diff -r e0004f1bce411f5b19faa125fcaa23ab68d5fd6c -r 08ce935c137a88d0f8d3aa66f947a90374e02c0b yt/frontends/enzo/answer_testing_support.py
--- a/yt/frontends/enzo/answer_testing_support.py
+++ b/yt/frontends/enzo/answer_testing_support.py
@@ -35,7 +35,8 @@
      GridValuesTest, \
      ProjectionValuesTest, \
      ParentageRelationshipsTest, \
-     temp_cwd
+     temp_cwd, \
+     AssertWrapper
 
 def requires_outputlog(path = ".", prefix = ""):
     def ffalse(func):
@@ -94,9 +95,10 @@
             for xmin, xmax in zip(self.left_edges, self.right_edges):
                 mask = (position >= xmin)*(position <= xmax)
                 exact_field = np.interp(position[mask], exact['pos'], exact[k]) 
+                myname = "ShockTubeTest_%s" % k
                 # yield test vs analytical solution 
-                yield assert_allclose, field[mask], exact_field, \
-                    self.rtol, self.atol
+                yield AssertWrapper(myname, assert_allclose, field[mask], 
+                                    exact_field, self.rtol, self.atol)
 
     def get_analytical_solution(self):
         # Reads in from file 


diff -r e0004f1bce411f5b19faa125fcaa23ab68d5fd6c -r 08ce935c137a88d0f8d3aa66f947a90374e02c0b yt/utilities/answer_testing/framework.py
--- a/yt/utilities/answer_testing/framework.py
+++ b/yt/utilities/answer_testing/framework.py
@@ -554,3 +554,18 @@
                     yield PixelizedProjectionValuesTest(
                         pf_fn, axis, field, weight_field,
                         ds)
+
+class AssertWrapper(object):
+    """
+    Used to wrap a numpy testing assertion, in order to provide a useful name
+    for a given assertion test.
+    """
+    def __init__(self, description, *args):
+        # The key here is to add a description attribute, which nose will pick
+        # up.
+        self.args = args
+        self.description = description
+
+    def __call__(self):
+        self.args[0](*self.args[1:])
+



https://bitbucket.org/yt_analysis/yt/changeset/3771c9459829/
changeset:   3771c9459829
branch:      yt
user:        samskillman
date:        2012-11-20 05:53:30
summary:     Merging
affected #:  1 file

diff -r 08ce935c137a88d0f8d3aa66f947a90374e02c0b -r 3771c94598296eeb47988f1ee31d54064f5e0a7f yt/frontends/orion/fields.py
--- a/yt/frontends/orion/fields.py
+++ b/yt/frontends/orion/fields.py
@@ -126,7 +126,7 @@
         data["x-velocity"]**2.0
         + data["y-velocity"]**2.0
         + data["z-velocity"]**2.0 )
-add_orion_field("ThermalEnergy", function=_ThermalEnergy,
+add_field("ThermalEnergy", function=_ThermalEnergy,
                 units=r"\rm{ergs}/\rm{cm^3}")
 
 def _Pressure(field,data):
@@ -134,11 +134,11 @@
        NB: this will need to be modified for radiation
     """
     return (data.pf["Gamma"] - 1.0)*data["ThermalEnergy"]
-add_orion_field("Pressure", function=_Pressure, units=r"\rm{dyne}/\rm{cm}^{2}")
+add_field("Pressure", function=_Pressure, units=r"\rm{dyne}/\rm{cm}^{2}")
 
 def _Temperature(field,data):
     return (data.pf["Gamma"]-1.0)*data.pf["mu"]*mh*data["ThermalEnergy"]/(kboltz*data["Density"])
-add_orion_field("Temperature",function=_Temperature,units=r"\rm{Kelvin}",take_log=False)
+add_field("Temperature",function=_Temperature,units=r"\rm{Kelvin}",take_log=False)
 
 # particle fields

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