astro-math 0.0.1

Astronomy math algorithms for telescope control and sky transforms
Documentation
  • Coverage
  • 65.38%
    17 out of 26 items documented10 out of 16 items with examples
  • Size
  • Source code size: 58.52 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 2.39 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 16s Average build duration of successful builds.
  • all releases: 1m 2s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Repository
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • gaker

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.