Commit Graph

25 Commits

Author SHA1 Message Date
Don Cross
5dbede1a4b Looking at _CalcVsop as the possible origin of numeric errors. 2024-05-28 17:10:07 -04:00
Don Cross
4153488d13 Removed obsolete entries from .gitignore 2024-05-28 16:26:17 -04:00
Don Cross
9975edc81b Updated star database to HYG v 3.6.1. 2023-09-21 15:41:03 -04:00
Don Cross
f4405e390c Updated star database to HYG v 3.5.1.
This change affects internal unit testing only.
It does not affect developers who use Astronomy Engine.
Upgraded the HYG database used for verification of
constellation calculations to v 3.5.1.

See conversation at:
https://github.com/astronexus/HYG-Database/issues/21
2023-09-19 15:08:49 -04:00
Don Cross
d1d34d5254 Enable generation of C documentation by default.
When building Astronomy Engine for publication,
I was disabling generation of C documentation by default,
because I used to have issues getting deterministic output
in the CI tests (GitHub Actions). Now I have reason to believe
it will work reliably, so I am turning on C docs generation
by default.

If this fails the CI test, I will have to make the CI test
explicitly disable this step until I figure out how to fix it.
Otherwise (and preferably) the CI test will ensure that the
published C documentation is always up to date, and will fail
the build if there are any issues generating the docs.

I also had forgotten to enable installing dependencies for
my custom tool `hydrogen` in the Windows build. I added a fix
for that.
2021-11-24 19:37:13 -05:00
Don Cross
cbcacc4b57 Improved agreement of precision among the 4 supported languages.
Before making these changes, I had the following discrepancies
between the calculations made by the different programming
language implementations of Astronomy Engine:

    C vs C#: 5.55112e-17, worst line number = 6
    C vs JS: 2.78533e-12, worst line number = 196936
    C vs PY: 1.52767e-12, worst line number = 159834

Now the results are:

    Diffing calculations: C vs C#
    ctest(Diff): Maximum numeric difference = 5.55112e-17, worst line number = 5

    Diffing calculations: C vs JS
    ctest(Diff): Maximum numeric difference = 1.02318e-12, worst line number = 133677

    Diffing calculations: C vs PY
    ctest(Diff): Maximum numeric difference = 5.68434e-14, worst line number = 49066

    Diffing calculations: JS vs PY
    ctest(Diff): Maximum numeric difference = 1.02318e-12, worst line number = 133677

Here is how I did this:

1. Use new constants HOUR2RAD, RAD2HOUR that directly convert between radians and sidereal hours.
   This reduces tiny roundoff errors in the conversions.

2. In VSOP longitude calculations, keep clamping the angular sum to
   the range [-2pi, +2pi], to prevent it from accumulating thousands
   of radians. This reduces the accumulated error in the final result
   before it is fed into trig functions.

The remaining discrepancies are largely because of an "azimuth amplification" effect:
When converting equatorial coordinates to horizontal coordinates, an object near
the zenith (or nadir) has an azimuth that is highly sensitive to the input
equatorial coordinates. A tiny change in right ascension (RA) can cause a much
larger change in azimuth.

I tracked down the RA discrepancy, and it is due to a different behavior
of the atan2 function in C and JavaScript. There are cases where the least
significant decimal digit is off by 1, as if due to a difference of opinion
about rounding policy.

My best thought is to go back and have a more nuanced diffcalc that
applies less strict tests for azimuth values than the other calculated values.
It seems like every other computed quantity is less sensitive, because solar
system bodies tend to stay away from "poles" of other angular coordinate
systems: their ecliptic latitudes and equatorial declinations are usually
reasonably close to zero. Therefore, right ascensions and ecliptic longitudes
are usually insensitive to changes in the cartesian coordinates they
are calculated from.
2021-04-18 21:15:17 -04:00
Mateo Tibaquira
21c053dbed JS: Refactor the build setup
The npm dependencies required are now
installed locally inside the generate folder.

Cleaned up the Astronomy object closure for TS
and kept it for the Browser bundle.

We will have some usage examples in the website.
2021-02-07 17:09:21 -05:00
Don Cross
28749fd671 Wrote scripts to plot Pluto distance, comparing NOVAS vs TOP2013.
The data plot confirms there is some kind of high-frequency error
that causes excessive local minima/maxima that fools the apside
finder.
2020-07-06 14:47:07 -04:00
Don Cross
60b69065b8 Factored out download logic into a bash function. Download TOP2013 data.
I'm starting to work on a replacement for Pluto calculations that
are not bounded in time. I'm trying the TOP2013 model that calculates
elliptic parameters of the outer planets Jupiter..Pluto.
I needed to download the 24MB file TOP2013.dat.
I already had redundant download logic for two files, and this was a third.
So I eliminated the redundancy and generalized the download logic
in the new bash function Download.
2020-06-30 14:03:27 -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
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
5db8a91404 Verifying that I can build dotnet core 2.2 programs in Travis CI. 2019-10-09 20:28:46 -04:00
Don Cross
700d3d7870 Starting to create my own custom Python to Markdown converter.
Once again, existing tools are too complicated and don't do what I want.
It's actually easier to create my own tool for this special purpose.
I also want the documentation to be similar in style to the other languages.
2019-07-08 14:25:49 -04:00
Don Cross
254238b9ea Disable Python doc generation on Travis CI. 2019-07-07 15:03:02 -04:00
Don Cross
c611b50d3f Significant performance boost to Python code: eliminate _ter2cel().
There were 3 calls to _ter2cel(), each of which redundantly
called _sidereal_time, which results in 3 calculations of _e_tilt().
Reworked so there is only one call to _e_tilt().

Minor changes to support using cProfile, which is how I found this.
2019-06-27 14:22:59 -04:00
Don Cross
4566547cb7 Keep generated planet models in Git repo.
Force regeneration of planet models in Travis CI,
just to ensure that everything is still working.
This also will detect if the planet models change
unexpectedly on my development machines.
2019-06-04 17:52:47 -04:00
Don Cross
720f5b367f Ignore flag file to enable generating C documentation. 2019-05-26 12:22:33 -04:00
Don Cross
42945d08b6 Instead of searching for executables, generate them in a known location.
I found out by accident that OUTDIR environment variable tells msbuild
where to put executables. Taking advantage of this so I can control
where generate.exe and ctest.exe end up, instead of having to search for them.
2019-05-19 21:49:40 -04:00
Don Cross
6615e3b9f8 Starting to unit test astronomy.c.
Beginnings of a unit test for the C version of Astronomy Engine.
Currently verifies that Astro_MakeTime() is working correctly.
2019-05-16 16:18:03 -04:00
Don Cross
819e08ce0d Generate local HTML documentation for previewing.
Instead of reading Markdown files locally, I generate HTML documentation.
I tell Git to ignore the html directory because it is only for local use.
2019-05-05 13:23:23 -04:00
Don Cross
55d7467678 Documented that I have figured out the JPL Horizons refraction formula.
I created a Jupyter notebook that shows how I figured out the
refraction formula used by the JPL Horizons online tool.
2019-04-13 21:13:32 -04:00
Don Cross
390e0692d7 Added JavaScript unit test. 2019-04-09 13:34:56 -04:00
Don Cross
1e0527e2cf Generating VSOP output files. 2019-04-08 22:25:38 -04:00
Don Cross
f4b67f1f0e Automatically download and validate the ephemeris file if missing. 2019-04-08 15:45:23 -04:00
Don Cross
f163d86170 Starting to work on astronomy source generator C program. 2019-04-08 08:57:43 -04:00