[yt-svn] commit/yt: 9 new changesets
Bitbucket
commits-noreply at bitbucket.org
Wed Oct 24 17:39:57 PDT 2012
9 new commits in yt:
https://bitbucket.org/yt_analysis/yt/changeset/ba7fa4cdeeba/
changeset: ba7fa4cdeeba
branch: yt
user: MatthewTurk
date: 2012-10-24 20:54:50
summary: This adds an ellipsoid tests script, which currently fails.
affected #: 2 files
diff -r 221b5163bffa2e478a2b65d80090adf1be45bb2e -r ba7fa4cdeeba48591c7488891046cc395713c03f yt/data_objects/data_containers.py
--- a/yt/data_objects/data_containers.py
+++ b/yt/data_objects/data_containers.py
@@ -5,7 +5,7 @@
Affiliation: KIPAC/SLAC/Stanford
Author: Britton Smith <Britton.Smith at colorado.edu>
Affiliation: University of Colorado at Boulder
-Author: Geoffrey So <gsiisg at gmail.com> (AMREllipsoidBase)
+Author: Geoffrey So <gsiisg at gmail.com>
Affiliation: UCSD Physics/CASS
Homepage: http://yt-project.org/
License:
diff -r 221b5163bffa2e478a2b65d80090adf1be45bb2e -r ba7fa4cdeeba48591c7488891046cc395713c03f yt/data_objects/tests/test_ellipsoid.py
--- /dev/null
+++ b/yt/data_objects/tests/test_ellipsoid.py
@@ -0,0 +1,32 @@
+from yt.testing import *
+
+def setup():
+ from yt.config import ytcfg
+ ytcfg["yt","__withintesting"] = "True"
+
+def test_ellipsoid():
+ # We decompose in different ways
+ cs = [[0.5, 0.5, 0.5],
+ [0.1, 0.2, 0.3],
+ [0.8, 0.8, 0.8]]
+ for nprocs in [1, 2, 4, 8]:
+ pf = fake_random_pf(64, nprocs = nprocs)
+ ABC = np.random.random((3, 12)) * 0.1
+ e0s = np.random.random((3, 12))
+ tilts = np.random.random((3, 12))
+ ABC[:,0] = 0.1
+
+ for i in range(12):
+ for c in cs:
+ A, B, C = reversed(sorted(ABC[:,i]))
+ e0 = e0s[:,i]
+ tilt = tilts[:,i]
+ ell = pf.h.ellipsoid(c, A, B, C, e0, tilt)
+ yield assert_equal, np.all(ell["Radius"] <= A), True
+ for i in xrange(ell["Radius"].size):
+ pos = np.array([ell[ax][i] for ax in 'xyz'])
+ v = 0.0
+ v += (pos * ell._e0).sum() / ell._A
+ v += (pos * ell._e1).sum() / ell._B
+ v += (pos * ell._e2).sum() / ell._C
+ yield assert_equal, (v <= 1.0), True
https://bitbucket.org/yt_analysis/yt/changeset/a086a1e8aac5/
changeset: a086a1e8aac5
branch: yt
user: MatthewTurk
date: 2012-10-24 20:57:29
summary: Fixing up ellipsoidal tests to be a lot faster.
affected #: 1 file
diff -r ba7fa4cdeeba48591c7488891046cc395713c03f -r a086a1e8aac54197d64b5a40872a67c4434a2f0c yt/data_objects/tests/test_ellipsoid.py
--- a/yt/data_objects/tests/test_ellipsoid.py
+++ b/yt/data_objects/tests/test_ellipsoid.py
@@ -23,10 +23,12 @@
tilt = tilts[:,i]
ell = pf.h.ellipsoid(c, A, B, C, e0, tilt)
yield assert_equal, np.all(ell["Radius"] <= A), True
+ all_in = True
for i in xrange(ell["Radius"].size):
pos = np.array([ell[ax][i] for ax in 'xyz'])
v = 0.0
v += (pos * ell._e0).sum() / ell._A
v += (pos * ell._e1).sum() / ell._B
v += (pos * ell._e2).sum() / ell._C
- yield assert_equal, (v <= 1.0), True
+ all_in = (v <= 1.0) and all_in
+ yield assert_equal, all_in, True
https://bitbucket.org/yt_analysis/yt/changeset/288fd314cb04/
changeset: 288fd314cb04
branch: yt
user: MatthewTurk
date: 2012-10-24 21:01:55
summary: Oops, could get too small of spheres, as well as we don't really want to double
up our index of iteration. Also, use vectors.
affected #: 1 file
diff -r a086a1e8aac54197d64b5a40872a67c4434a2f0c -r 288fd314cb048b305dc82156594dee020e8622c0 yt/data_objects/tests/test_ellipsoid.py
--- a/yt/data_objects/tests/test_ellipsoid.py
+++ b/yt/data_objects/tests/test_ellipsoid.py
@@ -2,6 +2,7 @@
def setup():
from yt.config import ytcfg
+ ytcfg["yt","loglevel"] = "50"
ytcfg["yt","__withintesting"] = "True"
def test_ellipsoid():
@@ -11,24 +12,25 @@
[0.8, 0.8, 0.8]]
for nprocs in [1, 2, 4, 8]:
pf = fake_random_pf(64, nprocs = nprocs)
+ min_dx = 2.0/pf.domain_dimensions
ABC = np.random.random((3, 12)) * 0.1
e0s = np.random.random((3, 12))
tilts = np.random.random((3, 12))
ABC[:,0] = 0.1
-
for i in range(12):
for c in cs:
A, B, C = reversed(sorted(ABC[:,i]))
+ A = max(A, min_dx[0])
+ B = max(B, min_dx[1])
+ C = max(C, min_dx[2])
e0 = e0s[:,i]
tilt = tilts[:,i]
ell = pf.h.ellipsoid(c, A, B, C, e0, tilt)
yield assert_equal, np.all(ell["Radius"] <= A), True
all_in = True
- for i in xrange(ell["Radius"].size):
- pos = np.array([ell[ax][i] for ax in 'xyz'])
- v = 0.0
- v += (pos * ell._e0).sum() / ell._A
- v += (pos * ell._e1).sum() / ell._B
- v += (pos * ell._e2).sum() / ell._C
- all_in = (v <= 1.0) and all_in
- yield assert_equal, all_in, True
+ pos = np.array([ell[ax] for ax in 'xyz'])
+ v = np.zeros_like(ell["Radius"])
+ v += (pos * ell._e0[:,None]).sum(axis=0) / ell._A
+ v += (pos * ell._e1[:,None]).sum(axis=0) / ell._B
+ v += (pos * ell._e2[:,None]).sum(axis=0) / ell._C
+ yield assert_equal, np.all(v <= 1.0), True
https://bitbucket.org/yt_analysis/yt/changeset/4df7141c25c1/
changeset: 4df7141c25c1
branch: yt
user: MatthewTurk
date: 2012-10-24 21:08:47
summary: Subtract off the position
affected #: 1 file
diff -r 288fd314cb048b305dc82156594dee020e8622c0 -r 4df7141c25c1cd1bc27c770ee6a64126f8547e47 yt/data_objects/tests/test_ellipsoid.py
--- a/yt/data_objects/tests/test_ellipsoid.py
+++ b/yt/data_objects/tests/test_ellipsoid.py
@@ -7,9 +7,9 @@
def test_ellipsoid():
# We decompose in different ways
- cs = [[0.5, 0.5, 0.5],
- [0.1, 0.2, 0.3],
- [0.8, 0.8, 0.8]]
+ cs = [np.array([0.5, 0.5, 0.5]),
+ np.array([0.1, 0.2, 0.3]),
+ np.array([0.8, 0.8, 0.8])]
for nprocs in [1, 2, 4, 8]:
pf = fake_random_pf(64, nprocs = nprocs)
min_dx = 2.0/pf.domain_dimensions
@@ -30,7 +30,7 @@
all_in = True
pos = np.array([ell[ax] for ax in 'xyz'])
v = np.zeros_like(ell["Radius"])
- v += (pos * ell._e0[:,None]).sum(axis=0) / ell._A
- v += (pos * ell._e1[:,None]).sum(axis=0) / ell._B
- v += (pos * ell._e2[:,None]).sum(axis=0) / ell._C
+ v += ((pos - c[:,None]) * ell._e0[:,None]).sum(axis=0) / ell._A
+ v += ((pos - c[:,None]) * ell._e1[:,None]).sum(axis=0) / ell._B
+ v += ((pos - c[:,None]) * ell._e2[:,None]).sum(axis=0) / ell._C
yield assert_equal, np.all(v <= 1.0), True
https://bitbucket.org/yt_analysis/yt/changeset/9b26aeca02b5/
changeset: 9b26aeca02b5
branch: yt
user: MatthewTurk
date: 2012-10-24 21:10:15
summary: Have to take the sqrt of v.
affected #: 1 file
diff -r 4df7141c25c1cd1bc27c770ee6a64126f8547e47 -r 9b26aeca02b5cd8b4f09caab3b064156242e2897 yt/data_objects/tests/test_ellipsoid.py
--- a/yt/data_objects/tests/test_ellipsoid.py
+++ b/yt/data_objects/tests/test_ellipsoid.py
@@ -27,10 +27,9 @@
tilt = tilts[:,i]
ell = pf.h.ellipsoid(c, A, B, C, e0, tilt)
yield assert_equal, np.all(ell["Radius"] <= A), True
- all_in = True
pos = np.array([ell[ax] for ax in 'xyz'])
v = np.zeros_like(ell["Radius"])
v += ((pos - c[:,None]) * ell._e0[:,None]).sum(axis=0) / ell._A
v += ((pos - c[:,None]) * ell._e1[:,None]).sum(axis=0) / ell._B
v += ((pos - c[:,None]) * ell._e2[:,None]).sum(axis=0) / ell._C
- yield assert_equal, np.all(v <= 1.0), True
+ yield assert_equal, np.all(np.sqrt(v) <= 1.0), True
https://bitbucket.org/yt_analysis/yt/changeset/d58e6b99d5a3/
changeset: d58e6b99d5a3
branch: yt
user: MatthewTurk
date: 2012-10-24 21:23:34
summary: Normalize e0 in the ellipsoid constructor and use just a single float for tilt
in the tests.
affected #: 2 files
diff -r 9b26aeca02b5cd8b4f09caab3b064156242e2897 -r d58e6b99d5a3dbd004a8a50ac62e786e890854d5 yt/data_objects/data_containers.py
--- a/yt/data_objects/data_containers.py
+++ b/yt/data_objects/data_containers.py
@@ -3538,7 +3538,7 @@
self._A = A
self._B = B
self._C = C
- self._e0 = e0
+ self._e0 = e0 / (e0**2.0).sum()**0.5
self._tilt = tilt
# find the t1 angle needed to rotate about z axis to align e0 to x
diff -r 9b26aeca02b5cd8b4f09caab3b064156242e2897 -r d58e6b99d5a3dbd004a8a50ac62e786e890854d5 yt/data_objects/tests/test_ellipsoid.py
--- a/yt/data_objects/tests/test_ellipsoid.py
+++ b/yt/data_objects/tests/test_ellipsoid.py
@@ -15,7 +15,7 @@
min_dx = 2.0/pf.domain_dimensions
ABC = np.random.random((3, 12)) * 0.1
e0s = np.random.random((3, 12))
- tilts = np.random.random((3, 12))
+ tilts = np.random.random(12)
ABC[:,0] = 0.1
for i in range(12):
for c in cs:
@@ -24,7 +24,7 @@
B = max(B, min_dx[1])
C = max(C, min_dx[2])
e0 = e0s[:,i]
- tilt = tilts[:,i]
+ tilt = tilts[i]
ell = pf.h.ellipsoid(c, A, B, C, e0, tilt)
yield assert_equal, np.all(ell["Radius"] <= A), True
pos = np.array([ell[ax] for ax in 'xyz'])
https://bitbucket.org/yt_analysis/yt/changeset/703f3d1b8448/
changeset: 703f3d1b8448
branch: yt
user: MatthewTurk
date: 2012-10-24 21:25:36
summary: Square components of v before summing
affected #: 1 file
diff -r d58e6b99d5a3dbd004a8a50ac62e786e890854d5 -r 703f3d1b8448e2f5b6609194c7c4d854f41f32c0 yt/data_objects/tests/test_ellipsoid.py
--- a/yt/data_objects/tests/test_ellipsoid.py
+++ b/yt/data_objects/tests/test_ellipsoid.py
@@ -27,9 +27,9 @@
tilt = tilts[i]
ell = pf.h.ellipsoid(c, A, B, C, e0, tilt)
yield assert_equal, np.all(ell["Radius"] <= A), True
- pos = np.array([ell[ax] for ax in 'xyz'])
+ p = np.array([ell[ax] for ax in 'xyz'])
v = np.zeros_like(ell["Radius"])
- v += ((pos - c[:,None]) * ell._e0[:,None]).sum(axis=0) / ell._A
- v += ((pos - c[:,None]) * ell._e1[:,None]).sum(axis=0) / ell._B
- v += ((pos - c[:,None]) * ell._e2[:,None]).sum(axis=0) / ell._C
+ v += (((p - c[:,None]) * ell._e0[:,None]).sum(axis=0) / ell._A)**2
+ v += (((p - c[:,None]) * ell._e1[:,None]).sum(axis=0) / ell._B)**2
+ v += (((p - c[:,None]) * ell._e2[:,None]).sum(axis=0) / ell._C)**2
yield assert_equal, np.all(np.sqrt(v) <= 1.0), True
https://bitbucket.org/yt_analysis/yt/changeset/e10bee53b408/
changeset: e10bee53b408
branch: yt
user: MatthewTurk
date: 2012-10-24 21:41:53
summary: If we normalize like this, the e0 used below in the cross product will already
be normalized. This makes all tests pass.
affected #: 1 file
diff -r 703f3d1b8448e2f5b6609194c7c4d854f41f32c0 -r e10bee53b4089b31450a0de688a932ae610e736d yt/data_objects/data_containers.py
--- a/yt/data_objects/data_containers.py
+++ b/yt/data_objects/data_containers.py
@@ -3538,7 +3538,7 @@
self._A = A
self._B = B
self._C = C
- self._e0 = e0 / (e0**2.0).sum()**0.5
+ self._e0 = e0 = e0 / (e0**2.0).sum()**0.5
self._tilt = tilt
# find the t1 angle needed to rotate about z axis to align e0 to x
https://bitbucket.org/yt_analysis/yt/changeset/189d2eace2e9/
changeset: 189d2eace2e9
branch: yt
user: samskillman
date: 2012-10-25 02:39:55
summary: Merged in MatthewTurk/yt (pull request #315)
affected #: 2 files
diff -r 1922fd7145acd17f277eadc9f00220f81294a673 -r 189d2eace2e91e9ac7aeae9593fe465b50b6cf92 yt/data_objects/data_containers.py
--- a/yt/data_objects/data_containers.py
+++ b/yt/data_objects/data_containers.py
@@ -5,7 +5,7 @@
Affiliation: KIPAC/SLAC/Stanford
Author: Britton Smith <Britton.Smith at colorado.edu>
Affiliation: University of Colorado at Boulder
-Author: Geoffrey So <gsiisg at gmail.com> (AMREllipsoidBase)
+Author: Geoffrey So <gsiisg at gmail.com>
Affiliation: UCSD Physics/CASS
Homepage: http://yt-project.org/
License:
@@ -3566,7 +3566,7 @@
self._A = A
self._B = B
self._C = C
- self._e0 = e0
+ self._e0 = e0 = e0 / (e0**2.0).sum()**0.5
self._tilt = tilt
# find the t1 angle needed to rotate about z axis to align e0 to x
diff -r 1922fd7145acd17f277eadc9f00220f81294a673 -r 189d2eace2e91e9ac7aeae9593fe465b50b6cf92 yt/data_objects/tests/test_ellipsoid.py
--- /dev/null
+++ b/yt/data_objects/tests/test_ellipsoid.py
@@ -0,0 +1,35 @@
+from yt.testing import *
+
+def setup():
+ from yt.config import ytcfg
+ ytcfg["yt","loglevel"] = "50"
+ ytcfg["yt","__withintesting"] = "True"
+
+def test_ellipsoid():
+ # We decompose in different ways
+ cs = [np.array([0.5, 0.5, 0.5]),
+ np.array([0.1, 0.2, 0.3]),
+ np.array([0.8, 0.8, 0.8])]
+ for nprocs in [1, 2, 4, 8]:
+ pf = fake_random_pf(64, nprocs = nprocs)
+ min_dx = 2.0/pf.domain_dimensions
+ ABC = np.random.random((3, 12)) * 0.1
+ e0s = np.random.random((3, 12))
+ tilts = np.random.random(12)
+ ABC[:,0] = 0.1
+ for i in range(12):
+ for c in cs:
+ A, B, C = reversed(sorted(ABC[:,i]))
+ A = max(A, min_dx[0])
+ B = max(B, min_dx[1])
+ C = max(C, min_dx[2])
+ e0 = e0s[:,i]
+ tilt = tilts[i]
+ ell = pf.h.ellipsoid(c, A, B, C, e0, tilt)
+ yield assert_equal, np.all(ell["Radius"] <= A), True
+ p = np.array([ell[ax] for ax in 'xyz'])
+ v = np.zeros_like(ell["Radius"])
+ v += (((p - c[:,None]) * ell._e0[:,None]).sum(axis=0) / ell._A)**2
+ v += (((p - c[:,None]) * ell._e1[:,None]).sum(axis=0) / ell._B)**2
+ v += (((p - c[:,None]) * ell._e2[:,None]).sum(axis=0) / ell._C)**2
+ yield assert_equal, np.all(np.sqrt(v) <= 1.0), True
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