From 23349b8f5f7c89596bfd8289ffaf67f36c2786c8 Mon Sep 17 00:00:00 2001 From: mdroe Date: Fri, 13 Jun 2014 01:20:29 +0000 Subject: Modest performance improvement. git-svn-id: http://svn.stsci.edu/svn/ssb/stsci_python/stsci.sphere/trunk@32538 fe389314-cf27-0410-b35b-8c050e845b92 Former-commit-id: 5e631ecb491dc8b9ef1f0eaade320c8f53437458 --- stsci/sphere/great_circle_arc.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'stsci/sphere/great_circle_arc.py') diff --git a/stsci/sphere/great_circle_arc.py b/stsci/sphere/great_circle_arc.py index 5df7aa2..59260c9 100644 --- a/stsci/sphere/great_circle_arc.py +++ b/stsci/sphere/great_circle_arc.py @@ -84,11 +84,11 @@ def _fast_cross(a, b): return cp -def _cross_and_normalize(A, B): - if HAS_C_UFUNCS: - with np.errstate(invalid='ignore'): - return math_util.cross_and_norm(A, B) +if HAS_C_UFUNCS: + _fast_cross = math_util.cross + +def _cross_and_normalize(A, B): T = _fast_cross(A, B) # Normalization l = np.sqrt(np.sum(T ** 2, axis=-1)) @@ -99,6 +99,12 @@ def _cross_and_normalize(A, B): return TN +if HAS_C_UFUNCS: + def _cross_and_normalize(A, B): + with np.errstate(invalid='ignore'): + return math_util.cross_and_norm(A, B) + + def intersection(A, B, C, D): r""" Returns the point of intersection between two great circle arcs. -- cgit