Commit Graph

2227 Commits

Author SHA1 Message Date
Mateo Tibaquira
27634b9553 website: initial homepage based on PrettyDocs theme 2021-02-07 23:38:32 -05:00
Mateo Tibaquira
ba921d45b4 website: add the main module with index component 2021-02-07 23:38:31 -05:00
Mateo Tibaquira
cc31072506 build: generate JSON documentation with JSDoc 2021-02-07 23:38:31 -05:00
Mateo Tibaquira
22acc9fe9c docs: ng add @angular/material @angular/flex-layout 2021-02-07 23:32:19 -05:00
Mateo Tibaquira
7447d400bd docs: ng new website 2021-02-07 23:32:19 -05:00
Mateo Tibaquira
fa6f7c0767 JS: Fix the links in the README file 2021-02-07 23:31:43 -05:00
Mateo Tibaquira
f6917c9a7d JS: Improve typedef docblocks
Restored the jsdoc2md template usage for the Javascript README.md
2021-02-07 21:39:18 -05:00
Mateo Tibaquira
44a96f8c21 JS: Improve the documentation of FlexibleDateTime
Also moved the NPM commands to the package.json
so the makedoc scripts execute them in a central place.

Installed a jsdoc theme to improve the html output.
2021-02-07 20:42:05 -05: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
e5726bfae6 JS: Fixed problems passing parameters to Search, and checking for failures.
The JavaScript version of Astronomy.Search was sometimes being passed
an incorrect 'options' parameter. It should always be either omitted
or passed in an object with the correct shape.

Also, there were places where Search failures, indicated by it
returning null, should cause an immediate exception.
2021-02-07 15:17:51 -05:00
Don Cross
35167c84aa Merge branch 'master' into typescript 2021-02-06 15:41:53 -05:00
Don Cross
8c53180f18 Fixed C# floating point parse/format issues in European cultures.
When built from a system with a European (or similar) culture setting
where a comma is used as a decimal marker instead of a period,
the C# unit tests and demos would fail.

Now explicitly specify InvariantCulture to resolve these problems.
2021-02-06 15:39:55 -05:00
Don Cross
d776c3d453 Enabled --strict option in TypeScript compiler. Fixed resulting errors.
Improved the type checking by using tsc --strict.
Nothing substatial changed in the generated JavaScript, and no
actual bugs were found, but I removed a lot of loose/sloppy
type signatures. This should make mistakes less likely
in the JavaScript code going forward.
2021-02-05 20:46:56 -05: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
48b7ffe96e Fixed #81 - Upgraded C# projects from .NET Core 3.1 to .NET 5.0. 2021-02-03 14:52:55 -05:00
Don Cross
4337c1b62c Merge pull request #80 from matheo/netlify-integration
Integrate Netlify for Open Source projects.
2021-02-02 15:17:11 -05:00
Mateo Tibaquira
15387033c5 Integrate Netlify for Open Source projects 2021-02-02 12:43:19 -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
14ff7519b5 Updated npm package to 1.1.3 to include full moon search fix. 2021-01-06 21:56:27 -05:00
Don Cross
246ac47d2b Fixed a failure to find a full moon using certain start dates.
In all four versions of Astronomy Engine (C, C#, JavaScript, and Python),
starting a search for a full moon near December 19, 2020 would fail.
I added a unit test to all four languages and it failed consistently
across them all.

The root cause: I was too optimistic about how narrow I could make
the window around the approximate moon phase time in the
SearchMoonPhase functions. Finding the exact moon phase time failed
because it was outside this excessively small window around the approximate
time. I increased the window from 1.8 days to 3.0 days.
This should handle all cases with minimal impact on performance.

Now all four of the new unit tests pass.
2020-12-18 14:29:41 -05:00
Don Cross
c58a59dabf Fixed #76 - Migrating from travis-ci.org to travis-ci.com. 2020-09-16 20:41:42 -04:00
Don Cross
d8e268e116 linux_riseset.c demo: Moon, Sun culmination.
Calculate the next Moon and Sun cumlination,
and include the altitude of the body above
the horizon at that moment.
2020-09-13 19:23:09 -04:00
Don Cross
b779a6aeca Added linux_riseset.c, a variation of riseset.c.
This new demo shows how to calculate rise and set times
of the Sun and Moon in local time, using Linux functions.
It also sorts the events in chronological order.
2020-09-08 21:40:05 -04:00
Don Cross
9dfa0285e2 Perform JavaScript unit tests on the minified code.
In order to verify that the minified code is valid, the
JavaScript unit tests should use it rather than the original
code. I must have changed back to using the normal code while
I was debugging something and forgot to change it back.
2020-08-31 11:34:20 -04:00
Don Cross
f6f9df369e Removed obsolete code generators.
I no longer need code generators for Chebyshev and TOP2013 models.
2020-08-26 20:21:36 -04: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
10d7821184 npm version 1.1.2 - Improved Pluto calculation.
The minimized code astronomy.min.js is now significantly smaller
because it uses a completely new algorithm for calculating
the position of Pluto. Instead of using TOP2013 formulas directly,
it simulates the gravitational forces on Pluto between 40
precalculated checkpoints spread over a 4000 year range.
2020-08-24 21:42:06 -04:00
Don Cross
9de3be62d3 Made a change to astronomy.cs template that didn't get checked in. 2020-08-24 21:06:50 -04:00
Don Cross
8f16f0a5ae Pluto integrator: finished porting to Python.
I believe this wraps up the Python integrator.
It now works in all 4 languages and passes all tests.
Fixed up demo tests to match new output.
Turned on Travis CI checking in this branch again.
2020-08-24 20:54:20 -04:00
Don Cross
1a2508f68b Pluto integrator: ported to JavaScript. 2020-08-24 14:14:32 -04:00
Don Cross
304d10fc97 Pluto integrator: ported to C#.
Ported Pluto integrator to C#.

Along the way, I noticed that I had VSOP87 latitude and longitude
swapped in such a way that they worked, but were labeled wrong.
This confused me quite a bit as I tried to implement functions
to calculate the derivatives of the VSOP87 spherical coordinates.
Fixed this in the code generator and the C and C# template files.
2020-08-23 20:49:10 -04:00
Don Cross
80780637e6 Added vgtest script, for running ctest through valgrind.
The vgtest script allows checking for memory errors in
Astronomy Engine using valgrind. This helped me find
a bug where I was using uninitialized memory.
2020-08-22 14:34:25 -04:00
Don Cross
3bcc44d0fc Reduced precision of generated PlutoStateTable.
The PlutoStateTable was slightly different when generated
in Linux and Windows, because there was so much precision
after the decimal point. Reduced precision until Linux
and Windows generated the exact same output.
2020-08-22 14:08:07 -04:00
Don Cross
dcd548f0a1 PlutoCheck is now terse unless -v is specified. 2020-08-22 12:08:17 -04:00
Don Cross
bfaa2c185b Pluto integrator: cache all calculated segments.
Instead of remembering the most recent 3 segments of Pluto's orbits,
cache up to all 40 segments within the year span 0000..4000.
Use dynamic memory to allocate them instead of static memory.
Added Astronomy_Reset() to free memory before exit.
2020-08-22 12:01:20 -04:00
Don Cross
10139d3762 Pluto integrator: More refactoring to make code smaller. 2020-08-21 20:09:02 -04:00
Don Cross
64d425994f Pluto integrator: More refactoring to decrease code size.
Also reduced stack usage by sharing bary[5] more.
Eliminated a redundant call to MajorBodyBary() when
calculating one-way outside the bounds of PlutoStateTable.
2020-08-21 19:16:01 -04:00
Don Cross
38139c620b Pluto integrator: making code a little smaller. 2020-08-21 16:59:18 -04:00
Don Cross
90c6b18729 Pluto integrator: simplify calculating table indexes.
There were two places where I was searching for table entries.
I realized I can just directly calculate the same indexes.
This makes the code smaller and faster.
2020-08-21 15:27:14 -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
f58778b071 Pluto integrator: Changed dt from 500 to 250 days. Tweaked error threshold. 2020-08-20 15:54:29 -04:00
Don Cross
5c3e5a83d9 Pluto integrator: keep and recycle calculations over segments.
To make Pluto calculations have a low amortized time cost,
calculate up to 3 segments between adjacent pairs of
pre-calulcated states and recycle them. Do linear ramp
fade-mixing between them.

Currently, something is wrong with this because it fails
by inaccurately calculating horizontal coordinates of Pluto
in one test. I'm not sure what's going wrong there yet,
but likely related to multiple calls via search.
2020-08-20 13:49:21 -04:00
Don Cross
a71acd70ca Pluto integrator: settled on dt = 500 days.
This is a happy compromise between speed and accuracy.
Solidified this as a #define PLUTO_DT, which will allow
me to do compile-time math to establish an array size for
an internal buffer of lazy-computed dt increments between
most recently requested segment endpoints.
2020-08-19 17:12:45 -04:00
Don Cross
783aa5008c Pluto integrator: Dramatically improved accuracy and speed.
Now we are getting somewhere!
Using the mean acceleration over the interval seems so much
better than the complicated calculus thing I did.
Now I am using a very large time step: 500 days,
with an error less than 0.2 arcminutes.

C PlutoCheck: dt = 500.000000
C PlutoCheck: 2049-12-19T12:00:00.000Z = 18250.000000 UT = 18250.001076 TT
C PlutoCheck: calc pos = [ 37.4373396436339121, -10.2445033319559062, -14.4764587025278448]
C PlutoCheck: ref  pos = [ 37.4377303529113306, -10.2466292445590774, -14.4773101309873091]
C PlutoCheck: del  pos = [ -0.0003907092774185,   0.0021259126031712,   0.0008514284594643]
C PlutoCheck: diff = 2.323163e-03 AU, 0.198 arcmin
2020-08-19 16:20:51 -04:00
Don Cross
0bfd30d751 Pluto integrator: 'ctest pluto' allows tweaking dt. Default dt = 50 days.
Allow passing in the dt value as an environment variable PLUTO_DT:

$ PLUTO_DT=100 ./ctest pluto
C PlutoCheck: dt = 100.000000
C PlutoCheck: 2049-12-19T12:00:00.000Z = 18250.000000 UT = 18250.001076 TT
C PlutoCheck: calc pos = [ 37.4506659151144774, -10.2638146514621269, -14.4865003148403595]
C PlutoCheck: ref  pos = [ 37.4377303529113306, -10.2466292445590774, -14.4773101309873091]
C PlutoCheck: del  pos = [  0.0129355622031468,  -0.0171854069030495,  -0.0091901838530504]
C PlutoCheck: error = 2.339073e-02 AU, 1.989 arcmin

Default to dt = 50 days.
2020-08-19 14:35:46 -04:00
Don Cross
68b0ec92bd Fixed another Pluto integrator bug: corrected SSB calculation.
I had a bug in the calculation of the Solar System Barycenter.
The position and velocity vectors were both backwards.
This caused the barycentric Sun to be in the wrong place.

C PlutoCheck: 2049-12-19T12:00:00.000Z = 18250.000000 UT = 18250.001076 TT
C PlutoCheck: calc pos = [ 37.4386594210222654, -10.2474739785185811, -14.4777836541558340]
C PlutoCheck: ref  pos = [ 37.4377303529113306, -10.2466292445590774, -14.4773101309873091]
C PlutoCheck: del  pos = [  0.0009290681109348,  -0.0008447339595037,  -0.0004735231685249]
C PlutoCheck: error = 1.342001e-03
2020-08-19 14:23:09 -04:00
Don Cross
a5d011ee78 Pluto integrator: factored out search for nearest starting state. 2020-08-19 12:53:08 -04:00
Don Cross
b6087c9b14 Pluto integrator: fixed a small math mistake.
I didn't implement the math I had derived on paper exactly right.
There was one place where I meant to have (dt^3 / 6), but I had (dt^2 / 6).
This has only a tiny effect on the error. I know this can work better,
so I'm still searching for the real problem.

C PlutoCheck: 2049-12-19T12:00:00.000Z = 18250.000000 UT = 18250.001076 TT
C PlutoCheck: calc pos = [ 37.3682426267669996, -10.0216432448322834, -14.3724661626442582]
C PlutoCheck: ref  pos = [ 37.4377303529113306, -10.2466292445590774, -14.4773101309873091]
C PlutoCheck: del  pos = [ -0.0694877261443310,   0.2249859997267940,   0.1048439683430509]
C PlutoCheck: error = 2.577586e-01
2020-08-18 21:59:37 -04:00
Don Cross
f279cdd9b5 PlutoCheck: made test much more difficult.
I picked a worst-case starting time that is halfway between
two entries in the PlutoStateTable[]. This requires the most
iterations to calculate. Now I have a better metric for
position accuracy:

C PlutoCheck: 2049-12-19T12:00:00.000Z = 18250.000000 UT = 18250.001076 TT
C PlutoCheck: calc pos = [ 37.3682426469732860, -10.0216428456503461, -14.3724660445065933]
C PlutoCheck: ref  pos = [ 37.4377303529113306, -10.2466292445590774, -14.4773101309873091]
C PlutoCheck: del  pos = [ -0.0694877059380445,   0.2249863989087313,   0.1048440864807159]
C PlutoCheck: error = 2.577590e-01

Clearly I still have a lot of work to do!
2020-08-18 20:37:52 -04:00