Commit Graph

106 Commits

Author SHA1 Message Date
Don Cross
898276e130 Update copyrights, move AstroTime notes to correct file, copyediting. 2024-05-26 16:30:43 -04:00
Don Cross
63ed3746b2 Misc fixes for Raspberry Pi 4 build.
On the Raspberry Pi 4, using latest versions of cppcheck
and pylint, a few more minor fixes were needed for eliminating
warnings.

Also had to soften a tolerance for the Kotlin unit tests.
2023-06-19 16:28:34 -04:00
Don Cross
62192357ba Updated copyrights for 2023.
Windows build process now updates copyright
years just like the Linux build process does.
Ran it to update the copyright years for 2023.
2023-01-07 17:13:07 -05:00
Don Cross
b4c36e7188 Merge branch 'master' into ecliptic 2022-12-08 13:44:53 -05:00
Don Cross
30a9b0b757 Fixed warnings from gcc 12.2.
I'm taking gcc 12.2 for a test drive today.
It reports a few warnings that slipped through earlier versions.
None of the warnings concern me for actual code safety,
but I went ahead and resolved them to keep the build clean.

Also provide a hook for a CPP environment variable to override
the C++ compiler to use, instead of forcing g++.
2022-12-08 13:41:12 -05:00
Don Cross
552c7a5557 EclipticGeoMoon uses true equinox of date in all languages.
Added EclipticGeoMoon as output to the temp/*_check.txt files as 'm' lines.
This ensures that all the languages calculate nearly identical values.

Optimized EclipticGeoMoon a little more by eliminating a redundant
call to mean_obliq.
2022-12-05 21:44:35 -05:00
Don Cross
d3f36b942d Verify nutation angles are consistent across languages. 2022-12-04 14:20:44 -05:00
Don Cross
8fd8d7b624 Kotlin AstroTime: millisecond resolution, ISO 8601
Allow floating point values for seconds when initializing
an AstroTime from (year, month, ..., seconds).
AstroTime can now represent date/time to millisecond resolution.

Represent AstroTime strings in ISO 8601 format:
yyyy-mm-ddThh:mm:ss.sssZ

Minor docstring fixes.

Rename target file to 'astronomy.kt'.
2022-03-21 13:28:49 -04:00
Don Cross
a278a893ff Merge branch 'master' into kotlin
This brings in recent fixes to the Python
pip package build process.
2022-03-20 20:00:43 -04:00
Don Cross
74044b39d3 More Python/pip package cleanup : version 2.0.17.
Generate astronomy.py directly in the package directory.
I realized it doesn't make sense to generate it in the
parent directory and then copy it; just generate it where
it will end up anyway.

Updated documentation so people know they can just do

    pip install astronomy-engine

to install Astronomy Engine in their Python project.

Removed the GitHub Actions status badge because it is redundant with
the checkmark/X indicator.

Now that private symbols are no longer exported, I had to
fix a couple of places where the unit tests still accessed them.
2022-03-20 16:47:29 -04:00
Don Cross
e92cf212f2 Added Kotlin to source code generator.
This is just a stub to get started. None of the
necessary macros have been implemented in the Kotlin
code generator. But at least I can start editing the
Kotlin template and generating code from it.
2022-03-18 20:28:14 -04:00
Don Cross
b2f9219b56 Updated copyrights for 2022. 2022-01-04 18:55:20 -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
56d08a7370 Less verbose JupiterMoonTruncate. 2021-04-21 20:36:16 -04:00
Don Cross
6d3f27cd4c Added diffcalc testing for Jupiter's moons: position and velocity vectors.
This test verifies that the calculations of Jupiter's moons
are consistent across C, C#, JavaScript, and Python.
2021-04-21 13:06:44 -04:00
Don Cross
a6b1963291 Decreased minified JS size from 98382 to 94490 bytes.
I increased the error tolerance slightly for the Jupiter moons model.
This shrank the model tables significantly, giving me some more
breathing room to stay under 100K download size.
2021-04-12 20:53:42 -04:00
Don Cross
5891cfdb5e Jupiter Moons: implemented optimizer that truncates series.
The optimizer makes the Jupiter moons series as short as
possible while keeping error within an acceptable limit.
This should help produce much smaller code, especially
for JavaScript where it really matters.
2021-04-11 17:27:03 -04:00
Don Cross
58c0fe342f Jupiter Moons: added debug prints to get a feel for series frequencies. 2021-04-11 14:45:45 -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
c5738052b4 Starting to convert JavaScript code to TypeScript, and compiling it back to JavaScript.
The goal is to provide both TypeScript and JavaScript to developers.
Will also provide a type definition file once I figure that out.
This is just the first pass through the code.
It builds and passes all the unit tests, with some minor changes
to the generated README.md.
2021-02-04 22:12:49 -05:00
Don Cross
f34b700ce3 Updated copyrights for 2021. This resolves Travis CI broken build.
I forgot that my build process automatically updates
copyright years when the current year changes.
My Travis CI unit tests verify that there are no local
changes after running all the tests.
That test failed because the update_copyrights.py changed
all the "2019-2020" to "2019-2021".
2021-01-07 08:55:52 -05:00
Don Cross
7183f9be30 Eliminated some more obsolete code I missed. 2020-08-25 18:01:28 -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
4febeff50e Pluto integrator: added ability to calculate before outside years 0000..4000.
Calculations outside 0000..4000 are slower because they are not cached.
But at least they work now instead of returning an error.
2020-08-20 21:56:43 -04:00
Don Cross
013fbc03c4 Pluto test: fail if error increases above current amount. 2020-08-18 17:46:10 -04:00
Don Cross
f94ba04032 Pluto integrator: refined coordinates for Pluto test.
The 'ctest pluto' command was testing against slightly wrong coordinates.
Added 'generate topcalc' command to print out exact TOP2013 values.
Used those values as the reference coordinates in 'ctest pluto'.
Sadly, this increased the measured error from 1.347e-02 AU to 1.412e-02 AU.
2020-08-18 15:33:31 -04:00
Don Cross
b6db310641 Keeping useful changes from abandoned branch small_pluto.
I was experimenting with an alternative way to calculate Pluto's position.
That idea didn't work out, but in the process, I did make some changes
I want to keep:

1. A typecast in generate/codegen.c that eliminates a build warning
   in Windows (Visual Studio 2015).

2. Expanded generate/vsop/vsop.c to calculate both position and velocity
   vectors. This was tricky to get working, and could come in handy.
2020-08-15 13:28:16 -04:00
Don Cross
bccffc0055 Generate JSON ephemeris using J2000 dates instead of Julian dates. 2020-07-11 10:10:27 -04:00
Don Cross
c563237399 Added generation of ephemeris in JSON format.
I'm working on a Solar System gravity simulation.
I need very precise position and velocity data for the major
Solar System bodies. I want to write the simulator as a browser-
based animation, so I will code it in JavaScript. This JSON
generator is a bootstrap to provide the initial solar system
state, plus it allows testing how accurate the simulation
is as it unfolds. Plus it may be useful for any program that
can parse JSON easily.
2020-07-11 09:31:26 -04:00
Don Cross
8a2b12295d Fixed Windows build warning in gravsim. 2020-07-09 22:16:27 -04:00
Don Cross
75c3559326 Add an experimental gravity simulator for Pluto. 2020-07-09 21:32:24 -04:00
Don Cross
a198b9e59e TOP2013: Re-tightened error tolerances for Pluto. 2020-07-07 16:56:34 -04:00
Don Cross
b31c0185df TOP2013: greatly decrease waviness in Pluto curve.
The high-frequency wobble in the Pluto position function was bothering me.
Decreased the arcminute error threshold from 1.0 to 0.5, resulting
in a much larger model, but a lot less ripple:

   547 [    78   140    94   115    21    99]
2020-07-07 15:38:39 -04: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
d89b9a19d5 C: Replaced Chebyshev with TOP2013 for Pluto calculations.
Now the C version of Astronomy Engine is using the TOP2013 model
of Pluto instead of resampled Chebyshev polynomials.

I added temporary hacks to ignore differences for Pluto between
C output and output from Python, JavaScript, and C#.
I will remove these after all four languages are using TOP2013.
See the variable ToleratePlutoErrors in ctest.c.

ctest.c DiffLine function now understands that longitude-like
angles (right ascension and azimuth) can wrap around, and to tolerate
very small angular differences that happen to straddle the wraparound
value. I should have done this a long time ago, but it never caused
problems before now.

C PlanetApsis has a serious problem with Pluto that I didn't expect.
I need to investigate and understand this before porting to other
languages. For now, I hack around it using ToleratePlutoErrors.
2020-07-06 13:47:05 -04:00
Don Cross
852681b225 TOP2013: NudgeSearch shuffles the order of each delta value also.
This is another way to explore possible solutions in a random order
so that we don't keep going in the same directions each time.

Found a better solution:

   219 [    27    63    61    58     6     4]
2020-07-05 21:13:22 -04:00
Don Cross
07887d30b8 TOP2013: NudgeSearch randomly shuffles the order it searches the coordinates. 2020-07-05 20:19:17 -04:00
Don Cross
ab815498af TOP2013: found a better Pluto model.
224 [    27    73    56    58     6     4]

Added a 'topinfo' command to generate.c for displaying
the above stats.
2020-07-05 19:39:55 -04:00
Don Cross
cb5f4fd998 TOP2013: found better solution using new script 'hunt'.
winner:   0.998305 arcmin :    228 [     37     63     60     58      6      4]

This script keeps running the ray search followed by the nudge search.
If it finds a better solution that the existing one, it replaces it.
Found the above solution after about 30 minutes.
2020-07-05 17:46:46 -04:00
Don Cross
ea989f53a2 TOP2013: Implemented NudgeSearch to make Pluto model even smaller.
0.993372 arcmin :    238 [     41     62     63     63      5      4]
2020-07-05 16:30:20 -04:00
Don Cross
a8ce5191b4 Improved term sorting by adjusting "millennia" value.
I realized that I still was telling the code to assume the
time coordinate never gets more than 0.2 millennia away from J2000.
But in fact, it is getting 0.5 millennia away. Fixed that, and
immediately found a smaller model that works.

OptimizeTop:    255 terms [     41     62     71     68      9      4]
2020-07-05 14:12:36 -04:00
Don Cross
6588e21d72 TOP2013: Relaxed required accuracy to 1 arcminute; some optimizations.
Relax apparent angular error threshold from 0.4 to 1.0 arcminutes.
No longer compare TOP2013 to NOVAS while optimizing.
Use worst-case distance between Earth and Pluto:
Pluto radius from Sun, minus Earth aphelion distance.

Sample 503 points intead of 293.
Measure 2 full orbits before J2000 and 2 full orbits after J2000.

Statistics for output/8.top :
OptimizeTop:    268 terms [     34     57     72     90      9      6]
2020-07-05 13:31:43 -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
0afc803b94 TOP2013: First draft of a random-ray search for small models. 2020-07-04 19:31:39 -04:00
Don Cross
3ce9f07c63 TOP2013: Implemented function for picking random 6D unit vectors.
Created functions for generating random unit vectors in
6-dimensional space. Will use this for trying different
directions along which to do a binary search between
truncated TOP2013 models that have acceptable error
and those which have unacceptable error. Will home in on
the smallest model that is within tolerable error.
2020-07-04 14:24:06 -04:00
Don Cross
c2785f9ae0 Updated comments that document binary search stats. 2020-07-03 23:01:58 -04:00
Don Cross
c3d1cdf465 TOP2013: Made measurements run twice as fast by recycling invariant calculations. 2020-07-03 22:59:24 -04:00
Don Cross
d3680c1f1d TOP2013: exploring how many terms I can truncate from the 6 formulas. 2020-07-03 22:13:05 -04:00
Don Cross
cb9e5e9107 TOP2013: added helper function to directly calculate rectangular coordinates.
Also optimized calculation of rotation matrix.
2020-07-03 20:37:24 -04:00
Don Cross
ac6a101607 TOP2013: Changed my mind. Will squash models by integer skip values.
Instead of calculating amplitudes and truncating based on them,
I realized when it comes right down to it, all I want to do
is truncate fewer or more terms from each formula until I find
a good compromise between size and accuracy. A term is either
included or excluded. Therefore the degree of freedom is discrete,
not continuous. There is no need to calculate a continuous value
to adjust something with only discrete options available.
2020-07-03 20:15:53 -04:00