Skip to content

jfcarr/practical-astronomy-rust

Repository files navigation

Practical Astronomy in Rust

Algorithms from "Practical Astronomy with your Calculator or Spreadsheet" by Peter Duffett-Smith, implemented in Rust. API documentation is published here.

If you're interested in this topic, please buy the book! It provides far more detail and context.

Code Organization

There are two projects:

Name Description
practical-astronomy-rust This is a library containing implementations of all the Practical Astronomy algorithms.
practical-astronomy-rust-tests This is a binary project containing unit tests for each of the library functions.

Running the Tests

Open a terminal in the practical-astronomy-rust-tests directory, then:

Regular tests:

cargo test

Verbose tests:

cargo test -v -- --nocapture

Building Documentation

If you want to rebuild the documentation:

./build-rust-docs.sh

Library Functions - Status

Date/Time

  • Calculate -> Date of Easter
  • Convert -> Civil Date to Day Number
  • Convert -> Civil Time <-> Decimal Hours
  • Extract -> Hour, Minutes, and Seconds parts of Decimal Hours
  • Convert -> Local Civil Time <-> Universal Time
  • Convert -> Universal Time <-> Greenwich Sidereal Time
  • Convert -> Greenwich Sidereal Time <-> Local Sidereal Time
  • Calculate -> Day of Week for Julian Date

Coordinates

  • Convert -> Angle <-> Decimal Degrees
  • Convert -> Right Ascension <-> Hour Angle
  • Convert -> Equatorial Coordinates <-> Horizon Coordinates
  • Calculate -> Obliquity of the Ecliptic
  • Convert -> Ecliptic Coordinates <-> Equatorial Coordinates
  • Convert -> Equatorial Coordinates <-> Galactic Coordinates
  • Calculate -> Angle between two objects
  • Calculate -> Rising and Setting times for an object
  • Calculate -> Precession (corrected coordinates between two epochs)
  • Calculate -> Nutation (in ecliptic longitude and obliquity) for a Greenwich date
  • Calculate -> Effects of aberration for ecliptic coordinates
  • Calculate -> RA and Declination values, corrected for atmospheric refraction
  • Calculate -> RA and Declination values, corrected for geocentric parallax
  • Calculate -> Heliographic coordinates
  • Calculate -> Carrington rotation number
  • Calculate -> Selenographic (lunar) coordinates (sub-Earth and sub-Solar)

The Sun

  • Calculate -> Approximate and precise positions of the Sun
  • Calculate -> Sun's distance and angular size
  • Calculate -> Local sunrise and sunset
  • Calculate -> Morning and evening twilight
  • Calculate -> Equation of time
  • Calculate -> Solar elongation

Planets

  • Calculate -> Approximate position of planet
  • Calculate -> Precise position of planet
  • Calculate -> Visual aspects of planet (distance, angular diameter, phase, light time, position angle of bright limb, and apparent magnitude)
  • Calculate -> Position of comet (elliptical and parabolic)
  • Calculate -> Binary star orbit data

The Moon

  • Calculate -> Approximate and precise position of Moon
  • Calculate -> Moon phase and position angle of bright limb
  • Calculate -> Times of new Moon and full Moon
  • Calculate -> Moon's distance, angular diameter, and horizontal parallax
  • Calculate -> Local moonrise and moonset

Eclipses

  • Calculate -> Lunar eclipse occurrence and circumstances
  • Calculate -> Solar eclipse occurrence and circumstances

About

Implementation of algorithms from "Practical Astronomy with your Calculator or Spreadsheet"

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages