Commit Graph

2245 Commits

Author SHA1 Message Date
Don Cross
954a00f6a0 Performance metrics: tally calls to Search.
Now I can see that rise_set_test is causing Search to sample
the altitude function 18 times per call.
2019-04-21 10:48:07 -04:00
Don Cross
043a05b78e Starting to add some simple performance metrics for Search function.
I am interested in optimizing the Search function.
Right now it is a very simple binary search that keeps breaking
an interval in half to narrow in on the time of where the supplied
function ascends through zero.  I know this can be made much better,
and this is important because the function calls are very expensive
in some cases.

So this commit adds the beginning of some simple metrics tracking
where unit test code can retrieve the number of times Search
sampled the function it is trying to find the ascending root for.
2019-04-21 10:34:31 -04:00
Don Cross
c1d8970873 Updated comments, renamed gmst variable to gast. 2019-04-21 10:10:49 -04:00
Don Cross
690a71ecf2 Replaced rise/set test data to have less extreme latitudes.
Latitudes within the arctic/antarctic circles cause too much
hassle because of horizon-grazing that makes it hard for
two different programs to agree on when (or even whether)
a rise or set took place.
2019-04-20 23:23:17 -04:00
Don Cross
8c2118ed67 Fixed #23 - Crazy behavior in refraction formula
The refraction formula went nuts near altitude angle -5.11 degrees.
We were taking the tangent of a value that zoomed toward infinity
near that value, causing essentially random numbers without any
upper bound to their size. Just like JPL Horizons, truncate any
angle more than 1 degree below the horizon, only I have a linear
taper down to 0 refraction as the altitude angle approaches -90.
I did not want any chance of creating an altitude less than -90.

Removed unit tests for the Sun at latitude -80 degrees.
It is too easy for my code to behave differently from another
calculator, because tiny changes in atmospheric modeling can
cause disagreement about whether there even is a sunset/sunrise.
This is because for observers so close to the pole, the Sun
sometimes barely dips below the horizon and then comes back
up for less than an hour.
2019-04-20 23:00:02 -04:00
Don Cross
9de4451468 Reworked rise/set algorithm based on culm/bottom bounding.
This is the first time it has passed the unit test,
although the unit test is just exercising whether the predictions
occur in the right order. I will need to add check for how accurate
the predictions are.
2019-04-20 19:12:29 -04:00
Don Cross
f465ac2d0a Turned off the rise/set test for now; I need to fix that code.
I will rework the rise/set algorithm to use min/max altitude events.
The result will be much more efficient, and will handle special
cases near the poles better.
2019-04-19 22:06:28 -04:00
Don Cross
d10f7e4bcb Can now search for time of object's highest/lowest altitude.
This will help me create a better algorithm for rise/set,
plus the culmination is one of the things I wanted for its own sake.
2019-04-19 22:03:55 -04:00
Don Cross
5965a43cc0 rise_test_test.js logs which body,lat,lon it is working on. 2019-04-19 13:37:33 -04:00
Don Cross
e3dc71952c Starting to implement rise/set search, but not working yet. 2019-04-18 21:32:06 -04:00
Don Cross
23e43ec9af Converted raw html rise/set data files to a format easier to process. 2019-04-18 16:07:43 -04:00
Don Cross
6413a24094 Run.bat now builds code before proceeding. 2019-04-18 14:40:40 -04:00
Don Cross
0c5415a1f5 Added batch file to rebuild generate.exe on Windows. 2019-04-18 14:34:14 -04:00
Don Cross
77c149519b Trying again with verify_clean script.
Git seems to return different exit codes on every system I try.
So now I'm just looking at whether 'git status --porcelain'
emits any text or not, without paying any attention to its exit code.
2019-04-18 14:01:56 -04:00
Don Cross
fa609fa6a0 Separated generating planet models and generating source code.
This allows me to very quickly and easily test changes that don't
affect the planet models or how code is generated.
2019-04-18 13:45:40 -04:00
Don Cross
e2d85e7bfb Added separate unit_test script. 2019-04-18 13:14:33 -04:00
Don Cross
0e757dfc0d Skip 6 days (instead of 1) to find next moon quarter.
This should help find the next quarter slightly more efficiently
because it will provide a more accurate estimate of the next quarter.
2019-04-18 13:05:29 -04:00
Don Cross
da07dda836 Fixed #21 - Travis CI - Verify generated code matches what was checked in.
Very simply, use git command to confirm there were no unexpected
modifications. In particular, if the checked in generated source
doesn't match what got written by the generate program, this will
fail the Travis CI build.
2019-04-18 12:43:58 -04:00
Don Cross
c1587de28d Deleted unused variable. 2019-04-18 09:02:35 -04:00
Don Cross
2705e6669f Added handy JS function Astronomy.NextMoonQuarter.
This way people don't have to figure out how to iterate
through moon quarters. Use SearchMoonQuarter to start iteration,
NextMoonQuarter to iterate through as many more as desired.
2019-04-18 08:58:40 -04:00
Don Cross
0be5745030 Adding test data for Sun and Moon rise/set times. Not used yet. 2019-04-18 08:51:44 -04:00
Don Cross
6834d4e582 Fixed #6 - Added JS functions to find moon quarters.
Can now search for the next new moon, first quarter,
full moon, or third quarter.
Verified against US Navy Observatory data.
Predictions are confirmed to within 2 minutes of time
for years between 1800 and 2100.
2019-04-17 21:03:38 -04:00
Don Cross
0477a47811 Merge branch 'master' of github.com:cosinekitty/astronomy 2019-04-17 15:15:12 -04:00
Don Cross
b02069be69 Updated Windows run.bat to run the moon phase unit test. 2019-04-17 15:14:43 -04:00
Don Cross
661c1d63e9 Got rid of ugly hack in Astronomy.Ecliptic().
It was conceptually wrong also, because the J2000 epoch
relates to UT, not TT.  In practice, there is no measurable
difference in the obliquity less than a minute apart.
2019-04-17 05:12:46 -04:00
Don Cross
d00e40341b Added test of ecliptic longitude formula.
Using moon phase test data, exercised the calculation of
ecliptic longitude of the Sun and Moon at indicated times.
Compared the actual difference in longitude with 90*phase degrees,
where phase is 0 for new moon, 1 for first quarter, 2 for full,
3 for third quarter. The results always agree within 1 arcminute
(just barely).

Added this to the unit test.

Will come back and add unit tests for the phase searcher once
I implement it.
2019-04-17 05:03:47 -04:00
Don Cross
f39cca2931 Starting to validate ecliptic longitude calculations. 2019-04-16 21:58:40 -04:00
Don Cross
feaa97cb7a First attempt at calculating J2000 geocentric ecliptic coordinates.
Needs testing/validation. Checking in for backup.
2019-04-16 21:19:12 -04:00
Don Cross
83d852b2d1 JS CalcMoon() now uses a Time object like other high-level functions.
This will be handy if I need to use it to calculate moon phases.
Not sure yet.
2019-04-16 20:36:11 -04:00
Don Cross
61b4652a31 Added ability to regenerate target code quickly.
Can now run "generate fast" to skip all the VSOP and Chebyshev
calculations and just regenerate the target code (currently JS only).
This is helpful for rapid development but must be used with care.
2019-04-16 20:30:26 -04:00
Don Cross
d7e9133f2e Generate moon phase test data from US Navy online service.
Created test data using a Windows batch file that downloads
moon phase data from the US Navy Astronomical Applications API,
then converts the resulting JSON into a flat text file.
This has every moon phase for every tenth calendar year
between 1800 and 2100.

I'm keeping the scripts for reference, but I'm checking in
the test data to the repo for repeated use in a unit test
to be created.
2019-04-16 17:51:11 -04:00
Don Cross
db6a7d3258 Curl needs -L option to follow redirects to download from GitHub. 2019-04-16 13:57:08 -04:00
Don Cross
36ed3883b3 Updated Windows batch file run.bat to download ephemeris from GitHub.
Also fixed resulting problem in curl.exe so that it follows redirects.
2019-04-16 13:55:58 -04:00
Don Cross
ee569c7ee1 Enable Travis CI on all branches. 2019-04-16 13:13:15 -04:00
Don Cross
18e09d8290 Check all return values of fread() and fseek() to make warnings go away. 2019-04-16 13:03:11 -04:00
Don Cross
907353c2bd Rolled back my change to novas.c, because it didn't eliminate warnings after all. 2019-04-16 12:49:04 -04:00
Don Cross
a3f2495b59 Hosting DE405 ephemeris file on my own GitHub account.
I kept having trouble with Travis CI timing out trying
to download the DE405 ephmeris file from its official ftp site,
so I'm mirroring it on my own GitHub account.
Hopefully this makes the download smoother.
2019-04-16 12:40:14 -04:00
Don Cross
043f8c7e86 Added Travis CI build status badge. 2019-04-16 12:39:57 -04:00
Don Cross
4a4bed0fe6 Band-aid on NOVAS source code to hush compiler warnings.
The original code really is ignoring fread() return values.
That is not good.
But right now I just want it to build without warnings
so I patched the code to make the warnings go away.
2019-04-16 12:37:27 -04:00
Don Cross
2912350197 Simpler attempt at building C code from Travis CI. 2019-04-16 11:45:48 -04:00
Don Cross
1b792e1c4c Another attempt to specify gcc-7 2019-04-15 17:10:48 -04:00
Don Cross
ab4fe5fcbe Fixed mistakes in previous Travis config 2019-04-15 17:01:10 -04:00
Don Cross
562929f827 Another attempt to build my code without silly warnings. 2019-04-15 16:57:12 -04:00
Don Cross
1349ae47d4 Upgrading C/C++ compiler to get rid of silly warnings. 2019-04-15 16:46:15 -04:00
Don Cross
e38a4785c8 Attempt to build C code. 2019-04-15 16:30:33 -04:00
Don Cross
e88914e67e Total guess about how to run a script from Travis CI. 2019-04-15 15:09:25 -04:00
Don Cross
b244eeb92d Enable Travis CI on the 'travis' branch. 2019-04-15 15:06:39 -04:00
Don Cross
a1f802e0a4 Experimenting with Travis CI.
I have no idea what I'm doing yet, but I want to start
using Travis CI to run automated unit tests with each commit
or pull request. First I will try to build the 'generate'
project without doing anything else.
2019-04-15 15:03:06 -04:00
Don Cross
ad3bec5f4b Fixed #14 - Linux and Windows JS now match.
The floating point constants emitted for the Pluto Chebyshev
model did not quite match between Linux and Windows.
I suspect the real problem is not the operating system
but that I'm using different versions of Node on both:
Windows: v10.15.3
Linux: v8.15.1

Now I print only 12 place after the decimal instead of 18.
This makes no difference in the unit test output,
and reduces the JS code size significantly.
2019-04-15 13:32:12 -04:00
Don Cross
a55b8cab0f Updated Windows jplcheck.bat to match Linux jplcheck script.
Now the Windows batch file has the same final check of
the worst-case error found across all test cases.
2019-04-15 13:21:28 -04:00