EphCore.Ephemeris (eph_core v0.1.0)

Copy Markdown View Source

Geocentric and barycentric state vectors read straight from SPK kernels.

This is the layer beneath EphCore.observe/4: it maps body atoms to NAIF IDs, resolves the center chains DE440s uses (barycenters for the outer planets, EMB for Earth and Moon, Sun-relative for Horizons asteroid kernels), and returns ICRF/J2000 vectors in kilometres for a Terrestrial Time Julian date.

Requires the ephemeris kernels described in the README data setup; positions for a body outside the loaded kernels' coverage return {:error, reason}.

Summary

Functions

Barycentric (SSB) position of body (km) at jd_tt, querying the body→SSB chain directly.

Telemetry-free body_ssb_km/2 for the almanac hot path.

Telemetry-free precompute_earth_ssb/1 for the almanac hot path.

Functions

body_ssb_km(jd_tt, target)

@spec body_ssb_km(float(), atom()) ::
  {:ok, {float(), float(), float()}} | {:error, term()}

Barycentric (SSB) position of body (km) at jd_tt, querying the body→SSB chain directly.

Unlike precompute_earth_ssb/1 + geocentric_state_from_cache/2, this skips reconstructing Earth/EMB state when only the body's SSB position is needed (e.g. the light-time retarded epoch in EphCore.Corrections.ApparentPlace). For a planet this is a single SPK query instead of three; Moon and asteroid chains are preserved.

body_ssb_km_fast(jd_tt, target)

@spec body_ssb_km_fast(float(), atom()) ::
  {:ok, {float(), float(), float()}} | {:error, term()}

Telemetry-free body_ssb_km/2 for the almanac hot path.

geocentric_state(jd_tt, target)

@spec geocentric_state(float(), atom()) ::
  {:ok,
   %{
     geocentric_position_km: {float(), float(), float()},
     geocentric_range_km: float(),
     frame: atom(),
     query_seconds_past_j2000: float()
   }}
  | {:error, term()}

geocentric_state_from_cache(cache, target)

@spec geocentric_state_from_cache(
  %{
    seconds: float(),
    earth_ssb: {float(), float(), float()},
    emb_ssb: {float(), float(), float()}
  },
  atom()
) ::
  {:ok,
   %{
     geocentric_position_km: {float(), float(), float()},
     geocentric_range_km: float(),
     frame: atom(),
     query_seconds_past_j2000: float()
   }}
  | {:error, term()}

geocentric_state_from_cache_fast(cache, target)

@spec geocentric_state_from_cache_fast(
  %{
    seconds: float(),
    earth_ssb: {float(), float(), float()},
    emb_ssb: {float(), float(), float()}
  },
  atom()
) ::
  {:ok,
   %{
     geocentric_position_km: {float(), float(), float()},
     geocentric_range_km: float(),
     frame: atom(),
     query_seconds_past_j2000: float()
   }}
  | {:error, term()}

Telemetry-free geocentric_state_from_cache/2 for the almanac hot path.

precompute_earth_ssb(jd_tt)

@spec precompute_earth_ssb(float()) ::
  {:ok,
   %{
     seconds: float(),
     earth_ssb: {float(), float(), float()},
     emb_ssb: {float(), float(), float()}
   }}
  | {:error, term()}

precompute_earth_ssb_fast(jd_tt)

@spec precompute_earth_ssb_fast(float()) ::
  {:ok,
   %{
     seconds: float(),
     earth_ssb: {float(), float(), float()},
     emb_ssb: {float(), float(), float()}
   }}
  | {:error, term()}

Telemetry-free precompute_earth_ssb/1 for the almanac hot path.