summaryrefslogtreecommitdiff
path: root/stsci/sphere/great_circle_arc.py
diff options
context:
space:
mode:
Diffstat (limited to 'stsci/sphere/great_circle_arc.py')
-rw-r--r--stsci/sphere/great_circle_arc.py14
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.