Commit Graph

1235 Commits

Author SHA1 Message Date
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
Don Cross
9a6005bf24 Shrank minified JavaScript from 86423 bytes to 80904 bytes.
Changed the units of the angles stored in the constellation
borders data so that the numbers can be represented more compactly.
This requires converting the numbers back at runtime, but this is
well worth the smaller size.
2020-05-04 12:27:37 -04:00
Don Cross
c955a56210 Added constellation finder function to JavaScript code. 2020-05-04 10:09:46 -04:00
Don Cross
2cb06afa63 Added JavaScript code generator for constellation data tables. 2020-05-03 22:06:18 -04:00
Don Cross
540d9d7cef Added constellation function to Python code. 2020-05-03 21:37:28 -04:00
Don Cross
d05f213584 Added constellation finder algorithm to C#. 2020-05-03 15:06:02 -04:00
Don Cross
4f8977067b Snapped constellation border to nearest quarter arcminute.
Instead of using decimal hours/degrees rounded to 4 decimal places,
I went back to the original constel.c and modified it to represent
both RA and DEC in degrees, and to round all values to the nearest
quarter arcminute. This seems closer to the original intent of the
constellation boundaries.
2020-05-02 21:21:32 -04:00
Don Cross
8367638d28 Updated codegen to generate C# constellation tables.
This is just a step toward supporting constellation
calculations in C#. Nothing uses the new tables yet.
2020-05-02 19:24:01 -04:00
Don Cross
7fe9863b88 Renamed C function Astronomy_FindConstellation to Astronomy_Constellation. 2020-05-02 17:21:58 -04:00
Don Cross
e803a65b4e More thorough constellation unit test for C code.
I'm using the HYG star database v3 from:
https://github.com/astronexus/HYG-Database

I compare the star constellations it reports against
what I calculate from the star RA/DEC it lists.
When I try this against all stars in the database, I
find 25 disagreements about which constellation contains
the star. Another person found 3 disagreements. See:

https://github.com/astronexus/HYG-Database/issues/21

For now, I'm testing only the stars brighter than mag 4.890,
which eliminates all the disagreements, and still gets me
over 1000 test cases.

Also, now I'm verifying ephemeris file and star database
checksums whether or not they have just been downloaded.
The idea is to catch corruption or unexpected changes
each time I run the unit test.
2020-05-02 15:10:10 -04:00
Don Cross
1e1af922fe Constellations: Added C unit test. Fixed bugs in C code.
This unit test only exercises 8 different points.
I want to add a more thorough unit test soon, before
moving on to implementing the constellation finder in
the other supported programming languages.
2020-05-02 13:33:25 -04:00
Don Cross
d0f328fe78 Starting work on C version of constellation lookup.
Generate C code for constellation tables.
First pass of Astronomy_FindConstellation(). Not yet tested.
2020-05-02 11:45:32 -04:00
Don Cross
3bb740fd1c Fixed #62 - Automatically update copyright year range. 2020-04-30 15:12:14 -04:00
Don Cross
e80b5a45d0 Updated npm package version to 1.0.5: supports EMB, SSB.
Astronomy Engine now supports calculating heliocentric
Solar System Barycenter (SSB) and
Earth/Moon Barycenter (EMB).
2020-04-29 22:11:11 -04:00
Don Cross
f754a6de82 Fixed #58 - Solar System Barycenter, Earth/Moon Barycenter.
Can now calculate the heliocentric Solar System Barycenter (SSB)
and Earth/Moon Barycenter (EMB).

Changes made in C, C#, JavaScript and Python:
Added new body codes SSB, EMB.
Added support for calculating both in HelioVector functions.
Verified that all calculations match NOVAS.
Verified that all calculations match each other across languages.
2020-04-29 21:53:57 -04:00
Don Cross
20f94c9622 Published npm package 1.0.4 2020-01-07 16:28:19 -05:00
Don Cross
6d871c023a More JavaScript documentation fixes. 2020-01-07 15:34:15 -05:00
Don Cross
762ae30a14 Fixes to JavaScript documentation. 2020-01-07 14:59:42 -05:00
Don Cross
60db741717 Ported planetary apsis search functions to JavaScript. 2020-01-07 14:09:45 -05:00
Don Cross
ec6a82b133 Improved performance of Neptune apsis search.
The apsis search for Neptune was sampling 1000 points
in its first pass. It turns out 100 is enough.
2020-01-07 11:57:54 -05:00
Don Cross
7892b797ba Python: planet apsis search is working. 2020-01-06 20:49:49 -05:00
Don Cross
cdf9c6955e Added planet apsis functions to C and C# documentation topic indexes. 2020-01-06 17:28:09 -05:00
Don Cross
977ab2d5b3 C# planet apsis: Implemented unit tests. 2020-01-06 16:04:57 -05:00
Don Cross
9992f2570b Starting to port planetary apsis functions to C#.
No unit tests implemented yet.
2020-01-06 15:19:19 -05:00
Don Cross
ff482335db C planet apsis: made SearchPlanetApsis, NextPlanetApsis parameters consistent.
Existing functions have body parameter before time parameter.
Made the planet apsis search functions consistent with that pattern.
2020-01-06 14:16:17 -05:00
Don Cross
6304cc861a C planet apsis: removed unnecessary clamping of apsis search interval to 10 days. 2020-01-06 13:57:00 -05:00
Don Cross
02dc4e95a4 Pluto apsis predictions are now within 0.0810 degrees of orbit period.
Increased from 7 Chebyshev sections to 8.
This also decreases max arcmin error from 0.336084 to 0.120252.
2020-01-06 11:25:47 -05:00
Don Cross
f67ddf1c8d Planet apsis: all planets but Pluto now have prediction error below 0.1 degrees.
Adjust VSOP models for planets to bring their prediction errors beneath
0.1 degrees of a total orbit.
ctest no longer runs tests when no command line arguments are given.
That was annoying because I kept running it by accident.
2020-01-06 10:59:38 -05:00
Don Cross
819e59745d Decreased Neptune apsis prediction errors from 49.25 days to 15.45 days.
Include an extra 4 terms in the radial component of the VSOP
model for Neptune. The code automatically picks the 4 terms
that maximize the time derivative's highest possible contribution.
2020-01-05 20:44:29 -05:00
Don Cross
331bdfcea9 Added special-case logic for finding Neptune perihelion/aphelion.
Because of Sun/SSB wobble, can't use slope solver to find
Neptune apsides. Added special case logic to find them
using more of a brute force algorithm.
Unit tests now pass, but require very loose tolerances
for the outer planets.
I will have to adjust the model generator to create
more accurate heliocentric distance models for the VSOP
planets, and more accurate Chebyshev polynomials for Pluto.
This will be a judgment call to balance accuracy versus code size.
2020-01-04 11:01:28 -05:00
Don Cross
1436a0be25 Planet apsides - work in progress - BROKEN TESTS.
Use planet apsis test data generated by generate.c to verify
Astronomy Engine calculations. Currently this fails for Neptune
as expected. Will fix that in a future commit.

Implemented a more efficient function Astronomy_HelioDistance
for calculating heliocentric distances of the planets
Mercury through Neptune: use VSOP distance formula only.
For Moon and Pluto, fall back to calculating heliocentric
vector and then finding the length of that vector.
2020-01-04 09:37:56 -05:00
Don Cross
703f924210 Python: Added Time.Parse function.
Added function Time.Parse to convert a UTC date/time string
into a Time object. People should not have to keep reinventing
that wheel. I will be able to simplify astro_demo_common.py.
2020-01-03 14:03:01 -05:00
Don Cross
4d573b50bd C: First draft of SearchPlanetApsis, NextPlanetApsis.
I have tested only for Earth.
Will need to add tests for all the other planets.
2019-12-31 16:02:23 -05:00