Commit Graph

2245 Commits

Author SHA1 Message Date
Don Cross
30c2141ca6 Added documentation about lunar eclipse functions to topic indexes. 2020-05-16 20:41:57 -04:00
Don Cross
80590e10c7 Added mention of lunar eclipses to README.md. 2020-05-16 17:40:08 -04:00
Don Cross
fe18eb81e4 Implemented Python version of lunar eclipse predictor. 2020-05-16 17:38:00 -04:00
Don Cross
b970694aa2 Implemented JavaScript version of lunar eclipse functions. 2020-05-16 15:43:16 -04:00
Don Cross
a753fb54b7 C# LunarEclipse: Applied optmizations from the C version of LunarEclipse. 2020-05-16 13:58:49 -04:00
Don Cross
dd27224950 C LunarEclipse optimization: unit test is down to 110461 CalcMoon() calls.
Constrain the search for partial eclipse semiduration to
within what we already found for the penumbral eclipse.
Same for total/partial. This is a very small improvement because
narrowing the search window does not improve quadratic interpolation
very much. But it is an extremely cheap and safe optimization.
2020-05-16 12:02:24 -04:00
Don Cross
b7dcfba3f8 C LunarEclipse optimization: narrow the search window for finding peak shadow.
It turns out that searching plus or minus 0.03 days around the
full moon is ample for finding minimum shadow distance.
This reduces CalcMoon() call count from 127155 to 112827.
Performance ratio with original algorithm = 5.13.
2020-05-16 10:07:18 -04:00
Don Cross
af7cd4c7ea C LunarEclipse: Optimize by pruning full moons with large ecliptic latitudes.
When the full moon's ecliptic latitude is larger than 1.8 degrees,
even a penumbral eclipse is not possible. Thus there is no need
to search for the minimum shadow distance in that case.
This decreased unit test CalcMoon() count to 127155.
Improvement ratio over original algorithm = 4.55.
2020-05-16 09:36:31 -04:00
Don Cross
0a0eb6282c C LunarEclipse: Improved efficiency of finding time of minimum shadow distance.
Greatly reduced the number of CalcMoon() calls needed to find
the time of the minimum shadow distance, when searching for a lunar eclipse.
Use Astronomy_Search() instead of dumb search.
Added undocumented global variable for counting how manyh times CalcMoon()
is called.
The call count went from 578569 down to 207186 (ratio = 2.79).
Execution time likewise decreased from 2.9 seconds to 1.1.
2020-05-16 07:34:24 -04:00
Don Cross
a3ee6d3035 C# lunar eclipse code is now passing unit test. 2020-05-15 22:30:43 -04:00
Don Cross
f5b7c6c758 C#: Coded SearchLunarEclipse, NextLunarEclipse. Not yet tested. 2020-05-15 21:33:52 -04:00
Don Cross
1739e71c92 Decrease error threshold by using JPL Horizons Delta T function. 2020-05-15 20:04:04 -04:00
Don Cross
eec6e0b782 Removed obsolete Delta T code generator logic.
We don't need to generate Delta T tables any more because
none of the Astronomy Engine supported languages use it any more.
Now they all use Espenak/Meeus polynomials instead.
2020-05-15 19:40:35 -04:00
Don Cross
9ea6a0664f Python: Use Espenak/Meeus formula for calculating Delta T. 2020-05-15 19:28:54 -04:00
Don Cross
30a85407b4 JavaScript: Use Espenak/Meeus DeltaT function. 2020-05-15 18:42:12 -04:00
Don Cross
7eb3322fd1 C#: Use Espenak/Meeus DeltaT function. 2020-05-15 17:20:51 -04:00
Don Cross
e1b29026c8 C: Overhauled DeltaT calculation.
I'm in the process of replacing how Astronomy Engine calculates
Delta T. Instead of a series of line segments based on canned data,
I'm switching over to use the Espenak/Meeus piecewise polynomials.
Also allowing the user to change the Delta T function to match
an external reference. I will use this in the unit tests that
reference JPL Horizons data, so that I can greatly tighten the
test tolerances.
2020-05-15 16:07:15 -04:00
Don Cross
3a520386e9 Fixed #68 - No trailing whitespace in generated source code. 2020-05-15 14:31:05 -04:00
Don Cross
f2ee3d38b8 Moved JPL Horizons file for DeltaT so it doesn't break unit tests.
I downloaded the airless_Moon_dt.txt file from JPL Horizons so that
I could reverse engineer their DeltaT function. But keeping it in
the horizons directory caused unit test breakage. Moved to delta_t
directory so dtplot can still use it to make graphs.
2020-05-15 14:16:11 -04:00
Don Cross
3b521d65b5 Also plot Delta T using JPL Horizons data. 2020-05-15 13:43:59 -04:00
Don Cross
258b0572a0 Plot a graph of Delta T extrapolator versus generated function. 2020-05-15 13:05:00 -04:00
Don Cross
b7c59f6628 Include extrapolated DeltaT values for the years 2030..2200.
I had to increase certain error tolerances in the unit tests.
Reworked the unit tests to make more sense by waiting until
each language step is done to check against each other.
That way I can run a single language step independently.
2020-05-14 20:24:34 -04:00
Don Cross
28ac608169 Added Fred Espenak formulas for extrapolating Delta-T, but commented out. 2020-05-14 17:20:34 -04:00
Don Cross
612efd7011 Fixed bug in CheckSkyPos().
This bug has been there a long time, but I didn't notice it
until I started experimenting with larger Delta-T values.
Fortunately, the bug was in the unit test, not Astronomy Engine
release code. Calling NOVAS place(), I need to pass in Delta-T
expressed in seconds, not days.
2020-05-14 17:10:57 -04:00
Don Cross
1c6feffc53 Added script to track down GM position bug affected by DeltaT. 2020-05-14 14:20:17 -04:00
Don Cross
b79b151934 Fixed incorrect string format in C# unit test. 2020-05-14 11:52:56 -04:00
Don Cross
d9c29adb97 C lunar eclipse unit test now generates CSV output file.
Write eclipse/c_le_stats.csv that contains all the error
values for each lunar eclipse calculation. This helped
me figure out the main source of lunar eclipse error was
discrepancy with Delta-T values in the future.
2020-05-14 09:00:52 -04:00
Don Cross
33ba028bf2 Simplified FAIL... macros in C unit test. 2020-05-13 19:13:40 -04:00
Don Cross
d27851137b Increased Earth's atmosphere thickness for lunar eclipse calculations.
Using some trial and error, I found that using 85 km instead of 65.4 km
for the thickness of the Earth's atmosphere results in better overall
fit with the test data.
2020-05-13 17:34:43 -04:00
Don Cross
4354e72e52 Minor tweaks due to sun, moon radius changes for lunar eclipse calculations.
Adding support for lunar eclipse calculations in the C code
caused me to tweak the values of the Sun and Moon radii.
This in turn caused unit test failures.
Made slight changes to the unit tests to get things passing again.
2020-05-13 15:52:22 -04:00
Don Cross
6ed3d8f5b8 Added documentation for C functions that calculate lunar eclipses. 2020-05-13 15:34:06 -04:00
Don Cross
34bb52f5a4 Added lunar eclipse predictor to C code.
Also added FAIL... macros to ctest.c to make it simpler
to print an error and abort.
2020-05-13 15:17:39 -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
3d765fc41e Added transit data for Mercury and Venus. No parsing yet. 2020-05-12 14:05:15 -04:00
Don Cross
0411e1af64 Added solar eclipse data and updated norm.py to parse it. 2020-05-12 13:52:12 -04:00
Don Cross
822b92239f Increased time span of lunar eclipse data, and wrote pre-processor.
I found that lunar eclipse data is available for many centuries.
I downloaded the data for the years 1701..2200.
Wrote norm.py to extract and convert the parts I care about
into a format that will be much easier to parse in the unit
tests for all four languages.
Regenerate the normalized data from the 'run' script.
This way, I have documentation for where the data came from.
2020-05-12 12:19:22 -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
85c69414a7 Added test data for lunar eclipses. 2020-05-11 20:58:56 -04:00
Don Cross
a20c2d0391 Fixed #65 - unit test output indicates programming language. 2020-05-11 20:31:01 -04:00
Don Cross
df776d73a6 Fixed #66 - removed JavaScript performance tuning code. 2020-05-11 19:50:47 -04:00
Don Cross
bc69e723f2 Python: converted remaining enumerated types from IntEnum to Enum.
Also added @enum.unique decorator to these types as a
sanity check that their values are all unique.
2020-05-07 21:20:12 -04:00
Don Cross
85cdeee357 Python: converted Body from IntEnum to Enum.
Increase type safety by making the enumerated type Body
derive from Enum rather than IntEnum, as recommended by
https://www.python.org/dev/peps/pep-0435/

Fixed places where I was treating Body values as integers.
2020-05-07 20:53:46 -04:00
Don Cross
107a07223b Python: added repr() support for astronomy.Time class.
Now when a Time object is evaluated and represented in
the Python interpreter, it results in a string of the form:

    astronomy.Time(ut)

where ut is the numeric representation of the ut field.
This mimics the exact way such a Time value could be constructed.
That is, eval(repr(t)) results in a time value equal to t.
2020-05-05 21:40:55 -04:00
Don Cross
6c3655c1c6 Corrected the B1875 epoch for determining constellation boundaries.
It turns out I was off by nearly 18 hours in the B1875 epoch.
This has a tiny effect on the orientation of the Earth's axis.
Instead of:           ut = 1875-01-01T12:00:00.000Z
the correct epoch is: ut = 1874-12-31T18:12.21.950Z

See the comments in the Constellation functions in
each of the source files for more info.
2020-05-04 21:30:36 -04:00
Don Cross
4b4c637468 Added missing constellation test runs in Windows. 2020-05-04 16:10:28 -04:00
Don Cross
bcb97d8a19 Windows run.bat now downloads star database and builds constellation test data. 2020-05-04 16:02:08 -04:00
Don Cross
61e694a0b2 Fixed build warnings-as-errors in Windows. 2020-05-04 16:01:29 -04:00
Don Cross
f9daa64ca0 Published npm package v 1.0.6. 2020-05-04 14:36:58 -04:00
Don Cross
9df1a7a128 Added documentation for JavaScript function Constellation. 2020-05-04 13:37:11 -04:00