Commit Graph

567 Commits

Author SHA1 Message Date
Don Cross
3c5de6b4f9 C: Fixed documentation mistake. 2020-05-26 21:18:50 -04:00
Don Cross
9645ff6cc3 C# LocalSolarEclipse: finished code, but no unit test yet. 2020-05-26 21:09:22 -04:00
Don Cross
26b3a68e00 C# GlobalSolarEclipse: code builds, but no unit test yet. 2020-05-25 22:46:50 -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
692744d8b8 C solar eclipse: added documentation in topic index. 2020-05-24 21:00:35 -04:00
Don Cross
1015b503de Fixed bug : wasn't calculating peak time. Not sure why anything worked. 2020-05-24 14:56:53 -04:00
Don Cross
a79ed9a487 C local solar eclipse predictor is passing first batch of unit tests. 2020-05-24 14:05:57 -04:00
Don Cross
8c29661d6f Redesigned local solar eclipse programming interface.
I decided it made more sense to report the Sun's altitude
at each solar eclipse event than reporting sunrise and sunset.
Sunrise and sunset are ambiguous because it's not clear which pair
should be reported. It's also harder to interpret than knowing
whether the Sun is above/below the horizon at each interesting time.
This motivated me to create a new type astro_eclipse_event_t that
holds the (time, altitude) pair for each event.
2020-05-24 10:30:55 -04:00
Don Cross
ef12121621 Starting to implement C version of local solar eclipse.
Defined data structure astro_local_solar_eclipse_t.
Created stubs for functions to find local solar eclipses.
Renamed lunar eclipse 'center' to 'peak' to be consistent.
2020-05-23 21:29:16 -04:00
Don Cross
d0699e828e doxygen: enable more warnings, eliminate unnecessary output.
Tell doxygen to warn (and fail) for undocumented parameters.
Tell doxygen to generate XML only, not LaTeX, HTML, etc.
2020-05-23 13:58:23 -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
c148fa6869 C global solar eclipse: Determine whether observer sees total or annular.
Refactored the shadow calculator so that the abstract logic is centralized
in a new function CalcShadow. Use that function to calculate the umbra
radius at the peak observation site. Theoretically, any positive value
indicates a total eclipse, but I had to fudge a little to get my calculations
to match the test data.
2020-05-22 20:54:14 -04:00
Don Cross
d9e5f9dc57 C global solar eclipse: added documentation for functions.
Documented C versions of SearchGlobalSolarEclipse and NextGlobalSolarEclipse.
Removed ECLIPSE_HYBRID enumeration value. Not going to use it.
Reworded structure documentation to indicate that the eclipse
kind refers to the peak observer only.
2020-05-21 22:13:47 -04:00
Don Cross
dd02364fb4 C global solar eclipse: calculate longitude of the peak eclipse.
Use sidereal time to calculate the longitude of the point
on the Earth's surface where the Moon's shadow ray strikes it.
In the unit test, ignore glancing blows, but if the shadow
ray passes within 6100 km of the Earth's center, verify that
the total angular error is within about a quarter degree.
2020-05-21 20:59:22 -04:00
Don Cross
12aec84513 C global solar eclipse: calculating geographic latitude.
When there is a total or annular eclipse at the peak time and location,
I am calculating the geographic latitude of that peak within
1.006 degrees. I am disappointed by how sloppy that is, so I
will have to double-check all the math, especially related
to correcting for the Earth's oblateness.
2020-05-20 22:31:08 -04:00
Don Cross
741e38a3ef Increased efficiency of global solar eclipse predictor.
Search for peak shadow within 0.03 days of new moon.
2020-05-20 19:19:43 -04:00
Don Cross
487fe9743d Doubled performance of global solar eclipse predictor.
Ignore new moons whose ecliptic latitude is beyond 1.8 degrees.
This cuts the number of CalcMoon() calls in half.
2020-05-20 18:59:36 -04:00
Don Cross
7e345915b2 Simplified the inequalities that detect type of lunar eclipses.
There is no need to use absolute value, and it makes the logic
easier for me to understand if I express each of the inequalities
in terms of addition rather than subtraction.
2020-05-20 17:24:43 -04:00
Don Cross
8d3c43d794 Making progress on the C version of the solar eclipse predictor. 2020-05-19 22:33:33 -04:00
Don Cross
9ced9b4052 Starting to work on C version of global solar eclipse prediction. 2020-05-19 17:49:33 -04:00
Don Cross
7a182d1d8d Bumped node package version to 1.0.7. 2020-05-17 14:32:27 -04:00
Don Cross
30c2141ca6 Added documentation about lunar eclipse functions to topic indexes. 2020-05-16 20:41:57 -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
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
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
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
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
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
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
Don Cross
4d81c4324f Shrank minified JS code to 76338 bytes.
Represent DeltaT table entries as lists rather than objects.
This makes them more compact in the minified code.
2020-05-04 12:59:17 -04:00
Don Cross
e7e9d1bb78 Shrank minified JavaScript to 76978 bytes.
Represent constellation name/symbol pairs as lists rather than objects.
This makes the representation more compact.
2020-05-04 12:49:00 -04:00
Don Cross
762bf08f66 Shrank minified JS code more: from 80904 to 77329 bytes.
Store each constellation border as a list rather than an object.
This makes the encoding more compact.
2020-05-04 12:39:32 -04:00