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

Bitbucket commits-noreply at bitbucket.org
Fri Oct 19 05:12:07 PDT 2012


2 new commits in yt:


https://bitbucket.org/yt_analysis/yt/changeset/46dc87531a8e/
changeset:   46dc87531a8e
branch:      yt
user:        MatthewTurk
date:        2012-10-19 13:39:14
summary:     Changing Extrema derived quantity to use nanmin and nanmax
affected #:  2 files

diff -r b33c3a4a1cde5b796cc09f99b78c683518b4cd18 -r 46dc87531a8e2e450f2c0be2b3eac933c9c36a85 yt/data_objects/derived_quantities.py
--- a/yt/data_objects/derived_quantities.py
+++ b/yt/data_objects/derived_quantities.py
@@ -598,16 +598,16 @@
                     continue
             else:
                 nz_filter = None
-            mins.append(data[field][nz_filter].min())
-            maxs.append(data[field][nz_filter].max())
+            mins.append(np.nanmin(data[field][nz_filter]))
+            maxs.append(np.nanmax(data[field][nz_filter]))
         else:
             if this_filter.any():
                 if non_zero:
                     nz_filter = ((this_filter) &
                                  (data[field][this_filter] > 0.0))
                 else: nz_filter = this_filter
-                mins.append(data[field][nz_filter].min())
-                maxs.append(data[field][nz_filter].max())
+                mins.append(np.nanmin(data[field][nz_filter]))
+                maxs.append(np.nanmax(data[field][nz_filter]))
             else:
                 mins.append(1e90)
                 maxs.append(-1e90)


diff -r b33c3a4a1cde5b796cc09f99b78c683518b4cd18 -r 46dc87531a8e2e450f2c0be2b3eac933c9c36a85 yt/data_objects/test_derived_quantities.py
--- /dev/null
+++ b/yt/data_objects/test_derived_quantities.py
@@ -0,0 +1,20 @@
+from yt.testing import *
+from yt.data_objects.profiles import \
+    BinnedProfile1D, BinnedProfile2D, BinnedProfile3D
+import numpy as np
+
+def setup():
+    from yt.config import ytcfg
+    ytcfg["yt","__withintesting"] = "True"
+
+def test_extrema():
+    for nprocs in [1, 2, 4, 8]:
+        pf = fake_random_pf(16, nprocs = nprocs)
+        sp = pf.h.sphere("c", (0.25, '1'))
+        (mi, ma), = sp.quantities["Extrema"]("Density")
+        yield assert_equal, mi, np.nanmin(sp["Density"])
+        yield assert_equal, ma, np.nanmax(sp["Density"])
+        dd = pf.h.all_data()
+        (mi, ma), = dd.quantities["Extrema"]("Density")
+        yield assert_equal, mi, np.nanmin(dd["Density"])
+        yield assert_equal, ma, np.nanmax(dd["Density"])



https://bitbucket.org/yt_analysis/yt/changeset/8194d4172fc3/
changeset:   8194d4172fc3
branch:      yt
user:        MatthewTurk
date:        2012-10-19 14:01:53
summary:     Actually testing for NaNs -- and fixing some imports, moving some files.
affected #:  2 files

diff -r 46dc87531a8e2e450f2c0be2b3eac933c9c36a85 -r 8194d4172fc3edaea21bfd7a775c3573f0706d2d yt/data_objects/test_derived_quantities.py
--- a/yt/data_objects/test_derived_quantities.py
+++ /dev/null
@@ -1,20 +0,0 @@
-from yt.testing import *
-from yt.data_objects.profiles import \
-    BinnedProfile1D, BinnedProfile2D, BinnedProfile3D
-import numpy as np
-
-def setup():
-    from yt.config import ytcfg
-    ytcfg["yt","__withintesting"] = "True"
-
-def test_extrema():
-    for nprocs in [1, 2, 4, 8]:
-        pf = fake_random_pf(16, nprocs = nprocs)
-        sp = pf.h.sphere("c", (0.25, '1'))
-        (mi, ma), = sp.quantities["Extrema"]("Density")
-        yield assert_equal, mi, np.nanmin(sp["Density"])
-        yield assert_equal, ma, np.nanmax(sp["Density"])
-        dd = pf.h.all_data()
-        (mi, ma), = dd.quantities["Extrema"]("Density")
-        yield assert_equal, mi, np.nanmin(dd["Density"])
-        yield assert_equal, ma, np.nanmax(dd["Density"])


diff -r 46dc87531a8e2e450f2c0be2b3eac933c9c36a85 -r 8194d4172fc3edaea21bfd7a775c3573f0706d2d yt/data_objects/tests/test_derived_quantities.py
--- /dev/null
+++ b/yt/data_objects/tests/test_derived_quantities.py
@@ -0,0 +1,24 @@
+from yt.testing import *
+import numpy as np
+
+def setup():
+    from yt.config import ytcfg
+    ytcfg["yt","__withintesting"] = "True"
+
+def test_extrema():
+    for nprocs in [1, 2, 4, 8]:
+        pf = fake_random_pf(16, nprocs = nprocs, fields = ("Density",
+                "x-velocity", "y-velocity", "z-velocity"))
+        sp = pf.h.sphere("c", (0.25, '1'))
+        (mi, ma), = sp.quantities["Extrema"]("Density")
+        yield assert_equal, mi, np.nanmin(sp["Density"])
+        yield assert_equal, ma, np.nanmax(sp["Density"])
+        dd = pf.h.all_data()
+        (mi, ma), = dd.quantities["Extrema"]("Density")
+        yield assert_equal, mi, np.nanmin(dd["Density"])
+        yield assert_equal, ma, np.nanmax(dd["Density"])
+        sp = pf.h.sphere("max", (0.25, '1'))
+        yield assert_equal, np.any(np.isnan(sp["RadialVelocity"])), True
+        (mi, ma), = dd.quantities["Extrema"]("RadialVelocity")
+        yield assert_equal, mi, np.nanmin(dd["RadialVelocity"])
+        yield assert_equal, ma, np.nanmax(dd["RadialVelocity"])

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