Commit Graph

188 Commits

Author SHA1 Message Date
Don Cross
bbd16d299a Minor cleanup in Python documentation. 2021-04-01 10:43:37 -04:00
Don Cross
4cc2a14a38 Python docs: provide mechanism for documenting constants.
Python docstrings don't work for variables, so I hacked
a special comment format for helping pydown generate Markdown
text for the README.md for the exported constant KM_PER_AU,
or any other constants I may want to expose in the future.
2021-04-01 09:39:51 -04:00
Don Cross
4e868732c5 PY: Implemented ObserverVector function and unit test. 2021-03-31 21:10:24 -04:00
Don Cross
085d285ef0 Refactored all the nutation and precession functions.
Use a private enumerated type to select which direction
the precession and nutation is to be done:
- from date to J2000
- from J2000 to date

Normalize the order of parameters to be consistent
between precession() and nutation(), and across languages.
Pass in AstroTime instead of a pair of floating point TT
values (one of which had to be 0).

Added TypeScript version of ObserverVector(),
but it has not yet been documented or tested.
2021-03-31 12:09:11 -04:00
Don Cross
5cd0e60d74 Updated obsolete comments about how Delta-T is calculated.
Astronomy Engine used to use USNO historical and predictive tables,
along with linear interpolation, to calculate Delta-T values.
The problem with the USNO tables is, they did not work well outside
a few centuries around present day.

Later I replaced with Espenak & Meeus piecewise polynomials
that work over a much larger time span (thousands of years).
I just discovered there were still comments in the code referring
to the USNO models. I updated the ones I could find to reflect
the current truth about how the code works today.
2021-03-27 19:44:37 -04:00
Don Cross
6f98095cae Reworked ecliptic coordinate types to contain a vector type.
This is technically a breaking change, but only for clients
that use the cartesian coordinates in an ecliptic coordinate
return type.  Before now, the coordinates were just separate
floating-point members ex, ey, ez. Now they are a standard
vector type.

The purpose is to allow seamless interfacing with vector
rotation functions, and to be consistent with the equatorial
coordinate types.
2021-03-27 12:26:27 -04:00
Don Cross
0426272da4 Eliminated obsolete function VectorFromEquator.
Now that equatorial coordinates include both angles
and cartesian coordinates, there is no need for the
VectorFromEquator function. It has been removed
from all four supported languages.

The expression "VectorFromEquator(equ, time)" can be
replaced with "equ.vec" in any calling code.
2021-03-27 08:24:42 -04:00
Don Cross
a97fc7da9c Ported IdentityMatrix, Pivot functions to Python. Added tests and camera demo. 2021-03-27 05:19:27 -04:00
Don Cross
9cc454b1f2 Added comments to explain horizontal coordinate calculations.
I'm about to start working on adding a new output
from the Horizon functions. It was a good time to better
document the ideas behind these calculations, before
adding anything new. These are internal comments only
and do not affect generated documentation.

While I was in there, I noticed extra code that was
checking for impossible return values from atan2().
I eliminated these.
2021-03-20 20:01:38 -04:00
Don Cross
f34b700ce3 Updated copyrights for 2021. This resolves Travis CI broken build.
I forgot that my build process automatically updates
copyright years when the current year changes.
My Travis CI unit tests verify that there are no local
changes after running all the tests.
That test failed because the update_copyrights.py changed
all the "2019-2020" to "2019-2021".
2021-01-07 08:55:52 -05:00
Don Cross
246ac47d2b Fixed a failure to find a full moon using certain start dates.
In all four versions of Astronomy Engine (C, C#, JavaScript, and Python),
starting a search for a full moon near December 19, 2020 would fail.
I added a unit test to all four languages and it failed consistently
across them all.

The root cause: I was too optimistic about how narrow I could make
the window around the approximate moon phase time in the
SearchMoonPhase functions. Finding the exact moon phase time failed
because it was outside this excessively small window around the approximate
time. I increased the window from 1.8 days to 3.0 days.
This should handle all cases with minimal impact on performance.

Now all four of the new unit tests pass.
2020-12-18 14:29:41 -05:00
Don Cross
8f16f0a5ae Pluto integrator: finished porting to Python.
I believe this wraps up the Python integrator.
It now works in all 4 languages and passes all tests.
Fixed up demo tests to match new output.
Turned on Travis CI checking in this branch again.
2020-08-24 20:54:20 -04:00
Don Cross
db9eb6b180 Maintain redundant copies of Astronomy Engine source in demo folders.
Windows does not support relative links in Git by default.
This broke the first-time experience for Windows users.
From now on I will maintain copies of the astronomy.js
and astronomy.py in the demo folders, so that the demos
will work on Windows immediately after cloning the repo.
2020-08-10 11:08:27 -04:00
Don Cross
f8cc44a0a5 Deleting relative links to astronomy code.
Using Linux relative links to astronomy.py and astronomy.js
from the demo directories just doesn't work in Windows.
This creates a stumbling block for first-time users.
To make it easier for people to get started, I will just
make redundant copies in other directories as needed.
It is better to use a little extra disk space -- hard drives are cheap!

This is the first step: get rid of the links.
2020-08-10 10:41:58 -04:00
Don Cross
e5c9e0d7b4 TOP2013: Removed code that prevented diffing Pluto data between the languages. 2020-07-08 15:52:26 -04:00
Don Cross
4f842627da Fixed mistake in GeoVector(SUN): we do need to correct for light-travel time.
To be consistent, when calculating the geocentric position of the Sun,
we do need to correct for light travel time just like we would for any
other object. This reduces the maximum time error for predicting transits
from 25 minutes to 11 minutes.

Also had to disable aberration when calculating moon phases
(longitude from Sun) in order to keep a good fit with test data.
2020-06-13 13:45:59 -04:00
Don Cross
a8b29b4509 Renamed lunar eclipse info member from 'center' to 'peak'.
This makes the name consistent with the solar eclipse fields.
2020-05-25 21:07:36 -04:00
Don Cross
e3255c7401 Cleaned up and unified Earth and Moon radius constants.
In all 4 supported languages, use consistent constant names for
Earth and Moon radii.

Use Moon's equatorial radius for rise/set timing.

Use Moon's mean radius for calculating Moon's umbra radius for
detecting solar eclipses.

Also use Moon's mean radius for determining whether the Earth's shadow
touches the Moon, for finding lunar eclipses.

Use the Moon's polar radius for distinguishing between total
and annular eclipses, with a 14 meter bias (instead of 1420 meters!)
to match Espenak data.

Use consistent unit test error threshold of 0.57 minutes for rise/set.
Updated demo test data for slight changes to rise/set prediction times.

Updated doxygen options to issue an error on any warnings.
Fixed the incorrect function name link that doxygen was warning me about.
2020-05-23 13:08:25 -04:00
Don Cross
83544bf57d Added C# demo for lunar eclipse.
Alphebetized demo readme pages.
2020-05-17 14:03:01 -04:00
Don Cross
d9e2ea5816 Added C version of lunar eclipse demo.
Also added better comments to Python version.
2020-05-17 13:02:18 -04:00
Don Cross
78e68354b0 Added Python demo for calculating lunar eclipses. 2020-05-16 22:14:55 -04:00
Don Cross
fe18eb81e4 Implemented Python version of lunar eclipse predictor. 2020-05-16 17:38:00 -04:00
Don Cross
9ea6a0664f Python: Use Espenak/Meeus formula for calculating Delta T. 2020-05-15 19:28:54 -04:00
Don Cross
0fc2a3208d Lunar eclipse experiments: must include Earth's atmosphere.
To get a good fit with Fred Espenak test data, I have to
include an additional 65 km or so in the Earth's radius,
for the thickness of the atmosphere.
2020-05-12 18:02:58 -04:00
Don Cross
d67c3c7c4a Improved precision of Earth shadow calculation.
Using geocentric Moon instead of heliocentric Moon
gives more floating point precision for determining
the distance between the Moon and the Earth's shadow ray.
2020-05-12 08:22:58 -04:00
Don Cross
6b60e109fb Program for testing a formula to help find lunar eclipses.
I figured out a formula that determines how far away
the Moon is from the center of the Earth's shadow.
This confirms the formula makes sense for a known
total lunar eclipse on May 26, 2021.
2020-05-11 22:22:07 -04:00
Don Cross
4023974079 More adjustments to unit tests to pass for model adjustments. 2020-01-06 12:53:05 -05:00
Don Cross
c2273bf4e9 graphdist.py now allows specifying the number of points to plot. 2020-01-03 19:35:44 -05:00
Don Cross
0cb14332aa Reworked Python demos to use new function Time.Parse. 2020-01-03 14:21:35 -05:00
Don Cross
982c92ff9f Added code to help me investigate planet distance vs time.
I am working on adding aphelion/perihelion functionality
for planets. I ran into complicated behavior with the orbit
of Neptune. Its orbit is so circular, and its movement so slow,
that wobbling of the Sun around the Solar System Barycenter (SSB)
causes there to be 3 consecutive zero-slope points near the true
perihelion. I still need to resolve this.
2020-01-03 11:19:15 -05:00
Don Cross
4db8c66775 Python: Ported example of finding intersection of ecliptic and horizon. 2019-12-19 13:14:37 -05:00
Don Cross
11b4678d2b Include culminate.py in demo documentation. 2019-08-11 16:11:14 -04:00
Don Cross
cb22bd40eb Added culminate.py demo program. 2019-08-10 18:02:15 -04:00
Don Cross
b508069049 Added Python demo: seasons.py. 2019-08-10 17:38:04 -04:00
Don Cross
0a8e470fed Added Python demo program positions.py. 2019-08-10 16:38:38 -04:00
Don Cross
7ce7af4a89 Added riseset demo program for Python.
Fixed bug in demo utility function ParseArgs.
Added README.md for Python demos.
2019-07-28 21:33:39 -04:00
Don Cross
7e21a5abb5 Python moonphase demo now has passing unit test. 2019-07-26 17:23:05 -04:00
Don Cross
91aafeaba7 Starting to add Python demo programs.
Created skeleton test harness for validating the demo programs.
Created stub moonphase.py.
Copied correct demo program outputs from nodejs; will tweak as needed.
Call the Python demo test harness from the 'run' script.
2019-07-26 16:49:48 -04:00