#astronomy #coordinates #transform #aerospace #sidereal #astrometry

astro-math

Astronomy math algorithms for telescope control and sky transforms

1 unstable release

new 0.0.1 Apr 21, 2025

#83 in #coordinates

Download history 79/week @ 2025-04-17

79 downloads per month

MIT/Apache

35KB
515 lines

Astro Math for Rust

codecov

workflow

Collection of astronomy-based algorithms based on the Jean Meeus book.

Currently considting of:

  • time – Julian Date, J2000, epoch helpers
  • sidereal – GMST, LMST, and Apparent Sidereal Time
  • location – Observer lat/lon/alt + LST calculation
  • transforms – RA/DEC ↔ Alt/Az conversion
  • timestamp – FITS-style UTC timestamp abstraction

Installation

Add to your Cargo.toml:

astro-math = "0.1"

Examples:

use astro_math::{Location, julian_date, ra_dec_to_alt_az};
use chrono::{TimeZone, Utc};

fn main() {
    let dt = Utc.with_ymd_and_hms(2024, 8, 4, 6, 0, 0).unwrap();
    let loc = Location {
        latitude_deg: 31.9583,
        longitude_deg: -111.6,
        altitude_m: 2120.0,
    };

    let jd = julian_date(dt);
    let lst = loc.local_sidereal_time(dt);
    let (alt, az) = ra_dec_to_alt_az(279.23473479, 38.78368896, dt, &loc);

    println!("JD: {:.5}", jd);
    println!("LST: {:.5} h", lst);
    println!("Vega Alt: {:.3}°, Az: {:.3}°", alt, az);
}

Produces:

JD: 2460526.75000
LST: 19.44655 h
Vega Alt: 77.776°, Az: 307.388°

License

Licensed under either of:

at your option.

Dependencies

~1MB
~18K SLoC