Commit Graph

168 Commits

Author SHA1 Message Date
Don Cross
c3c8ffeb0f Finished documenting ObserverVector() in topic indexes. 2021-03-31 21:49:35 -04:00
Don Cross
4e868732c5 PY: Implemented ObserverVector function and unit test. 2021-03-31 21:10:24 -04:00
Don Cross
085d285ef0 Refactored all the nutation and precession functions.
Use a private enumerated type to select which direction
the precession and nutation is to be done:
- from date to J2000
- from J2000 to date

Normalize the order of parameters to be consistent
between precession() and nutation(), and across languages.
Pass in AstroTime instead of a pair of floating point TT
values (one of which had to be 0).

Added TypeScript version of ObserverVector(),
but it has not yet been documented or tested.
2021-03-31 12:09:11 -04:00
Don Cross
cef88bcb79 Added missing topic index entries in Python and JavaScript README.md.
I forgot to add topic index entries for the new functions
IdentityMatrix and Pivot to the README.md files for
JavaScript and Python. Fixed it.
2021-03-27 21:12:59 -04:00
Don Cross
5cd0e60d74 Updated obsolete comments about how Delta-T is calculated.
Astronomy Engine used to use USNO historical and predictive tables,
along with linear interpolation, to calculate Delta-T values.
The problem with the USNO tables is, they did not work well outside
a few centuries around present day.

Later I replaced with Espenak & Meeus piecewise polynomials
that work over a much larger time span (thousands of years).
I just discovered there were still comments in the code referring
to the USNO models. I updated the ones I could find to reflect
the current truth about how the code works today.
2021-03-27 19:44:37 -04:00
Don Cross
6f98095cae Reworked ecliptic coordinate types to contain a vector type.
This is technically a breaking change, but only for clients
that use the cartesian coordinates in an ecliptic coordinate
return type.  Before now, the coordinates were just separate
floating-point members ex, ey, ez. Now they are a standard
vector type.

The purpose is to allow seamless interfacing with vector
rotation functions, and to be consistent with the equatorial
coordinate types.
2021-03-27 12:26:27 -04:00
Don Cross
0426272da4 Eliminated obsolete function VectorFromEquator.
Now that equatorial coordinates include both angles
and cartesian coordinates, there is no need for the
VectorFromEquator function. It has been removed
from all four supported languages.

The expression "VectorFromEquator(equ, time)" can be
replaced with "equ.vec" in any calling code.
2021-03-27 08:24:42 -04:00
Don Cross
a97fc7da9c Ported IdentityMatrix, Pivot functions to Python. Added tests and camera demo. 2021-03-27 05:19:27 -04:00
Don Cross
9cc454b1f2 Added comments to explain horizontal coordinate calculations.
I'm about to start working on adding a new output
from the Horizon functions. It was a good time to better
document the ideas behind these calculations, before
adding anything new. These are internal comments only
and do not affect generated documentation.

While I was in there, I noticed extra code that was
checking for impossible return values from atan2().
I eliminated these.
2021-03-20 20:01:38 -04: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
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
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
9c940d7432 Fixed #69 - Support calculating Pluto without any year range limit.
Fixed lingering documentation and code that refers to a limited
year range for calculating Pluto's position.
2020-07-08 19:20:47 -04:00
Don Cross
03609b2825 TOP2013: Ported new Pluto model to Python. 2020-07-08 15:42:52 -04:00
Don Cross
9d04a0018c Python: improved Time repr. Added Vector repr, str support. 2020-06-14 21:31:07 -04:00
Don Cross
b6c0b9cb00 Python: added str and repr support for class Observer. 2020-06-14 21:14:53 -04:00
Don Cross
2f13b463f1 Fixed two documentation formatting mistakes. 2020-06-14 16:49:02 -04:00
Don Cross
100417dbe3 Fixed #52 - Finished documenting transit functions.
This completes work on eclipses and transits.
2020-06-14 15:05:01 -04:00
Don Cross
f9ef46c5cc Implemented Python version of transit search functions. 2020-06-14 14:55:52 -04:00
Don Cross
4f842627da Fixed mistake in GeoVector(SUN): we do need to correct for light-travel time.
To be consistent, when calculating the geocentric position of the Sun,
we do need to correct for light travel time just like we would for any
other object. This reduces the maximum time error for predicting transits
from 25 minutes to 11 minutes.

Also had to disable aberration when calculating moon phases
(longitude from Sun) in order to keep a good fit with test data.
2020-06-13 13:45:59 -04:00
Don Cross
84703016e1 Narrow the search window for local solar eclipses. 2020-06-06 14:32:04 -04:00
Don Cross
443c744aaf Implemented Python LocalSolarEclipse. 2020-06-06 13:42:40 -04:00
Don Cross
0a4e0c48a0 Documentation fixes for eclipse functions.
Added global/local solar eclipse functions to topic indexes for
C#, JavaScript, and Python.

Revised wording "eclipse found may be" --> "eclipse may be".

Python:
- Added missing Attributes section in class GlobalSolarEclipseInfo.
- Added classes EclipseEvent, LocalSolarEclipseInfo.
- Added stub functions SearchLocalSolarEclipse, NextLocalSolarEclipse.
2020-06-06 10:42:57 -04:00
Don Cross
3ed2bc3974 Implemented JS GlobalSolarEclipse. 2020-06-05 15:44:42 -04:00
Don Cross
9187e3e966 Python: Implemented GlobalSolarEclipse. 2020-06-04 19:01:39 -04:00
Don Cross
a8b29b4509 Renamed lunar eclipse info member from 'center' to 'peak'.
This makes the name consistent with the solar eclipse fields.
2020-05-25 21:07:36 -04:00
Don Cross
e3255c7401 Cleaned up and unified Earth and Moon radius constants.
In all 4 supported languages, use consistent constant names for
Earth and Moon radii.

Use Moon's equatorial radius for rise/set timing.

Use Moon's mean radius for calculating Moon's umbra radius for
detecting solar eclipses.

Also use Moon's mean radius for determining whether the Earth's shadow
touches the Moon, for finding lunar eclipses.

Use the Moon's polar radius for distinguishing between total
and annular eclipses, with a 14 meter bias (instead of 1420 meters!)
to match Espenak data.

Use consistent unit test error threshold of 0.57 minutes for rise/set.
Updated demo test data for slight changes to rise/set prediction times.

Updated doxygen options to issue an error on any warnings.
Fixed the incorrect function name link that doxygen was warning me about.
2020-05-23 13:08:25 -04:00
Don Cross
7e345915b2 Simplified the inequalities that detect type of lunar eclipses.
There is no need to use absolute value, and it makes the logic
easier for me to understand if I express each of the inequalities
in terms of addition rather than subtraction.
2020-05-20 17:24:43 -04:00
Don Cross
30c2141ca6 Added documentation about lunar eclipse functions to topic indexes. 2020-05-16 20:41:57 -04:00
Don Cross
fe18eb81e4 Implemented Python version of lunar eclipse predictor. 2020-05-16 17:38:00 -04:00
Don Cross
9ea6a0664f Python: Use Espenak/Meeus formula for calculating Delta T. 2020-05-15 19:28:54 -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
bc69e723f2 Python: converted remaining enumerated types from IntEnum to Enum.
Also added @enum.unique decorator to these types as a
sanity check that their values are all unique.
2020-05-07 21:20:12 -04:00
Don Cross
85cdeee357 Python: converted Body from IntEnum to Enum.
Increase type safety by making the enumerated type Body
derive from Enum rather than IntEnum, as recommended by
https://www.python.org/dev/peps/pep-0435/

Fixed places where I was treating Body values as integers.
2020-05-07 20:53:46 -04:00
Don Cross
107a07223b Python: added repr() support for astronomy.Time class.
Now when a Time object is evaluated and represented in
the Python interpreter, it results in a string of the form:

    astronomy.Time(ut)

where ut is the numeric representation of the ut field.
This mimics the exact way such a Time value could be constructed.
That is, eval(repr(t)) results in a time value equal to t.
2020-05-05 21:40:55 -04:00
Don Cross
6c3655c1c6 Corrected the B1875 epoch for determining constellation boundaries.
It turns out I was off by nearly 18 hours in the B1875 epoch.
This has a tiny effect on the orientation of the Earth's axis.
Instead of:           ut = 1875-01-01T12:00:00.000Z
the correct epoch is: ut = 1874-12-31T18:12.21.950Z

See the comments in the Constellation functions in
each of the source files for more info.
2020-05-04 21:30:36 -04:00
Don Cross
540d9d7cef Added constellation function to Python code. 2020-05-03 21:37:28 -04:00
Don Cross
3bb740fd1c Fixed #62 - Automatically update copyright year range. 2020-04-30 15:12:14 -04:00
Don Cross
f754a6de82 Fixed #58 - Solar System Barycenter, Earth/Moon Barycenter.
Can now calculate the heliocentric Solar System Barycenter (SSB)
and Earth/Moon Barycenter (EMB).

Changes made in C, C#, JavaScript and Python:
Added new body codes SSB, EMB.
Added support for calculating both in HelioVector functions.
Verified that all calculations match NOVAS.
Verified that all calculations match each other across languages.
2020-04-29 21:53:57 -04:00
Don Cross
ec6a82b133 Improved performance of Neptune apsis search.
The apsis search for Neptune was sampling 1000 points
in its first pass. It turns out 100 is enough.
2020-01-07 11:57:54 -05:00
Don Cross
7892b797ba Python: planet apsis search is working. 2020-01-06 20:49:49 -05:00
Don Cross
02dc4e95a4 Pluto apsis predictions are now within 0.0810 degrees of orbit period.
Increased from 7 Chebyshev sections to 8.
This also decreases max arcmin error from 0.336084 to 0.120252.
2020-01-06 11:25:47 -05:00
Don Cross
f67ddf1c8d Planet apsis: all planets but Pluto now have prediction error below 0.1 degrees.
Adjust VSOP models for planets to bring their prediction errors beneath
0.1 degrees of a total orbit.
ctest no longer runs tests when no command line arguments are given.
That was annoying because I kept running it by accident.
2020-01-06 10:59:38 -05:00
Don Cross
819e59745d Decreased Neptune apsis prediction errors from 49.25 days to 15.45 days.
Include an extra 4 terms in the radial component of the VSOP
model for Neptune. The code automatically picks the 4 terms
that maximize the time derivative's highest possible contribution.
2020-01-05 20:44:29 -05:00
Don Cross
703f924210 Python: Added Time.Parse function.
Added function Time.Parse to convert a UTC date/time string
into a Time object. People should not have to keep reinventing
that wheel. I will be able to simplify astro_demo_common.py.
2020-01-03 14:03:01 -05:00
Don Cross
1fde8049c6 Added check_internal_links.py utility to look for broken links in markdown files.
Currently I ignore any errors when checking the C# documentation,
because there are broken links for the rotation functions I
haven't started adding yet.  I will turn that error check back on
once I finish those functions.
2019-12-21 15:41:39 -05:00
Don Cross
330b8447f3 Fixed #57 - Finished preamble for Python documentation.
Python documention: corrected internal links in Markdown prefix.
This concludes support for Python documentation fixes.
2019-12-19 13:46:15 -05:00
Don Cross
07e68707a6 Add prefix markdown to Python documentation. 2019-12-19 13:35:56 -05:00
Don Cross
fce1468a1c Fixed #55 - Python documentation internal links translated to Markdown.
pydown.py now searches description text for internal links
and expands them properly for Markdown file README.md.
For example:  "#Body" ==> "[`Body`](#Body)".
Fixed a couple of incorrect "Astronomy_..." names in Python docs.
2019-12-18 17:07:00 -05:00
Don Cross
7040ff8684 Cleaned up documented return types for Python functions.
Never use pound-signs inside documentation for Python return types.
Automatically create internal link just like for function parameter types.
Added special case logic in pydown.py for "Time or `None`".
Fixed minor documentation mistakes in JS version.
2019-12-18 16:53:13 -05:00