Commit Graph

1670 Commits

Author SHA1 Message Date
Don Cross
8615a2548a Huge performance boost to Python code: re-use e_tilt calculations.
Calculate _e_tilt() no more than once per Time instance.
Cache the value in the Time instance and re-use it.
This reduced astro_check time from 5.0 minutes to 2.0 minutes.
2019-06-27 14:54:49 -04:00
Don Cross
f2478fa29d Improved performance in C and JS code by getting rid of ter2cel() function.
I already did this in the Python code to significantly reduce the number
of calls to e_tilt(). Did the same thing here: call sidereal_time() once,
then use the value 3 times.
2019-06-27 14:35:46 -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
f85025da31 Implemented astro_check in Python. Exercises major parts of the code.
There is still a slight discrepancy in calculations of altitude,azimuth
that is larger than between JS and C.
2019-06-26 21:12:27 -04:00
Don Cross
6d0ee59c1f Python: starting to implement astro_check. 2019-06-26 19:12:59 -04:00
Don Cross
221ea1130a Implemented Python Search function. Slight tweaks to C and JS versions. 2019-06-26 17:36:29 -04:00
Don Cross
f3efb29846 Python: Implemented quadratic interpolation, to be used by Search. 2019-06-26 17:06:14 -04:00
Don Cross
5802739e66 Python: implemented function GeoVector. 2019-06-26 07:28:51 -04:00
Don Cross
d2346051e3 Python: Implemented HelioVector function. 2019-06-26 06:05:24 -04:00
Don Cross
03c1bf3c8b Python: Implemented VSOP and Chebyshev calculations. 2019-06-26 05:51:55 -04:00
Don Cross
07ba91ed65 Use same code generator for JavaScript and Python: Chebyshev Pluto model. 2019-06-26 05:25:09 -04:00
Don Cross
027a6af007 Adapted JS vsop code generator to work with Python code too.
Now the Python code and the JavaScript code for VSOP models
are generated by codegen.c using the same $ASTRO_LIST_VSOP macro.
Python functions for calculating from VSOP are not yet implemented.
2019-06-25 21:28:20 -04:00
Don Cross
49e505e654 Verified GeoMoon C and Python versions are consistent for a single test case.
This is a good indicator that the Python translation of CalcMoon is correct.
2019-06-24 15:47:17 -04:00
Don Cross
787812287c Python: calling GeoMoon() without errors, but calculations not yet validated. 2019-06-24 15:25:28 -04:00
Don Cross
44b9d26d1d Python: CalcMoon work in progress. First pass is finished. Not yet tested. 2019-06-24 14:48:08 -04:00
Don Cross
79df146194 More Python CalcMoon work in progress.
Also made minor optimizations to spin() function in both JS and C.
Fixed a mistake in JS and C that does not appear to have any
algorithmic consequences, but it was definitely confusing once I saw it.
2019-06-24 14:08:38 -04:00
Don Cross
e47602f46b Python: translation in progress. 2019-06-23 21:28:45 -04:00
Don Cross
b5ebc4a645 Added python unit test. 2019-06-23 19:52:16 -04:00
Don Cross
7f0a369027 Python: reworked names and made Time more object-oriented. 2019-06-23 19:46:28 -04:00
Don Cross
a76b069ccc Python: added astro_time_t.Utc(). Added more testing. 2019-06-23 17:50:13 -04:00
Don Cross
8a344d251d Python: more work on date/time and formatting of same. 2019-06-23 17:36:33 -04:00
Don Cross
35017483cb Fixed problem in Python MakeTime() function.y 2019-06-23 17:10:58 -04:00
Don Cross
2a97849af2 Python: Implemented AddDays function. 2019-06-22 21:35:48 -04:00
Don Cross
f29d44aa43 Python: Implemented MakeTime function. 2019-06-22 21:33:48 -04:00
Don Cross
66b0efda5a Python: CurrentTime() working. 2019-06-22 21:24:56 -04:00
Don Cross
e37d7e90f0 Trim trailing whitespace from python code. 2019-06-22 21:15:54 -04:00
Don Cross
00dad8be32 Starting to add Python support in source translator. 2019-06-22 21:12:14 -04:00
Don Cross
5e755fe894 Fixed warnings found by lgtm. 2019-06-16 13:47:10 -04:00
Don Cross
e9a6c036ab Added comments to a couple of static functions. 2019-06-15 20:38:49 -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
92241cb1e7 Documented C functions Astronomy_SearchLunarApsis and Astronomy_NextLunarApsis. 2019-06-09 11:58:47 -04:00
Don Cross
dd2f6fb7b1 Added documentation for C function Astronomy_SearchPeakMagnitude. 2019-06-08 21:48:53 -04:00
Don Cross
a9f29f1c52 Added documentation for C function Astronomy_SearchRiseSet.
Added more parameter checking for C and JS versions of that function.
2019-06-08 21:11:39 -04:00
Don Cross
435c1e1533 Added documentation for C function Astronomy_SearchHourAngle.
Also added extra parameter checking in C and JS versions of this function.
2019-06-08 19:57:31 -04:00
Don Cross
f02c523f1b Added documentation for Astronomy_SearchRelativeLongitude.
Also consistently use startTime as the parameter name for the
astro_time_t at which a search is to be started.
2019-06-08 17:35:29 -04:00
Don Cross
1fd7305b92 Documented C functions SearchMoonPhase, SearchMoonQuarter, NextMoonQuarter.
Added parameter checking in NextMoonQuarter.
Fixed typo.
2019-06-06 21:41:02 -04:00
Don Cross
642b1c1748 Documented C function Astronomy_SearchSunLongitude. 2019-06-06 21:04:56 -04:00
Don Cross
e42d46381c Got Google Closure Compiler working to minify astronomy.js on Windows.
On Windows, I ended up having to use the Java version instead of the npm package.
Otherwise I got weird errors and could not get output that matched the Linux version.
2019-06-05 22:42:00 -04:00
Don Cross
b96c561a14 Switching JS unit tests to use minified astronomy.min.js.
This confirms the minification is working right.
In order to debug issues, we might need to temporarily switch
back to unminified code, but this makes me feel better
that the Google Closure Compiler is not messing up the code.
2019-06-05 21:34:27 -04:00
Don Cross
fcb04cd40f Fixed #15 - Using Google Closure Compiler to minify astronomy.js. 2019-06-05 20:52:05 -04:00
Don Cross
e0a119426a Correct for aberration when calculating angles seen from Earth.
Resolved FIXFIXFIX comments regarding whether or not to
correct for aberration. In all cases, the observations are
made from the Earth, in which case it makes the most sense
to correct for aberration.
2019-06-05 19:56:41 -04:00
Don Cross
3f60d2fac1 Added documentation for Astronomy_LongitudeFromSun and Astronomy_MoonPhase. 2019-06-05 19:23:25 -04:00
Don Cross
5a1cb85318 Fixed #44 - Renamed relative_longitude to ecliptic_separation.
I was using "relative longitude" to mean two different things.
Resolved the ambiguity by using relative longitude only for
differences in eclitpic longitude as seen from the Sun.

Use "ecliptic separation" for differences in ecliptic longitude
as measured from the Earth.

Fixed completely wrong documentation in the JavaScript code;
it had the meanings backwards inside the ElongationEvent class.
2019-06-05 17:32:23 -04:00
Don Cross
bb6edf67ed Added documentation for Astronomy_SearchMaxElongation.
Also renamed startDate parameters to startTime.
2019-06-05 12:44:36 -04:00
Don Cross
23dfc35177 This should be last attempt to keep Pluto model identical between Linux and Windows. 2019-06-04 20:04:09 -04:00
Don Cross
436d598b76 One more attempt to avoid diff noise in Chebyshev models between Linux and Windows. 2019-06-04 18:29:29 -04:00
Don Cross
be9ff7e09f Using lower precision calculations to avoid diff noise for Chebyshev Pluto model. 2019-06-04 18:13:43 -04:00