summaryrefslogtreecommitdiff
path: root/stsci/sphere/test/test.py
diff options
context:
space:
mode:
authormdroe <mdroe@stsci.edu>2014-06-13 18:04:04 -0400
committermdroe <mdroe@stsci.edu>2014-06-13 18:04:04 -0400
commite0211e21f3db0bb27a04490d712dabe04c0fed26 (patch)
treec48efb390b1baabb99ee349b2980d38b3e7f5bb6 /stsci/sphere/test/test.py
parent99b3bdc918d81c78ed1583804bcfa0d42f123667 (diff)
downloadstsci.sphere-e0211e21f3db0bb27a04490d712dabe04c0fed26.tar.gz
More speedups.
git-svn-id: http://svn.stsci.edu/svn/ssb/stsci_python/stsci.sphere/trunk@32541 fe389314-cf27-0410-b35b-8c050e845b92 Former-commit-id: 36e70c1cac043d59089f386a6b6d730c4887fa84
Diffstat (limited to 'stsci/sphere/test/test.py')
-rw-r--r--stsci/sphere/test/test.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/stsci/sphere/test/test.py b/stsci/sphere/test/test.py
index 8e6e270..5ab7bbb 100644
--- a/stsci/sphere/test/test.py
+++ b/stsci/sphere/test/test.py
@@ -19,8 +19,9 @@ graph.DEBUG = True
def test_normalize_vector():
x, y, z = np.ogrid[-100:100:11,-100:100:11,-100:100:11]
- xn, yn, zn = vector.normalize_vector(x.flatten(), y.flatten(), z.flatten())
- l = np.sqrt(xn ** 2 + yn ** 2 + zn ** 2)
+ xyz = np.dstack((x.flatten(), y.flatten(), z.flatten()))[0]
+ xyzn = vector.normalize_vector(xyz)
+ l = np.sqrt(np.sum(xyzn * xyzn, axis=-1))
assert_almost_equal(l, 1.0)