diff options
author | bsimon <bsimon@stsci.edu> | 2014-10-17 13:18:33 -0400 |
---|---|---|
committer | bsimon <bsimon@stsci.edu> | 2014-10-17 13:18:33 -0400 |
commit | 9edda1dbfe1e73f8ba74765ae03ad617bf1f3b7b (patch) | |
tree | b583b73ddc2735154377d29eafc72f46dae53cc9 | |
parent | b8263181dcfb4b01b4e6002a575f3373ae852847 (diff) | |
download | stsci.sphere-9edda1dbfe1e73f8ba74765ae03ad617bf1f3b7b.tar.gz |
I removed the monkey patched methods, intersection and intersect_point,
and changed the code to match the astropy version. The monkey patching
confused the documentation generation.
git-svn-id: http://svn.stsci.edu/svn/ssb/stsci_python/stsci.sphere/trunk@34879 fe389314-cf27-0410-b35b-8c050e845b92
Former-commit-id: 5959426efa9b880921c6da0467259e613e63f64b
-rw-r--r-- | stsci/sphere/great_circle_arc.py | 28 |
1 files changed, 12 insertions, 16 deletions
diff --git a/stsci/sphere/great_circle_arc.py b/stsci/sphere/great_circle_arc.py index 59260c9..0b47d89 100644 --- a/stsci/sphere/great_circle_arc.py +++ b/stsci/sphere/great_circle_arc.py @@ -59,8 +59,9 @@ else: from numpy.core.umath_tests import inner1d -__all__ = ['angle', 'intersection', 'intersects', 'length', 'midpoint', - 'interpolate'] +___all__ = ['angle', 'intersection', 'intersects', 'intersects_point', + 'length', 'midpoint', 'interpolate'] + def _fast_cross(a, b): @@ -139,13 +140,13 @@ def intersection(A, B, C, D): .. math:: - s_1 = ((A × B) × A) · T + s_1 = ((A × B) × A) \cdot T - s_2 = (B × (A × B)) · T + s_2 = (B × (A × B)) \cdot T - s_3 = ((C × D) × C) · T + s_3 = ((C × D) × C) \cdot T - s_4 = (D × (C × D)) · T + s_4 = (D × (C × D)) \cdot T For :math:`s_n`, if all positive :math:`T` is returned as-is. If all negative, :math:`T` is multiplied by :math:`-1`. Otherwise @@ -160,6 +161,9 @@ def intersection(A, B, C, D): http://www.mathworks.com/matlabcentral/newsreader/view_thread/276271 """ + if HAS_C_UFUNCS: + return math_util.intersection(A, B, C, D) + A = np.asanyarray(A) B = np.asanyarray(B) C = np.asanyarray(C) @@ -199,10 +203,6 @@ def intersection(A, B, C, D): return np.where(equals, np.nan, cross) -if HAS_C_UFUNCS: - intersection = math_util.intersection - - def length(A, B, degrees=True): r""" Returns the angular distance between two points (in vector space) @@ -228,7 +228,7 @@ def length(A, B, degrees=True): .. math:: - \Delta = \arccos(A \dot B) + \Delta = \arccos(A \cdot B) """ if HAS_C_UFUNCS: result = math_util.length(A, B) @@ -283,7 +283,7 @@ def intersects(A, B, C, D): def intersects_point(A, B, C): """ - Returns True if point C is along the great circle arc AB. + Returns True if point C is along the great circle arc *AB*. """ if HAS_C_UFUNCS: return math_util.intersects_point(A, B, C) @@ -297,10 +297,6 @@ def intersects_point(A, B, C): return length_diff < 1e-10 -if HAS_C_UFUNCS: - intersects_point = math_util.intersects_point - - def angle(A, B, C, degrees=True): """ Returns the angle at *B* between *AB* and *BC*. |