Commit Graph

66 Commits

Author SHA1 Message Date
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
04afcf6e91 Handle another update to hygdata_v3.csv.
The star database changed again, which causes my hash check
to fail. This time I locked on to the specific commit of the
file, so my build process won't break if it is changed again.
2023-04-10 19:56:14 -04:00
Don Cross
5faccc9920 cppcheck: verify more source files. 2023-03-26 06:59:27 -04:00
Don Cross
69311b3ccf Adjusted cppcheck options and fixed more warnings. 2023-03-26 06:47:09 -04:00
Don Cross
501c19015b Run cppcheck. Fixed errors in C code found by cppcheck. 2023-03-25 14:46:42 -04:00
Don Cross
0bd0df2cfa Use updated version of star database.
The star database file hygdata_v3.csv has been updated.
Updated the expected checksum for it.

Reworked the downloader to check for checksum disagreement.
If checksum doesn't match, delete the file and download,
then try the checksum again.
This change will automatically fix obsolete files that have already
been downloaded on contributor's development systems.
2023-03-22 15:05:00 -04:00
Don Cross
5cb273ceed Starting to add Kotlin demos.
Just like we have Java demos that use the Kotlin
version of Astronomy Engine, I want equivalent
demos in Kotlin.
2022-05-01 16:39:14 -04:00
Don Cross
efc59ae6fc Refactored demo tests.
I refactored the unit tests for all the demo programs
to follow a different pattern that makes it simpler
to add more demo tests in the future.

The main thing is that correct output and generated
output are now in separate directories `correct` and `test`.
I have moved the test scripts from `test/test` to `./demotest`
in all the langauge demo directories.

This makes it simpler to clean up any stale generated
files before each test run by `rm -f test/*.txt`.

I stumbled across this while making the Java demo tests,
and it was a better solution, so now all the other languages
are consistent with the Java demo tests.

In the C demo tests, I also decided to compile all the
binary executables into a subdirectory `bin` that can
be cleaned out before each run, to make sure there are
no stale executables from an earlier run.
2022-04-30 21:01:11 -04:00
Don Cross
105e806c4d Check download integrity on all operating systems.
The sha256sum and md5sum utilities are available by
default on Linux, but not Windows or Mac OS.
I created the script `checksum.py` that can perform
sha256 and md5 checksum verification on all 3 systems.

Got rid of the ugly checksum.bat I was using on Windows.
Deleted the md5 checksum files, since I only need sha256
for now.

Before this change, I was always skipping verification
of downloads on Mac systems.
2022-04-25 03:08:29 -04:00
Don Cross
896df1ad19 Removed Kotlin Native tests for now.
We are having difficulty getting Kotlin code to build for
both JVM and Native. For now, the priority is to support JVM,
so I am turning off installation of the Kotlin Native compiler.
2022-04-15 13:04:52 -04:00
Don Cross
ad439c6d97 Kotlin Native work in progress: build errors.
Checking in with the Kotlin Native tests turned off,
because the code does not build yet. Seeking help.
2022-04-14 13:16:09 -04:00
Don Cross
d1d18c60e6 Setting up for Kotlin Native demo/test.
Nothing very interesting yet.
Just building a very basic Kotlin Native app
to make sure build and execute work on GitHub Actions,
on Linux and Mac OS.  I will worry about Windows later.
2022-04-13 17:37:00 -04:00
Don Cross
ae5e744e1b Verify that Java demos work. Prep more demos.
Restructured the Java code so we pass in command
line arguments to select which demo we want to run.
We will also pass in date/time, latitude/longitude,
or whatever numeric data we need for future demos.

Automated test run of the Java demos from the
unit test suite.
2022-03-22 12:55:49 -04:00
Don Cross
a0723c7406 Kotlin build/test integrated with 'run' scripts.
Instead of being executed directly by the GitHub Actions
yml file, the Kotlin build now has been integrated with
the build/test steps for the other 4 languages in the
bash script `generate/run` and the Windows batch file
`generate/run.bat`. This will be necessary to control the
order of execution, because the Kotlin source code will have
to be written by the code generator before it is built
and executed.

I also added hints for myself and other contributors about
how to set up Kotlin/JDK tools on a new developement machine.
These instructions are not needed by most users of Astronomy Engine,
just contributors.
2022-03-17 20:52:32 -04:00
Don Cross
cc6a32bb98 Include the gravsim check in the unit tests.
I have gravsim_test.c to the point where it calculates a
standard deviation of error between TOP2013 and Astronomy Engine
for calculating the position of Pluto over 10 worst-case samples.
My baseline is now 0.205303 arcminutes of heliocentric position error.

For Runge-Kutta (or some other method) to be an improvement, it
has to beat that score without incurring significant extra work
or larger memory consumption.
2021-11-10 21:00:38 -05:00
Don Cross
1ccec1ffad Generate test data for converting GAL/EQJ.
Starting work on support for galatic coordinates.
Generate a test data file using calculations made
by the NOVAS function equ2gal(). Later I will use
this data to verify the conversion functions I
write for Astronomy Engine.
2021-06-06 13:46:22 -04:00
Don Cross
c5b05f84d9 More changes for GitHub actions.
The test build failed because diffcalc reported a small
discrepancy between the C and C# output.
So I made the threshold more lenient for now.
I want to come back later and figure out if I can get back
to exact agreement between C and C# code.

Told wget not to output rediculous progress bar stuff
that eats thousands of lines of log output.
2021-04-21 20:09:52 -04: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
Don Cross
f879bc51a6 Skip Jupiter Moon model optimization if already calculated.
This will save a lot of time in my local unit tests, but
will verify it isn't broken when I push to GitHub.
2021-04-11 19:27:09 -04:00
Don Cross
43d05b25bd Jupiter Moons: stubbed the idea of a model optimizer.
I want to experiment with truncating the L1.2 series to
sacrifice some accuracy for smaller generated code.
To that end, I implemented the ability to save the
Jupiter moons model after loading it. I added a 'jmopt'
command to the 'generate' program that will do this
optimization. For now, it just loads the model and
saves it back to a different file. Then the code generator
loads from the saved file instead of the original.
This commit verifies that everything is still working,
before I start truncating the series.
2021-04-11 13:42:23 -04:00
Don Cross
427fb8ed3a Purged obsolete code from generate.c.
Now that I no longer need to generate Chebyshev models
or TOP2013 models for Pluto, I got rid of all the
code in generate.c that is no longer needed.
This whacked about 1000 lines of code.
2020-08-25 17:39:22 -04:00
Don Cross
34a5d48e9c TOP2013: Froze Pluto model at 24816 bytes.
Instead of randomly searching for a good Pluto model, just use
the one I have so far. If I find a better one, I will replace it
in the Git repo.
2020-07-04 20:02:13 -04:00
Don Cross
03cfecea39 Starting to work TOP2013 Pluto model into the build/test process.
Generating an embryonic TOP2013 Pluto model, along with the old
Chebyshev resampling model of Pluto, into the Linux and Windows
build processes.

The TOP2013 Pluto model isn't used for anything, and it isn't
optimized properly yet, but at least this helps validate my code
automatically as I go forward.
2020-07-03 15:19:21 -04:00
Don Cross
85892ec0dd Simplified TOP2013 validation test.
Always validate all planets.
Removed the option to validate a single planet.
2020-07-01 16:08:25 -04:00
Don Cross
f258c27ce5 Validate TOP2013 logic as part of automatic unit tests. 2020-07-01 14:33:39 -04:00
Don Cross
ff5ef2b3bb Starting to implement ValidateTop2013().
Adding infrastructure for loading TOP2013 models of planets
and calculating them. Will start with a unit test to verify
I'm calculating the formulas correctly.
2020-06-30 17:58:42 -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
9cdaaa8761 Starting to work on planetary transit calculations.
Wrote stub C functions for finding transits.
Updated html files containing Espenak test data for Mercury, Venus.
Updated norm.py to convert the html files to easy-to-use text files.
2020-06-11 22:17:01 -04:00
Don Cross
75e26ccac2 Changed verbosity option from -d to more standard -v. 2020-05-26 11:58:02 -04:00
Don Cross
0787b88ddd Python unit tests are less verbose unless -d option is specified. 2020-05-26 11:14:12 -04:00
Don Cross
30a85407b4 JavaScript: Use Espenak/Meeus DeltaT function. 2020-05-15 18:42:12 -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
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
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
3bb740fd1c Fixed #62 - Automatically update copyright year range. 2020-04-30 15:12:14 -04:00
Don Cross
07201afe0a Generate planet perihelion/aphelion test data from NOVAS.
Created my own unit test data from NOVAS for planet apsides.
Handle oddities with Neptune's orbit as a special case.
Removed hacks in ctest.c.
2020-01-04 07:05:43 -05:00
Don Cross
3ffc77caa6 C# demo: more work getting set up. 2019-12-23 11:36:55 -05:00
Don Cross
7bff374d57 Starting to add support for generating C# code.
Decided to move call to makedoc script from run script.
It was confusing that it was hidden inside unit_test_js,
especially because it invokes the code generator for
all supported languages.
2019-10-10 14:56:49 -04:00
Don Cross
6c398251ef Added call to csharp unit test from 'run' script. 2019-10-09 20:38:10 -04: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
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
Don Cross
410cf99a5e Display the "All Tests Passed" ASCII art from a text file. 2019-07-09 20:38:54 -04:00
Don Cross
7c8722acad Print ASCII art "All Tests Passed" on success.
It's nice to have a clear signal that I can read across the room
that everything was successful.  If I don't see this, I know
something went wrong.
2019-07-02 14:12:19 -04:00
Don Cross
b5ebc4a645 Added python unit test. 2019-06-23 19:52:16 -04:00
Don Cross
d476465b6d Actually test moonphase.js and moonphase.c. Test after generating code. 2019-06-13 21:38:27 -04:00
Don Cross
58fa90a0bf Reworked tests of C examples.
Moved test files into separate test directory (cleaner).
Make C and nodejs 'position' tests generate identical output.
2019-06-13 21:04:45 -04:00
Don Cross
4061aa6b58 Added nodejs example 'positions.js'.
Unit test the calculations and fail if output deviates.
2019-06-13 20:37:43 -04:00
Don Cross
fb09678d4f Verify that demo C programs build. Validate positions.c output.
I could also validate moonphase.c output if only I modified it
to accept an optional date and time parameter.
2019-06-11 21:05:44 -04:00
Don Cross
bf3c7a45c4 Fixed bug in checking for planet model files. 2019-06-04 17:50:36 -04:00