-
Notifications
You must be signed in to change notification settings - Fork 11
Open
Description
Less than 1% of the times when I am running a model with parallax (letting pyLIMA fetch ephemerides for me), I get errors from JPL Horizon.
The culprit might be here where too many queries are made to JPL:
pyLIMA/pyLIMA/parallax/JPL_ephemerides.py
Lines 78 to 110 in 92b4f47
| if distances.min() < 0.002: # Low orbits | |
| # adding exact telescopes dates | |
| DATES = [dates.tolist()] | |
| RA = [ra.tolist()] | |
| DEC = [dec.tolist()] | |
| DISTANCES = [distances.tolist()] | |
| start = 0 | |
| while start < len(time_to_treat): # Split the time request in chunk of 50. | |
| end = start + 50 | |
| obj = Horizons(id=body, location=OBSERVATORY_ID, | |
| epochs=time_to_treat[start:end]) | |
| ephemerides = obj.ephemerides() | |
| dates = ephemerides['datetime_jd'].data.data | |
| ra = ephemerides['RA'].data.data | |
| dec = ephemerides['DEC'].data.data | |
| distances = ephemerides['delta'].data.data | |
| DATES.append(dates) | |
| RA.append(ra) | |
| DEC.append(dec) | |
| DISTANCES.append(distances) | |
| start = end | |
| dates = np.concatenate(DATES) | |
| ra = np.concatenate(RA) | |
| dec = np.concatenate(DEC) | |
| distances = np.concatenate(DISTANCES) |
However, it is also likely because I am running many models at the same time overloading the Horizon servers.
A fix that satisfies both issue is to add a "retry with backoff" algorithm (try to query again after waiting an exponentially increasing time)
It should be added to either here...
pyLIMA/pyLIMA/parallax/parallax.py
Lines 181 to 184 in 92b4f47
| from pyLIMA.parallax import JPL_ephemerides | |
| spacecraft_positions = \ | |
| JPL_ephemerides.horizons_API(satellite_name, time_to_treat, | |
| observatory='Geocentric')[1] |
or as part of JPL_ephemerides.horizons_API itself.
Metadata
Metadata
Assignees
Labels
No labels