EphCore.SnapshotPipeline.Intent (eph_core v0.1.0)

Copy Markdown View Source

Stage 00: INTENT — validate and normalize the request that drives the pipeline.

EphCore.observe/4 builds an intent from its arguments before any astronomy runs. Invalid input fails here with {:error, %Ecto.Changeset{}} rather than partway through a computation, and every later stage reads its settings from the resulting immutable struct.

Fields

  • :utc — required DateTime in UTC.
  • :observer%{lat_deg:, lon_deg:, height_m:} (WGS84), normalized from %{lat:, lon:, height:}.
  • :targets — supported body atoms (planets, :sun, :moon, :pluto, and the asteroids :ceres, :pallas, :juno, :vesta, :chiron).
  • :models:delta_t, :earth_orientation, :earth, :ecliptic_frame.
  • :corrections:precession_nutation, :aberration, :light_time.
  • :motion:enabled and :dt_minutes (1..1440).
  • :geometry:ring_samples (0, or clamped to 8..72).

Omitted keys fall back to defaults: IERS ΔT, GMST, WGS84, true-of-date ecliptic, no corrections, motion enabled at a 30-minute half-window, and 24 ring samples. See the README options reference for what each value changes.

Example

{:ok, snapshot} =
  Intent.new(%{
    utc: ~U[2026-01-12 17:32:10Z],
    observer: %{lat: 44.9778, lon: -93.2650, height: 250},
    targets: [:sun, :moon],
    models: %{ecliptic_frame: :mean_of_date}
  })

new/1 returns an internal snapshot struct wrapping the intent, which then accumulates each stage's results as it flows through the pipeline.

Summary

Functions

Returns true when both aberration and light_time correction flags are enabled, meaning apparent geocentric position should be computed.

Build the intent changeset without persisting data.

Build a new snapshot from intent params.

Types

observer()

@type observer() :: %{lat_deg: float(), lon_deg: float(), height_m: float()}

t()

@type t() :: %EphCore.SnapshotPipeline.Intent{
  corrections: %{
    precession_nutation: boolean(),
    aberration: boolean(),
    light_time: boolean()
  },
  geometry: %{ring_samples: integer()},
  models: %{
    delta_t: atom(),
    earth_orientation: atom(),
    earth: atom(),
    ecliptic_frame: atom()
  },
  motion: %{enabled: boolean(), dt_minutes: integer()},
  observer: observer() | nil,
  targets: [atom()] | nil,
  utc: DateTime.t()
}

Functions

apparent_geocentric?(intent)

@spec apparent_geocentric?(t()) :: boolean()

Returns true when both aberration and light_time correction flags are enabled, meaning apparent geocentric position should be computed.

changeset(params)

@spec changeset(map()) :: Ecto.Changeset.t()

Build the intent changeset without persisting data.

new(params)

@spec new(map() | keyword()) :: {:ok, term()} | {:error, Ecto.Changeset.t()}

Build a new snapshot from intent params.

Returns {:ok, %Snapshot{}} on success, otherwise {:error, changeset}.