back to home

onekiloparsec / aa-js

A fairly comprehensive collection of accurate astronomical algorithms in JavaScript (TypeScript).

50 stars
9 forks
4 issues
TypeScriptJavaScript

AI Architecture Analysis

This repository is indexed by RepoMind. By analyzing onekiloparsec/aa-js in our AI interface, you can instantly generate complete architecture diagrams, visualize control flows, and perform automated security audits across the entire codebase.

Our Agentic Context Augmented Generation (Agentic CAG) engine loads full source files into context on-demand, avoiding the fragmentation of traditional RAG systems. Ask questions about the architecture, dependencies, or specific features to see it in action.

Source files are only loaded when you start an analysis to optimize performance.

Embed this Badge

Showcase RepoMind's analysis directly in your repository's README.

[![Analyzed by RepoMind](https://img.shields.io/badge/Analyzed%20by-RepoMind-4F46E5?style=for-the-badge)](https://repomind.in/repo/onekiloparsec/aa-js)
Preview:Analyzed by RepoMind

Repository Overview (README excerpt)

Crawler view

aa-js ============ A fairly comprehensive collection of accurate astronomical algorithms (AA) in JavaScript (TypeScript). It started as an implementation of AA, but it is not yet complete. has **zero runtime dependencies**. At the beginning, 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+. Other AA implementations: Swift (SwiftAA), C# (AASharp). is the backbone of scientific algorithms used in Arcsecond.io. Main Changes in V4 ================ The v3 offered arbitrary-precision computations, thanks to decimal.js. But it was thousands (if not millions) of times slower than the original implementation, making its usage in a browser very difficult. After some nightly hours to optimise it and having most of both implementations side-by-side, we decided to remove decimal.js entirely. No big API changes, except there are no more Decimal.js at all, and thus no parameter. The method signatures have not changed, but all return types are based on instead of Decimal. Small changes: • The return type of is now always and not . If really the build of a JD is not correct, is returned with a warning. Main Changes in V3 ================ • ~~All algorithms based on arbitrary-precision operations thanks to decimal.js.~~ • **BREAKING** (since v3.2) Equatorial coordinates uses right ascension expressed in not . • **BREAKING** (since v3.2) Input parameters of the modules now use complete coordinates objects, rather than individual members to reduce the number of parameters in the functions. • ~~**BREAKING** (since v3.4) The precision of Decimal.js is not set to a default value. It is left to the consumer.~~ • Moved all (non-Earth) planets modules inside a 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 easy accessor for apparent geocentric equatorial coordinates of planets. • Added a transformation from equatorial to *topocentric* coordinates. • Important bugfix on and in the module. • Added easy accessors for rise, transit and set times for every planet. • Numerous bugfixes, and added methods for dates, julian days Available Modules ================ • Planets: all the (static and dynamic) details, coordinates, quantities about , , , , , and of course : planet constants, aphelion, perihelion, phase angle, illuminated fraction, magnitude, semi-diameters, heliocentric & geocentric coordinates, distance from earth, velocities, orbital details etc. • In addition, for : the planetocentric declination of the Sun and the Earth. • In addition, for : the planetocentric declination of the Sun and the Earth. • In addition, for : the details of the rings system. • : mean & true anomaly, coordinates. • : all the coordinates, mean anomaly, radius vector (distance) etc. • Inside module: : in longitude, for obliquity, true & mean obliquity of the ecliptic. • Inside module: : ecliptic and equatorial. • : phases, age, apparent coordinates etc. • : creation, transformation, local mean sidereal time. • : transformation between UTC, TT, AI, UT1... • : the cosmology calculator from Ned Wright's, but re-implemented, and tested. • : all the conversions of small and extra-galactic distances. • : all computation of parallactic angle, great circle angle, precessions, transformations (equatorial to ecliptic, galactic, topocentric, and inverse etc.). • : utilities for transforming values between decimal and sexagesimal. • : get rise, transit and set hours, dates, julian days, as well as altitude. • : **WIP** module to hold exoplanet transit details calculations. as altitude. Installation ================ Usage ================ 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. The documentation is published in onekiloparsec.dev/aa-js. Benchmarks ================ To run benchmarks, install globally ( ), then run individual benchmark like this: