Work with external data
These examples are opt-in. The site displays their code without executing requests or downloading kernels.
External data queries
| Source | Entry point | Required inputs |
|---|---|---|
| JPL Horizons | sloc.horizons_quick |
Object ID, epoch-range dictionary or list of Julian dates, observer location |
| JPL SBDB | sloc.fetch_orb |
Optional output Parquet path and filters |
Query a small Horizons interval
import skyloc as sloc
raw, ephemeris = sloc.horizons_quick(
objid="1",
epochs={"start": "2025-01-01", "stop": "2025-01-03", "step": "1d"},
location="500@399",
in_tdb=False,
)This requests Ceres as seen from Earth’s center:
rawis the original Astroquery table;ephemerisis a DataFrame with columns renamed and selected for comparison with skyloc.in_tdb=Falsetreats the input epochs as UTC.- Set
in_tdb=Trueonly when your input epochs are TDB. - A live service can fail or return updated solutions; retain the request and returned table with a research result.
Prepare an orbital-element file
import skyloc as sloc
orb, m_ng = sloc.fetch_orb(output="orb_sbdb.parq")Key considerations:
- Returns the orbital-element DataFrame
orband its aligned boolean non-gravitational-term maskm_ng. Keep using these outputs. - It can retrieve a large SBDB catalog and save it as Parquet. The default path is
"orb.parq";output=Noneuses Kete’s cache and requires Kete. - With
update_output=False(default), an existing file is reused without checking freshness. - Use
update_output=Trueto refresh entries, or a number of days to update when the file is older than that age. See the API for required fields and filtering behavior.
Define a field of view
With Kete and suitable kernels prepared, define fields at Earth’s geocenter. jd_tdb is a TDB Julian date; pointing, rotation, widths, and radius are in degrees. Short positional calls omit the observer vectors:
import skyloc as sloc
observer, fov = sloc.make_cone_fov("field", 2460676.5, 30, 20, radius_deg=5)
observer, rectangle = sloc.make_rect_fov("field", 2460676.5, 30, 20, 0)Each omitted or None vector defaults independently to (0, 0, 0): pos_au is in au and vel_aupd is in au/day, relative to center_id (default 399, Earth’s geocenter). A zero position places the observer at the body’s center; a zero velocity is relative to that center. The default fov_to_sun=True then converts the state to Sun-centered coordinates (center_id=10). For an actual observatory or spacecraft, supply its physical position and velocity relative to the chosen center.
Rectangles require center_ra_deg, center_dec_deg, and rotation_deg; cones require center_ra_deg and center_dec_deg. Required geometry follows state_desig, jd_tdb. For rectangle and cone factories, required arguments may be positional; optional arguments use keywords. Omitting required geometry raises TypeError. Omni fields need no pointing and keep their argument order. Calls that name all arguments keep working.
Migrate old pos/vel-first rectangle and cone calls by naming vectors and sizes. Here jd is a TDB Julian date, and pos and vel are your physical observer vectors in au and au/day:
import skyloc as sloc
# Before: observer vectors came first; sizes could be positional.
sloc.make_rect_fov("field", jd, pos, vel, 30, 20, 0, 2, 1)
sloc.make_cone_fov("field", jd, pos, vel, 30, 20, 5)
# After: required geometry comes first; name every optional argument.
sloc.make_rect_fov(
"field", jd, 30, 20, 0, lon_width_deg=2, lat_width_deg=1,
pos_au=pos, vel_aupd=vel,
)
sloc.make_cone_fov("field", jd, 30, 20, radius_deg=5, pos_au=pos, vel_aupd=vel)Choose a propagation workflow
| Task | Entry point | Prepare first |
|---|---|---|
| Locate cataloged small bodies in fields | sloc.SSOLocator or sloc.locator_twice |
kete, field definitions, orb, epochs |
| Reuse full-catalog states across epochs or runs (optional) | sloc.CachedOrbPropagator(orb, m_ng) |
Same orb and aligned m_ng, kete, local state-cache paths |
| Locate SPICE bodies in fields | sloc.SpiceLocator |
kete, field definitions, suitable SPICE coverage |
| Calculate ephemerides for propagated objects | sloc.calc_ephems |
kete, orbital elements, simultaneous states with observer information |
With your prepared FOVs in fovs and suitable kernels, the usual two-pass workflow is:
import skyloc as sloc
sl1, sl2 = sloc.locator_twice(fovs, orb)
ephemeris = sl2.ephWorkflow notes:
sloc.locator_twiceperforms the standard two-pass field search.sloc.CachedOrbPropagatorprepares source states and force models once and validates propagated-state caches. It does not fetch orbit data or replaceorbin the locator.- Use the optional catalog guide when state reuse across epochs or runs is useful; the existing locator workflow remains supported.
- Kernel-backed calculations need coverage for the selected bodies and time interval. Do not assume an arbitrary cache contains that coverage.
sloc.download_jpl_de()is an explicit download helper, not a required site-build step. See the locator API and notebook catalog for complete workflow inputs.