Skip to content
/ aa-js Public
forked from onekiloparsec/aa-js

Astronomical Algorithms in javascript

License

Notifications You must be signed in to change notification settings

ki7en/aa-js

 
 

Repository files navigation

aa-js

build and test

Astronomical Algorithms in JavaScript.

The ongoing rewrite for v3 will have arbitrary-precision, thanks to decimal.js.

Other implementations: Swift (SwiftAA) , C# (AASharp).

At the beginning, aa-js is the port in javascript of the C++ implementation of Astronomical Algorithms by J.P. Naughter, called AA+, based on the reference text book by Jean Meeus. It is written in TypeScript, and covered as much as possible with tests validating the correctness of the algorithms. Tests are inspired from Jean Meeus' book and those written in SwiftAA, and are much more extended than what is available in AA+.

aa-js is the backbone of scientific algorithms used in Arcsecond.io.

I am the author of the Swift version too. It's called SwiftAA.

Main Changes in the upcoming V3

  • All algorithms based on arbitrary-precision operations thanks to decimal.js.
  • nutation module moved inside the earth module.
  • Moved all (non-Earth) planets modules inside a planets folder.
  • Addition of numerous orbital getters for planets (mean longitude, semi-major axis, inclination, eccentricity...)
  • Much easier and cleaner distinction between heliocentric and geocentric coordinates of planets.
  • Added a transformation from equatorial to topocentric coordinates.
  • Important bugfix on getPositionAngle and getPhaseAngle in the Moon module.

Available Modules

  • Planets: all the (static and dynamic) details, coordinates, quantities about Mercury, Venus, Mars, Jupiter, Saturn, Neptune and of course Pluto: planet constants, aphelion, perihelion, phase angle, illuminated fraction, magnitude, semi-diameters.
  • In addition, for Mars: the planetocentric declination of the Sun and the Earth
  • In addition, for Jupiter: the planetocentric declination of the Sun and the Earth
  • In addition for Saturn: the details of the rings system
  • Earth & Moon: all the coordinates, and many details about the Moon
  • Sun: mean & true anomaly, coordinates
  • juliandays: creation, transformation, local mean sidereal time.
  • cosmology: the cosmology calculator from Ned Wright's, but re-implemented
  • distances: all the conversions of distances
  • nutation: in longitude, for obliquity, true & mean obliquity of the ecliptic
  • precession: all the precession functions between epochs for coordinates
  • sexagesimal: utilities for manipulating sexagesimals
  • transits: get rise, transit and set hours, dates, julian days, as well as altitude.

Installation

npm install aa-js

Usage

import { juliandays, Earth } from 'aa-js'

const jd = juliandays.getJulianDay(new Date())
const coords = Earth.Moon.getEquatorialCoordinates(jd)

Documentation

Almost every method is documented (quite sparingly sometimes). A good knowledge of basic astronomy helps very much. A copy of the Astronomical Algorithms textbook, by Jean Meeus (amazon) would also help, since many methods refer to it.

We have some difficulties configuring both Typescript and Typedoc at the same time. Hence, the documentation is not published in GH pages. If anyone knows how to do it, please submit a PR.

About

Astronomical Algorithms in javascript

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 93.6%
  • JavaScript 6.4%