From e0211e21f3db0bb27a04490d712dabe04c0fed26 Mon Sep 17 00:00:00 2001 From: mdroe Date: Fri, 13 Jun 2014 22:04:04 +0000 Subject: 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 --- stsci/sphere/test/test.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'stsci/sphere/test/test.py') 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) -- cgit