diff options
author | mdroe <mdroe@stsci.edu> | 2014-06-12 21:20:29 -0400 |
---|---|---|
committer | mdroe <mdroe@stsci.edu> | 2014-06-12 21:20:29 -0400 |
commit | 23349b8f5f7c89596bfd8289ffaf67f36c2786c8 (patch) | |
tree | 79f00fb9721df7ebb4aa78cf931a101f628e2a9a | |
parent | dfb4f51fad026b50912139d61e281e61b6bbc3a1 (diff) | |
download | stsci.sphere-23349b8f5f7c89596bfd8289ffaf67f36c2786c8.tar.gz |
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
-rw-r--r-- | stsci/sphere/great_circle_arc.py | 14 |
1 files changed, 10 insertions, 4 deletions
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. |