Files
astronomy/demo/python
Don Cross 8a153315cf Simplified and optimized nutation formula.
While trying to convert ecliptic coordinates from mean
equinox of date to true equinox of date, I ran into excessive
overhead from the IAU2000B nutation model. The fact that it
uses 77 trigonometric terms made the calculations a lot slower.

https://apps.dtic.mil/sti/pdfs/AD1112517.pdf
Page 4 in the above document mentions a shorter series
“NOD version 2” that has 13 terms instead of 77 as used in IAU2000B.
I had not noticed NOD2 before, because it appears only in
the FORTRAN version of NOVAS 3.x, not the C version.

After reading the FORTRAN code, I realized NOD2 is the same
as IAU2000B, only it keeps the first 13 of 77 terms.
The terms are already arranged in descending order of
significance, so it is easy to truncate the series.

Based on this discovery, I realized I could achieve all of
the required accuracy needed for Astronomy Engine by
keeping only the first 5 terms of the nutation series.
This tremendously speeds up nutation calculations while
sacrificing only a couple of arcseconds of accuracy.

It also makes the minified JavaScript code smaller:
Before: 119500 bytes.
After:  116653 bytes.

So that's what I did here. Most of the work was updating
unit tests for accepting slightly different calculation
results.

The nutation formula change did trigger detection of a
lurking bug in the inverse_terra functions, which convert
a geocentric vector into latitude, longitude, and elevation
(i.e. an Observer object). The Newton's Method loop in
this function was not always converging, resulting in
an infinite loop. I fixed that by increasing the
convergence threshold and throwing an exception
if the loop iterates more than 10 times.

I also fixed a couple of bugs in the `demotest` scripts.
2022-12-04 10:31:15 -05:00
..
2022-04-30 21:01:11 -04:00
2022-11-07 15:31:05 -05:00
2022-11-07 15:31:05 -05:00
2019-08-10 18:02:15 -04:00
2022-11-07 15:31:05 -05:00
2021-07-19 22:09:49 -04:00
2022-11-07 15:31:05 -05:00
2022-05-03 16:50:11 -04:00
2019-08-10 17:38:04 -04:00
2022-11-07 15:31:05 -05:00

Astronomy Engine examples in Python


Camera

Suppose you want to photograph the Moon, and you want to know what it will look like in the photo. Given a location on the Earth, and a date/time, this program calculates the orientation of the sunlit side of the Moon with respect to the top of your photo image. It assumes the camera faces directly toward the Moon's azimuth and tilts upward to its altitude angle above the horizon.

Constellation

This demo finds what constellation the Moon is in at a given time. It also shows how to do a binary search to find the moment in time when the Moon moves across the border between constellations.

Culmination

Finds when the Sun, Moon, and planets reach their highest position in the sky on a given date, as seen by an observer at a specified location on the Earth. Culmination is also the moment a body crosses the meridian, the imaginary semicircle in the sky that passes from due north on the horizon, through the zenith (straight up), and then toward due south on the horizon.

Galactic to Horizontal Converter

A demonstration of how to convert galactic coordinates to horizontal coordinates. This could be useful for backyard radio astronomers who know the galactic coordinates of a distant radio source and want to aim a radio dish at it. Given the galactic coordinates, the geographic coordinates of the observer, and the date and time of the observation, this program shows how to obtain the altitude and azimuth to aim the dish at the radio source.

Horizon Intersection

This is a more advanced example. It shows how to use coordinate transforms to find where the ecliptic intersects with an observer's horizon at a given date and time.

Jupiter's Moons

Calculates the coordinates of Jupiter and its four major moons (Io, Europa, Ganymede, and Callisto) as seen from the Earth at a given date and time. This program illustrates how to correct for the delay caused by the time it takes for light to reach the Earth from the Jupiter system.

Lunar Angles

This is an example of how to implement your own custom search function using Astronomy Engine. This program searches for the next few times the Moon reaches a relative ecliptic longitude with respect to another body (as seen from the Earth) that is a multiple of 30 degrees.

Lunar Eclipse

Calculates details about the first 10 partial/total lunar eclipses after the given date and time.

Moon Phase Calculator

This example shows how to determine the Moon's current phase, and how to predict when the next few quarter phases will occur.

Positions

Calculates equatorial and horizontal coordinates of the Sun, Moon, and planets.

Rise/Set

Shows how to calculate sunrise, sunset, moonrise, and moonset times.

Seasons

Calculates the equinoxes and solstices for a given calendar year.

Triangulate

Given the geographic coordinates of two observers, and angular directions they are looking in, determines geographic coordinates of the point they are both looking at. This example demonstrates use of the geoid functions VectorObserver and ObserverVector that convert between geographic coordinates and vectors.


API Reference

Complete documentation for all the functions and types available in the Python version of Astronomy Engine.