[yt-svn] commit/yt: 3 new changesets
commits-noreply at bitbucket.org
commits-noreply at bitbucket.org
Fri Jun 17 07:35:03 PDT 2016
3 new commits in yt:
https://bitbucket.org/yt_analysis/yt/commits/a44e3ec17cf5/
Changeset: a44e3ec17cf5
Branch: yt
User: MatthewTurk
Date: 2016-06-16 21:10:55+00:00
Summary: Adding checks for CIC against bounds
Affected #: 3 files
diff -r 88532ec0be1dac57a7c5bc2a7e6f4f22e39162a1 -r a44e3ec17cf5c1ff1b75fda3b16f9942c1c97abe yt/geometry/particle_deposit.pyx
--- a/yt/geometry/particle_deposit.pyx
+++ b/yt/geometry/particle_deposit.pyx
@@ -329,6 +329,11 @@
cdef np.float64_t[:,:,:,:] field
cdef public object ofield
def initialize(self):
+ if not all(_ > 1 for _ in self.nvals):
+ from yt.utilities.exceptions import YTBoundsDefinitionError
+ raise YTBoundsDefinitionError(
+ "CIC requires minimum of 2 zones in all dimensions",
+ self.nvals)
self.field = append_axes(
np.zeros(self.nvals, dtype="float64", order='F'), 4)
diff -r 88532ec0be1dac57a7c5bc2a7e6f4f22e39162a1 -r a44e3ec17cf5c1ff1b75fda3b16f9942c1c97abe yt/geometry/tests/test_particle_deposit.py
--- /dev/null
+++ b/yt/geometry/tests/test_particle_deposit.py
@@ -0,0 +1,18 @@
+import numpy as np
+
+from yt.utilities.exceptions import \
+ YTBoundsDefinitionError
+
+from yt.testing import \
+ fake_random_ds, \
+ assert_equal, \
+ assert_rel_equal
+from numpy.testing import \
+ assert_raises
+
+def test_cic_deposit():
+ ds = fake_random_ds(64, nprocs = 8, particles=64**3)
+ my_reg = ds.arbitrary_grid(ds.domain_left_edge, ds.domain_right_edge,
+ dims=[1, 800, 800])
+ f = ("deposit", "all_cic")
+ assert_raises(YTBoundsDefinitionError, my_reg.__getitem__, f)
diff -r 88532ec0be1dac57a7c5bc2a7e6f4f22e39162a1 -r a44e3ec17cf5c1ff1b75fda3b16f9942c1c97abe yt/utilities/exceptions.py
--- a/yt/utilities/exceptions.py
+++ b/yt/utilities/exceptions.py
@@ -568,3 +568,14 @@
v = "This operation is not supported for data of geometry %s; " % self.this
v += "It supports data of geometries %s" % (self.supported,)
return v
+
+class YTBoundsDefinitionError(YTException):
+ def __init__(self, message, bounds):
+ self.bounds = bounds
+ self.message = message
+
+ def __str__(self):
+ v = "This operation has encountered a bounds error: "
+ v += self.message
+ v += " Specified bounds are %s" % self.bounds
+ return v
https://bitbucket.org/yt_analysis/yt/commits/822f438121c5/
Changeset: 822f438121c5
Branch: yt
User: MatthewTurk
Date: 2016-06-16 22:21:48+00:00
Summary: Removing unused imports
Affected #: 1 file
diff -r a44e3ec17cf5c1ff1b75fda3b16f9942c1c97abe -r 822f438121c527749e20d8d02124ba8c5b8b78fa yt/geometry/tests/test_particle_deposit.py
--- a/yt/geometry/tests/test_particle_deposit.py
+++ b/yt/geometry/tests/test_particle_deposit.py
@@ -1,12 +1,8 @@
-import numpy as np
-
from yt.utilities.exceptions import \
YTBoundsDefinitionError
from yt.testing import \
- fake_random_ds, \
- assert_equal, \
- assert_rel_equal
+ fake_random_ds
from numpy.testing import \
assert_raises
https://bitbucket.org/yt_analysis/yt/commits/27783a435b49/
Changeset: 27783a435b49
Branch: yt
User: atmyers
Date: 2016-06-17 14:34:41+00:00
Summary: Merged in MatthewTurk/yt (pull request #2243)
Check that CIC always gets at least two cells. Closes #1057.
Affected #: 3 files
diff -r 5da31254f065d004d45d5e182f674f1cce9ea57f -r 27783a435b496c47db10e1a1f5f5f1485ab2bcf1 yt/geometry/particle_deposit.pyx
--- a/yt/geometry/particle_deposit.pyx
+++ b/yt/geometry/particle_deposit.pyx
@@ -329,6 +329,11 @@
cdef np.float64_t[:,:,:,:] field
cdef public object ofield
def initialize(self):
+ if not all(_ > 1 for _ in self.nvals):
+ from yt.utilities.exceptions import YTBoundsDefinitionError
+ raise YTBoundsDefinitionError(
+ "CIC requires minimum of 2 zones in all dimensions",
+ self.nvals)
self.field = append_axes(
np.zeros(self.nvals, dtype="float64", order='F'), 4)
diff -r 5da31254f065d004d45d5e182f674f1cce9ea57f -r 27783a435b496c47db10e1a1f5f5f1485ab2bcf1 yt/geometry/tests/test_particle_deposit.py
--- /dev/null
+++ b/yt/geometry/tests/test_particle_deposit.py
@@ -0,0 +1,14 @@
+from yt.utilities.exceptions import \
+ YTBoundsDefinitionError
+
+from yt.testing import \
+ fake_random_ds
+from numpy.testing import \
+ assert_raises
+
+def test_cic_deposit():
+ ds = fake_random_ds(64, nprocs = 8, particles=64**3)
+ my_reg = ds.arbitrary_grid(ds.domain_left_edge, ds.domain_right_edge,
+ dims=[1, 800, 800])
+ f = ("deposit", "all_cic")
+ assert_raises(YTBoundsDefinitionError, my_reg.__getitem__, f)
diff -r 5da31254f065d004d45d5e182f674f1cce9ea57f -r 27783a435b496c47db10e1a1f5f5f1485ab2bcf1 yt/utilities/exceptions.py
--- a/yt/utilities/exceptions.py
+++ b/yt/utilities/exceptions.py
@@ -568,3 +568,14 @@
v = "This operation is not supported for data of geometry %s; " % self.this
v += "It supports data of geometries %s" % (self.supported,)
return v
+
+class YTBoundsDefinitionError(YTException):
+ def __init__(self, message, bounds):
+ self.bounds = bounds
+ self.message = message
+
+ def __str__(self):
+ v = "This operation has encountered a bounds error: "
+ v += self.message
+ v += " Specified bounds are %s" % self.bounds
+ return v
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