Python: finished elongation/longitude tests.

This commit is contained in:
Don Cross
2019-06-30 14:29:25 -04:00
parent 503541e196
commit e3759ebde5
3 changed files with 139 additions and 42 deletions

View File

@@ -2289,15 +2289,13 @@ def SearchMaxElongation(body, startTime):
rlon_hi = -s1
t_start = startTime.AddDays(adjust_days)
search1 = SearchRelativeLongitude(body, rlon_lo, t_start)
if search1 is None:
t1 = SearchRelativeLongitude(body, rlon_lo, t_start)
if t1 is None:
return None
t1 = search1.time
search2 = SearchRelativeLongitude(body, rlon_hi, t1)
if search2 is None:
t2 = SearchRelativeLongitude(body, rlon_hi, t1)
if t2 is None:
return None
t2 = search2.time
# Now we have a time range [t1,t2] that brackets a maximum elongation event.
# Confirm the bracketing.
@@ -2310,12 +2308,12 @@ def SearchMaxElongation(body, startTime):
raise InternalError() # there is a bug in the bracketing algorithm!
# Use the generic search algorithm to home in on where the slope crosses from negative to positive.
searchx = Search(neg_elong_slope, body, t1, t2, 10.0)
if searchx is None:
tx = Search(_neg_elong_slope, body, t1, t2, 10.0)
if tx is None:
return None
if searchx.time.tt >= startTime.tt:
return Elongation(body, searchx.time)
if tx.tt >= startTime.tt:
return Elongation(body, tx)
# This event is in the past (earlier than startTime).
# We need to search forward from t2 to find the next possible window.
@@ -2820,15 +2818,9 @@ def NextLunarApsis(apsis):
# + Ecliptic
# + EclipticLongitude
# + AngleFromSun
# + SearchMaxElongation
# + _neg_elong_slope
# + SearchRelativeLongitude
# + Elongation
# + SearchHourAngle
# + SearchRiseSet
# + Illumination
# + SearchPeakMagnitude
# + SearchLunarApsis
# + _distance_slope
# + _MoonDistance
# + NextLunarApsis