Skip to main content

Crate supernovas

Crate supernovas 

Source
Expand description

Safe Rust bindings to SuperNOVAS, a high-precision astrometry library based on NOVAS (Naval Observatory Vector Astrometry Software).

§What’s implemented

  • Scalars: Angle, TimeAngle, Coordinate, Interval, Pressure, Temperature, ScalarVelocity — dimensioned newtypes with validated constructors and unit-aware accessors.
  • Vectors: Position and Velocity — 3-D Cartesian vectors with arithmetic operators and cross-type ops (Position / Interval → Velocity, Velocity × Interval → Position).
  • Spherical coordinates: Spherical (base shape), Horizontal (az/el), Equatorial (RA/Dec + equinox), Ecliptic (λ/β + equinox), Galactic (l/b).
  • Reference systems: ReferenceSystem, Equinox — tag coordinate sets with the equatorial frame they were computed in.
  • Refraction: Refraction — choose None / Standard / Optical / Radio when converting apparent equatorial → horizontal.
  • Time: Time — UTC, TT, and split Julian dates, plus Unix epoch.
  • Observers: Observer — geodetic ground site (Site + Weather) and geocenter.
  • Sources: Source sealed trait — common interface for all source kinds.
    • CatalogEntry — ICRS sidereal source with optional proper motion, parallax, and radial velocity.
    • Planet — major solar-system body (Sun, Moon, planets, barycenters) via the installed planet provider.
    • EphemObject — arbitrary body by name and NAIF ID from the installed ephemeris provider.
    • OrbitalObject / OrbitalElements — Keplerian elements source; no external provider required.
  • Frame + observation: Frame — observer × time snapshot; call Frame::observe (accepts any impl Source) for a quick az/el, or Source::apparent_in to get an Apparent position with access to intermediate RA/Dec and conversion to any output frame.

§Quick start

use supernovas::{Accuracy, CatalogEntry, Frame, Observer, Site, Time, Weather};

// Vega in ICRS J2000
let vega = CatalogEntry::icrs(
    "Vega",
    "18:36:56.336".parse().unwrap(),
    "+38:47:01.28".parse().unwrap(),
).unwrap();

// OVRO site with standard atmosphere
let site = Site::from_degrees(37.234, -118.282, 1222.0).unwrap()
    .with_weather(Weather::standard());
let observer = Observer::Geodetic(site);

// 2026-07-15 06:00 UTC (37 leap seconds, dut1 ≈ 0)
let time = Time::from_utc_jd(2_461_236.75, 37, 0.0).unwrap();

let frame = Frame::new(Accuracy::Reduced, &observer, &time).unwrap();
let horizontal = frame.observe(&vega).unwrap();
println!("{horizontal}");

The raw FFI bindings are re-exported as sys for callers that need to drop down to the C layer directly.

Re-exports§

pub use apparent::Apparent;
pub use apparent::ReferenceSystem;
pub use equinox::Equinox;
pub use error::Error;
pub use error::Result;
pub use frame::Accuracy;
pub use frame::Frame;
pub use observer::Observer;
pub use observer::Site;
pub use observer::Weather;
pub use refraction::Refraction;
pub use scalar::Angle;
pub use scalar::Coordinate;
pub use scalar::Interval;
pub use scalar::Pressure;
pub use scalar::ScalarVelocity;
pub use scalar::Temperature;
pub use scalar::TimeAngle;
pub use source::CatalogEntry;
pub use source::EphemObject;
pub use source::OrbitalElements;
pub use source::OrbitalObject;
pub use source::Planet;
pub use source::SolarBody;
pub use source::Source;
pub use spherical::Ecliptic;
pub use spherical::Equatorial;
pub use spherical::Galactic;
pub use spherical::Horizontal;
pub use spherical::Spherical;
pub use time::Time;
pub use vector::Position;
pub use vector::Velocity;
pub use supernovas_ffi as sys;

Modules§

apparent
Apparent place of a source as observed from a Frame.
equinox
Equinox: a (name, reference-system, date) triple identifying a particular equatorial coordinate system.
error
Error type for the safe wrapper.
frame
Observing frame: an observer × instant × Earth-orientation snapshot.
observer
Observers: who or where the observation is taken from.
refraction
Atmospheric refraction models.
scalar
Scalar quantities: dimensioned newtypes around f64.
source
spherical
Spherical-coordinate types: directions on a sphere, with reference-frame- specific newtype wrappers.
time
Astronomical time.
unit
Conversion factors from common units to SI base units.
vector
3-D vector quantities.