diff -Nru pymeeus-0.4.3+dfsg1/debian/changelog pymeeus-0.5.11+dfsg1/debian/changelog --- pymeeus-0.4.3+dfsg1/debian/changelog 2021-12-11 06:53:45.000000000 +0000 +++ pymeeus-0.5.11+dfsg1/debian/changelog 2021-12-12 07:59:22.000000000 +0000 @@ -1,9 +1,30 @@ -pymeeus (0.4.3+dfsg1-2ubuntu1) jammy; urgency=medium +pymeeus (0.5.11+dfsg1-1) unstable; urgency=medium - * Add a test dep on python3-all, corresponding to use of py3versions -s. - Closes: #1001370. + * Team upload. + [ Debian Janitor ] + * Bump debhelper from old 12 to 13. - -- Steve Langasek Sat, 11 Dec 2021 06:53:45 +0000 + [ Håvard Flaget Aasen ] + * New upstream version 0.5.11+dfsg1 + * autopkgtest: Add python3-all as dependency. Closes: #1001370 + * autopkgtest: Mark d/tests/python3-unittest as executable. + * d/watch: Bump to version 4. + * Capitalize word in long description. + * Add python3-pytest and python3-pytest-cov as dependencies during build and + when running autopkgtest. + * Remove fields Recommends and Suggests from binary package, not used. + * Document Rules-Requires-Root. + * Update Standards-Version to 4.6.0. + * d/copyright: + - Update years. + - Point to correct license file. + * Enable salsa CI. + + [ Jeroen Ploemen ] + * Copyright: add missing entry for pymeeus/JupiterMoons.py, + tests/test_jupiterMoons.py. + + -- Håvard Flaget Aasen Sun, 12 Dec 2021 07:59:22 +0000 pymeeus (0.4.3+dfsg1-2) unstable; urgency=medium diff -Nru pymeeus-0.4.3+dfsg1/debian/control pymeeus-0.5.11+dfsg1/debian/control --- pymeeus-0.4.3+dfsg1/debian/control 2021-12-11 06:53:43.000000000 +0000 +++ pymeeus-0.5.11+dfsg1/debian/control 2021-12-12 07:26:51.000000000 +0000 @@ -1,14 +1,16 @@ Source: pymeeus Section: python Priority: optional -Maintainer: Ubuntu Developers -XSBC-Original-Maintainer: Debian Python Team +Maintainer: Debian Python Team Uploaders: Antoine Beaupré -Build-Depends: debhelper-compat (= 12), +Build-Depends: debhelper-compat (= 13), dh-python, python3-all, python3-setuptools, -Standards-Version: 4.5.0 + python3-pytest, + python3-pytest-cov, +Standards-Version: 4.6.0 +Rules-Requires-Root: no Homepage: https://github.com/architest/pymeeus Vcs-Browser: https://salsa.debian.org/python-team/packages/pymeeus Vcs-Git: https://salsa.debian.org/python-team/packages/pymeeus.git @@ -16,8 +18,6 @@ Package: python3-pymeeus Architecture: all Depends: ${misc:Depends}, ${python3:Depends}, -Recommends: ${python3:Recommends} -Suggests: ${python3:Suggests} Description: Python implementation of Jean Meeus astronomical routines PyMeeus is a Python implementation of the astronomical algorithms described in the classical book "Astronomical Algorithms, 2nd Edition, @@ -25,7 +25,7 @@ . There are great astronomical libraries out there. For instance, if you're looking for high precision and speed you should take a look at - libnova. For a set of python modules aimed at professional + libnova. For a set of Python modules aimed at professional astronomers, you should look at Astropy. On the other hand, the advantages of PyMeeus are its simplicity, ease of use, ease of reading, ease of installation (it has the minimum amount of diff -Nru pymeeus-0.4.3+dfsg1/debian/copyright pymeeus-0.5.11+dfsg1/debian/copyright --- pymeeus-0.4.3+dfsg1/debian/copyright 2021-03-15 15:31:33.000000000 +0000 +++ pymeeus-0.5.11+dfsg1/debian/copyright 2021-12-12 07:45:09.000000000 +0000 @@ -6,7 +6,13 @@ docs/build/html Files: * -Copyright: 2018, Dagoberto Salazar +Copyright: 2018-2021 Dagoberto Salazar +License: LGPL-3+ + +Files: + pymeeus/JupiterMoons.py + tests/test_jupiterMoons.py +Copyright: 2020 Michael Lutz, Sophie Scholz, Vittorio Serra, Sebastian Veigl License: LGPL-3+ Files: debian/* @@ -27,5 +33,5 @@ You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . . - On Debian systems, the complete text of the GNU General Public - License version 3 can be found in "/usr/share/common-licenses/GPL-3". + On Debian systems, the complete text of the GNU Lesser General Public + License version 3 can be found in "/usr/share/common-licenses/LGPL-3". diff -Nru pymeeus-0.4.3+dfsg1/debian/salsa-ci.yml pymeeus-0.5.11+dfsg1/debian/salsa-ci.yml --- pymeeus-0.4.3+dfsg1/debian/salsa-ci.yml 1970-01-01 00:00:00.000000000 +0000 +++ pymeeus-0.5.11+dfsg1/debian/salsa-ci.yml 2021-12-12 07:26:51.000000000 +0000 @@ -0,0 +1,7 @@ +include: + - https://salsa.debian.org/salsa-ci-team/pipeline/raw/master/salsa-ci.yml + - https://salsa.debian.org/salsa-ci-team/pipeline/raw/master/pipeline-jobs.yml + +variables: + # no compiled code + SALSA_CI_DISABLE_BLHC: 'true' diff -Nru pymeeus-0.4.3+dfsg1/debian/tests/control pymeeus-0.5.11+dfsg1/debian/tests/control --- pymeeus-0.4.3+dfsg1/debian/tests/control 2021-12-11 06:53:13.000000000 +0000 +++ pymeeus-0.5.11+dfsg1/debian/tests/control 2021-12-12 07:26:51.000000000 +0000 @@ -1,3 +1,6 @@ Tests: python3-unittest Restrictions: allow-stderr -Depends: @, python3-all +Depends: python3-all, + python3-pymeeus, + python3-pytest, + python3-pytest-cov, diff -Nru pymeeus-0.4.3+dfsg1/debian/tests/python3-unittest pymeeus-0.5.11+dfsg1/debian/tests/python3-unittest --- pymeeus-0.4.3+dfsg1/debian/tests/python3-unittest 2021-03-15 15:31:33.000000000 +0000 +++ pymeeus-0.5.11+dfsg1/debian/tests/python3-unittest 2021-12-12 07:26:51.000000000 +0000 @@ -8,6 +8,6 @@ echo "Testing with $py" echo "----------------------------------------------" # text mode file opening is locale dependent so try both ASCII and UTF-8 - LC_ALL=C $py -m unittest discover --verbose - LC_ALL=C.UTF-8 $py -m unittest discover --verbose + LC_ALL=C $py -m pytest + LC_ALL=C.UTF-8 $py -m pytest done diff -Nru pymeeus-0.4.3+dfsg1/debian/watch pymeeus-0.5.11+dfsg1/debian/watch --- pymeeus-0.4.3+dfsg1/debian/watch 2021-03-15 15:31:33.000000000 +0000 +++ pymeeus-0.5.11+dfsg1/debian/watch 2021-12-12 07:26:51.000000000 +0000 @@ -1,4 +1,4 @@ # try also https://pypi.debian.net/PyMeeus/watch -version=3 +version=4 opts="uversionmangle=s/(rc|a|b|c)/~$1/,dversionmangle=s/\+dfsg\d*$//,repacksuffix=+dfsg1" \ https://pypi.debian.net/PyMeeus/PyMeeus-(.+)\.(?:zip|tgz|tbz|txz|(?:tar\.(?:gz|bz2|xz))) diff -Nru pymeeus-0.4.3+dfsg1/docs/source/Angle.rst pymeeus-0.5.11+dfsg1/docs/source/Angle.rst --- pymeeus-0.4.3+dfsg1/docs/source/Angle.rst 2021-03-03 01:28:56.000000000 +0000 +++ pymeeus-0.5.11+dfsg1/docs/source/Angle.rst 1970-01-01 00:00:00.000000000 +0000 @@ -1,12 +0,0 @@ -Angle -***** - -.. automodule:: pymeeus - - -Class to handle angles. - -.. automodule:: pymeeus.Angle - :members: - :special-members: - diff -Nru pymeeus-0.4.3+dfsg1/docs/source/base.rst pymeeus-0.5.11+dfsg1/docs/source/base.rst --- pymeeus-0.4.3+dfsg1/docs/source/base.rst 2021-03-03 01:28:56.000000000 +0000 +++ pymeeus-0.5.11+dfsg1/docs/source/base.rst 1970-01-01 00:00:00.000000000 +0000 @@ -1,12 +0,0 @@ -Base -**** - -.. automodule:: pymeeus - - -Basic, general functions and constants. - -.. automodule:: pymeeus.base - :members: - :special-members: - diff -Nru pymeeus-0.4.3+dfsg1/docs/source/bodies/Earth.rst pymeeus-0.5.11+dfsg1/docs/source/bodies/Earth.rst --- pymeeus-0.4.3+dfsg1/docs/source/bodies/Earth.rst 1970-01-01 00:00:00.000000000 +0000 +++ pymeeus-0.5.11+dfsg1/docs/source/bodies/Earth.rst 2018-12-06 10:09:58.000000000 +0000 @@ -0,0 +1,12 @@ +Earth +***** + +.. automodule:: pymeeus + + +Class to model Earth's globe. + +.. automodule:: pymeeus.Earth + :members: + :special-members: + diff -Nru pymeeus-0.4.3+dfsg1/docs/source/bodies/index.rst pymeeus-0.5.11+dfsg1/docs/source/bodies/index.rst --- pymeeus-0.4.3+dfsg1/docs/source/bodies/index.rst 1970-01-01 00:00:00.000000000 +0000 +++ pymeeus-0.5.11+dfsg1/docs/source/bodies/index.rst 2021-03-04 19:23:00.000000000 +0000 @@ -0,0 +1,21 @@ +.. PyMeeus documentation master file. + +Bodies +======= + +.. toctree:: + :maxdepth: 2 + + Earth + JupiterMoons + Jupiter + Mars + Mercury + Minor + Moon + Neptune + Pluto + Saturn + Sun + Uranus + Venus diff -Nru pymeeus-0.4.3+dfsg1/docs/source/bodies/JupiterMoons.rst pymeeus-0.5.11+dfsg1/docs/source/bodies/JupiterMoons.rst --- pymeeus-0.4.3+dfsg1/docs/source/bodies/JupiterMoons.rst 1970-01-01 00:00:00.000000000 +0000 +++ pymeeus-0.5.11+dfsg1/docs/source/bodies/JupiterMoons.rst 2021-02-23 18:13:34.000000000 +0000 @@ -0,0 +1,9 @@ +JupiterMoons +************** + +Class to model JupiterMoons. + +.. automodule:: pymeeus.JupiterMoons + :members: + :special-members: + diff -Nru pymeeus-0.4.3+dfsg1/docs/source/bodies/Jupiter.rst pymeeus-0.5.11+dfsg1/docs/source/bodies/Jupiter.rst --- pymeeus-0.4.3+dfsg1/docs/source/bodies/Jupiter.rst 1970-01-01 00:00:00.000000000 +0000 +++ pymeeus-0.5.11+dfsg1/docs/source/bodies/Jupiter.rst 2018-12-06 10:09:58.000000000 +0000 @@ -0,0 +1,12 @@ +Jupiter +******* + +.. automodule:: pymeeus + + +Class to model Jupiter planet. + +.. automodule:: pymeeus.Jupiter + :members: + :special-members: + diff -Nru pymeeus-0.4.3+dfsg1/docs/source/bodies/Mars.rst pymeeus-0.5.11+dfsg1/docs/source/bodies/Mars.rst --- pymeeus-0.4.3+dfsg1/docs/source/bodies/Mars.rst 1970-01-01 00:00:00.000000000 +0000 +++ pymeeus-0.5.11+dfsg1/docs/source/bodies/Mars.rst 2018-12-06 10:09:58.000000000 +0000 @@ -0,0 +1,12 @@ +Mars +**** + +.. automodule:: pymeeus + + +Class to model Mars planet. + +.. automodule:: pymeeus.Mars + :members: + :special-members: + diff -Nru pymeeus-0.4.3+dfsg1/docs/source/bodies/Mercury.rst pymeeus-0.5.11+dfsg1/docs/source/bodies/Mercury.rst --- pymeeus-0.4.3+dfsg1/docs/source/bodies/Mercury.rst 1970-01-01 00:00:00.000000000 +0000 +++ pymeeus-0.5.11+dfsg1/docs/source/bodies/Mercury.rst 2018-12-06 10:09:58.000000000 +0000 @@ -0,0 +1,12 @@ +Mercury +******* + +.. automodule:: pymeeus + + +Class to model Mercury planet. + +.. automodule:: pymeeus.Mercury + :members: + :special-members: + diff -Nru pymeeus-0.4.3+dfsg1/docs/source/bodies/Minor.rst pymeeus-0.5.11+dfsg1/docs/source/bodies/Minor.rst --- pymeeus-0.4.3+dfsg1/docs/source/bodies/Minor.rst 1970-01-01 00:00:00.000000000 +0000 +++ pymeeus-0.5.11+dfsg1/docs/source/bodies/Minor.rst 2018-12-06 10:09:58.000000000 +0000 @@ -0,0 +1,12 @@ +Minor +***** + +.. automodule:: pymeeus + + +Class to model minor celestial objetcs. + +.. automodule:: pymeeus.Minor + :members: + :special-members: + diff -Nru pymeeus-0.4.3+dfsg1/docs/source/bodies/Moon.rst pymeeus-0.5.11+dfsg1/docs/source/bodies/Moon.rst --- pymeeus-0.4.3+dfsg1/docs/source/bodies/Moon.rst 1970-01-01 00:00:00.000000000 +0000 +++ pymeeus-0.5.11+dfsg1/docs/source/bodies/Moon.rst 2021-02-28 20:43:30.000000000 +0000 @@ -0,0 +1,12 @@ +Moon +**** + +.. automodule:: pymeeus + + +Module holding functions to handle coordinates. + +.. automodule:: pymeeus.Moon + :members: + :special-members: + diff -Nru pymeeus-0.4.3+dfsg1/docs/source/bodies/Neptune.rst pymeeus-0.5.11+dfsg1/docs/source/bodies/Neptune.rst --- pymeeus-0.4.3+dfsg1/docs/source/bodies/Neptune.rst 1970-01-01 00:00:00.000000000 +0000 +++ pymeeus-0.5.11+dfsg1/docs/source/bodies/Neptune.rst 2018-12-06 10:09:58.000000000 +0000 @@ -0,0 +1,12 @@ +Neptune +******* + +.. automodule:: pymeeus + + +Class to model Neptune planet. + +.. automodule:: pymeeus.Neptune + :members: + :special-members: + diff -Nru pymeeus-0.4.3+dfsg1/docs/source/bodies/Pluto.rst pymeeus-0.5.11+dfsg1/docs/source/bodies/Pluto.rst --- pymeeus-0.4.3+dfsg1/docs/source/bodies/Pluto.rst 1970-01-01 00:00:00.000000000 +0000 +++ pymeeus-0.5.11+dfsg1/docs/source/bodies/Pluto.rst 2018-12-14 14:27:24.000000000 +0000 @@ -0,0 +1,12 @@ +Pluto +***** + +.. automodule:: pymeeus + + +Class to model Pluto planet. + +.. automodule:: pymeeus.Pluto + :members: + :special-members: + diff -Nru pymeeus-0.4.3+dfsg1/docs/source/bodies/Saturn.rst pymeeus-0.5.11+dfsg1/docs/source/bodies/Saturn.rst --- pymeeus-0.4.3+dfsg1/docs/source/bodies/Saturn.rst 1970-01-01 00:00:00.000000000 +0000 +++ pymeeus-0.5.11+dfsg1/docs/source/bodies/Saturn.rst 2018-12-06 10:09:58.000000000 +0000 @@ -0,0 +1,12 @@ +Saturn +****** + +.. automodule:: pymeeus + + +Class to model Saturn planet. + +.. automodule:: pymeeus.Saturn + :members: + :special-members: + diff -Nru pymeeus-0.4.3+dfsg1/docs/source/bodies/Sun.rst pymeeus-0.5.11+dfsg1/docs/source/bodies/Sun.rst --- pymeeus-0.4.3+dfsg1/docs/source/bodies/Sun.rst 1970-01-01 00:00:00.000000000 +0000 +++ pymeeus-0.5.11+dfsg1/docs/source/bodies/Sun.rst 2018-12-06 10:09:58.000000000 +0000 @@ -0,0 +1,12 @@ +Sun +*** + +.. automodule:: pymeeus + + +Module holding functions to handle coordinates. + +.. automodule:: pymeeus.Sun + :members: + :special-members: + diff -Nru pymeeus-0.4.3+dfsg1/docs/source/bodies/Uranus.rst pymeeus-0.5.11+dfsg1/docs/source/bodies/Uranus.rst --- pymeeus-0.4.3+dfsg1/docs/source/bodies/Uranus.rst 1970-01-01 00:00:00.000000000 +0000 +++ pymeeus-0.5.11+dfsg1/docs/source/bodies/Uranus.rst 2018-12-06 10:09:58.000000000 +0000 @@ -0,0 +1,12 @@ +Uranus +****** + +.. automodule:: pymeeus + + +Class to model Uranus planet. + +.. automodule:: pymeeus.Uranus + :members: + :special-members: + diff -Nru pymeeus-0.4.3+dfsg1/docs/source/bodies/Venus.rst pymeeus-0.5.11+dfsg1/docs/source/bodies/Venus.rst --- pymeeus-0.4.3+dfsg1/docs/source/bodies/Venus.rst 1970-01-01 00:00:00.000000000 +0000 +++ pymeeus-0.5.11+dfsg1/docs/source/bodies/Venus.rst 2018-12-06 10:09:58.000000000 +0000 @@ -0,0 +1,12 @@ +Venus +***** + +.. automodule:: pymeeus + + +Class to model Venus planet. + +.. automodule:: pymeeus.Venus + :members: + :special-members: + diff -Nru pymeeus-0.4.3+dfsg1/docs/source/conf.py pymeeus-0.5.11+dfsg1/docs/source/conf.py --- pymeeus-0.4.3+dfsg1/docs/source/conf.py 2021-03-03 01:28:56.000000000 +0000 +++ pymeeus-0.5.11+dfsg1/docs/source/conf.py 2021-03-18 20:52:27.000000000 +0000 @@ -59,9 +59,9 @@ # built documents. # # The short X.Y version. -version = u'0.3.6' +version = u'0.5.11' # The full version, including alpha/beta/rc tags. -release = u'0.3.6' +release = u'0.5.11' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. @@ -79,7 +79,7 @@ pygments_style = 'sphinx' # If true, `todo` and `todoList` produce output, else they produce nothing. -todo_include_todos = False +todo_include_todos = True # -- Options for HTML output ---------------------------------------------- @@ -94,7 +94,9 @@ # further. For a list of options available for each theme, see the # documentation. # -# html_theme_options = {} +html_theme_options = { + "collapse_navigation": False +} # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, diff -Nru pymeeus-0.4.3+dfsg1/docs/source/Coordinates.rst pymeeus-0.5.11+dfsg1/docs/source/Coordinates.rst --- pymeeus-0.4.3+dfsg1/docs/source/Coordinates.rst 2021-03-03 01:28:56.000000000 +0000 +++ pymeeus-0.5.11+dfsg1/docs/source/Coordinates.rst 1970-01-01 00:00:00.000000000 +0000 @@ -1,12 +0,0 @@ -Coordinates -*********** - -.. automodule:: pymeeus - - -Module holding functions to handle coordinates. - -.. automodule:: pymeeus.Coordinates - :members: - :special-members: - diff -Nru pymeeus-0.4.3+dfsg1/docs/source/core/Angle.rst pymeeus-0.5.11+dfsg1/docs/source/core/Angle.rst --- pymeeus-0.4.3+dfsg1/docs/source/core/Angle.rst 1970-01-01 00:00:00.000000000 +0000 +++ pymeeus-0.5.11+dfsg1/docs/source/core/Angle.rst 2018-12-06 10:09:58.000000000 +0000 @@ -0,0 +1,12 @@ +Angle +***** + +.. automodule:: pymeeus + + +Class to handle angles. + +.. automodule:: pymeeus.Angle + :members: + :special-members: + diff -Nru pymeeus-0.4.3+dfsg1/docs/source/core/base.rst pymeeus-0.5.11+dfsg1/docs/source/core/base.rst --- pymeeus-0.4.3+dfsg1/docs/source/core/base.rst 1970-01-01 00:00:00.000000000 +0000 +++ pymeeus-0.5.11+dfsg1/docs/source/core/base.rst 2018-12-06 10:09:58.000000000 +0000 @@ -0,0 +1,12 @@ +Base +**** + +.. automodule:: pymeeus + + +Basic, general functions and constants. + +.. automodule:: pymeeus.base + :members: + :special-members: + diff -Nru pymeeus-0.4.3+dfsg1/docs/source/core/Coordinates.rst pymeeus-0.5.11+dfsg1/docs/source/core/Coordinates.rst --- pymeeus-0.4.3+dfsg1/docs/source/core/Coordinates.rst 1970-01-01 00:00:00.000000000 +0000 +++ pymeeus-0.5.11+dfsg1/docs/source/core/Coordinates.rst 2018-12-06 10:09:58.000000000 +0000 @@ -0,0 +1,12 @@ +Coordinates +*********** + +.. automodule:: pymeeus + + +Module holding functions to handle coordinates. + +.. automodule:: pymeeus.Coordinates + :members: + :special-members: + diff -Nru pymeeus-0.4.3+dfsg1/docs/source/core/CurveFitting.rst pymeeus-0.5.11+dfsg1/docs/source/core/CurveFitting.rst --- pymeeus-0.4.3+dfsg1/docs/source/core/CurveFitting.rst 1970-01-01 00:00:00.000000000 +0000 +++ pymeeus-0.5.11+dfsg1/docs/source/core/CurveFitting.rst 2018-12-06 10:09:58.000000000 +0000 @@ -0,0 +1,12 @@ +Curveffiting +************ + +.. automodule:: pymeeus + + +Class to get the best fit of a curve to a set of (x, y) points. + +.. automodule:: pymeeus.CurveFitting + :members: + :special-members: + diff -Nru pymeeus-0.4.3+dfsg1/docs/source/core/Epoch.rst pymeeus-0.5.11+dfsg1/docs/source/core/Epoch.rst --- pymeeus-0.4.3+dfsg1/docs/source/core/Epoch.rst 1970-01-01 00:00:00.000000000 +0000 +++ pymeeus-0.5.11+dfsg1/docs/source/core/Epoch.rst 2018-12-06 10:09:58.000000000 +0000 @@ -0,0 +1,12 @@ +Epoch +***** + +.. automodule:: pymeeus + + +Class to handle time. + +.. automodule:: pymeeus.Epoch + :members: + :special-members: + diff -Nru pymeeus-0.4.3+dfsg1/docs/source/core/index.rst pymeeus-0.5.11+dfsg1/docs/source/core/index.rst --- pymeeus-0.4.3+dfsg1/docs/source/core/index.rst 1970-01-01 00:00:00.000000000 +0000 +++ pymeeus-0.5.11+dfsg1/docs/source/core/index.rst 2021-03-04 19:16:54.000000000 +0000 @@ -0,0 +1,14 @@ +.. PyMeeus documentation master file. + +Core +======= + +.. toctree:: + :maxdepth: 2 + + base + Angle + Coordinates + CurveFitting + Epoch + Interpolation diff -Nru pymeeus-0.4.3+dfsg1/docs/source/core/Interpolation.rst pymeeus-0.5.11+dfsg1/docs/source/core/Interpolation.rst --- pymeeus-0.4.3+dfsg1/docs/source/core/Interpolation.rst 1970-01-01 00:00:00.000000000 +0000 +++ pymeeus-0.5.11+dfsg1/docs/source/core/Interpolation.rst 2018-12-06 10:09:58.000000000 +0000 @@ -0,0 +1,12 @@ +Interpolation +************* + +.. automodule:: pymeeus + + +Class to find intermediate values from those given in a table. + +.. automodule:: pymeeus.Interpolation + :members: + :special-members: + diff -Nru pymeeus-0.4.3+dfsg1/docs/source/CurveFitting.rst pymeeus-0.5.11+dfsg1/docs/source/CurveFitting.rst --- pymeeus-0.4.3+dfsg1/docs/source/CurveFitting.rst 2021-03-03 01:28:56.000000000 +0000 +++ pymeeus-0.5.11+dfsg1/docs/source/CurveFitting.rst 1970-01-01 00:00:00.000000000 +0000 @@ -1,12 +0,0 @@ -Curveffiting -************ - -.. automodule:: pymeeus - - -Class to get the best fit of a curve to a set of (x, y) points. - -.. automodule:: pymeeus.CurveFitting - :members: - :special-members: - diff -Nru pymeeus-0.4.3+dfsg1/docs/source/Earth.rst pymeeus-0.5.11+dfsg1/docs/source/Earth.rst --- pymeeus-0.4.3+dfsg1/docs/source/Earth.rst 2021-03-03 01:28:56.000000000 +0000 +++ pymeeus-0.5.11+dfsg1/docs/source/Earth.rst 1970-01-01 00:00:00.000000000 +0000 @@ -1,12 +0,0 @@ -Earth -***** - -.. automodule:: pymeeus - - -Class to model Earth's globe. - -.. automodule:: pymeeus.Earth - :members: - :special-members: - diff -Nru pymeeus-0.4.3+dfsg1/docs/source/Epoch.rst pymeeus-0.5.11+dfsg1/docs/source/Epoch.rst --- pymeeus-0.4.3+dfsg1/docs/source/Epoch.rst 2021-03-03 01:28:56.000000000 +0000 +++ pymeeus-0.5.11+dfsg1/docs/source/Epoch.rst 1970-01-01 00:00:00.000000000 +0000 @@ -1,12 +0,0 @@ -Epoch -***** - -.. automodule:: pymeeus - - -Class to handle time. - -.. automodule:: pymeeus.Epoch - :members: - :special-members: - diff -Nru pymeeus-0.4.3+dfsg1/docs/source/examples/ex-Angle.rst pymeeus-0.5.11+dfsg1/docs/source/examples/ex-Angle.rst --- pymeeus-0.4.3+dfsg1/docs/source/examples/ex-Angle.rst 1970-01-01 00:00:00.000000000 +0000 +++ pymeeus-0.5.11+dfsg1/docs/source/examples/ex-Angle.rst 2018-12-06 10:09:58.000000000 +0000 @@ -0,0 +1,517 @@ +Angle examples +************** + +Let's define a small helper function:: + + def print_me(msg, val): + + print("{}: {}".format(msg, val)) + +Create an Angle object, providing degrees, minutes and seconds:: + + a = Angle(-23.0, 26.0, 48.999983999) + +First we print using the ``__call__()`` method (note the extra parentheses):: + + print_me("The angle 'a()' is", a()) + + # The angle 'a()' is: -23.44694444 + +Second we print using the ``__str__()`` method (no extra parentheses needed):: + + print_me("The angle 'a' is", a) + + # The angle 'a' is: -23.44694444 + +Use the copy constructor:: + + b = Angle(a) + + print_me("Angle 'b', which is a copy of 'a', is", b) + + # Angle 'b', which is a copy of 'a', is: -23.44694444 + +Use the static ``deg2dms()`` method to carry out conversions:: + + d, m, s, sign = Angle.deg2dms(23.44694444) + + val = "{}d {}' {}''".format(int(sign*d), m, s) + + print_me("{Deg}d {Min}' {Sec}''", val) + + # {Deg}d {Min}' {Sec}'': 23d 26' 48.999984'' + +We can print Angle ``a`` directly in sexagesimal format. + +- In *fancy* format:: + + print_me("{Deg}d {Min}' {Sec}''", a.dms_str()) + + # {Deg}d {Min}' {Sec}'': -23d 26' 48.999983999'' + +- In plain format:: + + print_me("{Deg}:{Min}:{Sec}", a.dms_str(False)) + + # {Deg}:{Min}:{Sec}: -23:26:48.999983999 + +Print directly as a tuple:: + + a = Angle(23.44694444) + + print_me("a.dms_tuple()", a.dms_tuple()) + + # a.dms_tuple(): (23, 26, 48.999983999997596, 1.0) + + print_me("a.ra_tuple()", a.ra_tuple()) + + # a.ra_tuple(): (1, 33, 47.26666559999941, 1.0) + +Redefine Angle ``a`` several times:: + + a.set(-0.44694444) + + print_me(" a.dms_str()", a.dms_str()) + + # a.dms_str(): -26' 48.999984'' + + a.set(0, 0, -46.31) + + print_me(" a.dms_str(False)", a.dms_str(False)) + + # a.dms_str(False): 0:0:-46.31 + +We can use decimals in degrees/minutes. They are converted automatically:: + + a.set(0, -46.25, 0.0) + + print_me(" a.dms_str()", a.dms_str()) + + # a.dms_str(): -46' 15.0'' + + a.set(0, 0, 0.0) + + print_me(" a.dms_str()", a.dms_str()) + + # a.dms_str(): 0d 0' 0.0'' + +We can define the angle as in radians. It will be converted to degrees:: + + b = Angle(pi, radians=True) + + print_me("b = Angle(pi, radians=True); print(b)", b) + + # b = Angle(pi, radians=True); print(b): 180.0 + +And we can easily carry out the *degrees to radians* conversion:: + + print_me("print(b.rad())", b.rad()) + + # print(b.rad()): 3.14159265359 + +We can also specify the angle as a Right Ascension. Angle can be given as a Right Ascension: Hours, Minutes, Seconds:: + + a.set_ra(9, 14, 55.8) + + print_me(" print(a)", a) + + # print(a): 138.7325 + + b = Angle(9, 14, 55.8, ra=True) + + print_me(" print(b)", b) + + # print(b): 138.7325 + + +We can print the Angle as Right Ascension, as a float and as string:: + + a = Angle(138.75) + + print_me(" print(a.get_ra())", a.get_ra()) + + # print(a.get_ra()): 9.25 + + print_me(" print(a.ra_str())", a.ra_str()) + + # print(a.ra_str()): 9h 15' 0.0'' + + print_me(" print(a.ra_str(False))", a.ra_str(False)) + + # print(a.ra_str(False)): 9:15:0.0 + + +Use the ``to_positive()`` method to get the positive version of an angle:: + + a = Angle(-87.32) + + print_me(" print(a.to_positive())", a.to_positive()) + + # print(a.to_positive()): 272.68 + + +Call the ``__repr__()`` method to get a string defining the current object. This string can then be fed to the ``eval()`` function to generate the object:: + + print_me("print(b.__repr__())", b.__repr__()) + + # print(b.__repr__()): Angle(138.7325) + + c = eval(repr(b)) + + print_me("c = eval(repr(b)); print(c)", c) + + # c = eval(repr(b)); print(c): 138.7325 + +Let's now work with some useful operators and functions:: + + print_me("c", c) + + # c: 138.7325 + +- Negate an angle:: + + d = Angle(13, 30) + + print_me("d", d) + + # d: 13.5 + + e = -d + + print_me(" e = -d", e) + + # e = -d: -13.5 + +- Get the absolute value of an angle:: + + e = abs(e) + + print_me(" e = abs(e)", e) + + # e = abs(e): 13.5 + +- Module operation on an angle:: + + d = Angle(17.0) + + print_me("d", d) + + # d: 17.0 + + e = c % d + + print_me(" e = c % d", e) + + # e = c % d: 2.7325 + + +- Convert the angle to an integer:: + + d = Angle(13.95) + + print_me("d", d) + + # d: 13.95 + + print_me(" int(d)", int(d)) + + # int(d): 13 + + d = Angle(-4.95) + + print_me("d", d) + + # d: -4.95 + + print_me(" int(d)", int(d)) + + # int(d): -4 + +- Convert the angle to a float:: + + print_me(" float(d)", float(d)) + + # float(d): -4.95 + +- Round the angle to a float:: + + e = Angle(-4.951648) + + print_me("e", e) + + # e: -4.951648 + + print_me(" round(e)", round(e)) + + # round(e): -5.0 + + print_me(" round(e, 2)", round(e, 2)) + + # round(e, 2): -4.95 + + print_me(" round(e, 3)", round(e, 3)) + + # round(e, 3): -4.952 + + print_me(" round(e, 4)", round(e, 4)) + + # round(e, 4): -4.9516 + +- Comparison operators:: + + print_me(" d == e", d == e) + + # d == e: False + + print_me(" d != e", d != e) + + # d != e: True + + print_me(" d > e", d > e) + + # d > e: True + + print_me(" c >= 180.0", c >= 180.0) + + # c >= 180.0: False + + print_me(" c < 180.0", c < 180.0) + + # c < 180.0: True + + print_me(" c <= 180.0", c <= 180.0) + + # c <= 180.0: True + +- It is very easy to add Angles to obtain a new Angle:: + + e = c + d + + print_me(" c + d", e) + + # c + d: 133.7825 + + We can also directly add a decimal angle:: + + e = c + 11.5 + + print_me(" c + 11.5", e) + + # c + 11.5: 150.2325 + + Types allowed are int, float and Angle:: + + print('e = c + "32.5"') + + # e = c + "32.5" + + try: + + e = c + "32.5" + + except TypeError: + + print("TypeError!: Valid types are int, float, and Angle, not string!") + + # TypeError!: Valid types are int, float, and Angle, not string! + + +- Subtraction:: + + e = c - d + + print_me(" c - d", e) + + # c - d: 143.6825 + +- Multiplication:: + + c.set(150.0) + + d.set(5.0) + + print_me("c", c) + + # c: 150.0 + + print_me("d", d) + + # d: 5.0 + + e = c * d + + print_me(" c * d", e) + + # c * d: 30.0 + +- Division:: + + c.set(150.0) + + d.set(6.0) + + print_me("d", d) + + # d: 6.0 + + e = c / d + + print_me(" c / d", e) + + # c / d: 25.0 + + + Division by zero is not allowed:: + + d.set(0.0) + + print_me("d", d) + + # d: 0.0 + + print('e = c / d') + + # e = c / d + + try: + + e = c / d + + except ZeroDivisionError: + + print("ZeroDivisionError!: Division by zero is not allowed!") + + # ZeroDivisionError!: Division by zero is not allowed! + +- Power:: + + d.set(2.2) + + print_me("d", d) + + # d: 2.2 + + e = c ** d + + print_me(" c ** d", e) + + # c ** d: 91.5733670999 + + +- Accumulative module operation:: + + d.set(17.0) + + print_me("d", d) + + # d: 17.0 + + e %= d + + print_me(" e %= d", e) + + # e %= d: 6.57336709993 + +- Accumulative addition:: + + c += d + + print_me(" c += d", c) + + # c += d: 167.0 + +- Accumulative subtraction:: + + print_me("b", b) + + # b: 138.7325 + + c -= b + + print_me(" c -= b", c) + + # c -= b: 28.2675 + +- Accumulative multiplication:: + + print_me("b", b) + + # b: 138.7325 + + c *= b + + print_me(" c *= b", c) + + # c *= b: 321.62094375 + +- Accumulative division:: + + print_me("b", b) + + # 138.7325 + + d.set(6.0) + + print_me("d", d) + + # d: 6.0 + + b /= d + + print_me(" b /= d", b) + + # b /= d: 23.1220833333 + +- Accumulative power:: + + d.set(2.2) + + print_me("d", d) + + # d: 2.2 + + c = abs(c) + + print_me(" c = abs(c)", c) + + # c = abs(c): 321.62094375 + + c **= d + + print_me(" c **= d", c) + + # c **= d: 254.307104203 + + +The same operations, but by the right side:: + + e = 3.5 + b + + print_me(" e = 3.5 + b", e) + + # e = 3.5 + b: 26.6220833333 + + e = 3.5 - b + + print_me(" e = 3.5 - b", e) + + # e = 3.5 - b: -19.6220833333 + + e = 3.5 * b + + print_me(" e = 3.5 * b", e) + + # e = 3.5 * b: 80.9272916667 + + e = 3.5 / b + + print_me(" e = 3.5 / b", e) + + # e = 3.5 / b: 0.151370443119 + + e = 3.5 ** b + + print_me(" e = 3.5 ** b", e) + + # e = 3.5 ** b: 260.783691406 + diff -Nru pymeeus-0.4.3+dfsg1/docs/source/examples/ex-base.rst pymeeus-0.5.11+dfsg1/docs/source/examples/ex-base.rst --- pymeeus-0.4.3+dfsg1/docs/source/examples/ex-base.rst 1970-01-01 00:00:00.000000000 +0000 +++ pymeeus-0.5.11+dfsg1/docs/source/examples/ex-base.rst 2018-12-06 10:09:58.000000000 +0000 @@ -0,0 +1,40 @@ +Base examples +************* + +Let's define a small helper function:: + + def print_me(msg, val): + + print("{}: {}".format(msg, val)) + +Let's print the tolerance:: + + print_me("The default value for the tolerance is", TOL) + + The default value for the tolerance is: 1e-10 + +Find the accuracy of this computer:: + + j, d = machine_accuracy() + + + print_me("Number of significant BITS in the mantissa\t", j) + + Number of significant BITS in the mantissa : 52.0 + + + print_me("Number of significant DIGITS in a decimal number", d) + + Number of significant DIGITS in a decimal number: 15 + +Print the suffixes for some ordinal numbers:: + + print_me("The suffix for ordinal 2 is", get_ordinal_suffix(2)) + + The suffix for ordinal 2 is: nd + + + print_me("The suffix for ordinal 16 is", get_ordinal_suffix(16)) + + The suffix for ordinal 16 is: th + diff -Nru pymeeus-0.4.3+dfsg1/docs/source/examples/ex-Coordinates.rst pymeeus-0.5.11+dfsg1/docs/source/examples/ex-Coordinates.rst --- pymeeus-0.4.3+dfsg1/docs/source/examples/ex-Coordinates.rst 1970-01-01 00:00:00.000000000 +0000 +++ pymeeus-0.5.11+dfsg1/docs/source/examples/ex-Coordinates.rst 2019-04-28 08:46:54.000000000 +0000 @@ -0,0 +1,813 @@ +Coordinates examples +******************** + +Let's define a small helper function:: + + def print_me(msg, val): + + print("{}: {}".format(msg, val)) + +It follows a series of important parameters related to the angle between Earth's rotation axis and the ecliptic. + +- The mean angle between Earth rotation axis and ecliptic axis is the **mean obliquity**:: + + e0 = Earth.mean_obliquity(1987, 4, 10) + + print_me("Mean obliquity for 1987/4/10", e0.dms_str()) + + # Mean obliquity for 1987/4/10: 23d 26' 27.4066466278'' + +- If we take into account the nutation effect on the obliquity, we get the **true obliquity**:: + + epsilon = Earth.true_obliquity(1987, 4, 10) + + print_me("True obliquity for 1987/4/10", epsilon.dms_str()) + + # True obliquity for 1987/4/10: 23d 26' 36.8491882378'' + + epsilon = Earth.true_obliquity(2018, 7, 29) + + print_me("True obliquity for 2018/7/29", epsilon.dms_str()) + + # True obliquity for 2018/7/29: 23d 26' 7.21570241139'' + +- The nutation effect is separated in two components: One parallel to the ecliptic (nutation in longitude) and other perpendicular to the ecliptic (nutation in obliquity):: + + dpsi = Earth.nutation_longitude(1987, 4, 10) + + print_me("Nutation in longitude for 1987/4/10", dpsi.dms_str(n_dec=3)) + + # Nutation in longitude for 1987/4/10: -3.788'' + + depsilon = Earth.nutation_obliquity(1987, 4, 10) + + print_me("Nutation in obliquity for 1987/4/10", depsilon.dms_str(n_dec=3)) + + # Nutation in obliquity for 1987/4/10: 9.443'' + +- We can compute the effects of precession on the equatorial coordinates of a given star, taking also into account its proper motion:: + + start_epoch = JDE2000 + + final_epoch = Epoch(2028, 11, 13.19) + + alpha0 = Angle(2, 44, 11.986, ra=True) + + delta0 = Angle(49, 13, 42.48) + + print_me("Initial right ascension", alpha0.ra_str(n_dec=3)) + + # Initial right ascension: 2h 44' 11.986'' + + print_me("Initial declination", delta0.dms_str(n_dec=2)) + + # Initial declination: 49d 13' 42.48'' + + pm_ra = Angle(0, 0, 0.03425, ra=True) + + pm_dec = Angle(0, 0, -0.0895) + + alpha, delta = Earth.precession_equatorial(start_epoch, final_epoch, + + alpha0, delta0, pm_ra, pm_dec) + + print_me("Final right ascension", alpha.ra_str(n_dec=3)) + + # Final right ascension: 2h 46' 11.331'' + + print_me("Final declination", delta.dms_str(n_dec=2)) + + # Final declination: 49d 20' 54.54'' + +Something similar can also be done with the ecliptical coordinates:: + + start_epoch = JDE2000 + + final_epoch = Epoch(-214, 6, 30.0) + + lon0 = Angle(149.48194) + + lat0 = Angle(1.76549) + + print_me("Initial ecliptical longitude", round(lon0(), 5)) + + # Initial ecliptical longitude: 149.48194 + + print_me("Initial ecliptical latitude", round(lat0(), 5)) + + # Initial ecliptical latitude: 1.76549 + + lon, lat = Earth.precession_ecliptical(start_epoch, final_epoch, lon0, lat0) + + print_me("Final ecliptical longitude", round(lon(), 3)) + + # Final ecliptical longitude: 118.704 + + print_me("Final ecliptical latitude", round(lat(), 3)) + + # Final ecliptical latitude: 1.615 + +Additionally, module ``Coordinates`` provides a function to compute the true movement of a star through the sky relative to the Sun:: + + ra = Angle(6, 45, 8.871, ra=True) + + dec = Angle(-16.716108) + + pm_ra = Angle(0, 0, -0.03847, ra=True) + + pm_dec = Angle(0, 0, -1.2053) + + dist = 2.64 + + vel = -7.6 + + alpha, delta = motion_in_space(ra, dec, dist, vel, pm_ra, pm_dec, -4000.0) + + print(alpha.ra_str(False, 2)) + + # 6:47:39.91 + + print(delta.dms_str(False, 1)) + + # -15:23:30.6 + +This module ``Coordinates`` also provides a series of functions to convert between equatorial, ecliptical, horizontal and galactic coordinates. + +- Equatorial to ecliptical coordinates:: + + ra = Angle(7, 45, 18.946, ra=True) + + dec = Angle(28, 1, 34.26) + + epsilon = Angle(23.4392911) + + lon, lat = equatorial2ecliptical(ra, dec, epsilon) + + print_me("Equatorial to ecliptical. Longitude", round(lon(), 5)) + + # Equatorial to ecliptical. Longitude: 113.21563 + + print_me("Equatorial to ecliptical. Latitude", round(lat(), 5)) + + # Equatorial to ecliptical. Latitude: 6.68417 + +- Ecliptical to equatorial coordinates:: + + lon = Angle(113.21563) + + lat = Angle(6.68417) + + epsilon = Angle(23.4392911) + + ra, dec = ecliptical2equatorial(lon, lat, epsilon) + + print_me("Ecliptical to equatorial. Right ascension", ra.ra_str(n_dec=3)) + + # Ecliptical to equatorial. Right ascension: 7h 45' 18.946'' + + print_me("Ecliptical to equatorial. Declination", dec.dms_str(n_dec=2)) + + # Ecliptical to equatorial. Declination: 28d 1' 34.26'' + +- Equatorial to horizontal coordinates:: + + lon = Angle(77, 3, 56) + + lat = Angle(38, 55, 17) + + ra = Angle(23, 9, 16.641, ra=True) + + dec = Angle(-6, 43, 11.61) + + theta0 = Angle(8, 34, 57.0896, ra=True) + + eps = Angle(23, 26, 36.87) + + # Compute correction to convert from mean to apparent sidereal time + + delta = Angle(0, 0, ((-3.868*cos(eps.rad()))/15.0), ra=True) + + theta0 += delta + + h = theta0 - lon - ra + + azi, ele = equatorial2horizontal(h, dec, lat) + + print_me("Equatorial to horizontal: Azimuth", round(azi, 3)) + + # Equatorial to horizontal: Azimuth: 68.034 + + print_me("Equatorial to horizontal: Elevation", round(ele, 3)) + + # Equatorial to horizontal: Elevation: 15.125 + +- Horizontal to equatorial coordinates:: + + azi = Angle(68.0337) + + ele = Angle(15.1249) + + lat = Angle(38, 55, 17) + + h, dec = horizontal2equatorial(azi, ele, lat) + + print_me("Horizontal to equatorial. Hour angle", round(h, 4)) + + # Horizontal to equatorial. Hour angle: 64.3521 + + print_me("Horizontal to equatorial. Declination", dec.dms_str(n_dec=0)) + + # Horizontal to equatorial. Declination: -6d 43' 12.0'' + +- Equatorial to galactic coordinates:: + + ra = Angle(17, 48, 59.74, ra=True) + + dec = Angle(-14, 43, 8.2) + + lon, lat = equatorial2galactic(ra, dec) + + print_me("Equatorial to galactic. Longitude", round(lon, 4)) + + # Equatorial to galactic. Longitude: 12.9593 + + print_me("Equatorial to galactic. Latitude", round(lat, 4)) + + # Equatorial to galactic. Latitude: 6.0463 + +- Galactic to equatorial coordinates:: + + lon = Angle(12.9593) + + lat = Angle(6.0463) + + ra, dec = galactic2equatorial(lon, lat) + + print_me("Galactic to equatorial. Right ascension", ra.ra_str(n_dec=1)) + + # Galactic to equatorial. Right ascension: 17h 48' 59.7'' + + print_me("Galactic to equatorial. Declination", dec.dms_str(n_dec=0)) + + # Galactic to equatorial. Declination: -14d 43' 8.0'' + +In addition, there is a function to compute the ecliptic longitudes of the two points of the ecliptic which are on the horizon, as well as the angle between the ecliptic and the horizon:: + + sidereal_time = Angle(5.0, ra=True) + + lat = Angle(51.0) + + epsilon = Angle(23.44) + + lon1, lon2, i = ecliptic_horizon(sidereal_time, lat, epsilon) + + print_me("Longitude of ecliptic point #1 on the horizon", lon1.dms_str(n_dec=1)) + + # Longitude of ecliptic point #1 on the horizon: 169d 21' 29.9'' + + print_me("Longitude of ecliptic point #2 on the horizon", lon2.dms_str(n_dec=1)) + + # Longitude of ecliptic point #2 on the horizon: 349d 21' 29.9'' + + print_me("Angle between the ecliptic and the horizon", round(i, 0)) + + # Angle between the ecliptic and the horizon: 62.0 + +Also, it is possible to compute the angle of the diurnal path of a celestial body relative to the horizon at the time of rising and setting:: + + dec = Angle(23.44) + + lat = Angle(40.0) + + j = diurnal_path_horizon(dec, lat) + + print_me("Diurnal path vs. horizon angle at time of rising and setting", j.dms_str(n_dec=1)) + + # Diurnal path vs. horizon angle at time of rising and setting: 45d 31' 28.4'' + +The times (in hours of the day) of rising, transit and setting of a given celestial body can be computed with the appropriate function:: + + longitude = Angle(71, 5, 0.0) + + latitude = Angle(42, 20, 0.0) + + alpha1 = Angle(2, 42, 43.25, ra=True) + + delta1 = Angle(18, 2, 51.4) + + alpha2 = Angle(2, 46, 55.51, ra=True) + + delta2 = Angle(18, 26, 27.3) + + alpha3 = Angle(2, 51, 7.69, ra=True) + + delta3 = Angle(18, 49, 38.7) + + h0 = Angle(-0.5667) + + delta_t = 56.0 + + theta0 = Angle(11, 50, 58.1, ra=True) + + rising, transit, setting = times_rise_transit_set(longitude, latitude,alpha1, delta1, \ + + alpha2, delta2, alpha3, delta3, h0, \ + + delta_t, theta0) + + print_me("Time of rising (hours of day)", round(rising, 4)) + + # Time of rising (hours of day): 12.4238 + + print_me("Time of transit (hours of day)", round(transit, 3)) + + # Time of transit (hours of day): 19.675 + + print_me("Time of setting (hours of day, next day)", round(setting, 3)) + + # Time of setting (hours of day, next day): 2.911 + +The air in the atmosphere introduces an error in the elevation due to the refraction. We can compute the true (airless) elevation from the apparent elevation, and viceversa. + +- Apparent elevation to true (airless) elevation:: + + apparent_elevation = Angle(0, 30, 0.0) + + true_elevation = refraction_apparent2true(apparent_elevation) + + print_me("True elevation for an apparent elevation of 30'", + + true_elevation.dms_str(n_dec=1)) + + # True elevation for an apparent elevation of 30': 1' 14.7'' + +- True elevation to apparent elevation:: + + true_elevation = Angle(0, 33, 14.76) + + apparent_elevation = refraction_true2apparent(true_elevation) + + print_me("Apparent elevation for a true elevation of 33' 14.76''", + + apparent_elevation.dms_str(n_dec=2)) + + # Apparent elevation for a true elevation of 33' 14.76'': 57' 51.96'' + +This module provides a function to compute the angular separation between two celestial bodies:: + + alpha1 = Angle(14, 15, 39.7, ra=True) + + delta1 = Angle(19, 10, 57.0) + + alpha2 = Angle(13, 25, 11.6, ra=True) + + delta2 = Angle(-11, 9, 41.0) + + sep_ang = angular_separation(alpha1, delta1, alpha2, delta2) + + print_me("Angular separation between two given celestial bodies, in degrees", + round(sep_ang, 3)) + + # Angular separation between two given celestial bodies, in degrees: 32.793 + +We can compute the minimum angular separation achieved between two celestial objects. For that, we must provide the positions at three equidistant epochs:: + + # EPOCH: Sep 13th, 1978, 0h TT: + + alpha1_1 = Angle(10, 29, 44.27, ra=True) + + delta1_1 = Angle(11, 2, 5.9) + + alpha2_1 = Angle(10, 33, 29.64, ra=True) + + delta2_1 = Angle(10, 40, 13.2) + + # EPOCH: Sep 14th, 1978, 0h TT: + + alpha1_2 = Angle(10, 36, 19.63, ra=True) + + delta1_2 = Angle(10, 29, 51.7) + + alpha2_2 = Angle(10, 33, 57.97, ra=True) + + delta2_2 = Angle(10, 37, 33.4) + + # EPOCH: Sep 15th, 1978, 0h TT: + + alpha1_3 = Angle(10, 43, 1.75, ra=True) + + delta1_3 = Angle(9, 55, 16.7) + + alpha2_3 = Angle(10, 34, 26.22, ra=True) + + delta2_3 = Angle(10, 34, 53.9) + + a = minimum_angular_separation(alpha1_1, delta1_1, alpha1_2, delta1_2, + + alpha1_3, delta1_3, alpha2_1, delta2_1, + + alpha2_2, delta2_2, alpha2_3, delta2_3) + + print_me("Minimum angular separation, epoch fraction", round(a[0], 6)) + + # Minimum angular separation, epoch fraction: -0.370726 + + # NOTE: Given that 'n' is negative, and Sep 14th is the middle epoch (n=0), + + # then the minimum angular separation is achieved on Sep 13th, specifically + + # at: 1.0 - 0.370726 = 0.629274 => Sep 13.629274 = Sep 13th, 15h 6' 9'' + + print_me("Minimum angular separation", a[1].dms_str(n_dec=0)) + + # Minimum angular separation: 3' 44.0'' + +There is a function to compute the relative position angle P of a body with respect to another body. In this example, given that the two bodies have the same right ascension, then the relative position angle between them must be 0 (or 180):: + + alpha1 = Angle(14, 15, 39.7, ra=True) + + delta1 = Angle(19, 10, 57.0) + + alpha2 = Angle(14, 15, 39.7, ra=True) # Same as alpha1 + + delta2 = Angle(-11, 9, 41.0) + + pos_ang = relative_position_angle(alpha1, delta1, alpha2, delta2) + + print_me("Relative position angle", round(pos_ang, 1)) + + # Relative position angle: 0.0 + +Planetary conjunctions may be computed with the appropriate function:: + + alpha1_1 = Angle(10, 24, 30.125, ra=True) + + delta1_1 = Angle(6, 26, 32.05) + + alpha1_2 = Angle(10, 25, 0.342, ra=True) + + delta1_2 = Angle(6, 10, 57.72) + + alpha1_3 = Angle(10, 25, 12.515, ra=True) + + delta1_3 = Angle(5, 57, 33.08) + + alpha1_4 = Angle(10, 25, 6.235, ra=True) + + delta1_4 = Angle(5, 46, 27.07) + + alpha1_5 = Angle(10, 24, 41.185, ra=True) + + delta1_5 = Angle(5, 37, 48.45) + + alpha2_1 = Angle(10, 27, 27.175, ra=True) + + delta2_1 = Angle(4, 4, 41.83) + + alpha2_2 = Angle(10, 26, 32.410, ra=True) + + delta2_2 = Angle(3, 55, 54.66) + + alpha2_3 = Angle(10, 25, 29.042, ra=True) + + delta2_3 = Angle(3, 48, 3.51) + + alpha2_4 = Angle(10, 24, 17.191, ra=True) + + delta2_4 = Angle(3, 41, 10.25) + + alpha2_5 = Angle(10, 22, 57.024, ra=True) + + delta2_5 = Angle(3, 35, 16.61) + + alpha1_list = [alpha1_1, alpha1_2, alpha1_3, alpha1_4, alpha1_5] + + delta1_list = [delta1_1, delta1_2, delta1_3, delta1_4, delta1_5] + + alpha2_list = [alpha2_1, alpha2_2, alpha2_3, alpha2_4, alpha2_5] + + delta2_list = [delta2_1, delta2_2, delta2_3, delta2_4, delta2_5] + + pc = planetary_conjunction(alpha1_list, delta1_list, alpha2_list, delta2_list) + + print_me("Epoch fraction 'n' for planetary conjunction", round(pc[0], 5)) + + # Epoch fraction 'n' for planetary conjunction: 0.23797 + + print_me("Difference in declination at conjunction", pc[1].dms_str(n_dec=1)) + + # Difference in declination at conjunction: 2d 8' 21.8'' + +If the planetary conjunction is with a star, it is a little bit simpler:: + + alpha_1 = Angle(15, 3, 51.937, ra=True) + + delta_1 = Angle(-8, 57, 34.51) + + alpha_2 = Angle(15, 9, 57.327, ra=True) + + delta_2 = Angle(-9, 9, 3.88) + + alpha_3 = Angle(15, 15, 37.898, ra=True) + + delta_3 = Angle(-9, 17, 37.94) + + alpha_4 = Angle(15, 20, 50.632, ra=True) + + delta_4 = Angle(-9, 23, 16.25) + + alpha_5 = Angle(15, 25, 32.695, ra=True) + + delta_5 = Angle(-9, 26, 1.01) + + alpha_star = Angle(15, 17, 0.446, ra=True) + + delta_star = Angle(-9, 22, 58.47) + + alpha_list = [alpha_1, alpha_2, alpha_3, alpha_4, alpha_5] + + delta_list = [delta_1, delta_2, delta_3, delta_4, delta_5] + + pc = planet_star_conjunction(alpha_list, delta_list, alpha_star, delta_star) + + print_me("Epoch fraction 'n' for planetary conjunction with star", round(pc[0], 4)) + + # Epoch fraction 'n' for planetary conjunction with star: 0.2551 + + print_me("Difference in declination with star at conjunction", pc[1].dms_str(n_dec=0)) + + # Difference in declination with star at conjunction: 3' 38.0'' + +It is possible to compute when a planet and two other stars will be in a straight line:: + + alpha_1 = Angle(7, 55, 55.36, ra=True) + + delta_1 = Angle(21, 41, 3.0) + + alpha_2 = Angle(7, 58, 22.55, ra=True) + + delta_2 = Angle(21, 35, 23.4) + + alpha_3 = Angle(8, 0, 48.99, ra=True) + + delta_3 = Angle(21, 29, 38.2) + + alpha_4 = Angle(8, 3, 14.66, ra=True) + + delta_4 = Angle(21, 23, 47.5) + + alpha_5 = Angle(8, 5, 39.54, ra=True) + + delta_5 = Angle(21, 17, 51.4) + + alpha_star1 = Angle(7, 34, 16.40, ra=True) + + delta_star1 = Angle(31, 53, 51.2) + + alpha_star2 = Angle(7, 45, 0.10, ra=True) + + delta_star2 = Angle(28, 2, 12.5) + + alpha_list = [alpha_1, alpha_2, alpha_3, alpha_4, alpha_5] + + delta_list = [delta_1, delta_2, delta_3, delta_4, delta_5] + + n = planet_stars_in_line(alpha_list, delta_list, alpha_star1, delta_star1, + + alpha_star2, delta_star2) + + print_me("Epoch fraction 'n' when bodies are in a straight line", round(n, 4)) + + # Epoch fraction 'n' when bodies are in a straight line: 0.2233 + +The function 'straight_line()' computes if three celestial bodies are in line providing the angle with which the bodies differ from a great circle:: + + alpha1 = Angle(5, 32, 0.40, ra=True) + + delta1 = Angle(0, -17, 56.9) + + alpha2 = Angle(5, 36, 12.81, ra=True) + + delta2 = Angle(-1, 12, 7.0) + + alpha3 = Angle(5, 40, 45.52, ra=True) + + delta3 = Angle(-1, 56, 33.3) + + psi, omega = straight_line(alpha1, delta1, alpha2, delta2, alpha3, delta3) + + print_me("Angle deviation from a straight line", psi.dms_str(n_dec=0)) + + # Angle deviation from a straight line: 7d 31' 1.0'' + + print_me("Angular distance of central point to the straight line", omega.dms_str(n_dec=0)) + + # Angular distance of central point to the straight line: -5' 24.0'' + +Now let's compute the size of the smallest circle that contains three given celestial bodies:: + + alpha1 = Angle(12, 41, 8.63, ra=True) + + delta1 = Angle(-5, 37, 54.2) + + alpha2 = Angle(12, 52, 5.21, ra=True) + + delta2 = Angle(-4, 22, 26.2) + + alpha3 = Angle(12, 39, 28.11, ra=True) + + delta3 = Angle(-1, 50, 3.7) + + d = circle_diameter(alpha1, delta1, alpha2, delta2, alpha3, delta3) + + print_me("Diameter of smallest circle containing three celestial bodies", d.dms_str(n_dec=0)) + + # Diameter of smallest circle containing three celestial bodies: 4d 15' 49.0'' + +Let's find the apparent position of a star (Theta Persei) for a given epoch:: + + epoch = Epoch(2028, 11, 13.19) + + alpha = Angle(2, 46, 11.331, ra=True) + + delta = Angle(49, 20, 54.54) + + sun_lon = Angle(231.328) + + app_alpha, app_delta = apparent_position(epoch, alpha, delta, sun_lon) + + print_me("Apparent right ascension", app_alpha.ra_str(n_dec=2)) + + # Apparent right ascension: 2h 46' 14.39'' + + print_me("Apparent declination", app_delta.dms_str(n_dec=2)) + + # Apparent declination: 49d 21' 7.45'' + +Convert orbital elements of a celestial object from one equinox to another:: + + epoch0 = Epoch(2358042.5305) + + epoch = Epoch(2433282.4235) + + i0 = Angle(47.122) + + arg0 = Angle(151.4486) + + lon0 = Angle(45.7481) + + i1, arg1, lon1 = orbital_equinox2equinox(epoch0, epoch, i0, arg0, lon0) + + print_me("New inclination", round(i1(), 3)) + + # New inclination: 47.138 + + print_me("New argument of perihelion", round(arg1(), 4)) + + # New argument of perihelion: 151.4782 + + print_me("New longitude of ascending node", round(lon1(), 4)) + + # New longitude of ascending node: 48.6037 + +Compute the eccentric and true anomalies using Kepler's equation:: + + eccentricity = 0.1 + + mean_anomaly = Angle(5.0) + + e, v = kepler_equation(eccentricity, mean_anomaly) + + print_me("Eccentric anomaly, Case #1", round(e(), 6)) + + # Eccentric anomaly, Case #1: 5.554589 + + print_me("True anomaly, Case #1", round(v(), 6)) + + # True anomaly, Case #1: 6.139762 + + e, v = kepler_equation(0.99, Angle(0.2, radians=True)) + + print_me("Eccentric anomaly, Case #2", round(e(), 8)) + + # Eccentric anomaly, Case #2: 61.13444578 + + print_me("True anomaly, Case #2", round(v(), 6)) + + # True anomaly, Case #2: 166.311977 + +Compute the velocity of a body in a given point of its (unperturbated elliptic) orbit, in this case the comet Halley in 1986:: + + r = 1.0 + + a = 17.9400782 + + v = velocity(r, a) + + print_me("Velocity ar 1 AU", round(v, 2)) + + # Velocity at 1 AU: 41.53 + +Compute the velocity at perihelion:: + + a = 17.9400782 + + e = 0.96727426 + + vp = velocity_perihelion(e, a) + + print_me("Velocity at perihelion", round(vp, 2)) + + # Velocity at perihelion: 54.52 + +And now compute the velocity at aphelion:: + + a = 17.9400782 + + e = 0.96727426 + + va = velocity_aphelion(e, a) + + print_me("Velocity at aphelion", round(va, 2)) + + # Velocity at aphelion: 0.91 + +Calculate the length of the orbit for the same comet Halley:: + + a = 17.9400782 + + e = 0.96727426 + + length = length_orbit(e, a) + + print_me("Length of the orbit (AU)", round(length, 2)) + + # Length of the orbit (AU): 77.06 + +Compute passage through the nodes of an elliptic orbit:: + + omega = Angle(111.84644) + + e = 0.96727426 + + a = 17.9400782 + + t = Epoch(1986, 2, 9.45891) + + time, r = passage_nodes_elliptic(omega, e, a, t) + + y, m, d = time.get_date() + + d = round(d, 2) + + print("Time of passage through ascending node: {}/{}/{}".format(y, m, d)) + + # Time of passage through ascending node: 1985/11/9.16 + + print("Radius vector at ascending node: {}".format(round(r, 4))) + + # Radius vector at ascending node: 1.8045 + +Passage through the nodes of a parabolic orbit:: + + omega = Angle(154.9103) + + q = 1.324502 + + t = Epoch(1989, 8, 20.291) + + time, r = passage_nodes_parabolic(omega, q, t, ascending=False) + + y, m, d = time.get_date() + + d = round(d, 2) + + print("Time of passage through descending node: {}/{}/{}".format(y, m, d)) + + # Time of passage through descending node: 1989/9/17.64 + + print("Radius vector at descending node: {}".format(round(r, 4))) + + # Radius vector at descending node: 1.3901 + +Compute the phase angle:: + + sun_dist = 0.724604 + + earth_dist = 0.910947 + + sun_earth_dist = 0.983824 + + angle = phase_angle(sun_dist, earth_dist, sun_earth_dist) + + print_me("Phase angle", round(angle, 2)) + + # Phase angle: 72.96 + +Now, let's compute the illuminated fraction of the disk:: + + k = illuminated_fraction(sun_dist, earth_dist, sun_earth_dist) + + print_me("Illuminated fraction of planet disk", round(k, 3)) + + # Illuminated fraction of planet disk: 0.647 diff -Nru pymeeus-0.4.3+dfsg1/docs/source/examples/ex-CurveFitting.rst pymeeus-0.5.11+dfsg1/docs/source/examples/ex-CurveFitting.rst --- pymeeus-0.4.3+dfsg1/docs/source/examples/ex-CurveFitting.rst 1970-01-01 00:00:00.000000000 +0000 +++ pymeeus-0.5.11+dfsg1/docs/source/examples/ex-CurveFitting.rst 2018-12-06 10:09:58.000000000 +0000 @@ -0,0 +1,117 @@ +CurveFitting examples +********************* + +Let's define a small helper function:: + + def print_me(msg, val): + + print("{}: {}".format(msg, val)) + +Now let's work with the CurveFitting class. First, create a CurveFitting object:: + + cf1 = CurveFitting([73.0, 38.0, 35.0, 42.0, 78.0, 68.0, 74.0, 42.0, 52.0, + + 54.0, 39.0, 61.0, 42.0, 49.0, 50.0, 62.0, 44.0, 39.0, + + 43.0, 54.0, 44.0, 37.0], + + [90.4, 125.3, 161.8, 143.4, 52.5, 50.8, 71.5, 152.8, + + 131.3, 98.5, 144.8, 78.1, 89.5, 63.9, 112.1, 82.0, + + 119.8, 161.2, 208.4, 111.6, 167.1, 162.1]) + + +Let's use ``linear_fitting()``:: + + a, b = cf1.linear_fitting() + + print(" a = {}\tb = {}".format(round(a, 2), round(b, 2))) + + # a = -2.49 b = 244.18 + +Use the copy constructor:: + + cf2 = CurveFitting(cf1) + + a, b = cf2.linear_fitting() + + print(" a = {}\tb = {}".format(round(a, 2), round(b, 2))) + + # a = -2.49 b = 244.18 + +Get the number of value pairs internally stored:: + + print_me("Number of value pairs inside 'cf2'", len(cf2)) + + # Number of value pairs inside 'cf2': 22 + +Compute the correlation coefficient:: + + r = cf1.correlation_coeff() + + print_me(" r", round(r, 3)) + + # r: -0.767 + +Define a new CurveFitting object:: + + cf2 = CurveFitting([-2.0, -1.5, -1.0, -0.5, 0.0, 0.5, 1.0, 1.5, 2.0, 2.5, 3.0], + + [-9.372, -3.821, 0.291, 3.730, 5.822, 8.324, 9.083, + + 6.957, 7.006, 0.365, -1.722]) + +Now use ``quadratic_fitting()``:: + + a, b, c = cf2.quadratic_fitting() + + # Original curve: y = -2.0*x*x + 3.5*x + 7.0 + noise + + print(" a = {}\tb = {}\tc = {}".format(round(a, 2), round(b, 2), round(c, 2))) + + # a = -2.22 b = 3.76 c = 6.64 + +Yet another CurveFitting object:: + + cf4 = CurveFitting([3, 20, 34, 50, 75, 88, 111, 129, 143, 160, 183, 200, + + 218, 230, 248, 269, 290, 303, 320, 344], + + [0.0433, 0.2532, 0.3386, 0.3560, 0.4983, 0.7577, 1.4585, + + 1.8628, 1.8264, 1.2431, -0.2043, -1.2431, -1.8422, + + -1.8726, -1.4889, -0.8372, -0.4377, -0.3640, -0.3508, + + -0.2126]) + +Let's define the three functions to be used for fitting:: + + def sin1(x): return sin(radians(x)) + + def sin2(x): return sin(radians(2.0*x)) + + def sin3(x): return sin(radians(3.0*x)) + +Use ``general_fitting()`` here:: + + a, b, c = cf4.general_fitting(sin1, sin2, sin3) + + # General fitting with f0 = sin(x), f1 = sin(2*x), f2 = sin(3*x) + + print(" a = {}\tb = {}\tc = {}".format(round(a, 2), round(b, 2), round(c, 2))) + + # a = 1.2 b = -0.77 c = 0.39 + +A final example:: + + cf5 = CurveFitting([0, 1.2, 1.4, 1.7, 2.1, 2.2]) + + a, b, c = cf5.general_fitting(sqrt) + + # General fitting with f0 = sqrt(x), f1 = 0.0 and f2 = 0.0 + + print(" a = {}\tb = {}\t\tc = {}".format(round(a, 3), round(b, 3), round(c, 3))) + + # a = 1.016 b = 0.0 c = 0.0 diff -Nru pymeeus-0.4.3+dfsg1/docs/source/examples/ex-Earth.rst pymeeus-0.5.11+dfsg1/docs/source/examples/ex-Earth.rst --- pymeeus-0.4.3+dfsg1/docs/source/examples/ex-Earth.rst 1970-01-01 00:00:00.000000000 +0000 +++ pymeeus-0.5.11+dfsg1/docs/source/examples/ex-Earth.rst 2019-04-28 08:46:54.000000000 +0000 @@ -0,0 +1,272 @@ +Earth examples +************** + +Let's define a small helper function:: + + def print_me(msg, val): + + print("{}: {}".format(msg, val)) + +An important concept are the reference ellipsoids, comprising information about +the Earth global model we are going to use. + +A very important reference ellipsoid is **WGS84**, predefined here:: + + print_me("WGS84", WGS84) + + # WGS84: 6378137.0:0.00335281066475:7.292115e-05 + + # First field is equatorial radius, second field is the flattening, and the + + # third field is the angular rotation velocity, in radians per second + +Let's print the semi-minor axis (polar radius):: + + print_me("Polar radius, b", WGS84.b()) + + # Polar radius, b: 6356752.31425 + +And now, let's print the eccentricity of Earth's meridian:: + + print_me("Eccentricity, e", WGS84.e()) + + # Eccentricity, e: 0.0818191908426 + +We create an Earth object with a given reference ellipsoid. By default, it is +**WGS84**, but we can use another:: + + e = Earth(IAU76) + +Print the parameters of reference ellipsoid being used:: + + print_me("'e' Earth object parameters", e) + + # 'e' Earth object parameters: 6378140.0:0.0033528131779:7.292114992e-05 + +Compute the distance to the center of the Earth from a given point at sea +level, and at a certain latitude. It is given as a fraction of equatorial +radius:: + + lat = Angle(65, 45, 30.0) # We can use an Angle for this + + print_me("Distance to Earth's center, from latitude 65d 45' 30''", e.rho(lat)) + + # Distance to Earth's center, from latitude 65d 45' 30'': 0.997216343095 + +Parameters *rho\*sin(lat)* and *rho\*cos(lat)* are useful for different +astronomical applications:: + + height = 650.0 + + print_me("rho*sin(lat)", e.rho_sinphi(lat, height)) + + # rho*sin(lat): 0.908341718779 + + print_me("rho*cos(lat)", e.rho_cosphi(lat, height)) + + # rho*cos(lat): 0.411775501279 + +Compute the radius of the parallel circle at a given latitude:: + + print_me("Radius of parallel circle at latitude 65d 45' 30'' (meters)", e.rp(lat)) + + # Radius of parallel circle at latitude 65d 45' 30'' (meters): 2626094.91467 + +Compute the radius of curvature of the Earth's meridian at given latitude:: + + print_me("Radius of Earth's meridian at latitude 65d 45' 30'' (meters)", e.rm(lat)) + + # Radius of Earth's meridian at latitude 65d 45' 30'' (meters): 6388705.74543 + +It is easy to compute the linear velocity at different latitudes:: + + print_me("Linear velocity at the Equator (meters/second)", e.linear_velocity(0.0)) + + # Linear velocity at the Equator (meters/second): 465.101303151 + + print_me("Linear velocity at latitude 65d 45' 30'' (meters/second)", e.linear_velocity(lat)) + + # Linear velocity at latitude 65d 45' 30'' (meters/second): 191.497860977 + +And now, let's compute the distance between two points on the Earth: + +- Bangkok: 13d 14' 09'' North, 100d 29' 39'' East +- Buenos Aires: 34d 36' 12'' South, 58d 22' 54'' West + +.. note:: We will consider that positions 'East' and 'South' are negative + +Here we will take advantage of facilities provided by ``Angle`` class:: + + lon_ban = Angle(-100, 29, 39.0) + + lat_ban = Angle(13, 14, 9.0) + + lon_bai = Angle(58, 22, 54.0) + + lat_bai = Angle(-34, 36, 12.0) + + dist, error = e.distance(lon_ban, lat_ban, lon_bai, lat_bai) + + print_me("The distance between Bangkok and Buenos Aires is (km)", round(dist/1000.0, 2)) + + # The distance between Bangkok and Buenos Aires is (km): 16832.89 + + print_me("The approximate error of the estimation is (meters)", round(error, 0)) + + # The approximate error of the estimation is (meters): 189.0 + +Let's now compute the geometric heliocentric position for a given epoch:: + + epoch = Epoch(1992, 10, 13.0) + + lon, lat, r = Earth.geometric_heliocentric_position(epoch) + + print_me("Geometric Heliocentric Longitude", lon.to_positive()) + + # Geometric Heliocentric Longitude: 19.9072721503 + + print_me("Geometric Heliocentric Latitude", lat.dms_str(n_dec=3)) + + # Geometric Heliocentric Latitude: -0.721'' + + print_me("Radius vector", r) + + # Radius vector: 0.997608520236 + +And now, compute the apparent heliocentric position for the same epoch:: + + epoch = Epoch(1992, 10, 13.0) + + lon, lat, r = Earth.apparent_heliocentric_position(epoch) + + print_me("Apparent Heliocentric Longitude", lon.to_positive()) + + # Apparent Heliocentric Longitude: 19.9059856939 + + print_me("Apparent Heliocentric Latitude", lat.dms_str(n_dec=3)) + + # Apparent Heliocentric Latitude: -0.721'' + + print_me("Radius vector", r) + + # Radius vector: 0.997608520236 + +Print mean orbital elements for Earth at 2065.6.24:: + + epoch = Epoch(2065, 6, 24.0) + + l, a, e, i, ome, arg = Earth.orbital_elements_mean_equinox(epoch) + + print_me("Mean longitude of the planet", round(l, 6)) + + # Mean longitude of the planet: 272.716028 + + print_me("Semimajor axis of the orbit (UA)", round(a, 8)) + + # Semimajor axis of the orbit (UA): 1.00000102 + + print_me("Eccentricity of the orbit", round(e, 7)) + + # Eccentricity of the orbit: 0.0166811 + + print_me("Inclination on plane of the ecliptic", round(i, 6)) + + # Inclination on plane of the ecliptic: 0.0 + + print_me("Longitude of the ascending node", round(ome, 5)) + + # Longitude of the ascending node: 174.71534 + + print_me("Argument of the perihelion", round(arg, 6)) + + # Argument of the perihelion: -70.651889 + +Find the epoch of the Perihelion closer to 2008/02/01:: + + epoch = Epoch(2008, 2, 1.0) + + e = Earth.perihelion_aphelion(epoch) + + y, m, d, h, mi, s = e.get_full_date() + + peri = str(y) + '/' + str(m) + '/' + str(d) + ' ' + str(h) + ':' + str(mi) + + print_me("The Perihelion closest to 2008/2/1 happened on", peri) + + # The Perihelion closest to 2008/2/1 happened on: 2008/1/2 23:53 + +Compute the time of passage through an ascending node:: + + epoch = Epoch(2019, 1, 1) + + time, r = Earth.passage_nodes(epoch) + + y, m, d = time.get_date() + + d = round(d, 1) + + print("Time of passage through ascending node: {}/{}/{}".format(y, m, d)) + + # Time of passage through ascending node: 2019/3/15.0 + + print("Radius vector at ascending node: {}".format(round(r, 4))) + + # Radius vector at ascending node: 0.9945 + +Compute the parallax correction:: + + right_ascension = Angle(22, 38, 7.25, ra=True) + + declination = Angle(-15, 46, 15.9) + + latitude = Angle(33, 21, 22) + + distance = 0.37276 + + hour_angle = Angle(288.7958) + + top_ra, top_dec = Earth.parallax_correction(right_ascension, declination, + + latitude, distance, hour_angle) + + print_me("Corrected topocentric right ascension: ", top_ra.ra_str(n_dec=2)) + + # Corrected topocentric right ascension: : 22h 38' 8.54'' + + print_me("Corrected topocentric declination", top_dec.dms_str(n_dec=1)) + + # Corrected topocentric declination: -15d 46' 30.0'' + +Compute the parallax correction in ecliptical coordinates:: + + longitude = Angle(181, 46, 22.5) + + latitude = Angle(2, 17, 26.2) + + semidiameter = Angle(0, 16, 15.5) + + obs_lat = Angle(50, 5, 7.8) + + obliquity = Angle(23, 28, 0.8) + + sidereal_time = Angle(209, 46, 7.9) + + distance = 0.0024650163 + + topo_lon, topo_lat, topo_diam = \ + + Earth.parallax_ecliptical(longitude, latitude, semidiameter, obs_lat, + + obliquity, sidereal_time, distance) + + print_me("Corrected topocentric longitude", topo_lon.dms_str(n_dec=1)) + + # Corrected topocentric longitude: 181d 48' 5.0'' + + print_me("Corrected topocentric latitude", topo_lat.dms_str(n_dec=1)) + + # Corrected topocentric latitude: 1d 29' 7.1'' + + print_me("Corrected topocentric semidiameter", topo_diam.dms_str(n_dec=1)) + + # Corrected topocentric semidiameter: 16' 25.5'' diff -Nru pymeeus-0.4.3+dfsg1/docs/source/examples/ex-Epoch.rst pymeeus-0.5.11+dfsg1/docs/source/examples/ex-Epoch.rst --- pymeeus-0.4.3+dfsg1/docs/source/examples/ex-Epoch.rst 1970-01-01 00:00:00.000000000 +0000 +++ pymeeus-0.5.11+dfsg1/docs/source/examples/ex-Epoch.rst 2021-02-24 19:52:15.000000000 +0000 @@ -0,0 +1,366 @@ +Epoch examples +************** + +Let's define a small helper function:: + + def print_me(msg, val): + + print("{}: {}".format(msg, val)) + +Let's start creating and Epoch object, and printing it:: + + e = Epoch(1987, 6, 19.5) + + print_me("JDE for 1987/6/19.5", e) + + # JDE for 1987/6/19.5: 2446966.00064 + +Redefine the Epoch object:: + + e.set(333, 'Jan', 27, 12) + + print_me("JDE for 333/1/27.5", e) + + # JDE for 333/1/27.5: 1842713.0 + +We can create an Epoch from a ``date`` or ``datetime`` object:: + + d = datetime.datetime(837, 4, 10, 7, 12, 0, 0) + + f = Epoch(d) + + print_me("JDE for 837/4/10.3", f) + + # JDE for 837/4/10.3: 2026871.8 + +Let's check if a given date belong to the Julian or the Gregorian calendar:: + + print_me("Is 1590/4/21.4 a Julian date?", Epoch.is_julian(1590, 4, 21.4)) + + # Is 1590/4/21.4 a Julian date?: False + +We can also check if a given year is leap or not:: + + print_me("Is -1000 a leap year?", Epoch.is_leap(-1000)) + + # Is -1000 a leap year?: True + + print_me("Is 1800 a leap year?", Epoch.is_leap(1800)) + + # Is 1800 a leap year?: False + + print_me("Is 2012 a leap year?", Epoch.is_leap(2012)) + + # Is 2012 a leap year?: True + +Get the Day Of Year (DOY) corresponding to a given date:: + + print_me("Day Of Year (DOY) of 1978/11/14", Epoch.get_doy(1978, 11, 14)) + + # Day Of Year (DOY) of 1978/11/14: 318.0 + + print_me("Day Of Year (DOY) of -400/2/29.9", Epoch.get_doy(-400, 2, 29.9)) + + # Day Of Year (DOY) of -400/2/29.9: 60.9 + +Now the opposite: Get a date from a DOY:: + + t = Epoch.doy2date(2017, 365.7) + + s = str(t[0]) + "/" + str(t[1]) + "/" + str(round(t[2], 2)) + + print_me("Date from DOY 2017:365.7", s) + + # Date from DOY 2017:365.7: 2017/12/31.7 + + t = Epoch.doy2date(-4, 60) + + s = str(t[0]) + "/" + str(t[1]) + "/" + str(round(t[2], 2)) + + print_me("Date from DOY -4:60", s) + + # Date from DOY -4:60: -4/2/29.0 + + +There is an internal table which we can use to get the leap seconds:: + + print_me("Number of leap seconds applied up to July 1983", Epoch.leap_seconds(1983, 7)) + + # Number of leap seconds applied up to July 1983: 12 + +We can convert the internal JDE value back to a date:: + + e = Epoch(2436116.31) + + y, m, d = e.get_date() + + s = str(y) + "/" + str(m) + "/" + str(round(d, 2)) + + print_me("Date from JDE 2436116.31", s) + + # Date from JDE 2436116.31: 1957/10/4.81 + +It is possible to get the day of the week corresponding to a given date:: + + e = Epoch(2018, 'Feb', 15) + + print_me("The day of week of 2018/2/15 is", e.dow(as_string=True)) + + # The day of week of 2018/2/15 is: Thursday + +In some cases it is useful to get the Modified Julian Day (MJD):: + + e = Epoch(1923, 'August', 23) + + print_me("Modified Julian Day for 1923/8/23", round(e.mjd(), 2)) + + # Modified Julian Day for 1923/8/23: 23654.0 + +If your system is appropriately configured, you can get the difference in seconds between your local time and UTC:: + + print_me("From local system time to UTC you must add/subtract" + + + " this amount of seconds", Epoch.utc2local()) + + # From local system time to UTC you must add/subtract this amount of seconds: 7200.0 + +Compute DeltaT = TT - UT differences for various dates:: + + print_me("DeltaT (TT - UT) for Feb/333", round(Epoch.tt2ut(333, 2), 1)) + + # DeltaT (TT - UT) for Feb/333: 7358.5 + + print_me("DeltaT (TT - UT) for Jan/1642", round(Epoch.tt2ut(1642, 1), 1)) + + # DeltaT (TT - UT) for Jan/1642: 62.1 + + print_me("DeltaT (TT - UT) for Feb/1928", round(Epoch.tt2ut(1928, 1), 1)) + + # DeltaT (TT - UT) for Feb/1928: 24.2 + + print_me("DeltaT (TT - UT) for Feb/1977", round(Epoch.tt2ut(1977, 2), 1)) + + # DeltaT (TT - UT) for Feb/1977: 47.7 + + print_me("DeltaT (TT - UT) for Jan/1998", round(Epoch.tt2ut(1998, 1), 1)) + + # DeltaT (TT - UT) for Jan/1998: 63.0 + +The difference between civil day and sidereal day is almost 4 minutes:: + + e = Epoch(1987, 4, 10) + + st1 = round(e.mean_sidereal_time(), 9) + + e = Epoch(1987, 4, 11) + + st2 = round(e.mean_sidereal_time(), 9) + + ds = (st2 - st1)*DAY2MIN + + msg = "{}m {}s".format(INT(ds), (ds % 1)*60.0) + + print_me("Difference between sidereal time 1987/4/11 and 1987/4/10", msg) + + # Difference between sidereal time 1987/4/11 and 1987/4/10: 3m 56.555424s + +When correcting for nutation-related effects, we get the **apparent** sidereal time:: + + e = Epoch(1987, 4, 10) + + print_me("e.apparent_sidereal_time(23.44357, (-3.788)/3600.0)", + + e.apparent_sidereal_time(23.44357, (-3.788)/3600.0)) + + # e.apparent_sidereal_time(23.44357, (-3.788)/3600.0): 0.549145082637 + +Epoch class can also provide the date of Easter for a given year. Let's spice up the output a little bit, calling ``dow()`` and ``get_month()``:: + + month, day = Epoch.easter(2019) + + e = Epoch(2019, month, day) + + s = e.dow(as_string=True) + ", " + str(day) + get_ordinal_suffix(day) + \ + + " of " + Epoch.get_month(month, as_string=True) + + print_me("Easter day for 2019", s) + + # Easter day for 2019: Sunday, 21st of April + +Compute the date of the Jewish Easter (Pesach) for a given year:: + + month, day = Epoch.jewish_pesach(1990) + + s = str(day) + get_ordinal_suffix(day) + " of " + Epoch.get_month(month, as_string=True) + + print_me("Jewish Pesach day for 1990", s) + + # Jewish Pesach day for 1990: 10th of April + +Now, let's convert a date in the Moslem calendar to the Gregorian calendar:: + + y, m, d = Epoch.moslem2gregorian(1421, 1, 1) + + print_me("The date 1421/1/1 in the Moslem calendar is, in Gregorian " + + + "calendar", "{}/{}/{}".format(y, m, d)) + + # The date 1421/1/1 in the Moslem calendar is, in Gregorian calendar: 2000/4/6 + + y, m, d = Epoch.moslem2gregorian(1439, 9, 1) + + print_me("The start of Ramadan month (9/1) for Gregorian year 2018 is", + + "{}/{}/{}".format(y, m, d)) + + # The start of Ramadan month (9/1) for Gregorian year 2018 is: 2018/5/16 + +We can go from the Gregorian calendar back to the Moslem calendar too:: + + print_me("Date 1991/8/13 in Gregorian calendar is, in Moslem calendar", + + "{}/{}/{}".format(*Epoch.gregorian2moslem(1991, 8, 13))) + + # Date 1991/8/13 in Gregorian calendar is, in Moslem calendar: 1412/2/2 + +.. note:: The ``*`` before ``Epoch`` will **unpack** the tuple into components + + +It is possible to carry out some algebraic operations with Epochs. + +- Add 10000 days to a given date:: + + a = Epoch(1991, 7, 11) + + b = a + 10000 + + y, m, d = b.get_date() + + s = str(y) + "/" + str(m) + "/" + str(round(d, 2)) + + print_me("1991/7/11 plus 10000 days is", s) + + # 1991/7/11 plus 10000 days is: 2018/11/26.0 + +- Subtract two Epochs to find the number of days between them:: + + a = Epoch(1986, 2, 9.0) + + b = Epoch(1910, 4, 20.0) + + print_me("The number of days between 1986/2/9 and 1910/4/20 is", round(a - b, 2)) + + # The number of days between 1986/2/9 and 1910/4/20 is: 27689.0 + +- We can also subtract a given amount of days from an Epoch:: + + a = Epoch(2003, 12, 31.0) + + b = a - 365.5 + + y, m, d = b.get_date() + + s = str(y) + "/" + str(m) + "/" + str(round(d, 2)) + + print_me("2003/12/31 minus 365.5 days is", s) + + # 2003/12/31 minus 365.5 days is: 2002/12/30.5 + +- Accumulative addition and subtraction of days is also allowed:: + + a = Epoch(2003, 12, 31.0) + + a += 32.5 + + y, m, d = a.get_date() + + s = str(y) + "/" + str(m) + "/" + str(round(d, 2)) + + print_me("2003/12/31 plus 32.5 days is", s) + + # 2003/12/31 plus 32.5 days is: 2004/2/1.5 + + + + a = Epoch(2001, 12, 31.0) + + a -= 2*365 + + y, m, d = a.get_date() + + s = str(y) + "/" + str(m) + "/" + str(round(d, 2)) + + print_me("2001/12/31 minus 2*365 days is", s) + + # 2001/12/31 minus 2*365 days is: 2000/1/1.0 + +- It is also possible to add days from the right:: + + a = Epoch(2004, 2, 27.8) + + b = 2.2 + a + + y, m, d = b.get_date() + + s = str(y) + "/" + str(m) + "/" + str(round(d, 2)) + + print_me("2.2 days plus 2004/2/27.8 is", s) + + # 2.2 days plus 2004/2/27.8 is: 2004/3/1.0 + +- Comparison operadors between epochs are also defined:: + + a = Epoch(2007, 5, 20.0) + + b = Epoch(2007, 5, 20.000001) + + print_me("2007/5/20.0 == 2007/5/20.000001", a == b) + + # 2007/5/20.0 == 2007/5/20.000001: False + + print_me("2007/5/20.0 != 2007/5/20.000001", a != b) + + # 2007/5/20.0 != 2007/5/20.000001: True + + print_me("2007/5/20.0 > 2007/5/20.000001", a > b) + + # 2007/5/20.0 > 2007/5/20.000001: False + + print_me("2007/5/20.0 <= 2007/5/20.000001", a <= b) + + # 2007/5/20.0 <= 2007/5/20.000001: True + +- Compute the time of rise and setting of the Sun in a given day:: + + e = Epoch(2018, 5, 2) + + print("On May 2nd, 2018, Sun rising/setting times in Munich were (UTC):") + + latitude = Angle(48, 8, 0) + + longitude = Angle(11, 34, 0) + + altitude = 520.0 + + rising, setting = e.rise_set(latitude, longitude, altitude) + + y, m, d, h, mi, s = rising.get_full_date() + + print("Rising time: {}:{}".format(h, mi)) + + # Rising time: 3:50 + + y, m, d, h, mi, s = setting.get_full_date() + + print("Setting time: {}:{}".format(h, mi)) + + # Setting time: 18:33 + +- Compute the hash of a given Epoch:: + + h = e.__hash__() + + print("Hash of Epoch({}): {}".format(e, h)) + + # Hash of Epoch(2458240.5): 1152921504609305216 diff -Nru pymeeus-0.4.3+dfsg1/docs/source/examples/ex-Interpolation.rst pymeeus-0.5.11+dfsg1/docs/source/examples/ex-Interpolation.rst --- pymeeus-0.4.3+dfsg1/docs/source/examples/ex-Interpolation.rst 1970-01-01 00:00:00.000000000 +0000 +++ pymeeus-0.5.11+dfsg1/docs/source/examples/ex-Interpolation.rst 2018-12-06 10:09:58.000000000 +0000 @@ -0,0 +1,167 @@ +Interpolation examples +********************** + +Let's define a small helper function:: + + def print_me(msg, val): + + print("{}: {}".format(msg, val)) + +Declare an Interpolation object:: + + i = Interpolation([5, 3, 6, 1, 2, 4, 9], [10, 6, 12, 2, 4, 8]) + + print(i) + + # X: [1, 2, 3, 4, 5, 6] + + # Y: [2, 4, 6, 8, 10, 12] + +.. note:: + + a. They are ordered in 'x' + b. The extra value in 'x' was dropped + +Use the copy constructor. We can easily make a copy of an Interpolation object:: + + j = Interpolation(i) + + print(j) + + # X: [1, 2, 3, 4, 5, 6] + + # Y: [2, 4, 6, 8, 10, 12] + + j = Interpolation([0.0, 1.0, 3.0], [-1.0, -2.0, 2.0]) + + print(j) + + # X: [0.0, 1.0, 3.0] + + # Y: [-1.0, -2.0, 2.0] + + print_me("j(2)", j(2)) + + # j(2): -1.0 + + print_me("j(0.5)", j(0.5)) + + # j(0.5): -1.75 + +- Test with a value already in the data table:: + + print_me("j(1)", j(1)) + + # j(1): -2.0 + +Get the number of interpolation points internally stored:: + + print_me("Number or interpolation points in 'j'", len(j)) + + # Number or interpolation points in 'j': 3 + +We can interpolate Angles too:: + + k = Interpolation([27.0, 27.5, 28.0, 28.5, 29.0], + + [Angle(0, 54, 36.125), Angle(0, 54, 24.606), + + Angle(0, 54, 15.486), Angle(0, 54, 8.694), + + Angle(0, 54, 4.133)]) + + print_me("k(28.278)", Angle(k(28.278)).dms_str()) + + # k(28.278): 54' 11.4279073579'' + +Let's work with a new Interpolation object:: + + m = Interpolation([-1.0, 0.0, 1.0], [-2.0, 3.0, 2.0]) + + print(m) + + # X: [-1.0, 0.0, 1.0] + + # Y: [-2.0, 3.0, 2.0] + +- Get some interpolated values:: + + print_me("m(-0.5)", m(-0.5)) + + # m(-0.5): 1.25 + + print_me("m(0.5)", m(0.5)) + + # m(0.5): 3.25 + +- Get derivatives:: + + print_me("m'(-1.0)", m.derivative(-1.0)) + + # m'(-1.0): 8.0 + + print_me("m'(-0.5)", m.derivative(-0.5)) + + # m'(-0.5): 5.0 + + print_me("m'(0.0)", m.derivative(0.0)) + + # m'(0.0): 2.0 + + print_me("m'(0.5)", m.derivative(0.5)) + + # m'(0.5): -1.0 + + print_me("m'(1.0)", m.derivative(1.0)) + + # m'(1.0): -4.0 + +- Get the root within the interval:: + + print_me("m.root()", m.root()) + + # m.root(): -0.720759220056 + +- Get the extremum within the interval:: + + print_me("m.minmax()", m.minmax()) + + # m.minmax(): 0.333333333333 + +Let's work now with the interpolation of sine function:: + + m = Interpolation([29.43, 30.97, 27.69, 28.11, 31.58, 33.05], + + [0.4913598528, 0.5145891926, 0.4646875083, + + 0.4711658342, 0.5236885653, 0.5453707057]) + + print_me("sin(29.5)\t", m(29.5)) + + # sin(29.5) : 0.492423560118 + + print_me("sin(30.0)\t", m(30.0)) + + # sin(30.0) : 0.500000000018 + + print_me("sin(30.5)\t", m(30.5)) + + # sin(30.5) : 0.507538362978 + +Derivatives must be adjusted because degrees were used instead of radians:: + + print_me("sin'(29.5)\t", degrees(m.derivative(29.5))) + + # sin'(29.5) : 0.870355696916 + + print_me("sin'(30.0)\t", degrees(m.derivative(30.0))) + + # sin'(30.0) : 0.866025403791 + + print_me("sqrt(3.0)/2.0\t", sqrt(3.0)/2.0) + + # sqrt(3.0)/2.0 : 0.866025403784 + + print_me("sin'(30.5)\t", degrees(m.derivative(30.5))) + + # sin'(30.5) : 0.861629160353 diff -Nru pymeeus-0.4.3+dfsg1/docs/source/examples/ex-JupiterMoons.rst pymeeus-0.5.11+dfsg1/docs/source/examples/ex-JupiterMoons.rst --- pymeeus-0.4.3+dfsg1/docs/source/examples/ex-JupiterMoons.rst 1970-01-01 00:00:00.000000000 +0000 +++ pymeeus-0.5.11+dfsg1/docs/source/examples/ex-JupiterMoons.rst 2021-03-09 19:07:56.000000000 +0000 @@ -0,0 +1,170 @@ +JupiterMoons examples +********************** + +Let's define a small helper function:: + + def print_me(msg, val): + print("{}: {}".format(msg, val)) + + +Lets compute the ascending node of Jupiter as well as the longitude of the node of +the equator of Jupiter on the ecliptic (psi):: + + utc_1992_12_16_00_00_00 = Epoch(1992, 12, 16, utc=True) + psi_corrected, OMEGA_ascending_node_jupiter = JupiterMoons.jupiter_system_angles(utc_1992_12_16_00_00_00) + print("Ascending node of Jupiter: ", OMEGA_ascending_node_jupiter) + #100.39249942976576 + print("Longitude of the node of the eauator of Jupiter on the ecliptic (psi):", psi_corrected) + #317.1058009213959 + +Lets compute the corrected rectangular geocentric position of Jupiter's satellites +for a given epoch, using the E5-theory:: + + utc_1992_12_16_00_00_00 = Epoch(1992, 12, 16, utc=True) + + io, europa, ganymede, callisto = JupiterMoons.rectangular_positions_jovian_equatorial(utc_1992_12_16_00_00_00) + + print("Corrected rectangular geocentric position of Io [X, Y , Z]: ", io) + #(-3.450168811390241, 0.21370246960509387, -4.818966623735296) + + print("Corrected rectangular geocentric position of Europa [X, Y , Z]: ", europa) + #(7.441869121153001, 0.27524463479625677, -5.747104399729193) + + print("Corrected rectangular geocentric position of Ganymede [X, Y , Z]: ", ganymede) + #(1.201111684800708, 0.5899903274317162, -14.940581367576527) + + print("Corrected rectangular geocentric position of Callisto [X, Y , Z]: ", callisto) + #(7.071943240286434, 1.0289562923230684, -25.224137724734955) + +Lets compute the uncorrected rectangular geocentric position of Jupiter's satellites for a given epoch, +using the E5-theory:: + + #So the effects of different light-time and perspective described in Pymeeus page 313 - 314 are neglected + + utc_1992_12_16_00_00_00 = Epoch(1992, 12, 16, utc=True) + io_uncorrected, europa_uncorrected, ganymede_uncorrected, callisto_uncorrected = \ + JupiterMoons.rectangular_positions_jovian_equatorial(utc_1992_12_16_00_00_00, do_correction=False) + + print("Uncorrected rectangular geocentric position of Io [X, Y , Z]: ", io_uncorrected) + # (-3.4489935969836503, 0.21361563816963675, -4.818966623735296) + + print("Uncorrected rectangular geocentric position of Europa [X, Y , Z]: ", europa_uncorrected) + # (7.438101803124541, 0.2751112576349763, -5.747104399729193) + + print("Uncorrected rectangular geocentric position of Ganymede [X, Y , Z]: ", ganymede_uncorrected) + # (1.1990581804888616, 0.589247092847632, -14.940581367576527) + + print("Uncorrected rectangular geocentric position of Callisto [X, Y , Z]: ", callisto_uncorrected) + # (7.056237832405445, 1.0267678919629089, -25.224137724734955) + +Lets calculate the distance between Earth and Jupiter (DELTA) for a given epoch:: + + utc_1992_12_16_00_00_00 = Epoch(1992, 12, 16, utc=True) + delta, tau, l, b, r = JupiterMoons.calculate_delta(utc_1992_12_16_00_00_00) + + print("Distance between Earth and Jupiter in AU: ", delta) + #5.6611211815432645 + + print("Light-time from Earth to Jupiter in d (day): ", tau) + #0.03269590898252075 + +Lets calculate the perspective distance in Jupiter radii of all satellites +for an eclipse of Io:: + + io_ecc_start_2021_02_12_14_19_14 = Epoch(2021, 2, 12.5966898148148) + + result_matrix = JupiterMoons.check_phenomena(io_ecc_start_2021_02_12_14_19_14) + + #structure of result_matrix + # Row 0: Io Column 0: perspective distance as seen from the Earth + # Row 1: Europa Column 1: perspective distance as seen from the Sun + # Row 2: Ganymede Column 2: No use + # Row 3: Callisto + + # print Row 0 + print("(perspective distance of Io (Earth View), perspective distance of Io (Sun view), No use): ") + print(result_matrix[0]) + #[1.1926058680144362, 0.856027716233023, 0.0] + + # print Row 1 + print("(perspective distance of Europa (Earth View), perspective distance of Europa (Sun view), No use): ") + print(result_matrix[1]) + #[-8.739720236890856, -8.893094092124032, 0.0] + + # print Row 2 + print("(perspective distance of Ganymede (Earth View), perspective distance of Ganymede (Sun view), No use): ") + print(result_matrix[2]) + #[14.069121992481382, 13.8323491767871, 0.0] + + # print Row 3 + print("(perspective distance of Callisto (Earth View), perspective distance of Callisto (Sun view), No use): ") + print(result_matrix[3]) + #[-2.934134686233644, -3.9904786452498144, 0.0] + +Lets check if an eclipse or\and occultation for any of the four Galilean satellites is detected for a given epoch:: + + io_ecc_start_2021_02_12_14_19_14 = Epoch(2021, 2, 12.5966898148148) + + #Structure of result matrix + # Row 0: Io Column 0: Occultation True\False + # Row 1: Europa Column 1: Eclipse True\False + # Row 2: Ganymede Column 2: No use + # Row 3: Callisto + + result_matrix = JupiterMoons.is_phenomena(io_ecc_start_2021_02_12_14_19_14) + + #print Row 0 + print("(Occultation of Io, Eclipse of Io, No use): ") + print(result_matrix[0]) + #[False, True, False] + + # print Row 1 + print(" (Occultation of Europa, Eclipse of Europa, No use): ") + print(result_matrix[1]) + #[False, False, False] + + # print Row 2 + print(" (Occultation of Ganymede, Eclipse of Gaymede, No use): ") + print(result_matrix[2]) + #[False,False,False] + + # print Row 3 + print("(Occultation of Callisto, Eclipse of Callisto, No use): ") + print(result_matrix[3]) + #[False,False,False] + +Calculation of the perspective distance ot the planet Io to the center of Jupiter +for December 16 at 0h UTC as seen from the Sun:: + + utc_1992_12_16_00_00_00 = Epoch(1992, 12, 16, utc=True) + + result_matrix = JupiterMoons.rectangular_positions_jovian_equatorial(utc_1992_12_16_00_00_00, solar=True) + + #Structure of result matrix + # Row 0: Io Column 0: X coordinate of satellite in Jupiter radii + # Row 1: Europa Column 1: Y coordinate of satellite in Jupiter radii + # Row 2: Ganymede Column 2: Z coordinate of satellite in Jupiter radii + # Row 3: Callisto + + io_radius_to_center_of_jupiter_sun = JupiterMoons.check_coordinates(result_matrix[0][0], result_matrix[0][1]) + + print("Perspective distance of Io as seen from the Sun in Jupiter radii: ", io_radius_to_center_of_jupiter_sun) + #3.457757270630766 + +Calculation of the perspective distance ot the planet Io to the center of Jupiter +for December 16 at 0h UTC as seen from the Earth:: + + utc_1992_12_16_00_00_00 = Epoch(1992, 12, 16, utc=True) + result_matrix = JupiterMoons.rectangular_positions_jovian_equatorial(utc_1992_12_16_00_00_00, solar=False) + + #Structure of result matrix + # Row 0: Io Column 0: X coordinate of satellite in Jupiter radii + # Row 1: Europa Column 1: Y coordinate of satellite in Jupiter radii + # Row 2: Ganymede Column 2: Z coordinate of satellite in Jupiter radii + # Row 3: Callisto + + io_radius_to_center_of_jupiter_earth = JupiterMoons.check_coordinates(result_matrix[0][0], result_matrix[0][1]) + + print("Perspective distance of Io as seen from the Earth in Jupiter radii: ", io_radius_to_center_of_jupiter_earth) + # 2.553301264153796 + diff -Nru pymeeus-0.4.3+dfsg1/docs/source/examples/ex-Jupiter.rst pymeeus-0.5.11+dfsg1/docs/source/examples/ex-Jupiter.rst --- pymeeus-0.4.3+dfsg1/docs/source/examples/ex-Jupiter.rst 1970-01-01 00:00:00.000000000 +0000 +++ pymeeus-0.5.11+dfsg1/docs/source/examples/ex-Jupiter.rst 2019-04-28 08:46:54.000000000 +0000 @@ -0,0 +1,170 @@ +Jupiter examples +**************** + +Let's define a small helper function:: + + def print_me(msg, val): + + print("{}: {}".format(msg, val)) + +We can compute the geometric heliocentric position for a given epoch:: + + epoch = Epoch(2018, 10, 27.0) + + lon, lat, r = Jupiter.geometric_heliocentric_position(epoch) + + print_me("Geometric Heliocentric Longitude", lon.to_positive()) + + # Geometric Heliocentric Longitude: 241.5873 + + print_me("Geometric Heliocentric Latitude", lat) + + # Geometric Heliocentric Latitude: 0.8216 + + print_me("Radius vector", r) + + # Radius vector: 5.36848 + +Compute the geocentric position for 1992/12/20:: + + epoch = Epoch(1992, 12, 20.0) + + ra, dec, elon = Jupiter.geocentric_position(epoch) + + print_me("Right ascension", ra.ra_str(n_dec=1)) + + # Right ascension: 12h 47' 9.6'' + + print_me("Declination", dec.dms_str(n_dec=1)) + + # Declination: -3d 41' 55.3'' + + print_me("Elongation", elon.dms_str(n_dec=1)) + + # Elongation: 76d 2' 26.0'' + +Print mean orbital elements for Jupiter at 2065.6.24:: + + epoch = Epoch(2065, 6, 24.0) + + l, a, e, i, ome, arg = Jupiter.orbital_elements_mean_equinox(epoch) + + print_me("Mean longitude of the planet", round(l, 6)) + + # Mean longitude of the planet: 222.433723 + + print_me("Semimajor axis of the orbit (UA)", round(a, 8)) + + # Semimajor axis of the orbit (UA): 5.20260333 + + print_me("Eccentricity of the orbit", round(e, 7)) + + # Eccentricity of the orbit: 0.0486046 + + print_me("Inclination on plane of the ecliptic", round(i, 6)) + + # Inclination on plane of the ecliptic: 1.29967 + + print_me("Longitude of the ascending node", round(ome, 5)) + + # Longitude of the ascending node: 101.13309 + + print_me("Argument of the perihelion", round(arg, 6)) + + # Argument of the perihelion: -85.745532 + +Compute the time of the conjunction close to 1993/10/1:: + + epoch = Epoch(1993, 10, 1.0) + + conj = Jupiter.conjunction(epoch) + + y, m, d = conj.get_date() + + d = round(d, 4) + + date = "{}/{}/{}".format(y, m, d) + + print_me("Conjunction date", date) + + # Conjunction date: 1993/10/18.3341 + +Compute the time of the opposition close to -6/9/1:: + + epoch = Epoch(-6, 9, 1.0) + + oppo = Jupiter.opposition(epoch) + + y, m, d = oppo.get_date() + + d = round(d, 4) + + date = "{}/{}/{}".format(y, m, d) + + print_me("Opposition date", date) + + # Opposition date: -6/9/15.2865 + +Compute the time of the station in longitude #1 close to 2018/11/1:: + + epoch = Epoch(2018, 11, 1.0) + + sta1 = Jupiter.station_longitude_1(epoch) + + y, m, d = sta1.get_date() + + d = round(d, 4) + + date = "{}/{}/{}".format(y, m, d) + + print_me("Date of station in longitude #1", date) + + # Date of station in longitude #1: 2018/3/9.1288 + +Compute the time of the station in longitude #2 close to 2018/11/1:: + + epoch = Epoch(2018, 11, 1.0) + + sta2 = Jupiter.station_longitude_2(epoch) + + y, m, d = sta2.get_date() + + d = round(d, 4) + + date = "{}/{}/{}".format(y, m, d) + + print_me("Date of station in longitude #2", date) + + # Date of station in longitude #2: 2018/7/10.6679 + +Find the epoch of the Aphelion closer to 1981/6/1:: + + epoch = Epoch(1981, 6, 1.0) + + e = Jupiter.perihelion_aphelion(epoch, perihelion=False) + + y, m, d, h, mi, s = e.get_full_date() + + peri = str(y) + '/' + str(m) + '/' + str(d) + ' at ' + str(h) + ' hours' + + print_me("The Aphelion closest to 1981/6/1 will happen on", peri) + + # The Aphelion closest to 1981/6/1 will happen on: 1981/7/28 at 6 hours + +Compute the time of passage through an ascending node:: + + epoch = Epoch(2019, 1, 1) + + time, r = Jupiter.passage_nodes(epoch) + + y, m, d = time.get_date() + + d = round(d, 1) + + print("Time of passage through ascending node: {}/{}/{}".format(y, m, d)) + + # Time of passage through ascending node: 2025/9/15.6 + + print("Radius vector at ascending node: {}".format(round(r, 4))) + + # Radius vector at ascending node: 5.1729 diff -Nru pymeeus-0.4.3+dfsg1/docs/source/examples/ex-Mars.rst pymeeus-0.5.11+dfsg1/docs/source/examples/ex-Mars.rst --- pymeeus-0.4.3+dfsg1/docs/source/examples/ex-Mars.rst 1970-01-01 00:00:00.000000000 +0000 +++ pymeeus-0.5.11+dfsg1/docs/source/examples/ex-Mars.rst 2019-04-28 08:46:54.000000000 +0000 @@ -0,0 +1,170 @@ +Mars examples +************* + +Let's define a small helper function:: + + def print_me(msg, val): + + print("{}: {}".format(msg, val)) + +We can compute the geometric heliocentric position for a given epoch:: + + epoch = Epoch(2018, 10, 27.0) + + lon, lat, r = Mars.geometric_heliocentric_position(epoch) + + print_me("Geometric Heliocentric Longitude", lon.to_positive()) + + # Geometric Heliocentric Longitude: 2.0015 + + print_me("Geometric Heliocentric Latitude", lat) + + # Geometric Heliocentric Latitude: -1.3683 + + print_me("Radius vector", r) + + # Radius vector: 1.39306 + +Compute the geocentric position for 1992/12/20:: + + epoch = Epoch(1992, 12, 20.0) + + ra, dec, elon = Mars.geocentric_position(epoch) + + print_me("Right ascension", ra.ra_str(n_dec=1)) + + # Right ascension: 7h 48' 35.4'' + + print_me("Declination", dec.dms_str(n_dec=1)) + + # Declination: 24d 35' 33.9'' + + print_me("Elongation", elon.dms_str(n_dec=1)) + + # Elongation: 153d 35' 1.6'' + +Print mean orbital elements for Mars at 2065.6.24:: + + epoch = Epoch(2065, 6, 24.0) + + l, a, e, i, ome, arg = Mars.orbital_elements_mean_equinox(epoch) + + print_me("Mean longitude of the planet", round(l, 6)) + + # Mean longitude of the planet: 288.855211 + + print_me("Semimajor axis of the orbit (UA)", round(a, 8)) + + # Semimajor axis of the orbit (UA): 1.52367934 + + print_me("Eccentricity of the orbit", round(e, 7)) + + # Eccentricity of the orbit: 0.0934599 + + print_me("Inclination on plane of the ecliptic", round(i, 6)) + + # Inclination on plane of the ecliptic: 1.849338 + + print_me("Longitude of the ascending node", round(ome, 5)) + + # Longitude of the ascending node: 50.06365 + + print_me("Argument of the perihelion", round(arg, 6)) + + # Argument of the perihelion: 287.202108 + +Compute the time of the conjunction close to 1993/10/1:: + + epoch = Epoch(1993, 10, 1.0) + + conj = Mars.conjunction(epoch) + + y, m, d = conj.get_date() + + d = round(d, 4) + + date = "{}/{}/{}".format(y, m, d) + + print_me("Conjunction date", date) + + # Conjunction date: 1993/12/27.0898 + +Compute the time of the opposition close to 2729/10/1:: + + epoch = Epoch(2729, 10, 1.0) + + oppo = Mars.opposition(epoch) + + y, m, d = oppo.get_date() + + d = round(d, 4) + + date = "{}/{}/{}".format(y, m, d) + + print_me("Opposition date", date) + + # Opposition date: 2729/9/9.1412 + +Compute the time of the station in longitude #1 close to 1997/3/1:: + + epoch = Epoch(1997, 3, 1.0) + + sta1 = Mars.station_longitude_1(epoch) + + y, m, d = sta1.get_date() + + d = round(d, 4) + + date = "{}/{}/{}".format(y, m, d) + + print_me("Date of station in longitude #1", date) + + # Date of station in longitude #1: 1997/2/6.033 + +Compute the time of the station in longitude #2 close to 1997/3/1:: + + epoch = Epoch(1997, 3, 1.0) + + sta2 = Mars.station_longitude_2(epoch) + + y, m, d = sta2.get_date() + + d = round(d, 4) + + date = "{}/{}/{}".format(y, m, d) + + print_me("Date of station in longitude #2", date) + + # Date of station in longitude #2: 1997/4/27.7553 + +Find the epoch of the Aphelion closer to 2032/1/1:: + + epoch = Epoch(2032, 1, 1.0) + + e = Mars.perihelion_aphelion(epoch, perihelion=False) + + y, m, d, h, mi, s = e.get_full_date() + + peri = str(y) + '/' + str(m) + '/' + str(d) + ' at ' + str(h) + ' hours' + + print_me("The Aphelion closest to 2032/1/1 will happen on", peri) + + # The Aphelion closest to 2032/1/1 will happen on: 2032/10/24 at 22 hours + +Compute the time of passage through an ascending node:: + + epoch = Epoch(2019, 1, 1) + + time, r = Mars.passage_nodes(epoch) + + y, m, d = time.get_date() + + d = round(d, 1) + + print("Time of passage through ascending node: {}/{}/{}".format(y, m, d)) + + # Time of passage through ascending node: 2019/1/15.2 + + print("Radius vector at ascending node: {}".format(round(r, 4))) + + # Radius vector at ascending node: 1.4709 diff -Nru pymeeus-0.4.3+dfsg1/docs/source/examples/ex-Mercury.rst pymeeus-0.5.11+dfsg1/docs/source/examples/ex-Mercury.rst --- pymeeus-0.4.3+dfsg1/docs/source/examples/ex-Mercury.rst 1970-01-01 00:00:00.000000000 +0000 +++ pymeeus-0.5.11+dfsg1/docs/source/examples/ex-Mercury.rst 2019-04-28 08:46:54.000000000 +0000 @@ -0,0 +1,214 @@ +Mercury examples +**************** + +Let's define a small helper function:: + + def print_me(msg, val): + + print("{}: {}".format(msg, val)) + +We can compute the geometric heliocentric position for a given epoch:: + + epoch = Epoch(2018, 10, 27.0) + + lon, lat, r = Mercury.geometric_heliocentric_position(epoch) + + print_me("Geometric Heliocentric Longitude", lon.to_positive()) + + # Geometric Heliocentric Longitude: 287.4887 + + print_me("Geometric Heliocentric Latitude", lat) + + # Geometric Heliocentric Latitude: -6.0086 + + print_me("Radius vector", r) + + # Radius vector: 0.45113 + +Compute the geocentric position for 1992/12/20:: + + epoch = Epoch(1992, 12, 20.0) + + ra, dec, elon = Mercury.geocentric_position(epoch) + + print_me("Right ascension", ra.ra_str(n_dec=1)) + + # Right ascension: 16h 33' 59.3'' + + print_me("Declination", dec.dms_str(n_dec=1)) + + # Declination: -20d 53' 31.6'' + + print_me("Elongation", elon.dms_str(n_dec=1)) + + # Elongation: 18d 24' 29.8'' + +Print mean orbital elements for Mercury at 2065.6.24:: + + epoch = Epoch(2065, 6, 24.0) + + l, a, e, i, ome, arg = Mercury.orbital_elements_mean_equinox(epoch) + + print_me("Mean longitude of the planet", round(l, 6)) + + # Mean longitude of the planet: 203.494701 + + print_me("Semimajor axis of the orbit (UA)", round(a, 8)) + + # Semimajor axis of the orbit (UA): 0.38709831 + + print_me("Eccentricity of the orbit", round(e, 7)) + + # Eccentricity of the orbit: 0.2056451 + + print_me("Inclination on plane of the ecliptic", round(i, 6)) + + # Inclination on plane of the ecliptic: 7.006171 + + print_me("Longitude of the ascending node", round(ome, 5)) + + # Longitude of the ascending node: 49.10765 + + print_me("Argument of the perihelion", round(arg, 6)) + + # Argument of the perihelion: 29.367732 + +Compute the time of the inferior conjunction close to 1993/10/1:: + + epoch = Epoch(1993, 10, 1.0) + + conjunction = Mercury.inferior_conjunction(epoch) + + y, m, d = conjunction.get_date() + + d = round(d, 4) + + date = "{}/{}/{}".format(y, m, d) + + print_me("Inferior conjunction date", date) + + # Inferior conjunction date: 1993/11/6.1449 + +Compute the time of the superior conjunction close to 1993/10/1:: + + epoch = Epoch(1993, 10, 1.0) + + conjunction = Mercury.superior_conjunction(epoch) + + y, m, d = conjunction.get_date() + + d = round(d, 4) + + date = "{}/{}/{}".format(y, m, d) + + print_me("Superior conjunction date", date) + + # Superior conjunction date: 1993/8/29.3301 + +Compute the time and angle of the western elongation close to 1993/11/1:: + + epoch = Epoch(1993, 11, 1.0) + + time, elongation = Mercury.western_elongation(epoch) + + y, m, d = time.get_date() + + d = round(d, 4) + + date = "{}/{}/{}".format(y, m, d) + + print_me("Western elongation date", date) + + # Western elongation date: 1993/11/22.6386 + + elong = round(elongation, 4) + + print_me("Maximum western elongation angle", elong) + + # Maximum western elongation angle: 19.7506 + +Compute the time and angle of the eastern elongation close to 1990/8/1:: + + epoch = Epoch(1990, 8, 1.0) + + time, elongation = Mercury.eastern_elongation(epoch) + + y, m, d = time.get_date() + + d = round(d, 4) + + date = "{}/{}/{}".format(y, m, d) + + print_me("Eastern elongation date", date) + + # Eastern elongation date: 1990/8/11.8514 + + elong = round(elongation, 4) + + print_me("Maximum eastern elongation angle", elong) + + # Maximum eastern elongation angle: 27.4201 + +Compute the time of the station in longitude #1 close to 1993/10/1:: + + epoch = Epoch(1993, 10, 1.0) + + sta1 = Mercury.station_longitude_1(epoch) + + y, m, d = sta1.get_date() + + d = round(d, 4) + + date = "{}/{}/{}".format(y, m, d) + + print_me("Date of station in longitude #1", date) + + # Date of station in longitude #1: 1993/10/25.9358 + +Compute the time of the station in longitude #2 close to 1993/10/1:: + + epoch = Epoch(1993, 10, 1.0) + + sta2 = Mercury.station_longitude_2(epoch) + + y, m, d = sta2.get_date() + + d = round(d, 4) + + date = "{}/{}/{}".format(y, m, d) + + print_me("Date of station in longitude #2", date) + + # Date of station in longitude #2: 1993/11/15.0724 + +Find the epoch of the Perihelion closer to 2000/01/01:: + + epoch = Epoch(2000, 1, 1.0) + + e = Mercury.perihelion_aphelion(epoch) + + y, m, d, h, mi, s = e.get_full_date() + + peri = str(y) + '/' + str(m) + '/' + str(d) + ' at ' + str(h) + ' hours' + + print_me("The Perihelion closest to 2000/1/1 happened on", peri) + + # The Perihelion closest to 2000/1/1 happened on: 2000/2/15 at 18 hours + +Compute the time of passage through an ascending node:: + + epoch = Epoch(2019, 1, 1) + + time, r = Mercury.passage_nodes(epoch) + + y, m, d = time.get_date() + + d = round(d, 1) + + print("Time of passage through ascending node: {}/{}/{}".format(y, m, d)) + + # Time of passage through ascending node: 2018/11/24.7 + + print("Radius vector at ascending node: {}".format(round(r, 4))) + + # Radius vector at ascending node: 0.3143 diff -Nru pymeeus-0.4.3+dfsg1/docs/source/examples/ex-Minor.rst pymeeus-0.5.11+dfsg1/docs/source/examples/ex-Minor.rst --- pymeeus-0.4.3+dfsg1/docs/source/examples/ex-Minor.rst 1970-01-01 00:00:00.000000000 +0000 +++ pymeeus-0.5.11+dfsg1/docs/source/examples/ex-Minor.rst 2018-12-06 10:09:58.000000000 +0000 @@ -0,0 +1,72 @@ +Minor examples +************** + +Let's define a small helper function:: + + def print_me(msg, val): + + print("{}: {}".format(msg, val)) + +Let's compute the equatorial coordinates of comet Encke:: + + a = 2.2091404 + + e = 0.8502196 + + q = a * (1.0 - e) + + i = Angle(11.94524) + + omega = Angle(334.75006) + + w = Angle(186.23352) + + t = Epoch(1990, 10, 28.54502) + + epoch = Epoch(1990, 10, 6.0) + + minor = Minor(q, e, i, omega, w, t) + + ra, dec, elong = minor.geocentric_position(epoch) + + print_me("Right ascension", ra.ra_str(n_dec=1)) + + # Right ascension: 10h 34' 13.7'' + + print_me("Declination", dec.dms_str(n_dec=0)) + + # Declination: 19d 9' 32.0'' + + print_me("Elongation", round(elong, 2)) + + # Elongation: 40.51 + +Now compute the heliocentric ecliptical coordinates:: + + a = 2.2091404 + + e = 0.8502196 + + q = a * (1.0 - e) + + i = Angle(11.94524) + + omega = Angle(334.75006) + + w = Angle(186.23352) + + t = Epoch(1990, 10, 28.54502) + + epoch = Epoch(1990, 10, 6.0) + + minor = Minor(q, e, i, omega, w, t) + + lon, lat = minor.heliocentric_ecliptical_position(epoch) + + print_me("Heliocentric ecliptical longitude", lon.dms_str(n_dec=1)) + + # Heliocentric ecliptical longitude: 66d 51' 57.8'' + + print_me("Heliocentric ecliptical latitude", lat.dms_str(n_dec=1)) + + # Heliocentric ecliptical latitude: 11d 56' 14.4'' diff -Nru pymeeus-0.4.3+dfsg1/docs/source/examples/ex-Moon.rst pymeeus-0.5.11+dfsg1/docs/source/examples/ex-Moon.rst --- pymeeus-0.4.3+dfsg1/docs/source/examples/ex-Moon.rst 1970-01-01 00:00:00.000000000 +0000 +++ pymeeus-0.5.11+dfsg1/docs/source/examples/ex-Moon.rst 2021-03-14 17:41:04.000000000 +0000 @@ -0,0 +1,242 @@ +Moon examples +************* + +Let's define a small helper function:: + + def print_me(msg, val): + + print("{}: {}".format(msg, val)) + +Let's now compute the Moon geocentric ecliptical position for a given epoch:: + + epoch = Epoch(1992, 4, 12.0) + + Lambda, Beta, Delta, ppi = Moon.geocentric_ecliptical_pos(epoch) + + print_me("Longitude (Lambda)", round(Lambda, 6)) + + # Longitude (Lambda): 133.162655 + + print_me("Latitude (Beta)", round(Beta, 6)) + + # Latitude (Beta): -3.229126 + + print_me("Distance (Delta)", round(Delta, 1)) + + # Distance (Delta): 368409.7 + + print_me("Equatorial horizontal parallax (Pi)", round(ppi, 6)) + + # Equatorial horizontal parallax (Pi): 0.99199 + +Now let's compute the apparent ecliptical position:: + + epoch = Epoch(1992, 4, 12.0) + + Lambda, Beta, Delta, ppi = Moon.apparent_ecliptical_pos(epoch) + + print_me("Longitude (Lambda)", round(Lambda, 6)) + + # Longitude (Lambda): 133.167264 + + print_me("Latitude (Beta)", round(Beta, 6)) + + # Latitude (Beta): -3.229126 + + print_me("Distance (Delta)", round(Delta, 1)) + + # Distance (Delta): 368409.7 + + print_me("Equatorial horizontal parallax (Pi)", round(ppi, 6)) + + # Equatorial horizontal parallax (Pi): 0.99199 + +Get the apparent equatorial position:: + + epoch = Epoch(1992, 4, 12.0) + + ra, dec, Delta, ppi = Moon.apparent_equatorial_pos(epoch) + + print_me("Right Ascension (ra)", round(ra, 6)) + + # Right Ascension (ra): 134.688469 + + print_me("Declination (dec)", round(dec, 6)) + + # Declination (dec): 13.768367 + + print_me("Distance (Delta)", round(Delta, 1)) + + # Distance (Delta): 368409.7 + + print_me("Equatorial horizontal parallax (Pi)", round(ppi, 6)) + + # Equatorial horizontal parallax (Pi): 0.99199 + +Compute the longitude of the Moon's mean ascending node:: + + epoch = Epoch(1913, 5, 27.0) + + Omega = Moon.longitude_mean_ascending_node(epoch) + + print_me("Longitude of the mean ascending node", round(Omega, 1)) + + # Longitude of the mean ascending node: 0.0 + + epoch = Epoch(1959, 12, 7.0) + + Omega = Moon.longitude_mean_ascending_node(epoch) + + print_me("Longitude of the mean ascending node", round(Omega, 1)) + + # Longitude of the mean ascending node: 180.0 + +Get the longitude of the Moonś true ascending node:: + + epoch = Epoch(1913, 5, 27.0) + + Omega = Moon.longitude_true_ascending_node(epoch) + + print_me("Longitude of the true ascending node", round(Omega, 4)) + + # Longitude of the true ascending node: 0.8763 + +Compute the longitude of the Moon's mean perigee:: + + epoch = Epoch(2021, 3, 5.0) + + Pi = Moon.longitude_mean_perigee(epoch) + + print_me("Longitude of the mean perigee", round(Pi, 5)) + + # Longitude of the mean perigee: 224.89194 + +Compute the approximate illuminated fraction of the Moon's disk:: + + epoch = Epoch(1992, 4, 12.0) + + k = Moon.illuminated_fraction_disk(epoch) + + print_me("Approximate illuminated fraction of Moon's disk", round(k, 2)) + + # Approximate illuminated fraction of Moon's disk: 0.68 + +Compute the position angle of the bright limb of the Moon:: + + epoch = Epoch(1992, 4, 12.0) + + xi = Moon.position_bright_limb(epoch) + + print_me("Position angle of the bright limb of the Moon", round(xi, 1)) + + # Position angle of the bright limb of the Moon: 285.0 + +Calculate the instant of a New Moon:: + + epoch = Epoch(1977, 2, 15.0) + + new_moon = Moon.moon_phase(epoch, target="new") + + y, m, d, h, mi, s = new_moon.get_full_date() + + print("New Moon: {}/{}/{} {}:{}:{}".format(y, m, d, h, mi, round(s))) + + # New Moon: 1977/2/18 3:37:42 + +Calculate the time of a Last Quarter:: + + epoch = Epoch(2044, 1, 15.0) + + new_moon = Moon.moon_phase(epoch, target="last") + + y, m, d, h, mi, s = new_moon.get_full_date() + + print("Last Quarter: {}/{}/{} {}:{}:{}".format(y, m, d, h, mi, round(s))) + + # Last Quarter: 2044/1/21 23:48:17 + +Compute the time and parallax of apogee:: + + epoch = Epoch(1988, 10, 1.0) + + apogee, parallax = Moon.moon_perigee_apogee(epoch, target="apogee") + + y, m, d, h, mi, s = apogee.get_full_date() + + print("Apogee epoch: {}/{}/{} {}:{}".format(y, m, d, h, mi)) + + # Apogee epoch: 1988/10/7 20:30 + + print_me("Equatorial horizontal parallax", parallax.dms_str(n_dec=3)) + + # Equatorial horizontal parallax: 54' 0.679'' + +Compute the time of passage by the ascending node:: + + epoch = Epoch(1987, 5, 15.0) + + passage = Moon.moon_passage_nodes(epoch, target="ascending") + + y, m, d, h, mi, s = passage.get_full_date() + + mi += s/60.0 + + print("Passage by the ascending node: {}/{}/{} {}:{}".format(y, m, d, h, round(mi))) + + # Passage by the ascending node: 1987/5/23 6:26 + +Compute the epoch and amplitude of maximum southern declination:: + + epoch = Epoch(2049, 4, 15.0) + + epo, dec = Moon.moon_maximum_declination(epoch, target='southern') + + y, m, d, h, mi, s = epo.get_full_date() + + print("Epoch of maximum declination: {}/{}/{} {}:{}".format(y, m, d, h, mi)) + + # Epoch of maximum declination: 2049/4/21 14:0 + + print_me("Amplitude of maximum declination", dec.dms_str(n_dec=0)) + + # Amplitude of maximum declination: -22d 8' 18.0'' + +Compute the librations of the Moon:: + + epoch = Epoch(1992, 4, 12.0) + + lopt, bopt, lphys, bphys, ltot, btot = Moon.moon_librations(epoch) + + print_me("Optical libration in longitude", round(lopt, 3)) + + # Optical libration in longitude: -1.206 + + print_me("Optical libration in latitude", round(bopt, 3)) + + # Optical libration in latitude: 4.194 + + print_me("Physical libration in longitude", round(lphys, 3)) + + # Physical libration in longitude: -0.025 + + print_me("Physical libration in latitude", round(bphys, 3)) + + # Physical libration in latitude: 0.006 + + print_me("Total libration in longitude", round(lphys, 2)) + + # Total libration in longitude: -1.23 + + print_me("Total libration in latitude", round(bphys, 3)) + + # Total libration in latitude: 4.2 + +Let's calculate the position angle of the Moon's axis of rotation:: + + epoch = Epoch(1992, 4, 12.0) + + p = Moon.moon_position_angle_axis(epoch) + + print_me("Position angle of Moon's axis of rotation", round(p, 2)) + + # Position angle of Moon's axis of rotation: 15.08 diff -Nru pymeeus-0.4.3+dfsg1/docs/source/examples/ex-Neptune.rst pymeeus-0.5.11+dfsg1/docs/source/examples/ex-Neptune.rst --- pymeeus-0.4.3+dfsg1/docs/source/examples/ex-Neptune.rst 1970-01-01 00:00:00.000000000 +0000 +++ pymeeus-0.5.11+dfsg1/docs/source/examples/ex-Neptune.rst 2018-12-14 14:23:02.000000000 +0000 @@ -0,0 +1,106 @@ +Neptune examples +**************** + +Let's define a small helper function:: + + def print_me(msg, val): + + print("{}: {}".format(msg, val)) + +We can compute the geometric heliocentric position for a given epoch:: + + epoch = Epoch(2018, 10, 27.0) + + lon, lat, r = Neptune.geometric_heliocentric_position(epoch) + + print_me("Geometric Heliocentric Longitude", lon.to_positive()) + + # Geometric Heliocentric Longitude: 345.3776 + + print_me("Geometric Heliocentric Latitude", lat) + + # Geometric Heliocentric Latitude: -0.9735 + + print_me("Radius vector", r) + + # Radius vector: 29.93966 + +Compute the geocentric position for 1992/12/20:: + + epoch = Epoch(1992, 12, 20.0) + + ra, dec, elon = Neptune.geocentric_position(epoch) + + print_me("Right ascension", ra.ra_str(n_dec=1)) + + # Right ascension: 19h 17' 14.5'' + + print_me("Declination", dec.dms_str(n_dec=1)) + + # Declination: -21d 34' 15.1'' + + print_me("Elongation", elon.dms_str(n_dec=1)) + + # Elongation: 19d 44' 59.6'' + +Print mean orbital elements for Neptune at 2065.6.24:: + + epoch = Epoch(2065, 6, 24.0) + + l, a, e, i, ome, arg = Neptune.orbital_elements_mean_equinox(epoch) + + print_me("Mean longitude of the planet", round(l, 6)) + + # Mean longitude of the planet: 88.321947 + + print_me("Semimajor axis of the orbit (UA)", round(a, 8)) + + # Semimajor axis of the orbit (UA): 30.11038676 + + print_me("Eccentricity of the orbit", round(e, 7)) + + # Eccentricity of the orbit: 0.0094597 + + print_me("Inclination on plane of the ecliptic", round(i, 6)) + + # Inclination on plane of the ecliptic: 1.763855 + + print_me("Longitude of the ascending node", round(ome, 5)) + + # Longitude of the ascending node: 132.46986 + + print_me("Argument of the perihelion", round(arg, 6)) + + # Argument of the perihelion: -83.415521 + +Compute the time of the conjunction close to 1993/10/1:: + + epoch = Epoch(1993, 10, 1.0) + + conj = Neptune.conjunction(epoch) + + y, m, d = conj.get_date() + + d = round(d, 4) + + date = "{}/{}/{}".format(y, m, d) + + print_me("Conjunction date", date) + + # Conjunction date: 1994/1/11.3057 + +Compute the time of the opposition close to 1846/8/1:: + + epoch = Epoch(1846, 8, 1) + + oppo = Neptune.opposition(epoch) + + y, m, d = oppo.get_date() + + d = round(d, 4) + + date = "{}/{}/{}".format(y, m, d) + + print_me("Opposition date", date) + + # Opposition date: 1846/8/20.1623 diff -Nru pymeeus-0.4.3+dfsg1/docs/source/examples/ex-Pluto.rst pymeeus-0.5.11+dfsg1/docs/source/examples/ex-Pluto.rst --- pymeeus-0.4.3+dfsg1/docs/source/examples/ex-Pluto.rst 1970-01-01 00:00:00.000000000 +0000 +++ pymeeus-0.5.11+dfsg1/docs/source/examples/ex-Pluto.rst 2018-12-14 14:34:56.000000000 +0000 @@ -0,0 +1,40 @@ +Pluto examples +************** + +Let's define a small helper function:: + + def print_me(msg, val): + + print("{}: {}".format(msg, val)) + +We can compute the geometric heliocentric position for a given epoch:: + + epoch = Epoch(2018, 10, 27.0) + + lon, lat, r = Pluto.geometric_heliocentric_position(epoch) + + print_me("Geometric Heliocentric Longitude", lon.to_positive()) + + # Geometric Heliocentric Longitude: 232.740711423 + + print_me("Geometric Heliocentric Latitude", lat) + + # Geometric Heliocentric Latitude: 14.5878173017 + + print_me("Radius vector", r) + + # Radius vector: 29.711110981 + +Compute the geocentric position for 1992/12/20:: + + epoch = Epoch(1992, 12, 20.0) + + ra, dec, elon = Pluto.geocentric_position(epoch) + + print_me("Right ascension", ra.ra_str(n_dec=1)) + + # Right ascension: 15h 31' 43.7'' + + print_me("Declination", dec.dms_str(n_dec=1)) + + # Declination: -4d 27' 28.8'' diff -Nru pymeeus-0.4.3+dfsg1/docs/source/examples/ex-Saturn.rst pymeeus-0.5.11+dfsg1/docs/source/examples/ex-Saturn.rst --- pymeeus-0.4.3+dfsg1/docs/source/examples/ex-Saturn.rst 1970-01-01 00:00:00.000000000 +0000 +++ pymeeus-0.5.11+dfsg1/docs/source/examples/ex-Saturn.rst 2021-02-28 16:36:29.000000000 +0000 @@ -0,0 +1,236 @@ +Saturn examples +*************** + +Let's define a small helper function:: + + def print_me(msg, val): + + print("{}: {}".format(msg, val)) + +We can compute the geometric heliocentric position for a given epoch:: + + epoch = Epoch(2018, 10, 27.0) + + lon, lat, r = Saturn.geometric_heliocentric_position(epoch) + + print_me("Geometric Heliocentric Longitude", lon.to_positive()) + + # Geometric Heliocentric Longitude: 279.5108 + + print_me("Geometric Heliocentric Latitude", lat) + + # Geometric Heliocentric Latitude: 0.6141 + + print_me("Radius vector", r) + + # Radius vector: 10.06266 + +Compute the geocentric position for 1992/12/20:: + + epoch = Epoch(1992, 12, 20.0) + + ra, dec, elon = Saturn.geocentric_position(epoch) + + print_me("Right ascension", ra.ra_str(n_dec=1)) + + # Right ascension: 21h 11' 41.8'' + + print_me("Declination", dec.dms_str(n_dec=1)) + + # Declination: -17d 15' 40.8'' + + print_me("Elongation", elon.dms_str(n_dec=1)) + + # Elongation: 46d 51' 47.7'' + +Print mean orbital elements for Saturn at 2065.6.24:: + + epoch = Epoch(2065, 6, 24.0) + + l, a, e, i, ome, arg = Saturn.orbital_elements_mean_equinox(epoch) + + print_me("Mean longitude of the planet", round(l, 6)) + + # Mean longitude of the planet: 131.196871 + + print_me("Semimajor axis of the orbit (UA)", round(a, 8)) + + # Semimajor axis of the orbit (UA): 9.55490779 + + print_me("Eccentricity of the orbit", round(e, 7)) + + # Eccentricity of the orbit: 0.0553209 + + print_me("Inclination on plane of the ecliptic", round(i, 6)) + + # Inclination on plane of the ecliptic: 2.486426 + + print_me("Longitude of the ascending node", round(ome, 5)) + + # Longitude of the ascending node: 114.23974 + + print_me("Argument of the perihelion", round(arg, 6)) + + # Argument of the perihelion: -19.896331 + +Compute the time of the conjunction close to 2125/6/1:: + + epoch = Epoch(2125, 6, 1.0) + + conj = Saturn.conjunction(epoch) + + y, m, d = conj.get_date() + + d = round(d, 4) + + date = "{}/{}/{}".format(y, m, d) + + print_me("Conjunction date", date) + + # Conjunction date: 2125/8/26.4035 + +Compute the time of the opposition close to -6/9/1:: + + epoch = Epoch(-6, 9, 1.0) + + oppo = Saturn.opposition(epoch) + + y, m, d = oppo.get_date() + + d = round(d, 4) + + date = "{}/{}/{}".format(y, m, d) + + print_me("Opposition date", date) + + # Opposition date: -6/9/14.3709 + +Compute the time of the station in longitude #1 close to 2018/11/1:: + + epoch = Epoch(2018, 11, 1.0) + + sta1 = Saturn.station_longitude_1(epoch) + + y, m, d = sta1.get_date() + + d = round(d, 4) + + date = "{}/{}/{}".format(y, m, d) + + print_me("Date of station in longitude #1", date) + + # Date of station in longitude #1: 2018/4/17.9433 + +Compute the time of the station in longitude #2 close to 2018/11/1:: + + epoch = Epoch(2018, 11, 1.0) + + sta2 = Saturn.station_longitude_2(epoch) + + y, m, d = sta2.get_date() + + d = round(d, 4) + + date = "{}/{}/{}".format(y, m, d) + + print_me("Date of station in longitude #2", date) + + # Date of station in longitude #2: 2018/9/6.4175 + +Find the epoch of the Perihelion closer to 2000/1/1:: + + epoch = Epoch(2000, 1, 1.0) + + e = Saturn.perihelion_aphelion(epoch) + + y, m, d, h, mi, s = e.get_full_date() + + peri = str(y) + '/' + str(m) + '/' + str(d) + ' at ' + str(h) + ' hours' + + print_me("The Perihelion closest to 2000/1/1 happened on", peri) + + # The Perihelion closest to 2000/1/1 happened on: 2003/7/26 at 15 hours + +Compute the time of passage through an ascending node:: + + epoch = Epoch(2019, 1, 1) + + time, r = Saturn.passage_nodes(epoch) + + y, m, d = time.get_date() + + d = round(d, 1) + + print("Time of passage through ascending node: {}/{}/{}".format(y, m, d)) + + # Time of passage through ascending node: 2034/5/30.2 + + print_me("Radius vector at ascending node", round(r, 4)) + + # Radius vector at ascending node: 9.0546 + +Compute the approximate magnitude of Saturn:: + + sun_dist = 9.867882 + + earth_dist = 10.464606 + + delta_u = Angle(16.442) + + b = Angle(4.198) + + m = Saturn.magnitude(sun_dist, earth_dist, delta_u, b) + + printi_me("Approximate magnitude of Saturn", m) + + # Approximate magnitude of Saturn: 1.9 + +Compute the ring inclination:: + + epoch = Epoch(1992, 12, 16.00068) + + i = Saturn.ring_inclination(epoch) + + print_me("Saturn's ring inclination", round(i, 6)) + + # Saturn's ring inclination: 28.076131 + +Compute the longitude of the ascending node of the ring:: + + epoch = Epoch(1992, 12, 16.00068) + + omega = Saturn.ring_logitude_ascending_node(epoch) + + print_me("Saturn's ring longitude of the ascending node", round(omega, 6)) + + # Saturn's ring longitude of the ascending node: 169.410243 + +Compute the parameters related to the ring:: + + epoch = Epoch(1992, 12, 16.00068) + + B, Bprime, P, delta_U, a, b = Saturn.ring_parameters(epoch) + + print_me("Saturnicentric latitude of the Earth", round(B, 3)) + + # Saturnicentric latitude of the Earth: 16.442 + + print_me("Saturnicentric latitude of the Sun", round(Bprime, 3)) + + # Saturnicentric latitude of the Sun: 14.679 + + print_me("Geocentric position angle of nothern semiminor axis", round(P, 3)) + + # Geocentric position angle of nothern semiminor axis: 6.741 + + print_me("Difference in Saturnicentric longitudes of Sun and Earth", round(delta_U, 3)) + + # Difference in Saturnicentric longitudes of Sun and Earth: 4.198 + + print_me("Size of major axis of outer ring", round(a, 2)) + + # Size of major axis of outer ring: 35.87 + + print_me("Size of minor axis of outer ring", round(b, 2)) + + # Size of minor axis of outer ring: 10.15 diff -Nru pymeeus-0.4.3+dfsg1/docs/source/examples/ex-Sun.rst pymeeus-0.5.11+dfsg1/docs/source/examples/ex-Sun.rst --- pymeeus-0.4.3+dfsg1/docs/source/examples/ex-Sun.rst 1970-01-01 00:00:00.000000000 +0000 +++ pymeeus-0.5.11+dfsg1/docs/source/examples/ex-Sun.rst 2018-12-06 10:09:58.000000000 +0000 @@ -0,0 +1,206 @@ +Sun examples +************ + +Let's define a small helper function:: + + def print_me(msg, val): + + print("{}: {}".format(msg, val)) + +It is possible to compute an approximation of the Sun's **true** ecliptical longitude:: + + epoch = Epoch(1992, 10, 13) + + true_lon, r = Sun.true_longitude_coarse(epoch) + + print_me("Sun's approximate true longitude", true_lon.dms_str(n_dec=0)) + + # Sun's approximate true longitude: 199d 54' 36.0'' + + print_me("Sun's radius vector", round(r, 5)) + + # Sun's radius vector: 0.99766 + +Now let's compute the Sun's approximate **apparent** ecliptical longitude:: + + epoch = Epoch(1992, 10, 13) + + app_lon, r = Sun.apparent_longitude_coarse(epoch) + + print_me("Sun's approximate apparent longitude", app_lon.dms_str(n_dec=0)) + + # Sun's approximate apparent longitude: 199d 54' 32.0'' + +And now is the turn for the **apparent** right ascension and declination:: + + epoch = Epoch(1992, 10, 13) + + ra, delta, r = Sun.apparent_rightascension_declination_coarse(epoch) + + print_me("Sun's apparent right ascension", ra.ra_str(n_dec=1)) + + # Sun's apparent right ascension: 13h 13' 31.4'' + + print_me("Sun's apparent declination", delta.dms_str(n_dec=0)) + + # Sun's apparent declination: -7d 47' 6.0'' + +Now, let's compute Sun's true (**geometric**) position again, but more accurately:: + + epoch = Epoch(1992, 10, 13.0) + + l, b, r = Sun.geometric_geocentric_position(epoch, toFK5=False) + + print_me("Geometric Geocentric Longitude", round(l.to_positive(), 6)) + + # Geometric Geocentric Longitude: 199.907297 + + print_me("Geometric Geocentric Latitude", b.dms_str(n_dec=3)) + + # Geometric Geocentric Latitude: 0.744'' + + print_me("Radius vector", round(r, 8)) + + # Radius vector: 0.99760852 + +Compute Sun's **apparent** postion accurately:: + + epoch = Epoch(1992, 10, 13.0) + + l, b, r = Sun.apparent_geocentric_position(epoch) + + print_me("Apparent Geocentric Longitude", l.to_positive().dms_str(n_dec=3)) + + # Apparent Geocentric Longitude: 199d 54' 21.548'' + + print_me("Apparent Geocentric Latitude", b.dms_str(n_dec=3)) + + # Apparent Geocentric Latitude; 0.721'' + + print_me("Radius vector", round(r, 8)) + + # Radius vector: 0.99760852 + +We can compute rectangular coordinates referred to mean equinox of date:: + + epoch = Epoch(1992, 10, 13.0) + + x, y, z = Sun.rectangular_coordinates_mean_equinox(epoch) + + print_me("X", round(x, 7)) + + # X: -0.9379963 + + print_me("Y", round(y, 6)) + + # Y: -0.311654 + + print_me("Z", round(z, 7)) + + # Z: -0.1351207 + +Now, compute rectangular coordinates w.r.t. standard equinox J2000.0:: + + epoch = Epoch(1992, 10, 13.0) + + x, y, z = Sun.rectangular_coordinates_j2000(epoch) + + print_me("X", round(x, 8)) + + # X: -0.93740485 + + print_me("Y", round(y, 8)) + + # Y: -0.3131474 + + print_me("Z", round(z, 8)) + + # Z: -0.12456646 + +Compute rectangular coordinates w.r.t. mean equinox of B1950.0:: + + epoch = Epoch(1992, 10, 13.0) + + x, y, z = Sun.rectangular_coordinates_b1950(epoch) + + print_me("X", round(x, 8)) + + # X: -0.94149557 + + print_me("Y", round(y, 8)) + + # Y: -0.30259922 + + print_me("Z", round(z, 8)) + + # Z: -0.11578695 + +And compute rectangular coordinates w.r.t. an arbitrary mean equinox:: + + epoch = Epoch(1992, 10, 13.0) + + e_equinox = Epoch(2467616.0) + + x, y, z = Sun.rectangular_coordinates_equinox(epoch, e_equinox) + + print_me("X", round(x, 8)) + + # X: -0.93373777 + + print_me("Y", round(y, 8)) + + # Y: -0.32235109 + + print_me("Z", round(z, 8)) + + # Z: -0.12856709 + +It is possible to compute the date of equinoxes and solstices:: + + epoch = Sun.get_equinox_solstice(1962, target="summer") + + y, m, d, h, mi, s = epoch.get_full_date() + + print("The summer solstice of 1962:") + + print("{}/{}/{} {}:{}:{}".format(y, m, d, h, mi, round(s, 0))) + + # 1962/6/21 21:24:42.0 + +The equation of time, i.e., the difference between apparent and mean time, can be easily computed:: + + epoch = Epoch(1992, 10, 13.0) + + m, s = Sun.equation_of_time(epoch) + + print("Equation of time difference: {} min {} secs".format(m, round(s, 1))) + + # Equation of time difference: 13 min 42.6 secs + +Compute the ephemeris of physical observations of the Sun using Carrington's formulas:: + + epoch = Epoch(1992, 10, 13) + + p, b0, l0 = Sun.ephemeris_physical_observations(epoch) + + print("Ephemeris of physical observations of the Sun:") + + print_me("P ", round(p, 2)) + + # P : 26.27 + + print_me("B0", round(b0, 2)) + + # B0: 5.99 + + print_me("L0", round(l0, 2)) + + # L0: 238.63 + +Get the epoch when the Carrington's synodic rotation No. 'number' starts:: + + epoch = Sun.beginning_synodic_rotation(1699) + + print_me("Epoch for Carrington's synodic rotation No. 1699", round(epoch(), 3)) + + # Epoch for Carrington's synodic rotation No. 1699: 2444480.723 diff -Nru pymeeus-0.4.3+dfsg1/docs/source/examples/ex-Uranus.rst pymeeus-0.5.11+dfsg1/docs/source/examples/ex-Uranus.rst --- pymeeus-0.4.3+dfsg1/docs/source/examples/ex-Uranus.rst 1970-01-01 00:00:00.000000000 +0000 +++ pymeeus-0.5.11+dfsg1/docs/source/examples/ex-Uranus.rst 2019-04-28 08:46:54.000000000 +0000 @@ -0,0 +1,138 @@ +Uranus examples +*************** + +Let's define a small helper function:: + + def print_me(msg, val): + + print("{}: {}".format(msg, val)) + +We can compute the geometric heliocentric position for a given epoch:: + + epoch = Epoch(2018, 10, 27.0) + + lon, lat, r = Uranus.geometric_heliocentric_position(epoch) + + print_me("Geometric Heliocentric Longitude", lon.to_positive()) + + # Geometric Heliocentric Longitude: 30.5888 + + print_me("Geometric Heliocentric Latitude", lat) + + # Geometric Heliocentric Latitude: -0.5315 + + print_me("Radius vector", r) + + # Radius vector: 19.86964 + +Compute the geocentric position for 1992/12/20:: + + epoch = Epoch(1992, 12, 20.0) + + ra, dec, elon = Uranus.geocentric_position(epoch) + + print_me("Right ascension", ra.ra_str(n_dec=1)) + + # Right ascension: 19h 13' 48.7'' + + print_me("Declination", dec.dms_str(n_dec=1)) + + # Declination: -22d 46' 13.0'' + + print_me("Elongation", elon.dms_str(n_dec=1)) + + # Elongation: 18d 44' 18.7'' + +Print mean orbital elements for Uranus at 2065.6.24:: + + epoch = Epoch(2065, 6, 24.0) + + l, a, e, i, ome, arg = Uranus.orbital_elements_mean_equinox(epoch) + + print_me("Mean longitude of the planet", round(l, 6)) + + # Mean longitude of the planet: 235.517526 + + print_me("Semimajor axis of the orbit (UA)", round(a, 8)) + + # Semimajor axis of the orbit (UA): 19.21844604 + + print_me("Eccentricity of the orbit", round(e, 7)) + + # Eccentricity of the orbit: 0.0463634 + + print_me("Inclination on plane of the ecliptic", round(i, 6)) + + # Inclination on plane of the ecliptic: 0.77372 + + print_me("Longitude of the ascending node", round(ome, 5)) + + # Longitude of the ascending node: 74.34776 + + print_me("Argument of the perihelion", round(arg, 6)) + + # Argument of the perihelion: 99.630865 + +Compute the time of the conjunction close to 1993/10/1:: + + epoch = Epoch(1993, 10, 1.0) + + conj = Uranus.conjunction(epoch) + + y, m, d = conj.get_date() + + d = round(d, 4) + + date = "{}/{}/{}".format(y, m, d) + + print_me("Conjunction date", date) + + # Conjunction date: 1994/1/12.7365 + +Compute the time of the opposition close to 1780/12/1:: + + epoch = Epoch(1780, 12, 1.0) + + oppo = Uranus.opposition(epoch) + + y, m, d = oppo.get_date() + + d = round(d, 4) + + date = "{}/{}/{}".format(y, m, d) + + print_me("Opposition date", date) + + # Opposition date: 1780/12/17.5998 + +Find the epoch of the Perihelion closer to 1780/1/1:: + + epoch = Epoch(1780, 1, 1.0) + + e = Uranus.perihelion_aphelion(epoch) + + y, m, d = e.get_date() + + peri = str(y) + '/' + str(m) + '/' + str(int(d)) + + print_me("The Perihelion closest to 1780/1/1 happened on", peri) + + # The Perihelion closest to 1780/1/1 happened on: 1798/2/26 + +Compute the time of passage through an ascending node:: + + epoch = Epoch(2019, 1, 1) + + time, r = Uranus.passage_nodes(epoch) + + y, m, d = time.get_date() + + d = round(d, 1) + + print("Time of passage through ascending node: {}/{}/{}".format(y, m, d)) + + # Time of passage through ascending node: 2028/8/23.2 + + print("Radius vector at ascending node: {}".format(round(r, 4))) + + # Radius vector at ascending node: 19.3201 diff -Nru pymeeus-0.4.3+dfsg1/docs/source/examples/ex-Venus.rst pymeeus-0.5.11+dfsg1/docs/source/examples/ex-Venus.rst --- pymeeus-0.4.3+dfsg1/docs/source/examples/ex-Venus.rst 1970-01-01 00:00:00.000000000 +0000 +++ pymeeus-0.5.11+dfsg1/docs/source/examples/ex-Venus.rst 2019-04-28 08:46:54.000000000 +0000 @@ -0,0 +1,238 @@ +Venus examples +************** + +Let's define a small helper function:: + + def print_me(msg, val): + + print("{}: {}".format(msg, val)) + +We can compute the geometric heliocentric position for a given epoch:: + + epoch = Epoch(1992, 12, 20.0) + + lon, lat, r = Venus.geometric_heliocentric_position(epoch) + + print_me("Geometric Heliocentric Longitude", round(lon.to_positive(), 5)) + + # Geometric Heliocentric Longitude: 26.11428 + + print_me("Geometric Heliocentric Latitude", round(lat, 4)) + + # Geometric Heliocentric Latitude: -2.6207 + + print_me("Radius vector", round(r, 6)) + + # Radius vector: 0.724603 + +Compute the geocentric position for 1992/12/20:: + + epoch = Epoch(1992, 12, 20.0) + + ra, dec, elon = Venus.geocentric_position(epoch) + + print_me("Right ascension", ra.ra_str(n_dec=1)) + + # Right ascension: 21h 4' 41.5'' + + print_me("Declination", dec.dms_str(n_dec=1)) + + # Declination: -18d 53' 16.8'' + + print_me("Elongation", elon.dms_str(n_dec=1)) + + # Elongation: 44d 46' 8.9'' + +Print mean orbital elements for Venus at 2065.6.24:: + + epoch = Epoch(2065, 6, 24.0) + + l, a, e, i, ome, arg = Venus.orbital_elements_mean_equinox(epoch) + + print_me("Mean longitude of the planet", round(l, 6)) + + # Mean longitude of the planet: 338.646306 + + print_me("Semimajor axis of the orbit (UA)", round(a, 8)) + + # Semimajor axis of the orbit (UA): 0.72332982 + + print_me("Eccentricity of the orbit", round(e, 7)) + + # Eccentricity of the orbit: 0.0067407 + + print_me("Inclination on plane of the ecliptic", round(i, 6)) + + # Inclination on plane of the ecliptic: 3.395319 + + print_me("Longitude of the ascending node", round(ome, 5)) + + # Longitude of the ascending node: 77.27012 + + print_me("Argument of the perihelion", round(arg, 6)) + + # Argument of the perihelion: 55.211257 + +Compute the time of the inferior conjunction close to 1882/12/1.0:: + + epoch = Epoch(1882, 12, 1.0) + + conjunction = Venus.inferior_conjunction(epoch) + + y, m, d = conjunction.get_date() + + d = round(d, 4) + + date = "{}/{}/{}".format(y, m, d) + + print_me("Inferior conjunction date", date) + + # Inferior conjunction date: 1882/12/6.6912 + +Compute the time of the superior conjunction close to 1993/10/1:: + + epoch = Epoch(1993, 10, 1.0) + + conjunction = Venus.superior_conjunction(epoch) + + y, m, d = conjunction.get_date() + + d = round(d, 4) + + date = "{}/{}/{}".format(y, m, d) + + print_me("Superior conjunction date", date) + + # Superior conjunction date: 1994/1/17.0465 + +Compute the time and angle of the western elongation close to 2019/1/1:: + + epoch = Epoch(2019, 1, 1.0) + + time, elongation = Venus.western_elongation(epoch) + + y, m, d = time.get_date() + + d = round(d, 4) + + date = "{}/{}/{}".format(y, m, d) + + print_me("Western elongation date", date) + + # Western elongation date: 2019/1/6.1895 + + elong = round(elongation, 4) + + print_me("Maximum western elongation angle", elong) + + # Maximum western elongation angle: 46.9571 + +Compute the time and angle of the eastern elongation close to 2019/10/1:: + + epoch = Epoch(2019, 10, 1.0) + + time, elongation = Venus.eastern_elongation(epoch) + + y, m, d = time.get_date() + + d = round(d, 4) + + date = "{}/{}/{}".format(y, m, d) + + print_me("Eastern elongation date", date) + + # Eastern elongation date: 2020/3/24.9179 + + elong = round(elongation, 4) + + print_me("Maximum eastern elongation angle", elong) + + # Maximum eastern elongation angle: 46.078 + +Compute the time of the station in longitude #1 close to 2018/12/1:: + + epoch = Epoch(2018, 12, 1.0) + + sta1 = Venus.station_longitude_1(epoch) + + y, m, d = sta1.get_date() + + d = round(d, 4) + + date = "{}/{}/{}".format(y, m, d) + + print_me("Date of station in longitude #1", date) + + # Date of station in longitude #1: 2018/10/5.7908 + +Compute the time of the station in longitude #2 close to 2018/12/1:: + + epoch = Epoch(2018, 12, 1.0) + + sta2 = Venus.station_longitude_2(epoch) + + y, m, d = sta2.get_date() + + d = round(d, 4) + + date = "{}/{}/{}".format(y, m, d) + + print_me("Date of station in longitude #2", date) + + # Date of station in longitude #2: 2018/11/16.439 + +Find the epoch of the Perihelion closer to 1978/10/15:: + + epoch = Epoch(1978, 10, 15.0) + + e = Venus.perihelion_aphelion(epoch) + + y, m, d, h, mi, s = e.get_full_date() + + peri = str(y) + '/' + str(m) + '/' + str(d) + ' at ' + str(h) + ' hours' + + print_me("The Perihelion closest to 1978/10/15 happened on", peri) + + # The Perihelion closest to 1978/10/15 happened on: 1978/12/31 at 4 hours + +Compute the time of passage through an ascending node:: + + epoch = Epoch(1979, 1, 1) + + time, r = Venus.passage_nodes(epoch) + + y, m, d = time.get_date() + + d = round(d, 1) + + print("Time of passage through ascending node: {}/{}/{}".format(y, m, d)) + + # Time of passage through ascending node: 1978/11/27.4 + + print("Radius vector at ascending node: {}".format(round(r, 4))) + + # Radius vector at ascending node: 0.7205 + +Compute the (approximate) illuminated fraction of Venus disk for an Epoch:: + + epoch = Epoch(1992, 12, 20) + + k = Venus.illuminated_fraction(epoch) + + print_me("Approximate illuminated fraction of Venus", round(k, 2)) + + # Approximate illuminated fraction of Venus: 0.64 + +Compute the magnitude of Venus:: + + sun_dist = 0.724604 + + earth_dist = 0.910947 + + phase_angle = Angle(72.96) + + m = Venus.magnitude(sun_dist, earth_dist, phase_angle) + + print_me("Venus' magnitude", round(m, 1)) + + # Venus' magnitude: -3.8 diff -Nru pymeeus-0.4.3+dfsg1/docs/source/examples/index.rst pymeeus-0.5.11+dfsg1/docs/source/examples/index.rst --- pymeeus-0.4.3+dfsg1/docs/source/examples/index.rst 1970-01-01 00:00:00.000000000 +0000 +++ pymeeus-0.5.11+dfsg1/docs/source/examples/index.rst 2021-03-04 19:34:46.000000000 +0000 @@ -0,0 +1,27 @@ +.. PyMeeus documentation master file. + +Usage Examples +============== + +.. toctree:: + :maxdepth: 2 + + ex-Angle + ex-base + ex-Coordinates + ex-CurveFitting + ex-Earth + ex-Epoch + ex-Interpolation + ex-Jupiter + ex-JupiterMoons + ex-Mars + ex-Mercury + ex-Minor + ex-Moon + ex-Neptune + ex-Pluto + ex-Saturn + ex-Sun + ex-Uranus + ex-Venus diff -Nru pymeeus-0.4.3+dfsg1/docs/source/ex-Angle.rst pymeeus-0.5.11+dfsg1/docs/source/ex-Angle.rst --- pymeeus-0.4.3+dfsg1/docs/source/ex-Angle.rst 2021-03-03 01:28:56.000000000 +0000 +++ pymeeus-0.5.11+dfsg1/docs/source/ex-Angle.rst 1970-01-01 00:00:00.000000000 +0000 @@ -1,517 +0,0 @@ -Angle examples -************** - -Let's define a small helper function:: - - def print_me(msg, val): - - print("{}: {}".format(msg, val)) - -Create an Angle object, providing degrees, minutes and seconds:: - - a = Angle(-23.0, 26.0, 48.999983999) - -First we print using the ``__call__()`` method (note the extra parentheses):: - - print_me("The angle 'a()' is", a()) - - # The angle 'a()' is: -23.44694444 - -Second we print using the ``__str__()`` method (no extra parentheses needed):: - - print_me("The angle 'a' is", a) - - # The angle 'a' is: -23.44694444 - -Use the copy constructor:: - - b = Angle(a) - - print_me("Angle 'b', which is a copy of 'a', is", b) - - # Angle 'b', which is a copy of 'a', is: -23.44694444 - -Use the static ``deg2dms()`` method to carry out conversions:: - - d, m, s, sign = Angle.deg2dms(23.44694444) - - val = "{}d {}' {}''".format(int(sign*d), m, s) - - print_me("{Deg}d {Min}' {Sec}''", val) - - # {Deg}d {Min}' {Sec}'': 23d 26' 48.999984'' - -We can print Angle ``a`` directly in sexagesimal format. - -- In *fancy* format:: - - print_me("{Deg}d {Min}' {Sec}''", a.dms_str()) - - # {Deg}d {Min}' {Sec}'': -23d 26' 48.999983999'' - -- In plain format:: - - print_me("{Deg}:{Min}:{Sec}", a.dms_str(False)) - - # {Deg}:{Min}:{Sec}: -23:26:48.999983999 - -Print directly as a tuple:: - - a = Angle(23.44694444) - - print_me("a.dms_tuple()", a.dms_tuple()) - - # a.dms_tuple(): (23, 26, 48.999983999997596, 1.0) - - print_me("a.ra_tuple()", a.ra_tuple()) - - # a.ra_tuple(): (1, 33, 47.26666559999941, 1.0) - -Redefine Angle ``a`` several times:: - - a.set(-0.44694444) - - print_me(" a.dms_str()", a.dms_str()) - - # a.dms_str(): -26' 48.999984'' - - a.set(0, 0, -46.31) - - print_me(" a.dms_str(False)", a.dms_str(False)) - - # a.dms_str(False): 0:0:-46.31 - -We can use decimals in degrees/minutes. They are converted automatically:: - - a.set(0, -46.25, 0.0) - - print_me(" a.dms_str()", a.dms_str()) - - # a.dms_str(): -46' 15.0'' - - a.set(0, 0, 0.0) - - print_me(" a.dms_str()", a.dms_str()) - - # a.dms_str(): 0d 0' 0.0'' - -We can define the angle as in radians. It will be converted to degrees:: - - b = Angle(pi, radians=True) - - print_me("b = Angle(pi, radians=True); print(b)", b) - - # b = Angle(pi, radians=True); print(b): 180.0 - -And we can easily carry out the *degrees to radians* conversion:: - - print_me("print(b.rad())", b.rad()) - - # print(b.rad()): 3.14159265359 - -We can also specify the angle as a Right Ascension. Angle can be given as a Right Ascension: Hours, Minutes, Seconds:: - - a.set_ra(9, 14, 55.8) - - print_me(" print(a)", a) - - # print(a): 138.7325 - - b = Angle(9, 14, 55.8, ra=True) - - print_me(" print(b)", b) - - # print(b): 138.7325 - - -We can print the Angle as Right Ascension, as a float and as string:: - - a = Angle(138.75) - - print_me(" print(a.get_ra())", a.get_ra()) - - # print(a.get_ra()): 9.25 - - print_me(" print(a.ra_str())", a.ra_str()) - - # print(a.ra_str()): 9h 15' 0.0'' - - print_me(" print(a.ra_str(False))", a.ra_str(False)) - - # print(a.ra_str(False)): 9:15:0.0 - - -Use the ``to_positive()`` method to get the positive version of an angle:: - - a = Angle(-87.32) - - print_me(" print(a.to_positive())", a.to_positive()) - - # print(a.to_positive()): 272.68 - - -Call the ``__repr__()`` method to get a string defining the current object. This string can then be fed to the ``eval()`` function to generate the object:: - - print_me("print(b.__repr__())", b.__repr__()) - - # print(b.__repr__()): Angle(138.7325) - - c = eval(repr(b)) - - print_me("c = eval(repr(b)); print(c)", c) - - # c = eval(repr(b)); print(c): 138.7325 - -Let's now work with some useful operators and functions:: - - print_me("c", c) - - # c: 138.7325 - -- Negate an angle:: - - d = Angle(13, 30) - - print_me("d", d) - - # d: 13.5 - - e = -d - - print_me(" e = -d", e) - - # e = -d: -13.5 - -- Get the absolute value of an angle:: - - e = abs(e) - - print_me(" e = abs(e)", e) - - # e = abs(e): 13.5 - -- Module operation on an angle:: - - d = Angle(17.0) - - print_me("d", d) - - # d: 17.0 - - e = c % d - - print_me(" e = c % d", e) - - # e = c % d: 2.7325 - - -- Convert the angle to an integer:: - - d = Angle(13.95) - - print_me("d", d) - - # d: 13.95 - - print_me(" int(d)", int(d)) - - # int(d): 13 - - d = Angle(-4.95) - - print_me("d", d) - - # d: -4.95 - - print_me(" int(d)", int(d)) - - # int(d): -4 - -- Convert the angle to a float:: - - print_me(" float(d)", float(d)) - - # float(d): -4.95 - -- Round the angle to a float:: - - e = Angle(-4.951648) - - print_me("e", e) - - # e: -4.951648 - - print_me(" round(e)", round(e)) - - # round(e): -5.0 - - print_me(" round(e, 2)", round(e, 2)) - - # round(e, 2): -4.95 - - print_me(" round(e, 3)", round(e, 3)) - - # round(e, 3): -4.952 - - print_me(" round(e, 4)", round(e, 4)) - - # round(e, 4): -4.9516 - -- Comparison operators:: - - print_me(" d == e", d == e) - - # d == e: False - - print_me(" d != e", d != e) - - # d != e: True - - print_me(" d > e", d > e) - - # d > e: True - - print_me(" c >= 180.0", c >= 180.0) - - # c >= 180.0: False - - print_me(" c < 180.0", c < 180.0) - - # c < 180.0: True - - print_me(" c <= 180.0", c <= 180.0) - - # c <= 180.0: True - -- It is very easy to add Angles to obtain a new Angle:: - - e = c + d - - print_me(" c + d", e) - - # c + d: 133.7825 - - We can also directly add a decimal angle:: - - e = c + 11.5 - - print_me(" c + 11.5", e) - - # c + 11.5: 150.2325 - - Types allowed are int, float and Angle:: - - print('e = c + "32.5"') - - # e = c + "32.5" - - try: - - e = c + "32.5" - - except TypeError: - - print("TypeError!: Valid types are int, float, and Angle, not string!") - - # TypeError!: Valid types are int, float, and Angle, not string! - - -- Subtraction:: - - e = c - d - - print_me(" c - d", e) - - # c - d: 143.6825 - -- Multiplication:: - - c.set(150.0) - - d.set(5.0) - - print_me("c", c) - - # c: 150.0 - - print_me("d", d) - - # d: 5.0 - - e = c * d - - print_me(" c * d", e) - - # c * d: 30.0 - -- Division:: - - c.set(150.0) - - d.set(6.0) - - print_me("d", d) - - # d: 6.0 - - e = c / d - - print_me(" c / d", e) - - # c / d: 25.0 - - - Division by zero is not allowed:: - - d.set(0.0) - - print_me("d", d) - - # d: 0.0 - - print('e = c / d') - - # e = c / d - - try: - - e = c / d - - except ZeroDivisionError: - - print("ZeroDivisionError!: Division by zero is not allowed!") - - # ZeroDivisionError!: Division by zero is not allowed! - -- Power:: - - d.set(2.2) - - print_me("d", d) - - # d: 2.2 - - e = c ** d - - print_me(" c ** d", e) - - # c ** d: 91.5733670999 - - -- Accumulative module operation:: - - d.set(17.0) - - print_me("d", d) - - # d: 17.0 - - e %= d - - print_me(" e %= d", e) - - # e %= d: 6.57336709993 - -- Accumulative addition:: - - c += d - - print_me(" c += d", c) - - # c += d: 167.0 - -- Accumulative subtraction:: - - print_me("b", b) - - # b: 138.7325 - - c -= b - - print_me(" c -= b", c) - - # c -= b: 28.2675 - -- Accumulative multiplication:: - - print_me("b", b) - - # b: 138.7325 - - c *= b - - print_me(" c *= b", c) - - # c *= b: 321.62094375 - -- Accumulative division:: - - print_me("b", b) - - # 138.7325 - - d.set(6.0) - - print_me("d", d) - - # d: 6.0 - - b /= d - - print_me(" b /= d", b) - - # b /= d: 23.1220833333 - -- Accumulative power:: - - d.set(2.2) - - print_me("d", d) - - # d: 2.2 - - c = abs(c) - - print_me(" c = abs(c)", c) - - # c = abs(c): 321.62094375 - - c **= d - - print_me(" c **= d", c) - - # c **= d: 254.307104203 - - -The same operations, but by the right side:: - - e = 3.5 + b - - print_me(" e = 3.5 + b", e) - - # e = 3.5 + b: 26.6220833333 - - e = 3.5 - b - - print_me(" e = 3.5 - b", e) - - # e = 3.5 - b: -19.6220833333 - - e = 3.5 * b - - print_me(" e = 3.5 * b", e) - - # e = 3.5 * b: 80.9272916667 - - e = 3.5 / b - - print_me(" e = 3.5 / b", e) - - # e = 3.5 / b: 0.151370443119 - - e = 3.5 ** b - - print_me(" e = 3.5 ** b", e) - - # e = 3.5 ** b: 260.783691406 - diff -Nru pymeeus-0.4.3+dfsg1/docs/source/ex-base.rst pymeeus-0.5.11+dfsg1/docs/source/ex-base.rst --- pymeeus-0.4.3+dfsg1/docs/source/ex-base.rst 2021-03-03 01:28:56.000000000 +0000 +++ pymeeus-0.5.11+dfsg1/docs/source/ex-base.rst 1970-01-01 00:00:00.000000000 +0000 @@ -1,40 +0,0 @@ -Base examples -************* - -Let's define a small helper function:: - - def print_me(msg, val): - - print("{}: {}".format(msg, val)) - -Let's print the tolerance:: - - print_me("The default value for the tolerance is", TOL) - - The default value for the tolerance is: 1e-10 - -Find the accuracy of this computer:: - - j, d = machine_accuracy() - - - print_me("Number of significant BITS in the mantissa\t", j) - - Number of significant BITS in the mantissa : 52.0 - - - print_me("Number of significant DIGITS in a decimal number", d) - - Number of significant DIGITS in a decimal number: 15 - -Print the suffixes for some ordinal numbers:: - - print_me("The suffix for ordinal 2 is", get_ordinal_suffix(2)) - - The suffix for ordinal 2 is: nd - - - print_me("The suffix for ordinal 16 is", get_ordinal_suffix(16)) - - The suffix for ordinal 16 is: th - diff -Nru pymeeus-0.4.3+dfsg1/docs/source/ex-Coordinates.rst pymeeus-0.5.11+dfsg1/docs/source/ex-Coordinates.rst --- pymeeus-0.4.3+dfsg1/docs/source/ex-Coordinates.rst 2021-03-03 01:28:56.000000000 +0000 +++ pymeeus-0.5.11+dfsg1/docs/source/ex-Coordinates.rst 1970-01-01 00:00:00.000000000 +0000 @@ -1,813 +0,0 @@ -Coordinates examples -******************** - -Let's define a small helper function:: - - def print_me(msg, val): - - print("{}: {}".format(msg, val)) - -It follows a series of important parameters related to the angle between Earth's rotation axis and the ecliptic. - -- The mean angle between Earth rotation axis and ecliptic axis is the **mean obliquity**:: - - e0 = Earth.mean_obliquity(1987, 4, 10) - - print_me("Mean obliquity for 1987/4/10", e0.dms_str()) - - # Mean obliquity for 1987/4/10: 23d 26' 27.4066466278'' - -- If we take into account the nutation effect on the obliquity, we get the **true obliquity**:: - - epsilon = Earth.true_obliquity(1987, 4, 10) - - print_me("True obliquity for 1987/4/10", epsilon.dms_str()) - - # True obliquity for 1987/4/10: 23d 26' 36.8491882378'' - - epsilon = Earth.true_obliquity(2018, 7, 29) - - print_me("True obliquity for 2018/7/29", epsilon.dms_str()) - - # True obliquity for 2018/7/29: 23d 26' 7.21570241139'' - -- The nutation effect is separated in two components: One parallel to the ecliptic (nutation in longitude) and other perpendicular to the ecliptic (nutation in obliquity):: - - dpsi = Earth.nutation_longitude(1987, 4, 10) - - print_me("Nutation in longitude for 1987/4/10", dpsi.dms_str(n_dec=3)) - - # Nutation in longitude for 1987/4/10: -3.788'' - - depsilon = Earth.nutation_obliquity(1987, 4, 10) - - print_me("Nutation in obliquity for 1987/4/10", depsilon.dms_str(n_dec=3)) - - # Nutation in obliquity for 1987/4/10: 9.443'' - -- We can compute the effects of precession on the equatorial coordinates of a given star, taking also into account its proper motion:: - - start_epoch = JDE2000 - - final_epoch = Epoch(2028, 11, 13.19) - - alpha0 = Angle(2, 44, 11.986, ra=True) - - delta0 = Angle(49, 13, 42.48) - - print_me("Initial right ascension", alpha0.ra_str(n_dec=3)) - - # Initial right ascension: 2h 44' 11.986'' - - print_me("Initial declination", delta0.dms_str(n_dec=2)) - - # Initial declination: 49d 13' 42.48'' - - pm_ra = Angle(0, 0, 0.03425, ra=True) - - pm_dec = Angle(0, 0, -0.0895) - - alpha, delta = Earth.precession_equatorial(start_epoch, final_epoch, - - alpha0, delta0, pm_ra, pm_dec) - - print_me("Final right ascension", alpha.ra_str(n_dec=3)) - - # Final right ascension: 2h 46' 11.331'' - - print_me("Final declination", delta.dms_str(n_dec=2)) - - # Final declination: 49d 20' 54.54'' - -Something similar can also be done with the ecliptical coordinates:: - - start_epoch = JDE2000 - - final_epoch = Epoch(-214, 6, 30.0) - - lon0 = Angle(149.48194) - - lat0 = Angle(1.76549) - - print_me("Initial ecliptical longitude", round(lon0(), 5)) - - # Initial ecliptical longitude: 149.48194 - - print_me("Initial ecliptical latitude", round(lat0(), 5)) - - # Initial ecliptical latitude: 1.76549 - - lon, lat = Earth.precession_ecliptical(start_epoch, final_epoch, lon0, lat0) - - print_me("Final ecliptical longitude", round(lon(), 3)) - - # Final ecliptical longitude: 118.704 - - print_me("Final ecliptical latitude", round(lat(), 3)) - - # Final ecliptical latitude: 1.615 - -Additionally, module ``Coordinates`` provides a function to compute the true movement of a star through the sky relative to the Sun:: - - ra = Angle(6, 45, 8.871, ra=True) - - dec = Angle(-16.716108) - - pm_ra = Angle(0, 0, -0.03847, ra=True) - - pm_dec = Angle(0, 0, -1.2053) - - dist = 2.64 - - vel = -7.6 - - alpha, delta = motion_in_space(ra, dec, dist, vel, pm_ra, pm_dec, -4000.0) - - print(alpha.ra_str(False, 2)) - - # 6:47:39.91 - - print(delta.dms_str(False, 1)) - - # -15:23:30.6 - -This module ``Coordinates`` also provides a series of functions to convert between equatorial, ecliptical, horizontal and galactic coordinates. - -- Equatorial to ecliptical coordinates:: - - ra = Angle(7, 45, 18.946, ra=True) - - dec = Angle(28, 1, 34.26) - - epsilon = Angle(23.4392911) - - lon, lat = equatorial2ecliptical(ra, dec, epsilon) - - print_me("Equatorial to ecliptical. Longitude", round(lon(), 5)) - - # Equatorial to ecliptical. Longitude: 113.21563 - - print_me("Equatorial to ecliptical. Latitude", round(lat(), 5)) - - # Equatorial to ecliptical. Latitude: 6.68417 - -- Ecliptical to equatorial coordinates:: - - lon = Angle(113.21563) - - lat = Angle(6.68417) - - epsilon = Angle(23.4392911) - - ra, dec = ecliptical2equatorial(lon, lat, epsilon) - - print_me("Ecliptical to equatorial. Right ascension", ra.ra_str(n_dec=3)) - - # Ecliptical to equatorial. Right ascension: 7h 45' 18.946'' - - print_me("Ecliptical to equatorial. Declination", dec.dms_str(n_dec=2)) - - # Ecliptical to equatorial. Declination: 28d 1' 34.26'' - -- Equatorial to horizontal coordinates:: - - lon = Angle(77, 3, 56) - - lat = Angle(38, 55, 17) - - ra = Angle(23, 9, 16.641, ra=True) - - dec = Angle(-6, 43, 11.61) - - theta0 = Angle(8, 34, 57.0896, ra=True) - - eps = Angle(23, 26, 36.87) - - # Compute correction to convert from mean to apparent sidereal time - - delta = Angle(0, 0, ((-3.868*cos(eps.rad()))/15.0), ra=True) - - theta0 += delta - - h = theta0 - lon - ra - - azi, ele = equatorial2horizontal(h, dec, lat) - - print_me("Equatorial to horizontal: Azimuth", round(azi, 3)) - - # Equatorial to horizontal: Azimuth: 68.034 - - print_me("Equatorial to horizontal: Elevation", round(ele, 3)) - - # Equatorial to horizontal: Elevation: 15.125 - -- Horizontal to equatorial coordinates:: - - azi = Angle(68.0337) - - ele = Angle(15.1249) - - lat = Angle(38, 55, 17) - - h, dec = horizontal2equatorial(azi, ele, lat) - - print_me("Horizontal to equatorial. Hour angle", round(h, 4)) - - # Horizontal to equatorial. Hour angle: 64.3521 - - print_me("Horizontal to equatorial. Declination", dec.dms_str(n_dec=0)) - - # Horizontal to equatorial. Declination: -6d 43' 12.0'' - -- Equatorial to galactic coordinates:: - - ra = Angle(17, 48, 59.74, ra=True) - - dec = Angle(-14, 43, 8.2) - - lon, lat = equatorial2galactic(ra, dec) - - print_me("Equatorial to galactic. Longitude", round(lon, 4)) - - # Equatorial to galactic. Longitude: 12.9593 - - print_me("Equatorial to galactic. Latitude", round(lat, 4)) - - # Equatorial to galactic. Latitude: 6.0463 - -- Galactic to equatorial coordinates:: - - lon = Angle(12.9593) - - lat = Angle(6.0463) - - ra, dec = galactic2equatorial(lon, lat) - - print_me("Galactic to equatorial. Right ascension", ra.ra_str(n_dec=1)) - - # Galactic to equatorial. Right ascension: 17h 48' 59.7'' - - print_me("Galactic to equatorial. Declination", dec.dms_str(n_dec=0)) - - # Galactic to equatorial. Declination: -14d 43' 8.0'' - -In addition, there is a function to compute the ecliptic longitudes of the two points of the ecliptic which are on the horizon, as well as the angle between the ecliptic and the horizon:: - - sidereal_time = Angle(5.0, ra=True) - - lat = Angle(51.0) - - epsilon = Angle(23.44) - - lon1, lon2, i = ecliptic_horizon(sidereal_time, lat, epsilon) - - print_me("Longitude of ecliptic point #1 on the horizon", lon1.dms_str(n_dec=1)) - - # Longitude of ecliptic point #1 on the horizon: 169d 21' 29.9'' - - print_me("Longitude of ecliptic point #2 on the horizon", lon2.dms_str(n_dec=1)) - - # Longitude of ecliptic point #2 on the horizon: 349d 21' 29.9'' - - print_me("Angle between the ecliptic and the horizon", round(i, 0)) - - # Angle between the ecliptic and the horizon: 62.0 - -Also, it is possible to compute the angle of the diurnal path of a celestial body relative to the horizon at the time of rising and setting:: - - dec = Angle(23.44) - - lat = Angle(40.0) - - j = diurnal_path_horizon(dec, lat) - - print_me("Diurnal path vs. horizon angle at time of rising and setting", j.dms_str(n_dec=1)) - - # Diurnal path vs. horizon angle at time of rising and setting: 45d 31' 28.4'' - -The times (in hours of the day) of rising, transit and setting of a given celestial body can be computed with the appropriate function:: - - longitude = Angle(71, 5, 0.0) - - latitude = Angle(42, 20, 0.0) - - alpha1 = Angle(2, 42, 43.25, ra=True) - - delta1 = Angle(18, 2, 51.4) - - alpha2 = Angle(2, 46, 55.51, ra=True) - - delta2 = Angle(18, 26, 27.3) - - alpha3 = Angle(2, 51, 7.69, ra=True) - - delta3 = Angle(18, 49, 38.7) - - h0 = Angle(-0.5667) - - delta_t = 56.0 - - theta0 = Angle(11, 50, 58.1, ra=True) - - rising, transit, setting = times_rise_transit_set(longitude, latitude,alpha1, delta1, \ - - alpha2, delta2, alpha3, delta3, h0, \ - - delta_t, theta0) - - print_me("Time of rising (hours of day)", round(rising, 4)) - - # Time of rising (hours of day): 12.4238 - - print_me("Time of transit (hours of day)", round(transit, 3)) - - # Time of transit (hours of day): 19.675 - - print_me("Time of setting (hours of day, next day)", round(setting, 3)) - - # Time of setting (hours of day, next day): 2.911 - -The air in the atmosphere introduces an error in the elevation due to the refraction. We can compute the true (airless) elevation from the apparent elevation, and viceversa. - -- Apparent elevation to true (airless) elevation:: - - apparent_elevation = Angle(0, 30, 0.0) - - true_elevation = refraction_apparent2true(apparent_elevation) - - print_me("True elevation for an apparent elevation of 30'", - - true_elevation.dms_str(n_dec=1)) - - # True elevation for an apparent elevation of 30': 1' 14.7'' - -- True elevation to apparent elevation:: - - true_elevation = Angle(0, 33, 14.76) - - apparent_elevation = refraction_true2apparent(true_elevation) - - print_me("Apparent elevation for a true elevation of 33' 14.76''", - - apparent_elevation.dms_str(n_dec=2)) - - # Apparent elevation for a true elevation of 33' 14.76'': 57' 51.96'' - -This module provides a function to compute the angular separation between two celestial bodies:: - - alpha1 = Angle(14, 15, 39.7, ra=True) - - delta1 = Angle(19, 10, 57.0) - - alpha2 = Angle(13, 25, 11.6, ra=True) - - delta2 = Angle(-11, 9, 41.0) - - sep_ang = angular_separation(alpha1, delta1, alpha2, delta2) - - print_me("Angular separation between two given celestial bodies, in degrees", - round(sep_ang, 3)) - - # Angular separation between two given celestial bodies, in degrees: 32.793 - -We can compute the minimum angular separation achieved between two celestial objects. For that, we must provide the positions at three equidistant epochs:: - - # EPOCH: Sep 13th, 1978, 0h TT: - - alpha1_1 = Angle(10, 29, 44.27, ra=True) - - delta1_1 = Angle(11, 2, 5.9) - - alpha2_1 = Angle(10, 33, 29.64, ra=True) - - delta2_1 = Angle(10, 40, 13.2) - - # EPOCH: Sep 14th, 1978, 0h TT: - - alpha1_2 = Angle(10, 36, 19.63, ra=True) - - delta1_2 = Angle(10, 29, 51.7) - - alpha2_2 = Angle(10, 33, 57.97, ra=True) - - delta2_2 = Angle(10, 37, 33.4) - - # EPOCH: Sep 15th, 1978, 0h TT: - - alpha1_3 = Angle(10, 43, 1.75, ra=True) - - delta1_3 = Angle(9, 55, 16.7) - - alpha2_3 = Angle(10, 34, 26.22, ra=True) - - delta2_3 = Angle(10, 34, 53.9) - - a = minimum_angular_separation(alpha1_1, delta1_1, alpha1_2, delta1_2, - - alpha1_3, delta1_3, alpha2_1, delta2_1, - - alpha2_2, delta2_2, alpha2_3, delta2_3) - - print_me("Minimum angular separation, epoch fraction", round(a[0], 6)) - - # Minimum angular separation, epoch fraction: -0.370726 - - # NOTE: Given that 'n' is negative, and Sep 14th is the middle epoch (n=0), - - # then the minimum angular separation is achieved on Sep 13th, specifically - - # at: 1.0 - 0.370726 = 0.629274 => Sep 13.629274 = Sep 13th, 15h 6' 9'' - - print_me("Minimum angular separation", a[1].dms_str(n_dec=0)) - - # Minimum angular separation: 3' 44.0'' - -There is a function to compute the relative position angle P of a body with respect to another body. In this example, given that the two bodies have the same right ascension, then the relative position angle between them must be 0 (or 180):: - - alpha1 = Angle(14, 15, 39.7, ra=True) - - delta1 = Angle(19, 10, 57.0) - - alpha2 = Angle(14, 15, 39.7, ra=True) # Same as alpha1 - - delta2 = Angle(-11, 9, 41.0) - - pos_ang = relative_position_angle(alpha1, delta1, alpha2, delta2) - - print_me("Relative position angle", round(pos_ang, 1)) - - # Relative position angle: 0.0 - -Planetary conjunctions may be computed with the appropriate function:: - - alpha1_1 = Angle(10, 24, 30.125, ra=True) - - delta1_1 = Angle(6, 26, 32.05) - - alpha1_2 = Angle(10, 25, 0.342, ra=True) - - delta1_2 = Angle(6, 10, 57.72) - - alpha1_3 = Angle(10, 25, 12.515, ra=True) - - delta1_3 = Angle(5, 57, 33.08) - - alpha1_4 = Angle(10, 25, 6.235, ra=True) - - delta1_4 = Angle(5, 46, 27.07) - - alpha1_5 = Angle(10, 24, 41.185, ra=True) - - delta1_5 = Angle(5, 37, 48.45) - - alpha2_1 = Angle(10, 27, 27.175, ra=True) - - delta2_1 = Angle(4, 4, 41.83) - - alpha2_2 = Angle(10, 26, 32.410, ra=True) - - delta2_2 = Angle(3, 55, 54.66) - - alpha2_3 = Angle(10, 25, 29.042, ra=True) - - delta2_3 = Angle(3, 48, 3.51) - - alpha2_4 = Angle(10, 24, 17.191, ra=True) - - delta2_4 = Angle(3, 41, 10.25) - - alpha2_5 = Angle(10, 22, 57.024, ra=True) - - delta2_5 = Angle(3, 35, 16.61) - - alpha1_list = [alpha1_1, alpha1_2, alpha1_3, alpha1_4, alpha1_5] - - delta1_list = [delta1_1, delta1_2, delta1_3, delta1_4, delta1_5] - - alpha2_list = [alpha2_1, alpha2_2, alpha2_3, alpha2_4, alpha2_5] - - delta2_list = [delta2_1, delta2_2, delta2_3, delta2_4, delta2_5] - - pc = planetary_conjunction(alpha1_list, delta1_list, alpha2_list, delta2_list) - - print_me("Epoch fraction 'n' for planetary conjunction", round(pc[0], 5)) - - # Epoch fraction 'n' for planetary conjunction: 0.23797 - - print_me("Difference in declination at conjunction", pc[1].dms_str(n_dec=1)) - - # Difference in declination at conjunction: 2d 8' 21.8'' - -If the planetary conjunction is with a star, it is a little bit simpler:: - - alpha_1 = Angle(15, 3, 51.937, ra=True) - - delta_1 = Angle(-8, 57, 34.51) - - alpha_2 = Angle(15, 9, 57.327, ra=True) - - delta_2 = Angle(-9, 9, 3.88) - - alpha_3 = Angle(15, 15, 37.898, ra=True) - - delta_3 = Angle(-9, 17, 37.94) - - alpha_4 = Angle(15, 20, 50.632, ra=True) - - delta_4 = Angle(-9, 23, 16.25) - - alpha_5 = Angle(15, 25, 32.695, ra=True) - - delta_5 = Angle(-9, 26, 1.01) - - alpha_star = Angle(15, 17, 0.446, ra=True) - - delta_star = Angle(-9, 22, 58.47) - - alpha_list = [alpha_1, alpha_2, alpha_3, alpha_4, alpha_5] - - delta_list = [delta_1, delta_2, delta_3, delta_4, delta_5] - - pc = planet_star_conjunction(alpha_list, delta_list, alpha_star, delta_star) - - print_me("Epoch fraction 'n' for planetary conjunction with star", round(pc[0], 4)) - - # Epoch fraction 'n' for planetary conjunction with star: 0.2551 - - print_me("Difference in declination with star at conjunction", pc[1].dms_str(n_dec=0)) - - # Difference in declination with star at conjunction: 3' 38.0'' - -It is possible to compute when a planet and two other stars will be in a straight line:: - - alpha_1 = Angle(7, 55, 55.36, ra=True) - - delta_1 = Angle(21, 41, 3.0) - - alpha_2 = Angle(7, 58, 22.55, ra=True) - - delta_2 = Angle(21, 35, 23.4) - - alpha_3 = Angle(8, 0, 48.99, ra=True) - - delta_3 = Angle(21, 29, 38.2) - - alpha_4 = Angle(8, 3, 14.66, ra=True) - - delta_4 = Angle(21, 23, 47.5) - - alpha_5 = Angle(8, 5, 39.54, ra=True) - - delta_5 = Angle(21, 17, 51.4) - - alpha_star1 = Angle(7, 34, 16.40, ra=True) - - delta_star1 = Angle(31, 53, 51.2) - - alpha_star2 = Angle(7, 45, 0.10, ra=True) - - delta_star2 = Angle(28, 2, 12.5) - - alpha_list = [alpha_1, alpha_2, alpha_3, alpha_4, alpha_5] - - delta_list = [delta_1, delta_2, delta_3, delta_4, delta_5] - - n = planet_stars_in_line(alpha_list, delta_list, alpha_star1, delta_star1, - - alpha_star2, delta_star2) - - print_me("Epoch fraction 'n' when bodies are in a straight line", round(n, 4)) - - # Epoch fraction 'n' when bodies are in a straight line: 0.2233 - -The function 'straight_line()' computes if three celestial bodies are in line providing the angle with which the bodies differ from a great circle:: - - alpha1 = Angle(5, 32, 0.40, ra=True) - - delta1 = Angle(0, -17, 56.9) - - alpha2 = Angle(5, 36, 12.81, ra=True) - - delta2 = Angle(-1, 12, 7.0) - - alpha3 = Angle(5, 40, 45.52, ra=True) - - delta3 = Angle(-1, 56, 33.3) - - psi, omega = straight_line(alpha1, delta1, alpha2, delta2, alpha3, delta3) - - print_me("Angle deviation from a straight line", psi.dms_str(n_dec=0)) - - # Angle deviation from a straight line: 7d 31' 1.0'' - - print_me("Angular distance of central point to the straight line", omega.dms_str(n_dec=0)) - - # Angular distance of central point to the straight line: -5' 24.0'' - -Now let's compute the size of the smallest circle that contains three given celestial bodies:: - - alpha1 = Angle(12, 41, 8.63, ra=True) - - delta1 = Angle(-5, 37, 54.2) - - alpha2 = Angle(12, 52, 5.21, ra=True) - - delta2 = Angle(-4, 22, 26.2) - - alpha3 = Angle(12, 39, 28.11, ra=True) - - delta3 = Angle(-1, 50, 3.7) - - d = circle_diameter(alpha1, delta1, alpha2, delta2, alpha3, delta3) - - print_me("Diameter of smallest circle containing three celestial bodies", d.dms_str(n_dec=0)) - - # Diameter of smallest circle containing three celestial bodies: 4d 15' 49.0'' - -Let's find the apparent position of a star (Theta Persei) for a given epoch:: - - epoch = Epoch(2028, 11, 13.19) - - alpha = Angle(2, 46, 11.331, ra=True) - - delta = Angle(49, 20, 54.54) - - sun_lon = Angle(231.328) - - app_alpha, app_delta = apparent_position(epoch, alpha, delta, sun_lon) - - print_me("Apparent right ascension", app_alpha.ra_str(n_dec=2)) - - # Apparent right ascension: 2h 46' 14.39'' - - print_me("Apparent declination", app_delta.dms_str(n_dec=2)) - - # Apparent declination: 49d 21' 7.45'' - -Convert orbital elements of a celestial object from one equinox to another:: - - epoch0 = Epoch(2358042.5305) - - epoch = Epoch(2433282.4235) - - i0 = Angle(47.122) - - arg0 = Angle(151.4486) - - lon0 = Angle(45.7481) - - i1, arg1, lon1 = orbital_equinox2equinox(epoch0, epoch, i0, arg0, lon0) - - print_me("New inclination", round(i1(), 3)) - - # New inclination: 47.138 - - print_me("New argument of perihelion", round(arg1(), 4)) - - # New argument of perihelion: 151.4782 - - print_me("New longitude of ascending node", round(lon1(), 4)) - - # New longitude of ascending node: 48.6037 - -Compute the eccentric and true anomalies using Kepler's equation:: - - eccentricity = 0.1 - - mean_anomaly = Angle(5.0) - - e, v = kepler_equation(eccentricity, mean_anomaly) - - print_me("Eccentric anomaly, Case #1", round(e(), 6)) - - # Eccentric anomaly, Case #1: 5.554589 - - print_me("True anomaly, Case #1", round(v(), 6)) - - # True anomaly, Case #1: 6.139762 - - e, v = kepler_equation(0.99, Angle(0.2, radians=True)) - - print_me("Eccentric anomaly, Case #2", round(e(), 8)) - - # Eccentric anomaly, Case #2: 61.13444578 - - print_me("True anomaly, Case #2", round(v(), 6)) - - # True anomaly, Case #2: 166.311977 - -Compute the velocity of a body in a given point of its (unperturbated elliptic) orbit, in this case the comet Halley in 1986:: - - r = 1.0 - - a = 17.9400782 - - v = velocity(r, a) - - print_me("Velocity ar 1 AU", round(v, 2)) - - # Velocity at 1 AU: 41.53 - -Compute the velocity at perihelion:: - - a = 17.9400782 - - e = 0.96727426 - - vp = velocity_perihelion(e, a) - - print_me("Velocity at perihelion", round(vp, 2)) - - # Velocity at perihelion: 54.52 - -And now compute the velocity at aphelion:: - - a = 17.9400782 - - e = 0.96727426 - - va = velocity_aphelion(e, a) - - print_me("Velocity at aphelion", round(va, 2)) - - # Velocity at aphelion: 0.91 - -Calculate the length of the orbit for the same comet Halley:: - - a = 17.9400782 - - e = 0.96727426 - - length = length_orbit(e, a) - - print_me("Length of the orbit (AU)", round(length, 2)) - - # Length of the orbit (AU): 77.06 - -Compute passage through the nodes of an elliptic orbit:: - - omega = Angle(111.84644) - - e = 0.96727426 - - a = 17.9400782 - - t = Epoch(1986, 2, 9.45891) - - time, r = passage_nodes_elliptic(omega, e, a, t) - - y, m, d = time.get_date() - - d = round(d, 2) - - print("Time of passage through ascending node: {}/{}/{}".format(y, m, d)) - - # Time of passage through ascending node: 1985/11/9.16 - - print("Radius vector at ascending node: {}".format(round(r, 4))) - - # Radius vector at ascending node: 1.8045 - -Passage through the nodes of a parabolic orbit:: - - omega = Angle(154.9103) - - q = 1.324502 - - t = Epoch(1989, 8, 20.291) - - time, r = passage_nodes_parabolic(omega, q, t, ascending=False) - - y, m, d = time.get_date() - - d = round(d, 2) - - print("Time of passage through descending node: {}/{}/{}".format(y, m, d)) - - # Time of passage through descending node: 1989/9/17.64 - - print("Radius vector at descending node: {}".format(round(r, 4))) - - # Radius vector at descending node: 1.3901 - -Compute the phase angle:: - - sun_dist = 0.724604 - - earth_dist = 0.910947 - - sun_earth_dist = 0.983824 - - angle = phase_angle(sun_dist, earth_dist, sun_earth_dist) - - print_me("Phase angle", round(angle, 2)) - - # Phase angle: 72.96 - -Now, let's compute the illuminated fraction of the disk:: - - k = illuminated_fraction(sun_dist, earth_dist, sun_earth_dist) - - print_me("Illuminated fraction of planet disk", round(k, 3)) - - # Illuminated fraction of planet disk: 0.647 diff -Nru pymeeus-0.4.3+dfsg1/docs/source/ex-CurveFitting.rst pymeeus-0.5.11+dfsg1/docs/source/ex-CurveFitting.rst --- pymeeus-0.4.3+dfsg1/docs/source/ex-CurveFitting.rst 2021-03-03 01:28:56.000000000 +0000 +++ pymeeus-0.5.11+dfsg1/docs/source/ex-CurveFitting.rst 1970-01-01 00:00:00.000000000 +0000 @@ -1,117 +0,0 @@ -CurveFitting examples -********************* - -Let's define a small helper function:: - - def print_me(msg, val): - - print("{}: {}".format(msg, val)) - -Now let's work with the CurveFitting class. First, create a CurveFitting object:: - - cf1 = CurveFitting([73.0, 38.0, 35.0, 42.0, 78.0, 68.0, 74.0, 42.0, 52.0, - - 54.0, 39.0, 61.0, 42.0, 49.0, 50.0, 62.0, 44.0, 39.0, - - 43.0, 54.0, 44.0, 37.0], - - [90.4, 125.3, 161.8, 143.4, 52.5, 50.8, 71.5, 152.8, - - 131.3, 98.5, 144.8, 78.1, 89.5, 63.9, 112.1, 82.0, - - 119.8, 161.2, 208.4, 111.6, 167.1, 162.1]) - - -Let's use ``linear_fitting()``:: - - a, b = cf1.linear_fitting() - - print(" a = {}\tb = {}".format(round(a, 2), round(b, 2))) - - # a = -2.49 b = 244.18 - -Use the copy constructor:: - - cf2 = CurveFitting(cf1) - - a, b = cf2.linear_fitting() - - print(" a = {}\tb = {}".format(round(a, 2), round(b, 2))) - - # a = -2.49 b = 244.18 - -Get the number of value pairs internally stored:: - - print_me("Number of value pairs inside 'cf2'", len(cf2)) - - # Number of value pairs inside 'cf2': 22 - -Compute the correlation coefficient:: - - r = cf1.correlation_coeff() - - print_me(" r", round(r, 3)) - - # r: -0.767 - -Define a new CurveFitting object:: - - cf2 = CurveFitting([-2.0, -1.5, -1.0, -0.5, 0.0, 0.5, 1.0, 1.5, 2.0, 2.5, 3.0], - - [-9.372, -3.821, 0.291, 3.730, 5.822, 8.324, 9.083, - - 6.957, 7.006, 0.365, -1.722]) - -Now use ``quadratic_fitting()``:: - - a, b, c = cf2.quadratic_fitting() - - # Original curve: y = -2.0*x*x + 3.5*x + 7.0 + noise - - print(" a = {}\tb = {}\tc = {}".format(round(a, 2), round(b, 2), round(c, 2))) - - # a = -2.22 b = 3.76 c = 6.64 - -Yet another CurveFitting object:: - - cf4 = CurveFitting([3, 20, 34, 50, 75, 88, 111, 129, 143, 160, 183, 200, - - 218, 230, 248, 269, 290, 303, 320, 344], - - [0.0433, 0.2532, 0.3386, 0.3560, 0.4983, 0.7577, 1.4585, - - 1.8628, 1.8264, 1.2431, -0.2043, -1.2431, -1.8422, - - -1.8726, -1.4889, -0.8372, -0.4377, -0.3640, -0.3508, - - -0.2126]) - -Let's define the three functions to be used for fitting:: - - def sin1(x): return sin(radians(x)) - - def sin2(x): return sin(radians(2.0*x)) - - def sin3(x): return sin(radians(3.0*x)) - -Use ``general_fitting()`` here:: - - a, b, c = cf4.general_fitting(sin1, sin2, sin3) - - # General fitting with f0 = sin(x), f1 = sin(2*x), f2 = sin(3*x) - - print(" a = {}\tb = {}\tc = {}".format(round(a, 2), round(b, 2), round(c, 2))) - - # a = 1.2 b = -0.77 c = 0.39 - -A final example:: - - cf5 = CurveFitting([0, 1.2, 1.4, 1.7, 2.1, 2.2]) - - a, b, c = cf5.general_fitting(sqrt) - - # General fitting with f0 = sqrt(x), f1 = 0.0 and f2 = 0.0 - - print(" a = {}\tb = {}\t\tc = {}".format(round(a, 3), round(b, 3), round(c, 3))) - - # a = 1.016 b = 0.0 c = 0.0 diff -Nru pymeeus-0.4.3+dfsg1/docs/source/ex-Earth.rst pymeeus-0.5.11+dfsg1/docs/source/ex-Earth.rst --- pymeeus-0.4.3+dfsg1/docs/source/ex-Earth.rst 2021-03-03 01:28:56.000000000 +0000 +++ pymeeus-0.5.11+dfsg1/docs/source/ex-Earth.rst 1970-01-01 00:00:00.000000000 +0000 @@ -1,272 +0,0 @@ -Earth examples -************** - -Let's define a small helper function:: - - def print_me(msg, val): - - print("{}: {}".format(msg, val)) - -An important concept are the reference ellipsoids, comprising information about -the Earth global model we are going to use. - -A very important reference ellipsoid is **WGS84**, predefined here:: - - print_me("WGS84", WGS84) - - # WGS84: 6378137.0:0.00335281066475:7.292115e-05 - - # First field is equatorial radius, second field is the flattening, and the - - # third field is the angular rotation velocity, in radians per second - -Let's print the semi-minor axis (polar radius):: - - print_me("Polar radius, b", WGS84.b()) - - # Polar radius, b: 6356752.31425 - -And now, let's print the eccentricity of Earth's meridian:: - - print_me("Eccentricity, e", WGS84.e()) - - # Eccentricity, e: 0.0818191908426 - -We create an Earth object with a given reference ellipsoid. By default, it is -**WGS84**, but we can use another:: - - e = Earth(IAU76) - -Print the parameters of reference ellipsoid being used:: - - print_me("'e' Earth object parameters", e) - - # 'e' Earth object parameters: 6378140.0:0.0033528131779:7.292114992e-05 - -Compute the distance to the center of the Earth from a given point at sea -level, and at a certain latitude. It is given as a fraction of equatorial -radius:: - - lat = Angle(65, 45, 30.0) # We can use an Angle for this - - print_me("Distance to Earth's center, from latitude 65d 45' 30''", e.rho(lat)) - - # Distance to Earth's center, from latitude 65d 45' 30'': 0.997216343095 - -Parameters *rho\*sin(lat)* and *rho\*cos(lat)* are useful for different -astronomical applications:: - - height = 650.0 - - print_me("rho*sin(lat)", e.rho_sinphi(lat, height)) - - # rho*sin(lat): 0.908341718779 - - print_me("rho*cos(lat)", e.rho_cosphi(lat, height)) - - # rho*cos(lat): 0.411775501279 - -Compute the radius of the parallel circle at a given latitude:: - - print_me("Radius of parallel circle at latitude 65d 45' 30'' (meters)", e.rp(lat)) - - # Radius of parallel circle at latitude 65d 45' 30'' (meters): 2626094.91467 - -Compute the radius of curvature of the Earth's meridian at given latitude:: - - print_me("Radius of Earth's meridian at latitude 65d 45' 30'' (meters)", e.rm(lat)) - - # Radius of Earth's meridian at latitude 65d 45' 30'' (meters): 6388705.74543 - -It is easy to compute the linear velocity at different latitudes:: - - print_me("Linear velocity at the Equator (meters/second)", e.linear_velocity(0.0)) - - # Linear velocity at the Equator (meters/second): 465.101303151 - - print_me("Linear velocity at latitude 65d 45' 30'' (meters/second)", e.linear_velocity(lat)) - - # Linear velocity at latitude 65d 45' 30'' (meters/second): 191.497860977 - -And now, let's compute the distance between two points on the Earth: - -- Bangkok: 13d 14' 09'' North, 100d 29' 39'' East -- Buenos Aires: 34d 36' 12'' South, 58d 22' 54'' West - -.. note:: We will consider that positions 'East' and 'South' are negative - -Here we will take advantage of facilities provided by ``Angle`` class:: - - lon_ban = Angle(-100, 29, 39.0) - - lat_ban = Angle(13, 14, 9.0) - - lon_bai = Angle(58, 22, 54.0) - - lat_bai = Angle(-34, 36, 12.0) - - dist, error = e.distance(lon_ban, lat_ban, lon_bai, lat_bai) - - print_me("The distance between Bangkok and Buenos Aires is (km)", round(dist/1000.0, 2)) - - # The distance between Bangkok and Buenos Aires is (km): 16832.89 - - print_me("The approximate error of the estimation is (meters)", round(error, 0)) - - # The approximate error of the estimation is (meters): 189.0 - -Let's now compute the geometric heliocentric position for a given epoch:: - - epoch = Epoch(1992, 10, 13.0) - - lon, lat, r = Earth.geometric_heliocentric_position(epoch) - - print_me("Geometric Heliocentric Longitude", lon.to_positive()) - - # Geometric Heliocentric Longitude: 19.9072721503 - - print_me("Geometric Heliocentric Latitude", lat.dms_str(n_dec=3)) - - # Geometric Heliocentric Latitude: -0.721'' - - print_me("Radius vector", r) - - # Radius vector: 0.997608520236 - -And now, compute the apparent heliocentric position for the same epoch:: - - epoch = Epoch(1992, 10, 13.0) - - lon, lat, r = Earth.apparent_heliocentric_position(epoch) - - print_me("Apparent Heliocentric Longitude", lon.to_positive()) - - # Apparent Heliocentric Longitude: 19.9059856939 - - print_me("Apparent Heliocentric Latitude", lat.dms_str(n_dec=3)) - - # Apparent Heliocentric Latitude: -0.721'' - - print_me("Radius vector", r) - - # Radius vector: 0.997608520236 - -Print mean orbital elements for Earth at 2065.6.24:: - - epoch = Epoch(2065, 6, 24.0) - - l, a, e, i, ome, arg = Earth.orbital_elements_mean_equinox(epoch) - - print_me("Mean longitude of the planet", round(l, 6)) - - # Mean longitude of the planet: 272.716028 - - print_me("Semimajor axis of the orbit (UA)", round(a, 8)) - - # Semimajor axis of the orbit (UA): 1.00000102 - - print_me("Eccentricity of the orbit", round(e, 7)) - - # Eccentricity of the orbit: 0.0166811 - - print_me("Inclination on plane of the ecliptic", round(i, 6)) - - # Inclination on plane of the ecliptic: 0.0 - - print_me("Longitude of the ascending node", round(ome, 5)) - - # Longitude of the ascending node: 174.71534 - - print_me("Argument of the perihelion", round(arg, 6)) - - # Argument of the perihelion: -70.651889 - -Find the epoch of the Perihelion closer to 2008/02/01:: - - epoch = Epoch(2008, 2, 1.0) - - e = Earth.perihelion_aphelion(epoch) - - y, m, d, h, mi, s = e.get_full_date() - - peri = str(y) + '/' + str(m) + '/' + str(d) + ' ' + str(h) + ':' + str(mi) - - print_me("The Perihelion closest to 2008/2/1 happened on", peri) - - # The Perihelion closest to 2008/2/1 happened on: 2008/1/2 23:53 - -Compute the time of passage through an ascending node:: - - epoch = Epoch(2019, 1, 1) - - time, r = Earth.passage_nodes(epoch) - - y, m, d = time.get_date() - - d = round(d, 1) - - print("Time of passage through ascending node: {}/{}/{}".format(y, m, d)) - - # Time of passage through ascending node: 2019/3/15.0 - - print("Radius vector at ascending node: {}".format(round(r, 4))) - - # Radius vector at ascending node: 0.9945 - -Compute the parallax correction:: - - right_ascension = Angle(22, 38, 7.25, ra=True) - - declination = Angle(-15, 46, 15.9) - - latitude = Angle(33, 21, 22) - - distance = 0.37276 - - hour_angle = Angle(288.7958) - - top_ra, top_dec = Earth.parallax_correction(right_ascension, declination, - - latitude, distance, hour_angle) - - print_me("Corrected topocentric right ascension: ", top_ra.ra_str(n_dec=2)) - - # Corrected topocentric right ascension: : 22h 38' 8.54'' - - print_me("Corrected topocentric declination", top_dec.dms_str(n_dec=1)) - - # Corrected topocentric declination: -15d 46' 30.0'' - -Compute the parallax correction in ecliptical coordinates:: - - longitude = Angle(181, 46, 22.5) - - latitude = Angle(2, 17, 26.2) - - semidiameter = Angle(0, 16, 15.5) - - obs_lat = Angle(50, 5, 7.8) - - obliquity = Angle(23, 28, 0.8) - - sidereal_time = Angle(209, 46, 7.9) - - distance = 0.0024650163 - - topo_lon, topo_lat, topo_diam = \ - - Earth.parallax_ecliptical(longitude, latitude, semidiameter, obs_lat, - - obliquity, sidereal_time, distance) - - print_me("Corrected topocentric longitude", topo_lon.dms_str(n_dec=1)) - - # Corrected topocentric longitude: 181d 48' 5.0'' - - print_me("Corrected topocentric latitude", topo_lat.dms_str(n_dec=1)) - - # Corrected topocentric latitude: 1d 29' 7.1'' - - print_me("Corrected topocentric semidiameter", topo_diam.dms_str(n_dec=1)) - - # Corrected topocentric semidiameter: 16' 25.5'' diff -Nru pymeeus-0.4.3+dfsg1/docs/source/ex-Epoch.rst pymeeus-0.5.11+dfsg1/docs/source/ex-Epoch.rst --- pymeeus-0.4.3+dfsg1/docs/source/ex-Epoch.rst 2021-03-03 01:28:56.000000000 +0000 +++ pymeeus-0.5.11+dfsg1/docs/source/ex-Epoch.rst 1970-01-01 00:00:00.000000000 +0000 @@ -1,366 +0,0 @@ -Epoch examples -************** - -Let's define a small helper function:: - - def print_me(msg, val): - - print("{}: {}".format(msg, val)) - -Let's start creating and Epoch object, and printing it:: - - e = Epoch(1987, 6, 19.5) - - print_me("JDE for 1987/6/19.5", e) - - # JDE for 1987/6/19.5: 2446966.00064 - -Redefine the Epoch object:: - - e.set(333, 'Jan', 27, 12) - - print_me("JDE for 333/1/27.5", e) - - # JDE for 333/1/27.5: 1842713.0 - -We can create an Epoch from a ``date`` or ``datetime`` object:: - - d = datetime.datetime(837, 4, 10, 7, 12, 0, 0) - - f = Epoch(d) - - print_me("JDE for 837/4/10.3", f) - - # JDE for 837/4/10.3: 2026871.8 - -Let's check if a given date belong to the Julian or the Gregorian calendar:: - - print_me("Is 1590/4/21.4 a Julian date?", Epoch.is_julian(1590, 4, 21.4)) - - # Is 1590/4/21.4 a Julian date?: False - -We can also check if a given year is leap or not:: - - print_me("Is -1000 a leap year?", Epoch.is_leap(-1000)) - - # Is -1000 a leap year?: True - - print_me("Is 1800 a leap year?", Epoch.is_leap(1800)) - - # Is 1800 a leap year?: False - - print_me("Is 2012 a leap year?", Epoch.is_leap(2012)) - - # Is 2012 a leap year?: True - -Get the Day Of Year (DOY) corresponding to a given date:: - - print_me("Day Of Year (DOY) of 1978/11/14", Epoch.get_doy(1978, 11, 14)) - - # Day Of Year (DOY) of 1978/11/14: 318.0 - - print_me("Day Of Year (DOY) of -400/2/29.9", Epoch.get_doy(-400, 2, 29.9)) - - # Day Of Year (DOY) of -400/2/29.9: 60.9 - -Now the opposite: Get a date from a DOY:: - - t = Epoch.doy2date(2017, 365.7) - - s = str(t[0]) + "/" + str(t[1]) + "/" + str(round(t[2], 2)) - - print_me("Date from DOY 2017:365.7", s) - - # Date from DOY 2017:365.7: 2017/12/31.7 - - t = Epoch.doy2date(-4, 60) - - s = str(t[0]) + "/" + str(t[1]) + "/" + str(round(t[2], 2)) - - print_me("Date from DOY -4:60", s) - - # Date from DOY -4:60: -4/2/29.0 - - -There is an internal table which we can use to get the leap seconds:: - - print_me("Number of leap seconds applied up to July 1983", Epoch.leap_seconds(1983, 7)) - - # Number of leap seconds applied up to July 1983: 12 - -We can convert the internal JDE value back to a date:: - - e = Epoch(2436116.31) - - y, m, d = e.get_date() - - s = str(y) + "/" + str(m) + "/" + str(round(d, 2)) - - print_me("Date from JDE 2436116.31", s) - - # Date from JDE 2436116.31: 1957/10/4.81 - -It is possible to get the day of the week corresponding to a given date:: - - e = Epoch(2018, 'Feb', 15) - - print_me("The day of week of 2018/2/15 is", e.dow(as_string=True)) - - # The day of week of 2018/2/15 is: Thursday - -In some cases it is useful to get the Modified Julian Day (MJD):: - - e = Epoch(1923, 'August', 23) - - print_me("Modified Julian Day for 1923/8/23", round(e.mjd(), 2)) - - # Modified Julian Day for 1923/8/23: 23654.0 - -If your system is appropriately configured, you can get the difference in seconds between your local time and UTC:: - - print_me("From local system time to UTC you must add/subtract" + - - " this amount of seconds", Epoch.utc2local()) - - # From local system time to UTC you must add/subtract this amount of seconds: 7200.0 - -Compute DeltaT = TT - UT differences for various dates:: - - print_me("DeltaT (TT - UT) for Feb/333", round(Epoch.tt2ut(333, 2), 1)) - - # DeltaT (TT - UT) for Feb/333: 7358.5 - - print_me("DeltaT (TT - UT) for Jan/1642", round(Epoch.tt2ut(1642, 1), 1)) - - # DeltaT (TT - UT) for Jan/1642: 62.1 - - print_me("DeltaT (TT - UT) for Feb/1928", round(Epoch.tt2ut(1928, 1), 1)) - - # DeltaT (TT - UT) for Feb/1928: 24.2 - - print_me("DeltaT (TT - UT) for Feb/1977", round(Epoch.tt2ut(1977, 2), 1)) - - # DeltaT (TT - UT) for Feb/1977: 47.7 - - print_me("DeltaT (TT - UT) for Jan/1998", round(Epoch.tt2ut(1998, 1), 1)) - - # DeltaT (TT - UT) for Jan/1998: 63.0 - -The difference between civil day and sidereal day is almost 4 minutes:: - - e = Epoch(1987, 4, 10) - - st1 = round(e.mean_sidereal_time(), 9) - - e = Epoch(1987, 4, 11) - - st2 = round(e.mean_sidereal_time(), 9) - - ds = (st2 - st1)*DAY2MIN - - msg = "{}m {}s".format(INT(ds), (ds % 1)*60.0) - - print_me("Difference between sidereal time 1987/4/11 and 1987/4/10", msg) - - # Difference between sidereal time 1987/4/11 and 1987/4/10: 3m 56.555424s - -When correcting for nutation-related effects, we get the **apparent** sidereal time:: - - e = Epoch(1987, 4, 10) - - print_me("e.apparent_sidereal_time(23.44357, (-3.788)/3600.0)", - - e.apparent_sidereal_time(23.44357, (-3.788)/3600.0)) - - # e.apparent_sidereal_time(23.44357, (-3.788)/3600.0): 0.549145082637 - -Epoch class can also provide the date of Easter for a given year. Let's spice up the output a little bit, calling ``dow()`` and ``get_month()``:: - - month, day = Epoch.easter(2019) - - e = Epoch(2019, month, day) - - s = e.dow(as_string=True) + ", " + str(day) + get_ordinal_suffix(day) + \ - - " of " + Epoch.get_month(month, as_string=True) - - print_me("Easter day for 2019", s) - - # Easter day for 2019: Sunday, 21st of April - -Compute the date of the Jewish Easter (Pesach) for a given year:: - - month, day = Epoch.jewish_pesach(1990) - - s = str(day) + get_ordinal_suffix(day) + " of " + Epoch.get_month(month, as_string=True) - - print_me("Jewish Pesach day for 1990", s) - - # Jewish Pesach day for 1990: 10th of April - -Now, let's convert a date in the Moslem calendar to the Gregorian calendar:: - - y, m, d = Epoch.moslem2gregorian(1421, 1, 1) - - print_me("The date 1421/1/1 in the Moslem calendar is, in Gregorian " + - - "calendar", "{}/{}/{}".format(y, m, d)) - - # The date 1421/1/1 in the Moslem calendar is, in Gregorian calendar: 2000/4/6 - - y, m, d = Epoch.moslem2gregorian(1439, 9, 1) - - print_me("The start of Ramadan month (9/1) for Gregorian year 2018 is", - - "{}/{}/{}".format(y, m, d)) - - # The start of Ramadan month (9/1) for Gregorian year 2018 is: 2018/5/16 - -We can go from the Gregorian calendar back to the Moslem calendar too:: - - print_me("Date 1991/8/13 in Gregorian calendar is, in Moslem calendar", - - "{}/{}/{}".format(*Epoch.gregorian2moslem(1991, 8, 13))) - - # Date 1991/8/13 in Gregorian calendar is, in Moslem calendar: 1412/2/2 - -.. note:: The ``*`` before ``Epoch`` will **unpack** the tuple into components - - -It is possible to carry out some algebraic operations with Epochs. - -- Add 10000 days to a given date:: - - a = Epoch(1991, 7, 11) - - b = a + 10000 - - y, m, d = b.get_date() - - s = str(y) + "/" + str(m) + "/" + str(round(d, 2)) - - print_me("1991/7/11 plus 10000 days is", s) - - # 1991/7/11 plus 10000 days is: 2018/11/26.0 - -- Subtract two Epochs to find the number of days between them:: - - a = Epoch(1986, 2, 9.0) - - b = Epoch(1910, 4, 20.0) - - print_me("The number of days between 1986/2/9 and 1910/4/20 is", round(a - b, 2)) - - # The number of days between 1986/2/9 and 1910/4/20 is: 27689.0 - -- We can also subtract a given amount of days from an Epoch:: - - a = Epoch(2003, 12, 31.0) - - b = a - 365.5 - - y, m, d = b.get_date() - - s = str(y) + "/" + str(m) + "/" + str(round(d, 2)) - - print_me("2003/12/31 minus 365.5 days is", s) - - # 2003/12/31 minus 365.5 days is: 2002/12/30.5 - -- Accumulative addition and subtraction of days is also allowed:: - - a = Epoch(2003, 12, 31.0) - - a += 32.5 - - y, m, d = a.get_date() - - s = str(y) + "/" + str(m) + "/" + str(round(d, 2)) - - print_me("2003/12/31 plus 32.5 days is", s) - - # 2003/12/31 plus 32.5 days is: 2004/2/1.5 - - - - a = Epoch(2001, 12, 31.0) - - a -= 2*365 - - y, m, d = a.get_date() - - s = str(y) + "/" + str(m) + "/" + str(round(d, 2)) - - print_me("2001/12/31 minus 2*365 days is", s) - - # 2001/12/31 minus 2*365 days is: 2000/1/1.0 - -- It is also possible to add days from the right:: - - a = Epoch(2004, 2, 27.8) - - b = 2.2 + a - - y, m, d = b.get_date() - - s = str(y) + "/" + str(m) + "/" + str(round(d, 2)) - - print_me("2.2 days plus 2004/2/27.8 is", s) - - # 2.2 days plus 2004/2/27.8 is: 2004/3/1.0 - -- Comparison operadors between epochs are also defined:: - - a = Epoch(2007, 5, 20.0) - - b = Epoch(2007, 5, 20.000001) - - print_me("2007/5/20.0 == 2007/5/20.000001", a == b) - - # 2007/5/20.0 == 2007/5/20.000001: False - - print_me("2007/5/20.0 != 2007/5/20.000001", a != b) - - # 2007/5/20.0 != 2007/5/20.000001: True - - print_me("2007/5/20.0 > 2007/5/20.000001", a > b) - - # 2007/5/20.0 > 2007/5/20.000001: False - - print_me("2007/5/20.0 <= 2007/5/20.000001", a <= b) - - # 2007/5/20.0 <= 2007/5/20.000001: True - -- Compute the time of rise and setting of the Sun in a given day:: - - e = Epoch(2018, 5, 2) - - print("On May 2nd, 2018, Sun rising/setting times in Munich were (UTC):") - - latitude = Angle(48, 8, 0) - - longitude = Angle(11, 34, 0) - - altitude = 520.0 - - rising, setting = e.rise_set(latitude, longitude, altitude) - - y, m, d, h, mi, s = rising.get_full_date() - - print("Rising time: {}:{}".format(h, mi)) - - # Rising time: 3:50 - - y, m, d, h, mi, s = setting.get_full_date() - - print("Setting time: {}:{}".format(h, mi)) - - # Setting time: 18:33 - -- Compute the hash of a given Epoch:: - - h = e.__hash__() - - print("Hash of Epoch({}): {}".format(e, h)) - - # Hash of Epoch(2458240.5): 1152921504609305216 diff -Nru pymeeus-0.4.3+dfsg1/docs/source/ex-Interpolation.rst pymeeus-0.5.11+dfsg1/docs/source/ex-Interpolation.rst --- pymeeus-0.4.3+dfsg1/docs/source/ex-Interpolation.rst 2021-03-03 01:28:56.000000000 +0000 +++ pymeeus-0.5.11+dfsg1/docs/source/ex-Interpolation.rst 1970-01-01 00:00:00.000000000 +0000 @@ -1,167 +0,0 @@ -Interpolation examples -********************** - -Let's define a small helper function:: - - def print_me(msg, val): - - print("{}: {}".format(msg, val)) - -Declare an Interpolation object:: - - i = Interpolation([5, 3, 6, 1, 2, 4, 9], [10, 6, 12, 2, 4, 8]) - - print(i) - - # X: [1, 2, 3, 4, 5, 6] - - # Y: [2, 4, 6, 8, 10, 12] - -.. note:: - - a. They are ordered in 'x' - b. The extra value in 'x' was dropped - -Use the copy constructor. We can easily make a copy of an Interpolation object:: - - j = Interpolation(i) - - print(j) - - # X: [1, 2, 3, 4, 5, 6] - - # Y: [2, 4, 6, 8, 10, 12] - - j = Interpolation([0.0, 1.0, 3.0], [-1.0, -2.0, 2.0]) - - print(j) - - # X: [0.0, 1.0, 3.0] - - # Y: [-1.0, -2.0, 2.0] - - print_me("j(2)", j(2)) - - # j(2): -1.0 - - print_me("j(0.5)", j(0.5)) - - # j(0.5): -1.75 - -- Test with a value already in the data table:: - - print_me("j(1)", j(1)) - - # j(1): -2.0 - -Get the number of interpolation points internally stored:: - - print_me("Number or interpolation points in 'j'", len(j)) - - # Number or interpolation points in 'j': 3 - -We can interpolate Angles too:: - - k = Interpolation([27.0, 27.5, 28.0, 28.5, 29.0], - - [Angle(0, 54, 36.125), Angle(0, 54, 24.606), - - Angle(0, 54, 15.486), Angle(0, 54, 8.694), - - Angle(0, 54, 4.133)]) - - print_me("k(28.278)", Angle(k(28.278)).dms_str()) - - # k(28.278): 54' 11.4279073579'' - -Let's work with a new Interpolation object:: - - m = Interpolation([-1.0, 0.0, 1.0], [-2.0, 3.0, 2.0]) - - print(m) - - # X: [-1.0, 0.0, 1.0] - - # Y: [-2.0, 3.0, 2.0] - -- Get some interpolated values:: - - print_me("m(-0.5)", m(-0.5)) - - # m(-0.5): 1.25 - - print_me("m(0.5)", m(0.5)) - - # m(0.5): 3.25 - -- Get derivatives:: - - print_me("m'(-1.0)", m.derivative(-1.0)) - - # m'(-1.0): 8.0 - - print_me("m'(-0.5)", m.derivative(-0.5)) - - # m'(-0.5): 5.0 - - print_me("m'(0.0)", m.derivative(0.0)) - - # m'(0.0): 2.0 - - print_me("m'(0.5)", m.derivative(0.5)) - - # m'(0.5): -1.0 - - print_me("m'(1.0)", m.derivative(1.0)) - - # m'(1.0): -4.0 - -- Get the root within the interval:: - - print_me("m.root()", m.root()) - - # m.root(): -0.720759220056 - -- Get the extremum within the interval:: - - print_me("m.minmax()", m.minmax()) - - # m.minmax(): 0.333333333333 - -Let's work now with the interpolation of sine function:: - - m = Interpolation([29.43, 30.97, 27.69, 28.11, 31.58, 33.05], - - [0.4913598528, 0.5145891926, 0.4646875083, - - 0.4711658342, 0.5236885653, 0.5453707057]) - - print_me("sin(29.5)\t", m(29.5)) - - # sin(29.5) : 0.492423560118 - - print_me("sin(30.0)\t", m(30.0)) - - # sin(30.0) : 0.500000000018 - - print_me("sin(30.5)\t", m(30.5)) - - # sin(30.5) : 0.507538362978 - -Derivatives must be adjusted because degrees were used instead of radians:: - - print_me("sin'(29.5)\t", degrees(m.derivative(29.5))) - - # sin'(29.5) : 0.870355696916 - - print_me("sin'(30.0)\t", degrees(m.derivative(30.0))) - - # sin'(30.0) : 0.866025403791 - - print_me("sqrt(3.0)/2.0\t", sqrt(3.0)/2.0) - - # sqrt(3.0)/2.0 : 0.866025403784 - - print_me("sin'(30.5)\t", degrees(m.derivative(30.5))) - - # sin'(30.5) : 0.861629160353 diff -Nru pymeeus-0.4.3+dfsg1/docs/source/ex-JupiterMoons.rst pymeeus-0.5.11+dfsg1/docs/source/ex-JupiterMoons.rst --- pymeeus-0.4.3+dfsg1/docs/source/ex-JupiterMoons.rst 2021-03-03 01:28:56.000000000 +0000 +++ pymeeus-0.5.11+dfsg1/docs/source/ex-JupiterMoons.rst 1970-01-01 00:00:00.000000000 +0000 @@ -1,170 +0,0 @@ -JupiterMoons examples -********************** - -Let's define a small helper function:: - - def print_me(msg, val): - print("{}: {}".format(msg, val)) - - -Lets compute the ascending node of Jupiter as well as the longitude of the node of -the equator of Jupiter on the ecliptic (psi):: - - utc_1992_12_16_00_00_00 = Epoch(1992, 12, 16, utc=True) - psi_corrected, OMEGA_ascending_node_jupiter = JupiterMoons.jupiter_system_angles(utc_1992_12_16_00_00_00) - print("Ascending node of Jupiter: ", OMEGA_ascending_node_jupiter) - #100.39249942976576 - print("Longitude of the node of the eauator of Jupiter on the ecliptic (psi):", psi_corrected) - #317.1058009213959 - -Lets compute the corrected rectangular geocentric position of Jupiter's satellites -for a given epoch, using the E5-theory:: - - utc_1992_12_16_00_00_00 = Epoch(1992, 12, 16, utc=True) - - io, europa, ganymede, callisto = JupiterMoons.rectangular_positions_jovian_equatorial(utc_1992_12_16_00_00_00) - - print("Corrected rectangular geocentric position of Io [X, Y , Z]: ", io) - #(-3.450168811390241, 0.21370246960509387, -4.818966623735296) - - print("Corrected rectangular geocentric position of Europa [X, Y , Z]: ", europa) - #(7.441869121153001, 0.27524463479625677, -5.747104399729193) - - print("Corrected rectangular geocentric position of Ganymede [X, Y , Z]: ", ganymede) - #(1.201111684800708, 0.5899903274317162, -14.940581367576527) - - print("Corrected rectangular geocentric position of Callisto [X, Y , Z]: ", callisto) - #(7.071943240286434, 1.0289562923230684, -25.224137724734955) - -Lets compute the uncorrected rectangular geocentric position of Jupiter's satellites for a given epoch, -using the E5-theory:: - - #So the effects of different light-time and perspective described in Pymeeus page 313 - 314 are neglected - - utc_1992_12_16_00_00_00 = Epoch(1992, 12, 16, utc=True) - io_uncorrected, europa_uncorrected, ganymede_uncorrected, callisto_uncorrected = \ - JupiterMoons.rectangular_positions_jovian_equatorial(utc_1992_12_16_00_00_00, do_correction=False) - - print("Uncorrected rectangular geocentric position of Io [X, Y , Z]: ", io_uncorrected) - # (-3.4489935969836503, 0.21361563816963675, -4.818966623735296) - - print("Uncorrected rectangular geocentric position of Europa [X, Y , Z]: ", europa_uncorrected) - # (7.438101803124541, 0.2751112576349763, -5.747104399729193) - - print("Uncorrected rectangular geocentric position of Ganymede [X, Y , Z]: ", ganymede_uncorrected) - # (1.1990581804888616, 0.589247092847632, -14.940581367576527) - - print("Uncorrected rectangular geocentric position of Callisto [X, Y , Z]: ", callisto_uncorrected) - # (7.056237832405445, 1.0267678919629089, -25.224137724734955) - -Lets calculate the distance between Earth and Jupiter (DELTA) for a given epoch:: - - utc_1992_12_16_00_00_00 = Epoch(1992, 12, 16, utc=True) - delta, tau, l, b, r = JupiterMoons.calculate_DELTA(utc_1992_12_16_00_00_00) - - print("Distance between Earth and Jupiter in AU: ", delta) - #5.6611211815432645 - - print("Light-time from Earth to Jupiter in d (day): ", tau) - #0.03269590898252075 - -Lets calculate the perspective distance in Jupiter radii of all satellites -for an eclipse of Io:: - - io_ecc_start_2021_02_12_14_19_14 = Epoch(2021, 2, 12.5966898148148) - - result_matrix = JupiterMoons.check_phenomena(io_ecc_start_2021_02_12_14_19_14) - - #structure of result_matrix - # Row 0: Io Column 0: perspective distance as seen from the Earth - # Row 1: Europa Column 1: perspective distance as seen from the Sun - # Row 2: Ganymede Column 2: No use - # Row 3: Callisto - - # print Row 0 - print("(perspective distance of Io (Earth View), perspective distance of Io (Sun view), No use): ") - print(result_matrix[0]) - #[1.1926058680144362, 0.856027716233023, 0.0] - - # print Row 1 - print("(perspective distance of Europa (Earth View), perspective distance of Europa (Sun view), No use): ") - print(result_matrix[1]) - #[-8.739720236890856, -8.893094092124032, 0.0] - - # print Row 2 - print("(perspective distance of Ganymede (Earth View), perspective distance of Ganymede (Sun view), No use): ") - print(result_matrix[2]) - #[14.069121992481382, 13.8323491767871, 0.0] - - # print Row 3 - print("(perspective distance of Callisto (Earth View), perspective distance of Callisto (Sun view), No use): ") - print(result_matrix[3]) - #[-2.934134686233644, -3.9904786452498144, 0.0] - -Lets check if an eclipse or\and occultation for any of the four Galilean satellites is detected for a given epoch:: - - io_ecc_start_2021_02_12_14_19_14 = Epoch(2021, 2, 12.5966898148148) - - #Structure of result matrix - # Row 0: Io Column 0: Occultation True\False - # Row 1: Europa Column 1: Eclipse True\False - # Row 2: Ganymede Column 2: No use - # Row 3: Callisto - - result_matrix = JupiterMoons.is_phenomena(io_ecc_start_2021_02_12_14_19_14) - - #print Row 0 - print("(Occultation of Io, Eclipse of Io, No use): ") - print(result_matrix[0]) - #[False, True, False] - - # print Row 1 - print(" (Occultation of Europa, Eclipse of Europa, No use): ") - print(result_matrix[1]) - #[False, False, False] - - # print Row 2 - print(" (Occultation of Ganymede, Eclipse of Gaymede, No use): ") - print(result_matrix[2]) - #[False,False,False] - - # print Row 3 - print("(Occultation of Callisto, Eclipse of Callisto, No use): ") - print(result_matrix[3]) - #[False,False,False] - -Calculation of the perspective distance ot the planet Io to the center of Jupiter -for December 16 at 0h UTC as seen from the Sun:: - - utc_1992_12_16_00_00_00 = Epoch(1992, 12, 16, utc=True) - - result_matrix = JupiterMoons.rectangular_positions_jovian_equatorial(utc_1992_12_16_00_00_00, solar=True) - - #Structure of result matrix - # Row 0: Io Column 0: X coordinate of satellite in Jupiter radii - # Row 1: Europa Column 1: Y coordinate of satellite in Jupiter radii - # Row 2: Ganymede Column 2: Z coordinate of satellite in Jupiter radii - # Row 3: Callisto - - io_radius_to_center_of_jupiter_sun = JupiterMoons.check_coordinates(result_matrix[0][0], result_matrix[0][1]) - - print("Perspective distance of Io as seen from the Sun in Jupiter radii: ", io_radius_to_center_of_jupiter_sun) - #3.457757270630766 - -Calculation of the perspective distance ot the planet Io to the center of Jupiter -for December 16 at 0h UTC as seen from the Earth:: - - utc_1992_12_16_00_00_00 = Epoch(1992, 12, 16, utc=True) - result_matrix = JupiterMoons.rectangular_positions_jovian_equatorial(utc_1992_12_16_00_00_00, solar=False) - - #Structure of result matrix - # Row 0: Io Column 0: X coordinate of satellite in Jupiter radii - # Row 1: Europa Column 1: Y coordinate of satellite in Jupiter radii - # Row 2: Ganymede Column 2: Z coordinate of satellite in Jupiter radii - # Row 3: Callisto - - io_radius_to_center_of_jupiter_earth = JupiterMoons.check_coordinates(result_matrix[0][0], result_matrix[0][1]) - - print("Perspective distance of Io as seen from the Earth in Jupiter radii: ", io_radius_to_center_of_jupiter_earth) - # 2.553301264153796 - diff -Nru pymeeus-0.4.3+dfsg1/docs/source/ex-Jupiter.rst pymeeus-0.5.11+dfsg1/docs/source/ex-Jupiter.rst --- pymeeus-0.4.3+dfsg1/docs/source/ex-Jupiter.rst 2021-03-03 01:28:56.000000000 +0000 +++ pymeeus-0.5.11+dfsg1/docs/source/ex-Jupiter.rst 1970-01-01 00:00:00.000000000 +0000 @@ -1,170 +0,0 @@ -Jupiter examples -**************** - -Let's define a small helper function:: - - def print_me(msg, val): - - print("{}: {}".format(msg, val)) - -We can compute the geometric heliocentric position for a given epoch:: - - epoch = Epoch(2018, 10, 27.0) - - lon, lat, r = Jupiter.geometric_heliocentric_position(epoch) - - print_me("Geometric Heliocentric Longitude", lon.to_positive()) - - # Geometric Heliocentric Longitude: 241.5873 - - print_me("Geometric Heliocentric Latitude", lat) - - # Geometric Heliocentric Latitude: 0.8216 - - print_me("Radius vector", r) - - # Radius vector: 5.36848 - -Compute the geocentric position for 1992/12/20:: - - epoch = Epoch(1992, 12, 20.0) - - ra, dec, elon = Jupiter.geocentric_position(epoch) - - print_me("Right ascension", ra.ra_str(n_dec=1)) - - # Right ascension: 12h 47' 9.6'' - - print_me("Declination", dec.dms_str(n_dec=1)) - - # Declination: -3d 41' 55.3'' - - print_me("Elongation", elon.dms_str(n_dec=1)) - - # Elongation: 76d 2' 26.0'' - -Print mean orbital elements for Jupiter at 2065.6.24:: - - epoch = Epoch(2065, 6, 24.0) - - l, a, e, i, ome, arg = Jupiter.orbital_elements_mean_equinox(epoch) - - print_me("Mean longitude of the planet", round(l, 6)) - - # Mean longitude of the planet: 222.433723 - - print_me("Semimajor axis of the orbit (UA)", round(a, 8)) - - # Semimajor axis of the orbit (UA): 5.20260333 - - print_me("Eccentricity of the orbit", round(e, 7)) - - # Eccentricity of the orbit: 0.0486046 - - print_me("Inclination on plane of the ecliptic", round(i, 6)) - - # Inclination on plane of the ecliptic: 1.29967 - - print_me("Longitude of the ascending node", round(ome, 5)) - - # Longitude of the ascending node: 101.13309 - - print_me("Argument of the perihelion", round(arg, 6)) - - # Argument of the perihelion: -85.745532 - -Compute the time of the conjunction close to 1993/10/1:: - - epoch = Epoch(1993, 10, 1.0) - - conj = Jupiter.conjunction(epoch) - - y, m, d = conj.get_date() - - d = round(d, 4) - - date = "{}/{}/{}".format(y, m, d) - - print_me("Conjunction date", date) - - # Conjunction date: 1993/10/18.3341 - -Compute the time of the opposition close to -6/9/1:: - - epoch = Epoch(-6, 9, 1.0) - - oppo = Jupiter.opposition(epoch) - - y, m, d = oppo.get_date() - - d = round(d, 4) - - date = "{}/{}/{}".format(y, m, d) - - print_me("Opposition date", date) - - # Opposition date: -6/9/15.2865 - -Compute the time of the station in longitude #1 close to 2018/11/1:: - - epoch = Epoch(2018, 11, 1.0) - - sta1 = Jupiter.station_longitude_1(epoch) - - y, m, d = sta1.get_date() - - d = round(d, 4) - - date = "{}/{}/{}".format(y, m, d) - - print_me("Date of station in longitude #1", date) - - # Date of station in longitude #1: 2018/3/9.1288 - -Compute the time of the station in longitude #2 close to 2018/11/1:: - - epoch = Epoch(2018, 11, 1.0) - - sta2 = Jupiter.station_longitude_2(epoch) - - y, m, d = sta2.get_date() - - d = round(d, 4) - - date = "{}/{}/{}".format(y, m, d) - - print_me("Date of station in longitude #2", date) - - # Date of station in longitude #2: 2018/7/10.6679 - -Find the epoch of the Aphelion closer to 1981/6/1:: - - epoch = Epoch(1981, 6, 1.0) - - e = Jupiter.perihelion_aphelion(epoch, perihelion=False) - - y, m, d, h, mi, s = e.get_full_date() - - peri = str(y) + '/' + str(m) + '/' + str(d) + ' at ' + str(h) + ' hours' - - print_me("The Aphelion closest to 1981/6/1 will happen on", peri) - - # The Aphelion closest to 1981/6/1 will happen on: 1981/7/28 at 6 hours - -Compute the time of passage through an ascending node:: - - epoch = Epoch(2019, 1, 1) - - time, r = Jupiter.passage_nodes(epoch) - - y, m, d = time.get_date() - - d = round(d, 1) - - print("Time of passage through ascending node: {}/{}/{}".format(y, m, d)) - - # Time of passage through ascending node: 2025/9/15.6 - - print("Radius vector at ascending node: {}".format(round(r, 4))) - - # Radius vector at ascending node: 5.1729 diff -Nru pymeeus-0.4.3+dfsg1/docs/source/ex-Mars.rst pymeeus-0.5.11+dfsg1/docs/source/ex-Mars.rst --- pymeeus-0.4.3+dfsg1/docs/source/ex-Mars.rst 2021-03-03 01:28:56.000000000 +0000 +++ pymeeus-0.5.11+dfsg1/docs/source/ex-Mars.rst 1970-01-01 00:00:00.000000000 +0000 @@ -1,170 +0,0 @@ -Mars examples -************* - -Let's define a small helper function:: - - def print_me(msg, val): - - print("{}: {}".format(msg, val)) - -We can compute the geometric heliocentric position for a given epoch:: - - epoch = Epoch(2018, 10, 27.0) - - lon, lat, r = Mars.geometric_heliocentric_position(epoch) - - print_me("Geometric Heliocentric Longitude", lon.to_positive()) - - # Geometric Heliocentric Longitude: 2.0015 - - print_me("Geometric Heliocentric Latitude", lat) - - # Geometric Heliocentric Latitude: -1.3683 - - print_me("Radius vector", r) - - # Radius vector: 1.39306 - -Compute the geocentric position for 1992/12/20:: - - epoch = Epoch(1992, 12, 20.0) - - ra, dec, elon = Mars.geocentric_position(epoch) - - print_me("Right ascension", ra.ra_str(n_dec=1)) - - # Right ascension: 7h 48' 35.4'' - - print_me("Declination", dec.dms_str(n_dec=1)) - - # Declination: 24d 35' 33.9'' - - print_me("Elongation", elon.dms_str(n_dec=1)) - - # Elongation: 153d 35' 1.6'' - -Print mean orbital elements for Mars at 2065.6.24:: - - epoch = Epoch(2065, 6, 24.0) - - l, a, e, i, ome, arg = Mars.orbital_elements_mean_equinox(epoch) - - print_me("Mean longitude of the planet", round(l, 6)) - - # Mean longitude of the planet: 288.855211 - - print_me("Semimajor axis of the orbit (UA)", round(a, 8)) - - # Semimajor axis of the orbit (UA): 1.52367934 - - print_me("Eccentricity of the orbit", round(e, 7)) - - # Eccentricity of the orbit: 0.0934599 - - print_me("Inclination on plane of the ecliptic", round(i, 6)) - - # Inclination on plane of the ecliptic: 1.849338 - - print_me("Longitude of the ascending node", round(ome, 5)) - - # Longitude of the ascending node: 50.06365 - - print_me("Argument of the perihelion", round(arg, 6)) - - # Argument of the perihelion: 287.202108 - -Compute the time of the conjunction close to 1993/10/1:: - - epoch = Epoch(1993, 10, 1.0) - - conj = Mars.conjunction(epoch) - - y, m, d = conj.get_date() - - d = round(d, 4) - - date = "{}/{}/{}".format(y, m, d) - - print_me("Conjunction date", date) - - # Conjunction date: 1993/12/27.0898 - -Compute the time of the opposition close to 2729/10/1:: - - epoch = Epoch(2729, 10, 1.0) - - oppo = Mars.opposition(epoch) - - y, m, d = oppo.get_date() - - d = round(d, 4) - - date = "{}/{}/{}".format(y, m, d) - - print_me("Opposition date", date) - - # Opposition date: 2729/9/9.1412 - -Compute the time of the station in longitude #1 close to 1997/3/1:: - - epoch = Epoch(1997, 3, 1.0) - - sta1 = Mars.station_longitude_1(epoch) - - y, m, d = sta1.get_date() - - d = round(d, 4) - - date = "{}/{}/{}".format(y, m, d) - - print_me("Date of station in longitude #1", date) - - # Date of station in longitude #1: 1997/2/6.033 - -Compute the time of the station in longitude #2 close to 1997/3/1:: - - epoch = Epoch(1997, 3, 1.0) - - sta2 = Mars.station_longitude_2(epoch) - - y, m, d = sta2.get_date() - - d = round(d, 4) - - date = "{}/{}/{}".format(y, m, d) - - print_me("Date of station in longitude #2", date) - - # Date of station in longitude #2: 1997/4/27.7553 - -Find the epoch of the Aphelion closer to 2032/1/1:: - - epoch = Epoch(2032, 1, 1.0) - - e = Mars.perihelion_aphelion(epoch, perihelion=False) - - y, m, d, h, mi, s = e.get_full_date() - - peri = str(y) + '/' + str(m) + '/' + str(d) + ' at ' + str(h) + ' hours' - - print_me("The Aphelion closest to 2032/1/1 will happen on", peri) - - # The Aphelion closest to 2032/1/1 will happen on: 2032/10/24 at 22 hours - -Compute the time of passage through an ascending node:: - - epoch = Epoch(2019, 1, 1) - - time, r = Mars.passage_nodes(epoch) - - y, m, d = time.get_date() - - d = round(d, 1) - - print("Time of passage through ascending node: {}/{}/{}".format(y, m, d)) - - # Time of passage through ascending node: 2019/1/15.2 - - print("Radius vector at ascending node: {}".format(round(r, 4))) - - # Radius vector at ascending node: 1.4709 diff -Nru pymeeus-0.4.3+dfsg1/docs/source/ex-Mercury.rst pymeeus-0.5.11+dfsg1/docs/source/ex-Mercury.rst --- pymeeus-0.4.3+dfsg1/docs/source/ex-Mercury.rst 2021-03-03 01:28:56.000000000 +0000 +++ pymeeus-0.5.11+dfsg1/docs/source/ex-Mercury.rst 1970-01-01 00:00:00.000000000 +0000 @@ -1,214 +0,0 @@ -Mercury examples -**************** - -Let's define a small helper function:: - - def print_me(msg, val): - - print("{}: {}".format(msg, val)) - -We can compute the geometric heliocentric position for a given epoch:: - - epoch = Epoch(2018, 10, 27.0) - - lon, lat, r = Mercury.geometric_heliocentric_position(epoch) - - print_me("Geometric Heliocentric Longitude", lon.to_positive()) - - # Geometric Heliocentric Longitude: 287.4887 - - print_me("Geometric Heliocentric Latitude", lat) - - # Geometric Heliocentric Latitude: -6.0086 - - print_me("Radius vector", r) - - # Radius vector: 0.45113 - -Compute the geocentric position for 1992/12/20:: - - epoch = Epoch(1992, 12, 20.0) - - ra, dec, elon = Mercury.geocentric_position(epoch) - - print_me("Right ascension", ra.ra_str(n_dec=1)) - - # Right ascension: 16h 33' 59.3'' - - print_me("Declination", dec.dms_str(n_dec=1)) - - # Declination: -20d 53' 31.6'' - - print_me("Elongation", elon.dms_str(n_dec=1)) - - # Elongation: 18d 24' 29.8'' - -Print mean orbital elements for Mercury at 2065.6.24:: - - epoch = Epoch(2065, 6, 24.0) - - l, a, e, i, ome, arg = Mercury.orbital_elements_mean_equinox(epoch) - - print_me("Mean longitude of the planet", round(l, 6)) - - # Mean longitude of the planet: 203.494701 - - print_me("Semimajor axis of the orbit (UA)", round(a, 8)) - - # Semimajor axis of the orbit (UA): 0.38709831 - - print_me("Eccentricity of the orbit", round(e, 7)) - - # Eccentricity of the orbit: 0.2056451 - - print_me("Inclination on plane of the ecliptic", round(i, 6)) - - # Inclination on plane of the ecliptic: 7.006171 - - print_me("Longitude of the ascending node", round(ome, 5)) - - # Longitude of the ascending node: 49.10765 - - print_me("Argument of the perihelion", round(arg, 6)) - - # Argument of the perihelion: 29.367732 - -Compute the time of the inferior conjunction close to 1993/10/1:: - - epoch = Epoch(1993, 10, 1.0) - - conjunction = Mercury.inferior_conjunction(epoch) - - y, m, d = conjunction.get_date() - - d = round(d, 4) - - date = "{}/{}/{}".format(y, m, d) - - print_me("Inferior conjunction date", date) - - # Inferior conjunction date: 1993/11/6.1449 - -Compute the time of the superior conjunction close to 1993/10/1:: - - epoch = Epoch(1993, 10, 1.0) - - conjunction = Mercury.superior_conjunction(epoch) - - y, m, d = conjunction.get_date() - - d = round(d, 4) - - date = "{}/{}/{}".format(y, m, d) - - print_me("Superior conjunction date", date) - - # Superior conjunction date: 1993/8/29.3301 - -Compute the time and angle of the western elongation close to 1993/11/1:: - - epoch = Epoch(1993, 11, 1.0) - - time, elongation = Mercury.western_elongation(epoch) - - y, m, d = time.get_date() - - d = round(d, 4) - - date = "{}/{}/{}".format(y, m, d) - - print_me("Western elongation date", date) - - # Western elongation date: 1993/11/22.6386 - - elong = round(elongation, 4) - - print_me("Maximum western elongation angle", elong) - - # Maximum western elongation angle: 19.7506 - -Compute the time and angle of the eastern elongation close to 1990/8/1:: - - epoch = Epoch(1990, 8, 1.0) - - time, elongation = Mercury.eastern_elongation(epoch) - - y, m, d = time.get_date() - - d = round(d, 4) - - date = "{}/{}/{}".format(y, m, d) - - print_me("Eastern elongation date", date) - - # Eastern elongation date: 1990/8/11.8514 - - elong = round(elongation, 4) - - print_me("Maximum eastern elongation angle", elong) - - # Maximum eastern elongation angle: 27.4201 - -Compute the time of the station in longitude #1 close to 1993/10/1:: - - epoch = Epoch(1993, 10, 1.0) - - sta1 = Mercury.station_longitude_1(epoch) - - y, m, d = sta1.get_date() - - d = round(d, 4) - - date = "{}/{}/{}".format(y, m, d) - - print_me("Date of station in longitude #1", date) - - # Date of station in longitude #1: 1993/10/25.9358 - -Compute the time of the station in longitude #2 close to 1993/10/1:: - - epoch = Epoch(1993, 10, 1.0) - - sta2 = Mercury.station_longitude_2(epoch) - - y, m, d = sta2.get_date() - - d = round(d, 4) - - date = "{}/{}/{}".format(y, m, d) - - print_me("Date of station in longitude #2", date) - - # Date of station in longitude #2: 1993/11/15.0724 - -Find the epoch of the Perihelion closer to 2000/01/01:: - - epoch = Epoch(2000, 1, 1.0) - - e = Mercury.perihelion_aphelion(epoch) - - y, m, d, h, mi, s = e.get_full_date() - - peri = str(y) + '/' + str(m) + '/' + str(d) + ' at ' + str(h) + ' hours' - - print_me("The Perihelion closest to 2000/1/1 happened on", peri) - - # The Perihelion closest to 2000/1/1 happened on: 2000/2/15 at 18 hours - -Compute the time of passage through an ascending node:: - - epoch = Epoch(2019, 1, 1) - - time, r = Mercury.passage_nodes(epoch) - - y, m, d = time.get_date() - - d = round(d, 1) - - print("Time of passage through ascending node: {}/{}/{}".format(y, m, d)) - - # Time of passage through ascending node: 2018/11/24.7 - - print("Radius vector at ascending node: {}".format(round(r, 4))) - - # Radius vector at ascending node: 0.3143 diff -Nru pymeeus-0.4.3+dfsg1/docs/source/ex-Minor.rst pymeeus-0.5.11+dfsg1/docs/source/ex-Minor.rst --- pymeeus-0.4.3+dfsg1/docs/source/ex-Minor.rst 2021-03-03 01:28:56.000000000 +0000 +++ pymeeus-0.5.11+dfsg1/docs/source/ex-Minor.rst 1970-01-01 00:00:00.000000000 +0000 @@ -1,72 +0,0 @@ -Minor examples -************** - -Let's define a small helper function:: - - def print_me(msg, val): - - print("{}: {}".format(msg, val)) - -Let's compute the equatorial coordinates of comet Encke:: - - a = 2.2091404 - - e = 0.8502196 - - q = a * (1.0 - e) - - i = Angle(11.94524) - - omega = Angle(334.75006) - - w = Angle(186.23352) - - t = Epoch(1990, 10, 28.54502) - - epoch = Epoch(1990, 10, 6.0) - - minor = Minor(q, e, i, omega, w, t) - - ra, dec, elong = minor.geocentric_position(epoch) - - print_me("Right ascension", ra.ra_str(n_dec=1)) - - # Right ascension: 10h 34' 13.7'' - - print_me("Declination", dec.dms_str(n_dec=0)) - - # Declination: 19d 9' 32.0'' - - print_me("Elongation", round(elong, 2)) - - # Elongation: 40.51 - -Now compute the heliocentric ecliptical coordinates:: - - a = 2.2091404 - - e = 0.8502196 - - q = a * (1.0 - e) - - i = Angle(11.94524) - - omega = Angle(334.75006) - - w = Angle(186.23352) - - t = Epoch(1990, 10, 28.54502) - - epoch = Epoch(1990, 10, 6.0) - - minor = Minor(q, e, i, omega, w, t) - - lon, lat = minor.heliocentric_ecliptical_position(epoch) - - print_me("Heliocentric ecliptical longitude", lon.dms_str(n_dec=1)) - - # Heliocentric ecliptical longitude: 66d 51' 57.8'' - - print_me("Heliocentric ecliptical latitude", lat.dms_str(n_dec=1)) - - # Heliocentric ecliptical latitude: 11d 56' 14.4'' diff -Nru pymeeus-0.4.3+dfsg1/docs/source/ex-Neptune.rst pymeeus-0.5.11+dfsg1/docs/source/ex-Neptune.rst --- pymeeus-0.4.3+dfsg1/docs/source/ex-Neptune.rst 2021-03-03 01:28:56.000000000 +0000 +++ pymeeus-0.5.11+dfsg1/docs/source/ex-Neptune.rst 1970-01-01 00:00:00.000000000 +0000 @@ -1,106 +0,0 @@ -Neptune examples -**************** - -Let's define a small helper function:: - - def print_me(msg, val): - - print("{}: {}".format(msg, val)) - -We can compute the geometric heliocentric position for a given epoch:: - - epoch = Epoch(2018, 10, 27.0) - - lon, lat, r = Neptune.geometric_heliocentric_position(epoch) - - print_me("Geometric Heliocentric Longitude", lon.to_positive()) - - # Geometric Heliocentric Longitude: 345.3776 - - print_me("Geometric Heliocentric Latitude", lat) - - # Geometric Heliocentric Latitude: -0.9735 - - print_me("Radius vector", r) - - # Radius vector: 29.93966 - -Compute the geocentric position for 1992/12/20:: - - epoch = Epoch(1992, 12, 20.0) - - ra, dec, elon = Neptune.geocentric_position(epoch) - - print_me("Right ascension", ra.ra_str(n_dec=1)) - - # Right ascension: 19h 17' 14.5'' - - print_me("Declination", dec.dms_str(n_dec=1)) - - # Declination: -21d 34' 15.1'' - - print_me("Elongation", elon.dms_str(n_dec=1)) - - # Elongation: 19d 44' 59.6'' - -Print mean orbital elements for Neptune at 2065.6.24:: - - epoch = Epoch(2065, 6, 24.0) - - l, a, e, i, ome, arg = Neptune.orbital_elements_mean_equinox(epoch) - - print_me("Mean longitude of the planet", round(l, 6)) - - # Mean longitude of the planet: 88.321947 - - print_me("Semimajor axis of the orbit (UA)", round(a, 8)) - - # Semimajor axis of the orbit (UA): 30.11038676 - - print_me("Eccentricity of the orbit", round(e, 7)) - - # Eccentricity of the orbit: 0.0094597 - - print_me("Inclination on plane of the ecliptic", round(i, 6)) - - # Inclination on plane of the ecliptic: 1.763855 - - print_me("Longitude of the ascending node", round(ome, 5)) - - # Longitude of the ascending node: 132.46986 - - print_me("Argument of the perihelion", round(arg, 6)) - - # Argument of the perihelion: -83.415521 - -Compute the time of the conjunction close to 1993/10/1:: - - epoch = Epoch(1993, 10, 1.0) - - conj = Neptune.conjunction(epoch) - - y, m, d = conj.get_date() - - d = round(d, 4) - - date = "{}/{}/{}".format(y, m, d) - - print_me("Conjunction date", date) - - # Conjunction date: 1994/1/11.3057 - -Compute the time of the opposition close to 1846/8/1:: - - epoch = Epoch(1846, 8, 1) - - oppo = Neptune.opposition(epoch) - - y, m, d = oppo.get_date() - - d = round(d, 4) - - date = "{}/{}/{}".format(y, m, d) - - print_me("Opposition date", date) - - # Opposition date: 1846/8/20.1623 diff -Nru pymeeus-0.4.3+dfsg1/docs/source/ex-Pluto.rst pymeeus-0.5.11+dfsg1/docs/source/ex-Pluto.rst --- pymeeus-0.4.3+dfsg1/docs/source/ex-Pluto.rst 2021-03-03 01:28:56.000000000 +0000 +++ pymeeus-0.5.11+dfsg1/docs/source/ex-Pluto.rst 1970-01-01 00:00:00.000000000 +0000 @@ -1,40 +0,0 @@ -Pluto examples -************** - -Let's define a small helper function:: - - def print_me(msg, val): - - print("{}: {}".format(msg, val)) - -We can compute the geometric heliocentric position for a given epoch:: - - epoch = Epoch(2018, 10, 27.0) - - lon, lat, r = Pluto.geometric_heliocentric_position(epoch) - - print_me("Geometric Heliocentric Longitude", lon.to_positive()) - - # Geometric Heliocentric Longitude: 232.740711423 - - print_me("Geometric Heliocentric Latitude", lat) - - # Geometric Heliocentric Latitude: 14.5878173017 - - print_me("Radius vector", r) - - # Radius vector: 29.711110981 - -Compute the geocentric position for 1992/12/20:: - - epoch = Epoch(1992, 12, 20.0) - - ra, dec, elon = Pluto.geocentric_position(epoch) - - print_me("Right ascension", ra.ra_str(n_dec=1)) - - # Right ascension: 15h 31' 43.7'' - - print_me("Declination", dec.dms_str(n_dec=1)) - - # Declination: -4d 27' 28.8'' diff -Nru pymeeus-0.4.3+dfsg1/docs/source/ex-Saturn.rst pymeeus-0.5.11+dfsg1/docs/source/ex-Saturn.rst --- pymeeus-0.4.3+dfsg1/docs/source/ex-Saturn.rst 2021-03-03 01:28:56.000000000 +0000 +++ pymeeus-0.5.11+dfsg1/docs/source/ex-Saturn.rst 1970-01-01 00:00:00.000000000 +0000 @@ -1,236 +0,0 @@ -Saturn examples -*************** - -Let's define a small helper function:: - - def print_me(msg, val): - - print("{}: {}".format(msg, val)) - -We can compute the geometric heliocentric position for a given epoch:: - - epoch = Epoch(2018, 10, 27.0) - - lon, lat, r = Saturn.geometric_heliocentric_position(epoch) - - print_me("Geometric Heliocentric Longitude", lon.to_positive()) - - # Geometric Heliocentric Longitude: 279.5108 - - print_me("Geometric Heliocentric Latitude", lat) - - # Geometric Heliocentric Latitude: 0.6141 - - print_me("Radius vector", r) - - # Radius vector: 10.06266 - -Compute the geocentric position for 1992/12/20:: - - epoch = Epoch(1992, 12, 20.0) - - ra, dec, elon = Saturn.geocentric_position(epoch) - - print_me("Right ascension", ra.ra_str(n_dec=1)) - - # Right ascension: 21h 11' 41.8'' - - print_me("Declination", dec.dms_str(n_dec=1)) - - # Declination: -17d 15' 40.8'' - - print_me("Elongation", elon.dms_str(n_dec=1)) - - # Elongation: 46d 51' 47.7'' - -Print mean orbital elements for Saturn at 2065.6.24:: - - epoch = Epoch(2065, 6, 24.0) - - l, a, e, i, ome, arg = Saturn.orbital_elements_mean_equinox(epoch) - - print_me("Mean longitude of the planet", round(l, 6)) - - # Mean longitude of the planet: 131.196871 - - print_me("Semimajor axis of the orbit (UA)", round(a, 8)) - - # Semimajor axis of the orbit (UA): 9.55490779 - - print_me("Eccentricity of the orbit", round(e, 7)) - - # Eccentricity of the orbit: 0.0553209 - - print_me("Inclination on plane of the ecliptic", round(i, 6)) - - # Inclination on plane of the ecliptic: 2.486426 - - print_me("Longitude of the ascending node", round(ome, 5)) - - # Longitude of the ascending node: 114.23974 - - print_me("Argument of the perihelion", round(arg, 6)) - - # Argument of the perihelion: -19.896331 - -Compute the time of the conjunction close to 2125/6/1:: - - epoch = Epoch(2125, 6, 1.0) - - conj = Saturn.conjunction(epoch) - - y, m, d = conj.get_date() - - d = round(d, 4) - - date = "{}/{}/{}".format(y, m, d) - - print_me("Conjunction date", date) - - # Conjunction date: 2125/8/26.4035 - -Compute the time of the opposition close to -6/9/1:: - - epoch = Epoch(-6, 9, 1.0) - - oppo = Saturn.opposition(epoch) - - y, m, d = oppo.get_date() - - d = round(d, 4) - - date = "{}/{}/{}".format(y, m, d) - - print_me("Opposition date", date) - - # Opposition date: -6/9/14.3709 - -Compute the time of the station in longitude #1 close to 2018/11/1:: - - epoch = Epoch(2018, 11, 1.0) - - sta1 = Saturn.station_longitude_1(epoch) - - y, m, d = sta1.get_date() - - d = round(d, 4) - - date = "{}/{}/{}".format(y, m, d) - - print_me("Date of station in longitude #1", date) - - # Date of station in longitude #1: 2018/4/17.9433 - -Compute the time of the station in longitude #2 close to 2018/11/1:: - - epoch = Epoch(2018, 11, 1.0) - - sta2 = Saturn.station_longitude_2(epoch) - - y, m, d = sta2.get_date() - - d = round(d, 4) - - date = "{}/{}/{}".format(y, m, d) - - print_me("Date of station in longitude #2", date) - - # Date of station in longitude #2: 2018/9/6.4175 - -Find the epoch of the Perihelion closer to 2000/1/1:: - - epoch = Epoch(2000, 1, 1.0) - - e = Saturn.perihelion_aphelion(epoch) - - y, m, d, h, mi, s = e.get_full_date() - - peri = str(y) + '/' + str(m) + '/' + str(d) + ' at ' + str(h) + ' hours' - - print_me("The Perihelion closest to 2000/1/1 happened on", peri) - - # The Perihelion closest to 2000/1/1 happened on: 2003/7/26 at 15 hours - -Compute the time of passage through an ascending node:: - - epoch = Epoch(2019, 1, 1) - - time, r = Saturn.passage_nodes(epoch) - - y, m, d = time.get_date() - - d = round(d, 1) - - print("Time of passage through ascending node: {}/{}/{}".format(y, m, d)) - - # Time of passage through ascending node: 2034/5/30.2 - - print_me("Radius vector at ascending node", round(r, 4)) - - # Radius vector at ascending node: 9.0546 - -Compute the approximate magnitude of Saturn:: - - sun_dist = 9.867882 - - earth_dist = 10.464606 - - delta_u = Angle(16.442) - - b = Angle(4.198) - - m = Saturn.magnitude(sun_dist, earth_dist, delta_u, b) - - printi_me("Approximate magnitude of Saturn", m) - - # Approximate magnitude of Saturn: 1.9 - -Compute the ring inclination:: - - epoch = Epoch(1992, 12, 16.00068) - - i = Saturn.ring_inclination(epoch) - - print_me("Saturn's ring inclination", round(i, 6)) - - # Saturn's ring inclination: 28.076131 - -Compute the longitude of the ascending node of the ring:: - - epoch = Epoch(1992, 12, 16.00068) - - omega = Saturn.ring_logitude_ascending_node(epoch) - - print_me("Saturn's ring longitude of the ascending node", round(omega, 6)) - - # Saturn's ring longitude of the ascending node: 169.410243 - -Compute the parameters related to the ring:: - - epoch = Epoch(1992, 12, 16.00068) - - B, Bprime, P, delta_U, a, b = Saturn.ring_parameters(epoch) - - print_me("Saturnicentric latitude of the Earth", round(B, 3)) - - # Saturnicentric latitude of the Eart: h16.442 - - print_me("Saturnicentric latitude of the Sun", round(Bprime, 3)) - - # Saturnicentric latitude of the Sun: 14.679 - - print_me("Geocentric position angle of nothern semiminor axis", round(P, 3)) - - # Geocentric position angle of nothern semiminor axis: 6.741 - - print_me("Difference in Saturnicentric longitudes of Sun and Earth", round(delta_U, 3)) - - # Difference in Saturnicentric longitudes of Sun and Earth: 4.198 - - print_me("Size of major axis of outer ring", round(a, 2)) - - # Size of major axis of outer ring: 35.87 - - print_me("Size of minor axis of outer ring", round(b, 2)) - - # Size of minor axis of outer ring: 10.15 diff -Nru pymeeus-0.4.3+dfsg1/docs/source/ex-Sun.rst pymeeus-0.5.11+dfsg1/docs/source/ex-Sun.rst --- pymeeus-0.4.3+dfsg1/docs/source/ex-Sun.rst 2021-03-03 01:28:56.000000000 +0000 +++ pymeeus-0.5.11+dfsg1/docs/source/ex-Sun.rst 1970-01-01 00:00:00.000000000 +0000 @@ -1,206 +0,0 @@ -Sun examples -************ - -Let's define a small helper function:: - - def print_me(msg, val): - - print("{}: {}".format(msg, val)) - -It is possible to compute an approximation of the Sun's **true** ecliptical longitude:: - - epoch = Epoch(1992, 10, 13) - - true_lon, r = Sun.true_longitude_coarse(epoch) - - print_me("Sun's approximate true longitude", true_lon.dms_str(n_dec=0)) - - # Sun's approximate true longitude: 199d 54' 36.0'' - - print_me("Sun's radius vector", round(r, 5)) - - # Sun's radius vector: 0.99766 - -Now let's compute the Sun's approximate **apparent** ecliptical longitude:: - - epoch = Epoch(1992, 10, 13) - - app_lon, r = Sun.apparent_longitude_coarse(epoch) - - print_me("Sun's approximate apparent longitude", app_lon.dms_str(n_dec=0)) - - # Sun's approximate apparent longitude: 199d 54' 32.0'' - -And now is the turn for the **apparent** right ascension and declination:: - - epoch = Epoch(1992, 10, 13) - - ra, delta, r = Sun.apparent_rightascension_declination_coarse(epoch) - - print_me("Sun's apparent right ascension", ra.ra_str(n_dec=1)) - - # Sun's apparent right ascension: 13h 13' 31.4'' - - print_me("Sun's apparent declination", delta.dms_str(n_dec=0)) - - # Sun's apparent declination: -7d 47' 6.0'' - -Now, let's compute Sun's true (**geometric**) position again, but more accurately:: - - epoch = Epoch(1992, 10, 13.0) - - l, b, r = Sun.geometric_geocentric_position(epoch, toFK5=False) - - print_me("Geometric Geocentric Longitude", round(l.to_positive(), 6)) - - # Geometric Geocentric Longitude: 199.907297 - - print_me("Geometric Geocentric Latitude", b.dms_str(n_dec=3)) - - # Geometric Geocentric Latitude: 0.744'' - - print_me("Radius vector", round(r, 8)) - - # Radius vector: 0.99760852 - -Compute Sun's **apparent** postion accurately:: - - epoch = Epoch(1992, 10, 13.0) - - l, b, r = Sun.apparent_geocentric_position(epoch) - - print_me("Apparent Geocentric Longitude", l.to_positive().dms_str(n_dec=3)) - - # Apparent Geocentric Longitude: 199d 54' 21.548'' - - print_me("Apparent Geocentric Latitude", b.dms_str(n_dec=3)) - - # Apparent Geocentric Latitude; 0.721'' - - print_me("Radius vector", round(r, 8)) - - # Radius vector: 0.99760852 - -We can compute rectangular coordinates referred to mean equinox of date:: - - epoch = Epoch(1992, 10, 13.0) - - x, y, z = Sun.rectangular_coordinates_mean_equinox(epoch) - - print_me("X", round(x, 7)) - - # X: -0.9379963 - - print_me("Y", round(y, 6)) - - # Y: -0.311654 - - print_me("Z", round(z, 7)) - - # Z: -0.1351207 - -Now, compute rectangular coordinates w.r.t. standard equinox J2000.0:: - - epoch = Epoch(1992, 10, 13.0) - - x, y, z = Sun.rectangular_coordinates_j2000(epoch) - - print_me("X", round(x, 8)) - - # X: -0.93740485 - - print_me("Y", round(y, 8)) - - # Y: -0.3131474 - - print_me("Z", round(z, 8)) - - # Z: -0.12456646 - -Compute rectangular coordinates w.r.t. mean equinox of B1950.0:: - - epoch = Epoch(1992, 10, 13.0) - - x, y, z = Sun.rectangular_coordinates_b1950(epoch) - - print_me("X", round(x, 8)) - - # X: -0.94149557 - - print_me("Y", round(y, 8)) - - # Y: -0.30259922 - - print_me("Z", round(z, 8)) - - # Z: -0.11578695 - -And compute rectangular coordinates w.r.t. an arbitrary mean equinox:: - - epoch = Epoch(1992, 10, 13.0) - - e_equinox = Epoch(2467616.0) - - x, y, z = Sun.rectangular_coordinates_equinox(epoch, e_equinox) - - print_me("X", round(x, 8)) - - # X: -0.93373777 - - print_me("Y", round(y, 8)) - - # Y: -0.32235109 - - print_me("Z", round(z, 8)) - - # Z: -0.12856709 - -It is possible to compute the date of equinoxes and solstices:: - - epoch = Sun.get_equinox_solstice(1962, target="summer") - - y, m, d, h, mi, s = epoch.get_full_date() - - print("The summer solstice of 1962:") - - print("{}/{}/{} {}:{}:{}".format(y, m, d, h, mi, round(s, 0))) - - # 1962/6/21 21:24:42.0 - -The equation of time, i.e., the difference between apparent and mean time, can be easily computed:: - - epoch = Epoch(1992, 10, 13.0) - - m, s = Sun.equation_of_time(epoch) - - print("Equation of time difference: {} min {} secs".format(m, round(s, 1))) - - # Equation of time difference: 13 min 42.6 secs - -Compute the ephemeris of physical observations of the Sun using Carrington's formulas:: - - epoch = Epoch(1992, 10, 13) - - p, b0, l0 = Sun.ephemeris_physical_observations(epoch) - - print("Ephemeris of physical observations of the Sun:") - - print_me("P ", round(p, 2)) - - # P : 26.27 - - print_me("B0", round(b0, 2)) - - # B0: 5.99 - - print_me("L0", round(l0, 2)) - - # L0: 238.63 - -Get the epoch when the Carrington's synodic rotation No. 'number' starts:: - - epoch = Sun.beginning_synodic_rotation(1699) - - print_me("Epoch for Carrington's synodic rotation No. 1699", round(epoch(), 3)) - - # Epoch for Carrington's synodic rotation No. 1699: 2444480.723 diff -Nru pymeeus-0.4.3+dfsg1/docs/source/ex-Uranus.rst pymeeus-0.5.11+dfsg1/docs/source/ex-Uranus.rst --- pymeeus-0.4.3+dfsg1/docs/source/ex-Uranus.rst 2021-03-03 01:28:56.000000000 +0000 +++ pymeeus-0.5.11+dfsg1/docs/source/ex-Uranus.rst 1970-01-01 00:00:00.000000000 +0000 @@ -1,138 +0,0 @@ -Uranus examples -*************** - -Let's define a small helper function:: - - def print_me(msg, val): - - print("{}: {}".format(msg, val)) - -We can compute the geometric heliocentric position for a given epoch:: - - epoch = Epoch(2018, 10, 27.0) - - lon, lat, r = Uranus.geometric_heliocentric_position(epoch) - - print_me("Geometric Heliocentric Longitude", lon.to_positive()) - - # Geometric Heliocentric Longitude: 30.5888 - - print_me("Geometric Heliocentric Latitude", lat) - - # Geometric Heliocentric Latitude: -0.5315 - - print_me("Radius vector", r) - - # Radius vector: 19.86964 - -Compute the geocentric position for 1992/12/20:: - - epoch = Epoch(1992, 12, 20.0) - - ra, dec, elon = Uranus.geocentric_position(epoch) - - print_me("Right ascension", ra.ra_str(n_dec=1)) - - # Right ascension: 19h 13' 48.7'' - - print_me("Declination", dec.dms_str(n_dec=1)) - - # Declination: -22d 46' 13.0'' - - print_me("Elongation", elon.dms_str(n_dec=1)) - - # Elongation: 18d 44' 18.7'' - -Print mean orbital elements for Uranus at 2065.6.24:: - - epoch = Epoch(2065, 6, 24.0) - - l, a, e, i, ome, arg = Uranus.orbital_elements_mean_equinox(epoch) - - print_me("Mean longitude of the planet", round(l, 6)) - - # Mean longitude of the planet: 235.517526 - - print_me("Semimajor axis of the orbit (UA)", round(a, 8)) - - # Semimajor axis of the orbit (UA): 19.21844604 - - print_me("Eccentricity of the orbit", round(e, 7)) - - # Eccentricity of the orbit: 0.0463634 - - print_me("Inclination on plane of the ecliptic", round(i, 6)) - - # Inclination on plane of the ecliptic: 0.77372 - - print_me("Longitude of the ascending node", round(ome, 5)) - - # Longitude of the ascending node: 74.34776 - - print_me("Argument of the perihelion", round(arg, 6)) - - # Argument of the perihelion: 99.630865 - -Compute the time of the conjunction close to 1993/10/1:: - - epoch = Epoch(1993, 10, 1.0) - - conj = Uranus.conjunction(epoch) - - y, m, d = conj.get_date() - - d = round(d, 4) - - date = "{}/{}/{}".format(y, m, d) - - print_me("Conjunction date", date) - - # Conjunction date: 1994/1/12.7365 - -Compute the time of the opposition close to 1780/12/1:: - - epoch = Epoch(1780, 12, 1.0) - - oppo = Uranus.opposition(epoch) - - y, m, d = oppo.get_date() - - d = round(d, 4) - - date = "{}/{}/{}".format(y, m, d) - - print_me("Opposition date", date) - - # Opposition date: 1780/12/17.5998 - -Find the epoch of the Perihelion closer to 1780/1/1:: - - epoch = Epoch(1780, 1, 1.0) - - e = Uranus.perihelion_aphelion(epoch) - - y, m, d = e.get_date() - - peri = str(y) + '/' + str(m) + '/' + str(int(d)) - - print_me("The Perihelion closest to 1780/1/1 happened on", peri) - - # The Perihelion closest to 1780/1/1 happened on: 1798/2/26 - -Compute the time of passage through an ascending node:: - - epoch = Epoch(2019, 1, 1) - - time, r = Uranus.passage_nodes(epoch) - - y, m, d = time.get_date() - - d = round(d, 1) - - print("Time of passage through ascending node: {}/{}/{}".format(y, m, d)) - - # Time of passage through ascending node: 2028/8/23.2 - - print("Radius vector at ascending node: {}".format(round(r, 4))) - - # Radius vector at ascending node: 19.3201 diff -Nru pymeeus-0.4.3+dfsg1/docs/source/ex-Venus.rst pymeeus-0.5.11+dfsg1/docs/source/ex-Venus.rst --- pymeeus-0.4.3+dfsg1/docs/source/ex-Venus.rst 2021-03-03 01:28:56.000000000 +0000 +++ pymeeus-0.5.11+dfsg1/docs/source/ex-Venus.rst 1970-01-01 00:00:00.000000000 +0000 @@ -1,238 +0,0 @@ -Venus examples -************** - -Let's define a small helper function:: - - def print_me(msg, val): - - print("{}: {}".format(msg, val)) - -We can compute the geometric heliocentric position for a given epoch:: - - epoch = Epoch(1992, 12, 20.0) - - lon, lat, r = Venus.geometric_heliocentric_position(epoch) - - print_me("Geometric Heliocentric Longitude", round(lon.to_positive(), 5)) - - # Geometric Heliocentric Longitude: 26.11428 - - print_me("Geometric Heliocentric Latitude", round(lat, 4)) - - # Geometric Heliocentric Latitude: -2.6207 - - print_me("Radius vector", round(r, 6)) - - # Radius vector: 0.724603 - -Compute the geocentric position for 1992/12/20:: - - epoch = Epoch(1992, 12, 20.0) - - ra, dec, elon = Venus.geocentric_position(epoch) - - print_me("Right ascension", ra.ra_str(n_dec=1)) - - # Right ascension: 21h 4' 41.5'' - - print_me("Declination", dec.dms_str(n_dec=1)) - - # Declination: -18d 53' 16.8'' - - print_me("Elongation", elon.dms_str(n_dec=1)) - - # Elongation: 44d 46' 8.9'' - -Print mean orbital elements for Venus at 2065.6.24:: - - epoch = Epoch(2065, 6, 24.0) - - l, a, e, i, ome, arg = Venus.orbital_elements_mean_equinox(epoch) - - print_me("Mean longitude of the planet", round(l, 6)) - - # Mean longitude of the planet: 338.646306 - - print_me("Semimajor axis of the orbit (UA)", round(a, 8)) - - # Semimajor axis of the orbit (UA): 0.72332982 - - print_me("Eccentricity of the orbit", round(e, 7)) - - # Eccentricity of the orbit: 0.0067407 - - print_me("Inclination on plane of the ecliptic", round(i, 6)) - - # Inclination on plane of the ecliptic: 3.395319 - - print_me("Longitude of the ascending node", round(ome, 5)) - - # Longitude of the ascending node: 77.27012 - - print_me("Argument of the perihelion", round(arg, 6)) - - # Argument of the perihelion: 55.211257 - -Compute the time of the inferior conjunction close to 1882/12/1.0:: - - epoch = Epoch(1882, 12, 1.0) - - conjunction = Venus.inferior_conjunction(epoch) - - y, m, d = conjunction.get_date() - - d = round(d, 4) - - date = "{}/{}/{}".format(y, m, d) - - print_me("Inferior conjunction date", date) - - # Inferior conjunction date: 1882/12/6.6912 - -Compute the time of the superior conjunction close to 1993/10/1:: - - epoch = Epoch(1993, 10, 1.0) - - conjunction = Venus.superior_conjunction(epoch) - - y, m, d = conjunction.get_date() - - d = round(d, 4) - - date = "{}/{}/{}".format(y, m, d) - - print_me("Superior conjunction date", date) - - # Superior conjunction date: 1994/1/17.0465 - -Compute the time and angle of the western elongation close to 2019/1/1:: - - epoch = Epoch(2019, 1, 1.0) - - time, elongation = Venus.western_elongation(epoch) - - y, m, d = time.get_date() - - d = round(d, 4) - - date = "{}/{}/{}".format(y, m, d) - - print_me("Western elongation date", date) - - # Western elongation date: 2019/1/6.1895 - - elong = round(elongation, 4) - - print_me("Maximum western elongation angle", elong) - - # Maximum western elongation angle: 46.9571 - -Compute the time and angle of the eastern elongation close to 2019/10/1:: - - epoch = Epoch(2019, 10, 1.0) - - time, elongation = Venus.eastern_elongation(epoch) - - y, m, d = time.get_date() - - d = round(d, 4) - - date = "{}/{}/{}".format(y, m, d) - - print_me("Eastern elongation date", date) - - # Eastern elongation date: 2020/3/24.9179 - - elong = round(elongation, 4) - - print_me("Maximum eastern elongation angle", elong) - - # Maximum eastern elongation angle: 46.078 - -Compute the time of the station in longitude #1 close to 2018/12/1:: - - epoch = Epoch(2018, 12, 1.0) - - sta1 = Venus.station_longitude_1(epoch) - - y, m, d = sta1.get_date() - - d = round(d, 4) - - date = "{}/{}/{}".format(y, m, d) - - print_me("Date of station in longitude #1", date) - - # Date of station in longitude #1: 2018/10/5.7908 - -Compute the time of the station in longitude #2 close to 2018/12/1:: - - epoch = Epoch(2018, 12, 1.0) - - sta2 = Venus.station_longitude_2(epoch) - - y, m, d = sta2.get_date() - - d = round(d, 4) - - date = "{}/{}/{}".format(y, m, d) - - print_me("Date of station in longitude #2", date) - - # Date of station in longitude #2: 2018/11/16.439 - -Find the epoch of the Perihelion closer to 1978/10/15:: - - epoch = Epoch(1978, 10, 15.0) - - e = Venus.perihelion_aphelion(epoch) - - y, m, d, h, mi, s = e.get_full_date() - - peri = str(y) + '/' + str(m) + '/' + str(d) + ' at ' + str(h) + ' hours' - - print_me("The Perihelion closest to 1978/10/15 happened on", peri) - - # The Perihelion closest to 1978/10/15 happened on: 1978/12/31 at 4 hours - -Compute the time of passage through an ascending node:: - - epoch = Epoch(1979, 1, 1) - - time, r = Venus.passage_nodes(epoch) - - y, m, d = time.get_date() - - d = round(d, 1) - - print("Time of passage through ascending node: {}/{}/{}".format(y, m, d)) - - # Time of passage through ascending node: 1978/11/27.4 - - print("Radius vector at ascending node: {}".format(round(r, 4))) - - # Radius vector at ascending node: 0.7205 - -Compute the (approximate) illuminated fraction of Venus disk for an Epoch:: - - epoch = Epoch(1992, 12, 20) - - k = Venus.illuminated_fraction(epoch) - - print_me("Approximate illuminated fraction of Venus", round(k, 2)) - - # Approximate illuminated fraction of Venus: 0.64 - -Compute the magnitude of Venus:: - - sun_dist = 0.724604 - - earth_dist = 0.910947 - - phase_angle = Angle(72.96) - - m = Venus.magnitude(sun_dist, earth_dist, phase_angle) - - print_me("Venus' magnitude", round(m, 1)) - - # Venus' magnitude: -3.8 diff -Nru pymeeus-0.4.3+dfsg1/docs/source/index.rst pymeeus-0.5.11+dfsg1/docs/source/index.rst --- pymeeus-0.4.3+dfsg1/docs/source/index.rst 2021-03-03 01:28:56.000000000 +0000 +++ pymeeus-0.5.11+dfsg1/docs/source/index.rst 2021-03-04 19:40:11.000000000 +0000 @@ -6,52 +6,22 @@ .. include:: ../../README.rst +API +======= .. toctree:: :maxdepth: 2 - :caption: API: - base - Angle - Coordinates - CurveFitting - Earth - Epoch - Interpolation - Jupiter - JupiterMoons - Mars - Mercury - Minor - Neptune - Pluto - Saturn - Sun - Uranus - Venus + core/index + bodies/index + +Examples +======== .. toctree:: :maxdepth: 2 - :caption: Examples: - ex-base - ex-Angle - ex-Coordinates - ex-CurveFitting - ex-Earth - ex-Epoch - ex-Interpolation - ex-Jupiter - ex-JupiterMoons - ex-Mars - ex-Mercury - ex-Minor - ex-Neptune - ex-Pluto - ex-Saturn - ex-Sun - ex-Uranus - ex-Venus + examples/index Indices and tables diff -Nru pymeeus-0.4.3+dfsg1/docs/source/Interpolation.rst pymeeus-0.5.11+dfsg1/docs/source/Interpolation.rst --- pymeeus-0.4.3+dfsg1/docs/source/Interpolation.rst 2021-03-03 01:28:56.000000000 +0000 +++ pymeeus-0.5.11+dfsg1/docs/source/Interpolation.rst 1970-01-01 00:00:00.000000000 +0000 @@ -1,12 +0,0 @@ -Interpolation -************* - -.. automodule:: pymeeus - - -Class to find intermediate values from those given in a table. - -.. automodule:: pymeeus.Interpolation - :members: - :special-members: - diff -Nru pymeeus-0.4.3+dfsg1/docs/source/JupiterMoons.rst pymeeus-0.5.11+dfsg1/docs/source/JupiterMoons.rst --- pymeeus-0.4.3+dfsg1/docs/source/JupiterMoons.rst 2021-03-03 01:28:56.000000000 +0000 +++ pymeeus-0.5.11+dfsg1/docs/source/JupiterMoons.rst 1970-01-01 00:00:00.000000000 +0000 @@ -1,9 +0,0 @@ -JupiterMoons -************** - -Class to model JupiterMoons. - -.. automodule:: pymeeus.JupiterMoons - :members: - :special-members: - diff -Nru pymeeus-0.4.3+dfsg1/docs/source/Jupiter.rst pymeeus-0.5.11+dfsg1/docs/source/Jupiter.rst --- pymeeus-0.4.3+dfsg1/docs/source/Jupiter.rst 2021-03-03 01:28:56.000000000 +0000 +++ pymeeus-0.5.11+dfsg1/docs/source/Jupiter.rst 1970-01-01 00:00:00.000000000 +0000 @@ -1,12 +0,0 @@ -Jupiter -******* - -.. automodule:: pymeeus - - -Class to model Jupiter planet. - -.. automodule:: pymeeus.Jupiter - :members: - :special-members: - diff -Nru pymeeus-0.4.3+dfsg1/docs/source/Mars.rst pymeeus-0.5.11+dfsg1/docs/source/Mars.rst --- pymeeus-0.4.3+dfsg1/docs/source/Mars.rst 2021-03-03 01:28:56.000000000 +0000 +++ pymeeus-0.5.11+dfsg1/docs/source/Mars.rst 1970-01-01 00:00:00.000000000 +0000 @@ -1,12 +0,0 @@ -Mars -**** - -.. automodule:: pymeeus - - -Class to model Mars planet. - -.. automodule:: pymeeus.Mars - :members: - :special-members: - diff -Nru pymeeus-0.4.3+dfsg1/docs/source/Mercury.rst pymeeus-0.5.11+dfsg1/docs/source/Mercury.rst --- pymeeus-0.4.3+dfsg1/docs/source/Mercury.rst 2021-03-03 01:28:56.000000000 +0000 +++ pymeeus-0.5.11+dfsg1/docs/source/Mercury.rst 1970-01-01 00:00:00.000000000 +0000 @@ -1,12 +0,0 @@ -Mercury -******* - -.. automodule:: pymeeus - - -Class to model Mercury planet. - -.. automodule:: pymeeus.Mercury - :members: - :special-members: - diff -Nru pymeeus-0.4.3+dfsg1/docs/source/Minor.rst pymeeus-0.5.11+dfsg1/docs/source/Minor.rst --- pymeeus-0.4.3+dfsg1/docs/source/Minor.rst 2021-03-03 01:28:56.000000000 +0000 +++ pymeeus-0.5.11+dfsg1/docs/source/Minor.rst 1970-01-01 00:00:00.000000000 +0000 @@ -1,12 +0,0 @@ -Minor -***** - -.. automodule:: pymeeus - - -Class to model minor celestial objetcs. - -.. automodule:: pymeeus.Minor - :members: - :special-members: - diff -Nru pymeeus-0.4.3+dfsg1/docs/source/Neptune.rst pymeeus-0.5.11+dfsg1/docs/source/Neptune.rst --- pymeeus-0.4.3+dfsg1/docs/source/Neptune.rst 2021-03-03 01:28:56.000000000 +0000 +++ pymeeus-0.5.11+dfsg1/docs/source/Neptune.rst 1970-01-01 00:00:00.000000000 +0000 @@ -1,12 +0,0 @@ -Neptune -******* - -.. automodule:: pymeeus - - -Class to model Neptune planet. - -.. automodule:: pymeeus.Neptune - :members: - :special-members: - diff -Nru pymeeus-0.4.3+dfsg1/docs/source/Pluto.rst pymeeus-0.5.11+dfsg1/docs/source/Pluto.rst --- pymeeus-0.4.3+dfsg1/docs/source/Pluto.rst 2021-03-03 01:28:56.000000000 +0000 +++ pymeeus-0.5.11+dfsg1/docs/source/Pluto.rst 1970-01-01 00:00:00.000000000 +0000 @@ -1,12 +0,0 @@ -Pluto -***** - -.. automodule:: pymeeus - - -Class to model Pluto planet. - -.. automodule:: pymeeus.Pluto - :members: - :special-members: - diff -Nru pymeeus-0.4.3+dfsg1/docs/source/Saturn.rst pymeeus-0.5.11+dfsg1/docs/source/Saturn.rst --- pymeeus-0.4.3+dfsg1/docs/source/Saturn.rst 2021-03-03 01:28:56.000000000 +0000 +++ pymeeus-0.5.11+dfsg1/docs/source/Saturn.rst 1970-01-01 00:00:00.000000000 +0000 @@ -1,12 +0,0 @@ -Saturn -****** - -.. automodule:: pymeeus - - -Class to model Saturn planet. - -.. automodule:: pymeeus.Saturn - :members: - :special-members: - diff -Nru pymeeus-0.4.3+dfsg1/docs/source/Sun.rst pymeeus-0.5.11+dfsg1/docs/source/Sun.rst --- pymeeus-0.4.3+dfsg1/docs/source/Sun.rst 2021-03-03 01:28:56.000000000 +0000 +++ pymeeus-0.5.11+dfsg1/docs/source/Sun.rst 1970-01-01 00:00:00.000000000 +0000 @@ -1,12 +0,0 @@ -Sun -*** - -.. automodule:: pymeeus - - -Module holding functions to handle coordinates. - -.. automodule:: pymeeus.Sun - :members: - :special-members: - diff -Nru pymeeus-0.4.3+dfsg1/docs/source/Uranus.rst pymeeus-0.5.11+dfsg1/docs/source/Uranus.rst --- pymeeus-0.4.3+dfsg1/docs/source/Uranus.rst 2021-03-03 01:28:56.000000000 +0000 +++ pymeeus-0.5.11+dfsg1/docs/source/Uranus.rst 1970-01-01 00:00:00.000000000 +0000 @@ -1,12 +0,0 @@ -Uranus -****** - -.. automodule:: pymeeus - - -Class to model Uranus planet. - -.. automodule:: pymeeus.Uranus - :members: - :special-members: - diff -Nru pymeeus-0.4.3+dfsg1/docs/source/Venus.rst pymeeus-0.5.11+dfsg1/docs/source/Venus.rst --- pymeeus-0.4.3+dfsg1/docs/source/Venus.rst 2021-03-03 01:28:56.000000000 +0000 +++ pymeeus-0.5.11+dfsg1/docs/source/Venus.rst 1970-01-01 00:00:00.000000000 +0000 @@ -1,12 +0,0 @@ -Venus -***** - -.. automodule:: pymeeus - - -Class to model Venus planet. - -.. automodule:: pymeeus.Venus - :members: - :special-members: - diff -Nru pymeeus-0.4.3+dfsg1/PKG-INFO pymeeus-0.5.11+dfsg1/PKG-INFO --- pymeeus-0.4.3+dfsg1/PKG-INFO 2021-03-03 01:28:56.000000000 +0000 +++ pymeeus-0.5.11+dfsg1/PKG-INFO 2021-03-18 21:06:59.482617600 +0000 @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: PyMeeus -Version: 0.4.3 +Version: 0.5.11 Summary: Python implementation of Jean Meeus astronomical routines Home-page: https://github.com/architest/pymeeus Author: Dagoberto Salazar @@ -46,6 +46,13 @@ pip3 install --user pymeeus + If you have PyMeeus already installed, but want to upgrade to the latest + version: + + .. code:: sh + + pip3 install -U pymeeus + Meta ---- @@ -108,6 +115,59 @@ What's new ---------- + - 0.5.11 + + - Added parameter ``local`` to the ``Epoch`` class constructor and + the methods ``get_date()`` and ``get_full_date()``. + + - 0.5.10 + + - Added methods ``moon_librations()`` and + ``moon_position_angle_axis()``. + + - 0.5.9 + + - Added method ``moon_maximum_declination()``. + + - 0.5.8 + + - Fixed several bugs in ``Epoch`` class, and added method ``doy()``. + + - 0.5.7 + + - Added method ``moon_passage_nodes()``. + + - 0.5.6 + + - Added method ``moon_perigee_apogee()``. + + - 0.5.5 + + - Added method ``moon_phase()``. + + - 0.5.4 + + - Added methods ``illuminated_fraction_disk()`` and + ``position_bright_limb()`` to ``Moon`` class. + + - 0.5.3 + + - Fixed error in the return type of method + ``Sun.equation_of_time()``. + + - 0.5.2 + + - Added methods to compute the Moon's longitude of ascending node + and perigee. + + - 0.5.1 + + - Changes in the organization of the documentation. + + - 0.5.0 + + - Added ``Moon`` class and ``position()`` methods. + - 0.4.3 - Added method ``ring_parameters()`` to Saturn class. @@ -120,73 +180,73 @@ - 0.4.1 - Added funtionality to compute the positions of Jupiter's Galilean - moons + moons. - 0.4.0 - Added methods to compute Saturn's ring inclination and longitude - of ascending node + of ascending node. - 0.3.13 - - Additional encoding changes + - Additional encoding changes. - 0.3.12 - Deleted ``encoding`` keyword from setup.py, which was giving - problems + problems. - 0.3.11 - - Added encoding specification to setup.py + - Added encoding specification to setup.py. - 0.3.10 - - Fixed characters with the wrong encoding + - Fixed characters with the wrong encoding. - 0.3.9 - Relaxed requirements, added contributor molsen234, and fixed - format problems showed by flake8 + format problems showed by flake8. - 0.3.8 - - Fixed undefined variable in ``Epoch.tt2ut`` + - Fixed undefined variable in ``Epoch.tt2ut``. - 0.3.7 - Fix bug when using fractional seconds, minutes, hours or days, - plus documentation improvements + plus documentation improvements. - 0.3.6 - - Add method to compute rising and setting times of the Sun + - Add method to compute rising and setting times of the Sun. - 0.3.5 - - Add method ``magnitude()`` to planet classes + - Add method ``magnitude()`` to planet classes. - 0.3.4 - - Add method to compute the parallax correction to Earth class + - Add method to compute the parallax correction to Earth class. - 0.3.3 - - Add methods to compute the passage through the nodes + - Add methods to compute the passage through the nodes. - 0.3.2 - - Add methods to compute the perihelion and aphelion of all planets + - Add methods to compute the perihelion and aphelion of all planets. - 0.3.1 - Fix errors in the elongation computation, add tests and examples of use of methods ``geocentric_position()``, and tests and - examples for ``Pluto`` class + examples for ``Pluto`` class. - 0.3.0 - - Added ``Pluto`` class + - Added ``Pluto`` class. Keywords: Meeus astronomy module library Platform: UNKNOWN diff -Nru pymeeus-0.4.3+dfsg1/pymeeus/Epoch.py pymeeus-0.5.11+dfsg1/pymeeus/Epoch.py --- pymeeus-0.4.3+dfsg1/pymeeus/Epoch.py 2021-03-03 01:28:56.000000000 +0000 +++ pymeeus-0.5.11+dfsg1/pymeeus/Epoch.py 2021-03-18 21:00:23.000000000 +0000 @@ -232,19 +232,30 @@ value will be used for the UTC->TAI conversion, and the internal leap seconds table will be bypassed. + It is also possible to provide a local time with the parameter + **local=True**. In such case, the method :meth:`utc2local()` is called + to compute the LocalTime-UTC difference. This implies that the + parameter **utc=True** is automatically set. + .. note:: The UTC to TT correction is only carried out for dates after January 1st, 1972. + .. note:: Please bear in mind that, in order for the method + :meth:`utc2local()` to work, your operative system must be correctly + configured, with the right time and corresponding time zone. + :param args: Either JDE, Epoch, date, datetime or year, month, day, hours, minutes, seconds values, by themselves or inside a tuple or - list + list. :type args: int, float, :py:class:`Epoch`, tuple, list, date, datetime - :param utc: Whether the provided epoch is a civil time (UTC) + :param utc: Whether the provided epoch is a civil time (UTC). :type utc: bool :param leap_seconds: This is the value to be used in the UTC->TAI conversion, instead of taking it from internal leap seconds table. :type leap_seconds: int, float + :param local: Whether the provided epoch is a local time. + :type utc: bool :returns: None. :rtype: None @@ -290,6 +301,18 @@ >>> e.set(d) >>> print(e) 2026871.8 + >>> e = Epoch(JDE2000, utc=True) + >>> print(round((e - JDE2000) * DAY2SEC, 3)) + 64.184 + >>> e = Epoch(2451545.0, utc=True) + >>> print(round((e - JDE2000) * DAY2SEC, 3)) + 64.184 + >>> e = Epoch(JDE2000, local=True) + >>> print(round((e - JDE2000) * DAY2SEC - Epoch.utc2local(), 3)) + 64.184 + >>> e = Epoch(JDE2000, local=True, leap_seconds=35.0) + >>> print(round((e - JDE2000) * DAY2SEC - Epoch.utc2local(), 3)) + 77.184 """ # Clean up the internal parameters @@ -297,14 +320,15 @@ # If no arguments are given, return. Internal values are 0.0 if len(args) == 0: return - # If we have only one argument, it can be a JDE or another Epoch object + # If we have only one argument, it can be a JDE, another Epoch object, + # a tuple with year, month, day, etc or a datetime object elif len(args) == 1: if isinstance(args[0], Epoch): self._jde = args[0]._jde - return + year, month, day, hours, minutes, sec = self.get_full_date() elif isinstance(args[0], (int, float)): self._jde = args[0] - return + year, month, day, hours, minutes, sec = self.get_full_date() elif isinstance(args[0], (tuple, list)): year, month, day, hours, minutes, sec = \ self._check_values(*args[0]) @@ -333,16 +357,26 @@ day += hours / DAY2HOURS + minutes / DAY2MIN + sec / DAY2SEC # Handle the 'leap_seconds' argument, if pressent if "leap_seconds" in kwargs: - # Compute JDE - self._jde = self._compute_jde(year, month, day, utc2tt=False, - leap_seconds=kwargs["leap_seconds"]) + if "local" in kwargs: + self._jde = self._compute_jde( + year, month, day, utc2tt=False, + leap_seconds=kwargs["leap_seconds"], + local=kwargs["local"]) + else: + self._jde = self._compute_jde( + year, month, day, utc2tt=False, + leap_seconds=kwargs["leap_seconds"]) elif "utc" in kwargs: self._jde = self._compute_jde(year, month, day, utc2tt=kwargs["utc"]) + elif "local" in kwargs: + self._jde = self._compute_jde(year, month, day, + local=kwargs["local"]) else: self._jde = self._compute_jde(year, month, day, utc2tt=False) - def _compute_jde(self, y, m, d, utc2tt=True, leap_seconds=0.0): + def _compute_jde(self, y, m, d, utc2tt=False, leap_seconds=0.0, + local=False): """Method to compute the Julian Ephemeris Day (JDE). .. note:: The UTC to TT correction is only carried out for dates after @@ -356,8 +390,10 @@ :type d: float :param utc2tt: Whether correction UTC to TT is done automatically. :type utc2tt: bool - :param leap_seconds: Number of leap seconds to apply + :param leap_seconds: Number of leap seconds to apply. :type leap_seconds: float + :param local: Whether a local time has been provided. + :type utc2tt: bool :returns: Julian Ephemeris Day (JDE) :rtype: float @@ -375,16 +411,20 @@ + iint(30.6001 * (m + 1.0)) + d + b - 1524.5) # If enabled, let's convert from UTC to TT, adding the needed seconds deltasec = 0.0 + if local: + deltasec = Epoch.utc2local() + if not utc2tt and leap_seconds == 0.0: + utc2tt = True # In this case, UTC to TT correction is applied automatically if utc2tt: if y >= 1972: - deltasec = 32.184 # Difference between TT and TAI + deltasec += 32.184 # Difference between TT and TAI deltasec += 10.0 # Difference between UTC and TAI in 1972 deltasec += Epoch.leap_seconds(y, m) else: # Correction is NOT automatic if leap_seconds != 0.0: # We apply provided leap seconds if y >= 1972: - deltasec = 32.184 # Difference between TT and TAI + deltasec += 32.184 # Difference between TT and TAI deltasec += 10.0 # Difference between UTC-TAI in 1972 deltasec += leap_seconds return jde + deltasec / DAY2SEC @@ -447,7 +487,8 @@ if month == 2: if Epoch.is_leap(year): limit_day = 29 - if day > limit_day: + # Add '1' to 'limit_day' in order to allow for fractional days + if day >= limit_day + 1: raise ValueError("Invalid value for the input day") # We are ready to return the parameters @@ -750,6 +791,30 @@ - k * iint((mm + 9.0) / 12.0) + day - 30.0) return float(doy + frac) + def doy(self): + """This method returns the Day Of Year (DOY) for the current Epoch + object. + + :returns: Day Of Year (DOY). + :rtype: float + + >>> e = Epoch(1999, 1, 29) + >>> round(e.doy(), 1) + 29.0 + >>> e = Epoch(2017, 12, 31.7) + >>> round(e.doy(), 1) + 365.7 + >>> e = Epoch(2012, 3, 3.1) + >>> round(e.doy(), 1) + 63.1 + >>> e = Epoch(-400, 2, 29.9) + >>> round(e.doy(), 1) + 60.9 + """ + + y, m, d = self.get_date() + return Epoch.get_doy(y, m, d) + @staticmethod def doy2date(year, doy): """This method takes a year and a Day Of Year values, and returns the @@ -892,15 +957,29 @@ def utc2local(): """Method to return the difference between UTC and local time. - By default, dates in this Epoch class are handled in Coordinated - Universal Time (UTC). This method provides you the seconds that you - have to add or subtract to UTC time to convert to your local time. - - Please bear in mind that, in order for this method to work, you - operative system must be correctly configured, with the right time and - corresponding time zone. + This method provides you the seconds that you have to add or subtract + to UTC time to convert to your local time. The correct way to apply + this method is according to the expression: + + utc2local() = LocalTime - UTC + + Therefore, if for example you are located in a place whose + corresponding time zone is UTC+2, then this method will yield 7200 + (seconds in two hours) and you must then apply this expression: - :returns: Difference in seconds between local and UTC time. + LocalTime = UTC + utclocal() = UTC + 7200 + + .. note:: Please bear in mind that, in order for this method to work, + your operative system must be correctly configured, with the right + time and corresponding time zone. + + .. note:: Remember that class :py:class:`Epoch` internally stores time + as Terrestrial Time (TT), not UTC. In order to get the UTC time you + must use a method like :meth:`get_date()` or :meth:`get_full_date()` + and pass the parameter **utc=True**. + + :returns: Difference in seconds between local and UTC time, in that + order. :rtype: float """ @@ -1208,10 +1287,21 @@ provide a non zero value to **leap_seconds** to apply a specific leap seconds value. + It is also possible to retrieve a local time with the parameter + **local=True**. In such case, the method :meth:`utc2local()` is called + to compute the LocalTime-UTC difference. This implies that the + parameter **utc=True** is automatically set. + + .. note:: Please bear in mind that, in order for the method + :meth:`utc2local()` to work, your operative system must be correctly + configured, with the right time and corresponding time zone. + :param utc: Whether the TT to UTC conversion mechanism will be enabled :type utc: bool :param leap_seconds: Optional value for leap seconds. :type leap_seconds: int, float + :param local: Whether the retrieved epoch is converted to local time. + :type utc: bool :returns: Year, month, day in a tuple :rtype: tuple @@ -1258,6 +1348,8 @@ year = int(year) month = int(month) + # If enabled, let's convert from TT to UTC, subtracting needed seconds + deltasec = 0.0 tt2utc = False if "utc" in kwargs: tt2utc = kwargs["utc"] @@ -1266,22 +1358,24 @@ leap_seconds = kwargs["leap_seconds"] else: leap_seconds = 0.0 - # If enabled, let's convert from TT to UTC, subtracting needed seconds - deltasec = 0.0 + if "local" in kwargs: + deltasec = Epoch.utc2local() + if not tt2utc and leap_seconds == 0.0: + tt2utc = True # In this case, TT to UTC correction is applied automatically, but only # for dates after July 1st, 1972 if tt2utc: if year > 1972 or (year == 1972 and month >= 7): - deltasec = 32.184 # Difference between TT and TAI + deltasec += 32.184 # Difference between TT and TAI deltasec += 10.0 # Difference between UTC and TAI in 1972 deltasec += Epoch.leap_seconds(year, month) else: # Correction is NOT automatic if leap_seconds != 0.0: # We apply provided leap seconds if year > 1972 or (year == 1972 and month >= 7): - deltasec = 32.184 # Difference between TT and TAI + deltasec += 32.184 # Difference between TT and TAI deltasec += 10.0 # Difference between UTC-TAI in 1972 deltasec += leap_seconds - + # Apply the correction if needed if deltasec != 0.0: doy = Epoch.get_doy(year, month, day) doy -= deltasec / DAY2SEC @@ -1299,10 +1393,21 @@ provide a non zero value to **leap_seconds** to apply a specific leap seconds value. + It is also possible to retrieve a local time with the parameter + **local=True**. In such case, the method :meth:`utc2local()` is called + to compute the LocalTime-UTC difference. This implies that the + parameter **utc=True** is automatically set. + + .. note:: Please bear in mind that, in order for the method + :meth:`utc2local()` to work, your operative system must be correctly + configured, with the right time and corresponding time zone. + :param utc: Whether the TT to UTC conversion mechanism will be enabled :type utc: bool :param leap_seconds: Optional value for leap seconds. :type leap_seconds: int, float + :param local: Whether the retrieved epoch is converted to local time. + :type utc: bool :returns: Year, month, day, hours, minutes, seconds in a tuple :rtype: tuple @@ -1675,9 +1780,9 @@ "Sunrise equation" of the Wikipedia at: https://en.wikipedia.org/wiki/Sunrise_equation - .. note:: This algorithm is only valid within the artic and antartic - circles (+/- 66d 33'). Outside that range this method returns - a ValueError exception + .. note:: This algorithm is only valid outside the artic and antartic + circles (+/- 66d 33'). For latitudes higher than +66d 33' and + smaller than -66d 33' this method returns a ValueError exception .. note:: The results are given in UTC time. @@ -2091,6 +2196,9 @@ # Get the Day Of Year corresponding to a given date print_me("Day Of Year (DOY) of 1978/11/14", Epoch.get_doy(1978, 11, 14)) print_me("Day Of Year (DOY) of -400/2/29.9", Epoch.get_doy(-400, 2, 29.9)) + # As before, but using the contents of the Epoch object + e = Epoch(2017, 12, 31.7) + print_me("Day Of Year (DOY) of 2017/12/31.7", round(e.doy(), 1)) print("") diff -Nru pymeeus-0.4.3+dfsg1/pymeeus/JupiterMoons.py pymeeus-0.5.11+dfsg1/pymeeus/JupiterMoons.py --- pymeeus-0.4.3+dfsg1/pymeeus/JupiterMoons.py 2021-03-03 01:28:56.000000000 +0000 +++ pymeeus-0.5.11+dfsg1/pymeeus/JupiterMoons.py 2021-03-09 19:07:56.000000000 +0000 @@ -730,7 +730,7 @@ return X, Y, Z @staticmethod - def calculate_DELTA(epoch): + def calculate_delta(epoch): """This method calculates the distance between Earth and Jupiter (DELTA) for a given epoch by iteration. @@ -744,7 +744,7 @@ :raises: TypeError if input values are wrong type >>> utc_1992_12_16_00_00_00 = Epoch(1992, 12, 16, utc=True) - >>> delta, tau, l, b, r = JupiterMoons.calculate_DELTA( \ + >>> delta, tau, l, b, r = JupiterMoons.calculate_delta( \ utc_1992_12_16_00_00_00) >>> print(round(delta, 10)) 5.6611211815 @@ -905,7 +905,7 @@ raise TypeError("Invalid input type") # Calculate light-time delay - # DELTA, tau = JupiterMoons.calculate_DELTA(epoch) + # DELTA, tau = JupiterMoons.calculate_delta(epoch) # Calculate coordinates as seen from the Earth Coords_Earth = JupiterMoons.rectangular_positions_jovian_equatorial( @@ -1251,7 +1251,7 @@ # Lets calculate the distance between Earth and Jupiter (DELTA) for a # given epoch. utc_1992_12_16_00_00_00 = Epoch(1992, 12, 16, utc=True) - delta, tau, l, b, r = JupiterMoons.calculate_DELTA(utc_1992_12_16_00_00_00) + delta, tau, l, b, r = JupiterMoons.calculate_delta(utc_1992_12_16_00_00_00) print("Distance between Earth and Jupiter in AU: ", delta) # 5.6611211815432645 diff -Nru pymeeus-0.4.3+dfsg1/pymeeus/Moon.py pymeeus-0.5.11+dfsg1/pymeeus/Moon.py --- pymeeus-0.4.3+dfsg1/pymeeus/Moon.py 1970-01-01 00:00:00.000000000 +0000 +++ pymeeus-0.5.11+dfsg1/pymeeus/Moon.py 2021-03-14 17:39:13.000000000 +0000 @@ -0,0 +1,1767 @@ + +# -*- coding: utf-8 -*- + + +# PyMeeus: Python module implementing astronomical algorithms. +# Copyright (C) 2021 Dagoberto Salazar +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with this program. If not, see . + + +from math import sin, cos, asin, atan2, tan, sqrt +from pymeeus.Angle import Angle +from pymeeus.Epoch import Epoch, JDE2000 +from pymeeus.Sun import Sun +from pymeeus.Coordinates import ( + nutation_longitude, true_obliquity, ecliptical2equatorial +) + +""" +.. module:: Moon + :synopsis: Class to model the Moon + :license: GNU Lesser General Public License v3 (LGPLv3) + +.. moduleauthor:: Dagoberto Salazar +""" + + +PERIODIC_TERMS_LR_TABLE = [ + [0, 0, 1, 0, 6288774.0, -20905355.0], + [2, 0, -1, 0, 1274027.0, -3699111.0], + [2, 0, 0, 0, 658314.0, -2955968.0], + [0, 0, 2, 0, 213618.0, -569925.0], + [0, 1, 0, 0, -185116.0, 48888.0], + [0, 0, 0, 2, -114332.0, -3149.0], + [2, 0, -2, 0, 58793.0, 246158.0], + [2, -1, -1, 0, 57066.0, -152138.0], + [2, 0, 1, 0, 53322.0, -170733.0], + [2, -1, 0, 0, 45758.0, -204586.0], + [0, 1, -1, 0, -40923.0, -129620.0], + [1, 0, 0, 0, -34720.0, 108743.0], + [0, 1, 1, 0, -30383.0, 104755.0], + [2, 0, 0, -2, 15327.0, 10321.0], + [0, 0, 1, 2, -12528.0, 0.0], + [0, 0, 1, -2, 10980.0, 79661.0], + [4, 0, -1, 0, 10675.0, -34782.0], + [0, 0, 3, 0, 10034.0, -23210.0], + [4, 0, -2, 0, 8548.0, -21636.0], + [2, 1, -1, 0, -7888.0, 24208.0], + [2, 1, 0, 0, -6766.0, 30824.0], + [1, 0, -1, 0, -5163.0, -8379.0], + [1, 1, 0, 0, 4987.0, -16675.0], + [2, -1, 1, 0, 4036.0, -12831.0], + [2, 0, 2, 0, 3994.0, -10445.0], + [4, 0, 0, 0, 3861.0, -11650.0], + [2, 0, -3, 0, 3665.0, 14403.0], + [0, 1, -2, 0, -2689.0, -7003.0], + [2, 0, -1, 2, -2602.0, 0.0], + [2, -1, -2, 0, 2390.0, 10056.0], + [1, 0, 1, 0, -2348.0, 6322.0], + [2, -2, 0, 0, 2236.0, -9884.0], + [0, 1, 2, 0, -2120.0, 5751.0], + [0, 2, 0, 0, -2069.0, 0.0], + [2, -2, -1, 0, 2048.0, -4950.0], + [2, 0, 1, -2, -1773.0, 4130.0], + [2, 0, 0, 2, -1595.0, 0.0], + [4, -1, -1, 0, 1215.0, -3958.0], + [0, 0, 2, 2, -1110.0, 0.0], + [3, 0, -1, 0, -892.0, 3258.0], + [2, 1, 1, 0, -810.0, 2616.0], + [4, -1, -2, 0, 759.0, -1897.0], + [0, 2, -1, 0, -713.0, -2117.0], + [2, 2, -1, 0, -700.0, 2354.0], + [2, 1, -2, 0, 691.0, 0.0], + [2, -1, 0, -2, 596.0, 0.0], + [4, 0, 1, 0, 549.0, -1423.0], + [0, 0, 4, 0, 537.0, -1117.0], + [4, -1, 0, 0, 520.0, -1571.0], + [1, 0, -2, 0, -487.0, -1739.0], + [2, 1, 0, -2, -399.0, 0.0], + [0, 0, 2, -2, -381.0, -4421.0], + [1, 1, 1, 0, 351.0, 0.0], + [3, 0, -2, 0, -340.0, 0.0], + [4, 0, -3, 0, 330.0, 0.0], + [2, -1, 2, 0, 327.0, 0.0], + [0, 2, 1, 0, -323.0, 1165.0], + [1, 1, -1, 0, 299.0, 0.0], + [2, 0, 3, 0, 294.0, 0.0], + [2, 0, -1, -2, 0.0, 8752.0] +] +"""This table contains the periodic terms for the longitude (Sigmal) and +distance (Sigmar) of the Moon. Units are 0.000001 degree for Sigmal, and 0.001 +kilometer for Sigmar. In Meeus' book this is Table 47.A and can be found in +pages 339-340.""" + +PERIODIC_TERMS_B_TABLE = [ + [0, 0, 0, 1, 5128122.0], + [0, 0, 1, 1, 280602.0], + [0, 0, 1, -1, 277693.0], + [2, 0, 0, -1, 173237.0], + [2, 0, -1, 1, 55413.0], + [2, 0, -1, -1, 46271.0], + [2, 0, 0, 1, 32573.0], + [0, 0, 2, 1, 17198.0], + [2, 0, 1, -1, 9266.0], + [0, 0, 2, -1, 8822.0], + [2, -1, 0, -1, 8216.0], + [2, 0, -2, -1, 4324.0], + [2, 0, 1, 1, 4200.0], + [2, 1, 0, -1, -3359.0], + [2, -1, -1, 1, 2463.0], + [2, -1, 0, 1, 2211.0], + [2, -1, -1, -1, 2065.0], + [0, 1, -1, -1, -1870.0], + [4, 0, -1, -1, 1828.0], + [0, 1, 0, 1, -1794.0], + [0, 0, 0, 3, -1749.0], + [0, 1, -1, 1, -1565.0], + [1, 0, 0, 1, -1491.0], + [0, 1, 1, 1, -1475.0], + [0, 1, 1, -1, -1410.0], + [0, 1, 0, -1, -1344.0], + [1, 0, 0, -1, -1335.0], + [0, 0, 3, 1, 1107.0], + [4, 0, 0, -1, 1021.0], + [4, 0, -1, 1, 833.0], + [0, 0, 1, -3, 777.0], + [4, 0, -2, 1, 671.0], + [2, 0, 0, -3, 607.0], + [2, 0, 2, -1, 596.0], + [2, -1, 1, -1, 491.0], + [2, 0, -2, 1, -451.0], + [0, 0, 3, -1, 439.0], + [2, 0, 2, 1, 422.0], + [2, 0, -3, -1, 421.0], + [2, 1, -1, 1, -366.0], + [2, 1, 0, 1, -351.0], + [4, 0, 0, 1, 331.0], + [2, -1, 1, 1, 315.0], + [2, -2, 0, -1, 302.0], + [0, 0, 1, 3, -283.0], + [2, 1, 1, -1, -229.0], + [1, 1, 0, -1, 223.0], + [1, 1, 0, 1, 223.0], + [0, 1, -2, -1, -220.0], + [2, 1, -1, -1, -220.0], + [1, 0, 1, 1, -185.0], + [2, -1, -2, -1, 181.0], + [0, 1, 2, 1, -177.0], + [4, 0, -2, -1, 176.0], + [4, -1, -1, -1, 166.0], + [1, 0, 1, -1, -164.0], + [4, 0, 1, -1, 132.0], + [1, 0, -1, -1, -119.0], + [4, -1, 0, -1, 115.0], + [2, -2, 0, 1, 107.0], +] +"""This table contains the periodic terms for the latitude of the Moon Sigmab. +Units are 0.000001 degree. In Meeus' book this is Table 47.B and can be found +in page 341.""" + + +class Moon(object): + """ + Class Moon models Earth's satellite. + """ + + @staticmethod + def geocentric_ecliptical_pos(epoch): + """This method computes the geocentric ecliptical position (longitude, + latitude) of the Moon for a given instant, referred to the mean equinox + of the date, as well as the Moon-Earth distance in kilometers and the + equatorial horizontal parallax. + + :param epoch: Instant to compute the Moon's position, as an + py:class:`Epoch` object. + :type epoch: :py:class:`Epoch` + + :returns: Tuple containing: + + * Geocentric longitude of the center of the Moon, as an + py:class:`Epoch` object. + * Geocentric latitude of the center of the Moon, as an + py:class:`Epoch` object. + * Distance in kilometers between the centers of Earth and Moon, in + kilometers (float) + * Equatorial horizontal parallax of the Moon, as an + py:class:`Epoch` object. + :rtype: tuple + :raises: TypeError if input value is of wrong type. + + >>> epoch = Epoch(1992, 4, 12.0) + >>> Lambda, Beta, Delta, ppi = Moon.geocentric_ecliptical_pos(epoch) + >>> print(round(Lambda, 6)) + 133.162655 + >>> print(round(Beta, 6)) + -3.229126 + >>> print(round(Delta, 1)) + 368409.7 + >>> print(round(ppi, 5)) + 0.99199 + """ + + # First check that input values are of correct types + if not (isinstance(epoch, Epoch)): + raise TypeError("Invalid input type") + # Get the time from J2000.0 in Julian centuries + t = (epoch - JDE2000) / 36525.0 + # Compute Moon's mean longitude, referred to mean equinox of date + Lprime = 218.3164477 + (481267.88123421 + + (-0.0015786 + + (1.0/538841.0 + - t/65194000.0) * t) * t) * t + # Mean elongation of the Moon + D = 297.8501921 + (445267.1114034 + + (-0.0018819 + + (1.0/545868.0 - t/113065000.0) * t) * t) * t + # Sun's mean anomaly + M = 357.5291092 + (35999.0502909 + (-0.0001536 + t/24490000.0) * t) * t + # Moon's mean anomaly + Mprime = 134.9633964 + (477198.8675055 + + (0.0087414 + + (1.0/69699.9 + + t/14712000.0) * t) * t) * t + # Moon's argument of latitude + F = 93.2720950 + (483202.0175233 + + (-0.0036539 + + (-1.0/3526000.0 + t/863310000.0) * t) * t) * t + # Let's compute some additional arguments + A1 = 119.75 + 131.849 * t + A2 = 53.09 + 479264.290 * t + A3 = 313.45 + 481266.484 * t + # Eccentricity of Earth's orbit around the Sun + E = 1.0 + (-0.002516 - 0.0000074 * t) * t + E2 = E * E + # Reduce the angles to a [0 360] range + Lprime = Angle(Angle.reduce_deg(Lprime)).to_positive() + Lprimer = Lprime.rad() + D = Angle(Angle.reduce_deg(D)).to_positive() + Dr = D.rad() + M = Angle(Angle.reduce_deg(M)).to_positive() + Mr = M.rad() + Mprime = Angle(Angle.reduce_deg(Mprime)).to_positive() + Mprimer = Mprime.rad() + F = Angle(Angle.reduce_deg(F)).to_positive() + Fr = F.rad() + A1 = Angle(Angle.reduce_deg(A1)).to_positive() + A1r = A1.rad() + A2 = Angle(Angle.reduce_deg(A2)).to_positive() + A2r = A2.rad() + A3 = Angle(Angle.reduce_deg(A3)).to_positive() + A3r = A3.rad() + # Let's store this results in a list, in preparation for using tables + arguments = [Dr, Mr, Mprimer, Fr] + # Now we use the tables of periodic terms. First for sigmal and sigmar + sigmal = 0.0 + sigmar = 0.0 + for i, value in enumerate(PERIODIC_TERMS_LR_TABLE): + argument = 0.0 + for j in range(4): + if PERIODIC_TERMS_LR_TABLE[i][j]: # Avoid multiply by zero + argument += PERIODIC_TERMS_LR_TABLE[i][j] * arguments[j] + coeffl = value[4] + coeffr = value[5] + if abs(value[1]) == 1: + coeffl = coeffl * E + coeffr = coeffr * E + elif abs(value[1]) == 2: + coeffl = coeffl * E2 + coeffr = coeffr * E2 + sigmal += coeffl * sin(argument) + sigmar += coeffr * cos(argument) + # Add the additive terms to sigmal + sigmal += (3958.0 * sin(A1r) + 1962.0 * sin(Lprimer - Fr) + + 318.0 * sin(A2r)) + # Now use the tabla for sigmab + sigmab = 0.0 + for i, value in enumerate(PERIODIC_TERMS_B_TABLE): + argument = 0.0 + for j in range(4): + if PERIODIC_TERMS_B_TABLE[i][j]: # Avoid multiply by zero + argument += PERIODIC_TERMS_B_TABLE[i][j] * arguments[j] + coeffb = value[4] + if abs(value[1]) == 1: + coeffb = coeffb * E + elif abs(value[1]) == 2: + coeffb = coeffb * E2 + sigmab += coeffb * sin(argument) + # Add the additive terms to sigmab + sigmab += (-2235.0 * sin(Lprimer) + 382.0 * sin(A3r) + + 175.0 * sin(A1r - Fr) + 175.0 * sin(A1r + Fr) + + 127.0 * sin(Lprimer - Mprimer) + - 115.0 * sin(Lprimer + Mprimer)) + Lambda = Lprime + (sigmal / 1000000.0) + Beta = Angle(sigmab / 1000000.0) + Delta = 385000.56 + (sigmar / 1000.0) + ppii = asin(6378.14 / Delta) + ppi = Angle(ppii, radians=True) + return Lambda, Beta, Delta, ppi + + @staticmethod + def apparent_ecliptical_pos(epoch): + """This method computes the apparent geocentric ecliptical position + (longitude, latitude) of the Moon for a given instant, referred to the + mean equinox of the date, as well as the Moon-Earth distance in + kilometers and the equatorial horizontal parallax. + + :param epoch: Instant to compute the Moon's position, as an + py:class:`Epoch` object. + :type epoch: :py:class:`Epoch` + + :returns: Tuple containing: + + * Apparent geocentric longitude of the center of the Moon, as an + py:class:`Epoch` object. + * Apparent geocentric latitude of the center of the Moon, as an + py:class:`Epoch` object. + * Distance in kilometers between the centers of Earth and Moon, in + kilometers (float) + * Equatorial horizontal parallax of the Moon, as an + py:class:`Epoch` object. + :rtype: tuple + :raises: TypeError if input value is of wrong type. + + >>> epoch = Epoch(1992, 4, 12.0) + >>> Lambda, Beta, Delta, ppi = Moon.apparent_ecliptical_pos(epoch) + >>> print(round(Lambda, 5)) + 133.16726 + >>> print(round(Beta, 6)) + -3.229126 + >>> print(round(Delta, 1)) + 368409.7 + >>> print(round(ppi, 5)) + 0.99199 + """ + + # First check that input values are of correct types + if not (isinstance(epoch, Epoch)): + raise TypeError("Invalid input type") + # Now, let's call the method geocentric_ecliptical_pos() + Lambda, Beta, Delta, ppi = Moon.geocentric_ecliptical_pos(epoch) + # Compute the nutation in longitude (deltaPsi) + deltaPsi = nutation_longitude(epoch) + # Correct the longitude to obtain the apparent longitude + aLambda = Lambda + deltaPsi + return aLambda, Beta, Delta, ppi + + @staticmethod + def apparent_equatorial_pos(epoch): + """This method computes the apparent equatorial position (right + ascension, declination) of the Moon for a given instant, referred to + the mean equinox of the date, as well as the Moon-Earth distance in + kilometers and the equatorial horizontal parallax. + + :param epoch: Instant to compute the Moon's position, as an + py:class:`Epoch` object. + :type epoch: :py:class:`Epoch` + + :returns: Tuple containing: + + * Apparent right ascension of the center of the Moon, as an + py:class:`Epoch` object. + * Apparent declination of the center of the Moon, as an + py:class:`Epoch` object. + * Distance in kilometers between the centers of Earth and Moon, in + kilometers (float) + * Equatorial horizontal parallax of the Moon, as an + py:class:`Epoch` object. + :rtype: tuple + :raises: TypeError if input value is of wrong type. + + >>> epoch = Epoch(1992, 4, 12.0) + >>> ra, dec, Delta, ppi = Moon.apparent_equatorial_pos(epoch) + >>> print(round(ra, 6)) + 134.688469 + >>> print(round(dec, 6)) + 13.768367 + >>> print(round(Delta, 1)) + 368409.7 + >>> print(round(ppi, 5)) + 0.99199 + """ + + # First check that input values are of correct types + if not (isinstance(epoch, Epoch)): + raise TypeError("Invalid input type") + # Let's start calling the method 'apparent_ecliptical_pos()' + Lambda, Beta, Delta, ppi = Moon.apparent_ecliptical_pos(epoch) + # Now we need the obliquity of the ecliptic + epsilon = true_obliquity(epoch) + # And now let's carry out the transformation ecliptical->equatorial + ra, dec = ecliptical2equatorial(Lambda, Beta, epsilon) + return ra, dec, Delta, ppi + + @staticmethod + def longitude_mean_ascending_node(epoch): + """This method computes the longitude of the mean ascending node of the + Moon in degrees, for a given instant, measured from the mean equinox of + the date. + + :param epoch: Instant to compute the Moon's mean ascending node, as an + py:class:`Epoch` object. + :type epoch: :py:class:`Epoch` + + :returns: The longitude of the mean ascending node. + :rtype: py:class:`Angle` + :raises: TypeError if input value is of wrong type. + + >>> epoch = Epoch(1913, 5, 27.0) + >>> Omega = Moon.longitude_mean_ascending_node(epoch) + >>> print(round(Omega, 1)) + 0.0 + >>> epoch = Epoch(2043, 9, 10.0) + >>> Omega = Moon.longitude_mean_ascending_node(epoch) + >>> print(round(Omega, 1)) + 0.0 + >>> epoch = Epoch(1959, 12, 7.0) + >>> Omega = Moon.longitude_mean_ascending_node(epoch) + >>> print(round(Omega, 1)) + 180.0 + >>> epoch = Epoch(2108, 11, 3.0) + >>> Omega = Moon.longitude_mean_ascending_node(epoch) + >>> print(round(Omega, 1)) + 180.0 + """ + + # First check that input values are of correct types + if not (isinstance(epoch, Epoch)): + raise TypeError("Invalid input type") + # Get the time from J2000.0 in Julian centuries + t = (epoch - JDE2000) / 36525.0 + # Compute Moon's longitude of the mean ascending node + Omega = 125.0445479 + (-1934.1362891 + + (0.0020754 + + (1.0/476441.0 + - t/60616000.0) * t) * t) * t + Omega = Angle(Omega).to_positive() + return Omega + + @staticmethod + def longitude_true_ascending_node(epoch): + """This method computes the longitude of the true ascending node of the + Moon in degrees, for a given instant, measured from the mean equinox of + the date. + + :param epoch: Instant to compute the Moon's true ascending node, as an + py:class:`Epoch` object. + :type epoch: :py:class:`Epoch` + + :returns: The longitude of the true ascending node. + :rtype: py:class:`Angle` + :raises: TypeError if input value is of wrong type. + + >>> epoch = Epoch(1913, 5, 27.0) + >>> Omega = Moon.longitude_true_ascending_node(epoch) + >>> print(round(Omega, 4)) + 0.8763 + """ + + # First check that input values are of correct types + if not (isinstance(epoch, Epoch)): + raise TypeError("Invalid input type") + # Let's start computing the longitude of the MEAN ascending node + Omega = Moon.longitude_mean_ascending_node(epoch) + # Get the time from J2000.0 in Julian centuries + t = (epoch - JDE2000) / 36525.0 + # Mean elongation of the Moon + D = 297.8501921 + (445267.1114034 + + (-0.0018819 + + (1.0/545868.0 - t/113065000.0) * t) * t) * t + # Sun's mean anomaly + M = 357.5291092 + (35999.0502909 + (-0.0001536 + t/24490000.0) * t) * t + # Moon's mean anomaly + Mprime = 134.9633964 + (477198.8675055 + + (0.0087414 + + (1.0/69699.9 + + t/14712000.0) * t) * t) * t + # Moon's argument of latitude + F = 93.2720950 + (483202.0175233 + + (-0.0036539 + + (-1.0/3526000.0 + t/863310000.0) * t) * t) * t + # Reduce the angles to a [0 360] range + D = Angle(Angle.reduce_deg(D)).to_positive() + Dr = D.rad() + M = Angle(Angle.reduce_deg(M)).to_positive() + Mr = M.rad() + Mprime = Angle(Angle.reduce_deg(Mprime)).to_positive() + Mprimer = Mprime.rad() + F = Angle(Angle.reduce_deg(F)).to_positive() + Fr = F.rad() + # Compute the periodic terms + corr = (-1.4979 * sin(2.0 * (Dr - Fr)) - 0.15 * sin(Mr) + - 0.1226 * sin(2.0 * Dr) + 0.1176 * sin(2.0 * Fr) + - 0.0801 * sin(2.0 * (Mprimer - Fr))) + Omega += Angle(corr) + return Omega + + @staticmethod + def longitude_mean_perigee(epoch): + """This method computes the longitude of the mean perigee of the lunar + orbitn in degrees, for a given instant, measured from the mean equinox + of the date. + + :param epoch: Instant to compute the Moon's mean perigee, as an + py:class:`Epoch` object. + :type epoch: :py:class:`Epoch` + + :returns: The longitude of the mean perigee. + :rtype: py:class:`Angle` + :raises: TypeError if input value is of wrong type. + + >>> epoch = Epoch(2021, 3, 5.0) + >>> Pi = Moon.longitude_mean_perigee(epoch) + >>> print(round(Pi, 5)) + 224.89194 + """ + + # First check that input values are of correct types + if not (isinstance(epoch, Epoch)): + raise TypeError("Invalid input type") + # Get the time from J2000.0 in Julian centuries + t = (epoch - JDE2000) / 36525.0 + # Compute Moon's longitude of the mean perigee + ppii = 83.3532465 + (4069.0137287 + + (-0.01032 + + (-1.0/80053.0 + t/18999000.0) * t) * t) * t + ppii = Angle(ppii) + return ppii + + @staticmethod + def illuminated_fraction_disk(epoch): + """This method computes the approximate illuminated fraction 'k' of the + disk of the Moon. The method used has a relatively low accuracy, but it + is enough to the 2nd decimal place. + + :param epoch: Instant to compute the Moon's illuminated fraction of the + disk, as a py:class:`Epoch` object. + :type epoch: :py:class:`Epoch` + + :returns: The approximate illuminated fraction of the Moon's disk. + :rtype: float + :raises: TypeError if input value is of wrong type. + + >>> epoch = Epoch(1992, 4, 12.0) + >>> k = Moon.illuminated_fraction_disk(epoch) + >>> print(round(k, 2)) + 0.68 + """ + + # First check that input values are of correct types + if not (isinstance(epoch, Epoch)): + raise TypeError("Invalid input type") + # Get the time from J2000.0 in Julian centuries + t = (epoch - JDE2000) / 36525.0 + # Mean elongation of the Moon + D = 297.8501921 + (445267.1114034 + + (-0.0018819 + + (1.0/545868.0 - t/113065000.0) * t) * t) * t + # Sun's mean anomaly + M = 357.5291092 + (35999.0502909 + (-0.0001536 + t/24490000.0) * t) * t + # Moon's mean anomaly + Mprime = 134.9633964 + (477198.8675055 + + (0.0087414 + + (1.0/69699.9 + + t/14712000.0) * t) * t) * t + # Reduce the angles to a [0 360] range + D = Angle(Angle.reduce_deg(D)).to_positive() + Dr = D.rad() + M = Angle(Angle.reduce_deg(M)).to_positive() + Mr = M.rad() + Mprime = Angle(Angle.reduce_deg(Mprime)).to_positive() + Mprimer = Mprime.rad() + # Compute the 'i' angle + i = Angle(180.0 - D - 6.289 * sin(Mprimer) + 2.1 * sin(Mr) + - 1.274 * sin(2.0 * Dr - Mprimer) - 0.658 * sin(2.0 * Dr) + - 0.214 * sin(2.0 * Mprimer) - 0.11 * sin(Dr)) + k = (1.0 + cos(i.rad())) / 2.0 + return k + + @staticmethod + def position_bright_limb(epoch): + """This method computes the position angle of the Moon's bright limb, + i.e., the position angle of the midpoint of the illuminated limb, + reckoned eastward from the North Point of the disk (not from the axis + of rotation of the lunar globe). + + :param epoch: Instant to compute the position angle of the Moon's + bright limb, as a py:class:`Epoch` object. + :type epoch: :py:class:`Epoch` + + :returns: The position angle of the Moon's bright limb. + :rtype: :py:class:`Angle` + :raises: TypeError if input value is of wrong type. + + >>> epoch = Epoch(1992, 4, 12.0) + >>> xi = Moon.position_bright_limb(epoch) + >>> print(round(xi, 1)) + 285.0 + """ + + # First check that input values are of correct types + if not (isinstance(epoch, Epoch)): + raise TypeError("Invalid input type") + # Compute the right ascension and declination of the Sun + a0, d0, r0 = Sun.apparent_rightascension_declination_coarse(epoch) + # Now compute the right ascension and declination of the Moon + a, d, r, ppi = Moon.apparent_equatorial_pos(epoch) + a0r = a0.rad() + d0r = d0.rad() + ar = a.rad() + dr = d.rad() + # Compute the numerator of the tan(xi) formula + numerator = cos(d0r) * sin(a0r - ar) + # Now the denominator + denominator = sin(d0r) * cos(dr) - cos(d0r) * sin(dr) * cos(a0r - ar) + # Now let's compute xi + xi = atan2(numerator, denominator) + xi = Angle(xi, radians=True).to_positive() + return xi + + @staticmethod + def moon_phase(epoch, target="new"): + """This method computes the time of the phase of the moon closest to + the provided epoch. The resulting time is expressed in the uniform time + scale of Dynamical Time (TT). + + :param epoch: Approximate epoch we want to compute the Moon phase for. + :type year: :py:class:`Epoch` + :param target: Corresponding phase. It can be "new" (New Moon), "first" + (First Quarter), "full" (Full Moon) and "last" (Last Quarter). It + is 'new' by default. + :type target: str + + :returns: The instant of time when the provided phase happens. + :rtype: :py:class:`Epoch` + :raises: TypeError if input values are of wrong type. + :raises: ValueError if 'target' value is invalid. + + >>> epoch = Epoch(1977, 2, 15.0) + >>> new_moon = Moon.moon_phase(epoch, target="new") + >>> y, m, d, h, mi, s = new_moon.get_full_date() + >>> print("{}/{}/{} {}:{}:{}".format(y, m, d, h, mi, round(s, 0))) + 1977/2/18 3:37:42.0 + >>> epoch = Epoch(2044, 1, 1.0) + >>> new_moon = Moon.moon_phase(epoch, target="last") + >>> y, m, d, h, mi, s = new_moon.get_full_date() + >>> print("{}/{}/{} {}:{}:{}".format(y, m, d, h, mi, round(s))) + 2044/1/21 23:48:17 + """ + + # First check that input values are of correct types + if not (isinstance(epoch, Epoch) and isinstance(target, str)): + raise TypeError("Invalid input types") + # Second, check that the target is correct + if ( + (target != "new") + and (target != "first") + and (target != "full") + and (target != "last") + ): + raise ValueError("'target' value is invalid") + # Let's start computing the year with decimals + y, m, d = epoch.get_date() + num_days_year = 365.0 + if Epoch.is_leap(y): + num_days_year = 366.0 + doy = Epoch.get_doy(y, m, d) + year = y + doy / num_days_year + # We compute the 'k' parameter + k = round((year - 2000.0) * 12.3685, 0) + if target == "first": + k += 0.25 + elif target == "full": + k += 0.5 + elif target == "last": + k += 0.75 + t = k / 1236.85 + # Compute the time of the 'mean' phase of the Moon + jde = (2451550.09766 + 29.530588861 * k + + (0.00015437 + (-0.00000015 + 0.00000000073 * t) * t) * t * t) + # Eccentricity of Earth's orbit around the Sun + E = 1.0 + (-0.002516 - 0.0000074 * t) * t + # Sun's mean anomaly + M = 2.5534 + 29.1053567 * k + (-0.0000014 - 0.00000011 * t) * t * t + # Moon's mean anomaly + Mprime = (201.5643 + 385.81693528 * k + + (0.0107582 + (0.00001238 - 0.000000058 * t) * t) * t * t) + # Moon's argument of latitude + F = (160.7108 + 390.67050284 * k + + (-0.0016118 + (-0.00000227 + 0.000000011 * t) * t) * t * t) + # Longitude of the ascending node of the lunar orbit + Omega = (124.7746 - 1.56375588 * k + + (0.0020672 + 0.00000215 * t) * t * t) + M = Angle(Angle.reduce_deg(M)).to_positive() + Mr = M.rad() + Mprime = Angle(Angle.reduce_deg(Mprime)).to_positive() + Mprimer = Mprime.rad() + F = Angle(Angle.reduce_deg(F)).to_positive() + Fr = F.rad() + Omega = Angle(Angle.reduce_deg(Omega)).to_positive() + Omegar = Omega.rad() + # Planetary arguments + a1 = 299.77 + 0.107408 * k - 0.009173 * t * t + a2 = 251.88 + 0.016321 * k + a3 = 251.83 + 26.651886 * k + a4 = 349.42 + 36.412478 * k + a5 = 84.66 + 18.206239 * k + a6 = 141.74 + 53.303771 * k + a7 = 207.14 + 2.453732 * k + a8 = 154.84 + 7.30686 * k + a9 = 34.52 + 27.261239 * k + a10 = 207.19 + 0.121824 * k + a11 = 291.34 + 1.844379 * k + a12 = 161.72 + 24.198154 * k + a13 = 239.56 + 25.513099 * k + a14 = 331.55 + 3.592518 * k + a1 = Angle(Angle.reduce_deg(a1)).to_positive() + a1r = a1.rad() + a2 = Angle(Angle.reduce_deg(a2)).to_positive() + a2r = a2.rad() + a3 = Angle(Angle.reduce_deg(a3)).to_positive() + a3r = a3.rad() + a4 = Angle(Angle.reduce_deg(a4)).to_positive() + a4r = a4.rad() + a5 = Angle(Angle.reduce_deg(a5)).to_positive() + a5r = a5.rad() + a6 = Angle(Angle.reduce_deg(a6)).to_positive() + a6r = a6.rad() + a7 = Angle(Angle.reduce_deg(a7)).to_positive() + a7r = a7.rad() + a8 = Angle(Angle.reduce_deg(a8)).to_positive() + a8r = a8.rad() + a9 = Angle(Angle.reduce_deg(a9)).to_positive() + a9r = a9.rad() + a10 = Angle(Angle.reduce_deg(a10)).to_positive() + a10r = a10.rad() + a11 = Angle(Angle.reduce_deg(a11)).to_positive() + a11r = a11.rad() + a12 = Angle(Angle.reduce_deg(a12)).to_positive() + a12r = a12.rad() + a13 = Angle(Angle.reduce_deg(a13)).to_positive() + a13r = a13.rad() + a14 = Angle(Angle.reduce_deg(a14)).to_positive() + a14r = a14.rad() + # Now let's compute the corrections + corr = 0.0 + w = 0.0 + if target == "new": + corr = (-0.4072 * sin(Mprimer) + 0.17241 * E * sin(Mr) + + 0.01608 * sin(2.0 * Mprimer) + 0.01039 * sin(2.0 * Fr) + + 0.00739 * E * sin(Mprimer - Mr) + - 0.00514 * E * sin(Mprimer + Mr) + + 0.00208 * E * E * sin(2.0 * Mr) + - 0.00111 * sin(Mprimer - 2.0 * Fr) + - 0.00057 * sin(Mprimer + 2.0 * Fr) + + 0.00056 * E * sin(2.0 * Mprimer + Mr) + - 0.00042 * sin(3.0 * Mprimer) + + 0.00042 * E * sin(Mr + 2.0 * Fr) + + 0.00038 * E * sin(Mr - 2.0 * Fr) + - 0.00024 * E * sin(2.0 * Mprimer - Mr) + - 0.00017 * sin(Omegar) - 0.00007 * sin(Mprimer + 2.0 * Mr) + + 0.00004 * sin(2.0 * (Mprimer - Fr)) + + 0.00004 * sin(3.0 * Mr) + + 0.00003 * sin(Mprimer + Mr - 2.0 * Fr) + + 0.00003 * sin(2.0 * (Mprimer + Fr)) + - 0.00003 * sin(Mprimer + Mr + 2.0 * Fr) + + 0.00003 * sin(Mprimer - Mr + 2.0 * Fr) + - 0.00002 * sin(Mprimer - Mr - 2.0 * Fr) + - 0.00002 * sin(3.0 * Mprimer + Mr) + + 0.00002 * sin(4.0 * Mprimer)) + elif target == "full": + corr = (-0.40614 * sin(Mprimer) + 0.17302 * E * sin(Mr) + + 0.01614 * sin(2.0 * Mprimer) + 0.01043 * sin(2.0 * Fr) + + 0.00734 * E * sin(Mprimer - Mr) + - 0.00515 * E * sin(Mprimer + Mr) + + 0.00209 * E * E * sin(2.0 * Mr) + - 0.00111 * sin(Mprimer - 2.0 * Fr) + - 0.00057 * sin(Mprimer + 2.0 * Fr) + + 0.00056 * E * sin(2.0 * Mprimer + Mr) + - 0.00042 * sin(3.0 * Mprimer) + + 0.00042 * E * sin(Mr + 2.0 * Fr) + + 0.00038 * E * sin(Mr - 2.0 * Fr) + - 0.00024 * E * sin(2.0 * Mprimer - Mr) + - 0.00017 * sin(Omegar) - 0.00007 * sin(Mprimer + 2.0 * Mr) + + 0.00004 * sin(2.0 * (Mprimer - Fr)) + + 0.00004 * sin(3.0 * Mr) + + 0.00003 * sin(Mprimer + Mr - 2.0 * Fr) + + 0.00003 * sin(2.0 * (Mprimer + Fr)) + - 0.00003 * sin(Mprimer + Mr + 2.0 * Fr) + + 0.00003 * sin(Mprimer - Mr + 2.0 * Fr) + - 0.00002 * sin(Mprimer - Mr - 2.0 * Fr) + - 0.00002 * sin(3.0 * Mprimer + Mr) + + 0.00002 * sin(4.0 * Mprimer)) + elif target == "first" or target == "last": + corr = (-0.62801 * sin(Mprimer) + 0.17172 * E * sin(Mr) + - 0.01183 * E * sin(Mprimer + Mr) + + 0.00862 * sin(2.0 * Mprimer) + 0.00804 * sin(2.0 * Fr) + + 0.00454 * E * sin(Mprimer - Mr) + + 0.00204 * E * E * sin(2.0 * Mr) + - 0.0018 * sin(Mprimer - 2.0 * Fr) + - 0.0007 * sin(Mprimer + 2.0 * Fr) + - 0.0004 * sin(3.0 * Mprimer) + - 0.00034 * E * sin(2.0 * Mprimer - Mr) + + 0.00032 * E * sin(Mr + 2.0 * Fr) + + 0.00032 * E * sin(Mr - 2.0 * Fr) + - 0.00028 * E * E * sin(Mprimer + 2.0 * Mr) + + 0.00027 * E * sin(2.0 * Mprimer + Mr) + - 0.00017 * sin(Omegar) + - 0.00005 * sin(Mprimer - Mr - 2.0 * Fr) + + 0.00004 * sin(2.0 * (Mprimer + Fr)) + - 0.00004 * sin(Mprimer + Mr + 2.0 * Fr) + + 0.00004 * sin(Mprimer - 2.0 * Mr) + + 0.00003 * sin(Mprimer + Mr - 2.0 * Fr) + + 0.00003 * sin(3.0 * Mr) + + 0.00002 * sin(2.0 * (Mprimer - Fr)) + + 0.00002 * sin(Mprimer - Mr + 2.0 * Fr) + - 0.00002 * sin(3.0 * Mprimer + Mr)) + w = (0.00306 - 0.00038 * E * cos(Mr) + 0.00026 * cos(Mprimer) + - 0.00002 * cos(Mprimer - Mr) + 0.00002 * cos(Mprimer + Mr) + + 0.00002 * cos(2.0 * Fr)) + if target == "last": + w = -w + # Additional corrections for all phases + corr2 = (0.000325 * sin(a1r) + 0.000165 * sin(a2r) + + 0.000164 * sin(a3r) + 0.000126 * sin(a4r) + + 0.000110 * sin(a5r) + 0.000062 * sin(a6r) + + 0.000060 * sin(a7r) + 0.000056 * sin(a8r) + + 0.000047 * sin(a9r) + 0.000042 * sin(a10r) + + 0.000040 * sin(a11r) + 0.000037 * sin(a12r) + + 0.000035 * sin(a13r) + 0.000023 * sin(a14r)) + jde += corr + corr2 + w + jde = Epoch(jde) + return jde + + @staticmethod + def moon_perigee_apogee(epoch, target="perigee"): + """This method computes the approximate times when the distance between + the Earth and the Moon is a minimum (perigee) or a maximum (apogee). + The resulting times will be expressed in the uniform time scale of + Dynamical Time (TT). + + :param epoch: Approximate epoch we want to compute the Moon's perigee + or apogee for. + :type year: :py:class:`Epoch` + :param target: Either 'perigee' or 'apogee'. It's 'perigee' by default. + :type target: str + + :returns: A tuple containing the instant of time when the perigee or + apogee happens, as a :py:class:`Epoch` object, and the Moon's + corresponding equatorial horizontal parallax, as a + :py:class:`Angle` object. + :rtype: tuple + :raises: TypeError if input values are of wrong type. + :raises: ValueError if 'target' value is invalid. + + >>> epoch = Epoch(1988, 10, 1.0) + >>> apogee, parallax = Moon.moon_perigee_apogee(epoch, target="apogee") + >>> y, m, d, h, mi, s = apogee.get_full_date() + >>> print("{}/{}/{} {}:{}".format(y, m, d, h, mi)) + 1988/10/7 20:30 + >>> print("{}".format(parallax.dms_str(n_dec=3))) + 54' 0.679'' + """ + + # First check that input values are of correct types + if not (isinstance(epoch, Epoch) and isinstance(target, str)): + raise TypeError("Invalid input types") + # Second, check that the target is correct + if ( + (target != "perigee") + and (target != "apogee") + ): + raise ValueError("'target' value is invalid") + # Let's start computing the year with decimals + y, m, d = epoch.get_date() + num_days_year = 365.0 + if Epoch.is_leap(y): + num_days_year = 366.0 + doy = Epoch.get_doy(y, m, d) + year = y + doy / num_days_year + # We compute the 'k' parameter + k = round((year - 1999.97) * 13.2555, 0) + if target == "apogee": + k += 0.5 + t = k / 1325.55 + # Compute the time of the 'mean' perigee or apogee + jde = (2451534.6698 + 27.55454989 * k + + (-0.0006691 + (0.000001098 + 0.0000000052 * t) * t) * t * t) + # Moon's mean elongation at jde + D = (171.9179 + 335.9106046 * k + + (-0.0100383 + (-0.00001156 + 0.000000055 * t) * t) * t * t) + # Sun's mean anomaly + M = 347.3477 + 27.1577721 * k + (-0.000813 - 0.000001 * t) * t * t + # Moon's argument of latitude + F = 316.6109 + 364.5287911 * k + (-0.0125053 - 0.0000148 * t) * t * t + D = Angle(Angle.reduce_deg(D)).to_positive() + Dr = D.rad() + M = Angle(Angle.reduce_deg(M)).to_positive() + Mr = M.rad() + F = Angle(Angle.reduce_deg(F)).to_positive() + Fr = F.rad() + corr = 0.0 + parallax = 0.0 + if target == "perigee": + corr = (-1.6769 * sin(2.0 * Dr) + 0.4589 * sin(4.0 * Dr) + - 0.1856 * sin(6.0 * Dr) + 0.0883 * sin(8.0 * Dr) + + (-0.0773 + 0.00019 * t) * sin(2.0 * Dr - Mr) + + (0.0502 - 0.00013 * t) * sin(Mr) - 0.046 * sin(10.0 * Dr) + + (0.0422 - 0.00011 * t) * sin(4.0 * Dr - Mr) + - 0.0256 * sin(6.0 * Dr - Mr) + 0.0253 * sin(12.0 * Dr) + + 0.0237 * sin(Dr) + 0.0162 * sin(8.0 * Dr - Mr) + - 0.0145 * sin(14.0 * Dr) + 0.0129 * sin(2.0 * Fr) + - 0.0112 * sin(3.0 * Dr) - 0.0104 * sin(10.0 * Dr - Mr) + + 0.0086 * sin(16.0 * Dr) + 0.0069 * sin(12.0 * Dr - Mr) + + 0.0066 * sin(5.0 * Dr) - 0.0053 * sin(2.0 * (Dr + Fr)) + - 0.0052 * sin(18.0 * Dr) - 0.0046 * sin(14.0 * Dr - Mr) + - 0.0041 * sin(7.0 * Dr) + 0.004 * sin(2.0 * Dr + Mr) + + 0.0032 * sin(20.0 * Dr) - 0.0032 * sin(Dr + Mr) + + 0.0031 * sin(16.0 * Dr - Mr) + - 0.0029 * sin(4.0 * Dr + Mr) + 0.0027 * sin(9.0 * Dr) + + 0.0027 * sin(4.0 * Dr + 2.0 * Fr) + - 0.0027 * sin(2.0 * (Dr - Mr)) + + 0.0024 * sin(4.0 * Dr - 2.0 * Mr) + - 0.0021 * sin(6.0 * Dr - 2.0 * Mr) + - 0.0021 * sin(22.0 * Dr) - 0.0021 * sin(18.0 * Dr - Mr) + + 0.0019 * sin(6.0 * Dr + Mr) - 0.0018 * sin(11.0 * Dr) + - 0.0014 * sin(8.0 * Dr + Mr) + - 0.0014 * sin(4.0 * Dr - 2.0 * Fr) + - 0.0014 * sin(6.0 * Dr + 2.0 * Fr) + + 0.0014 * sin(3.0 * Dr + Mr) - 0.0014 * sin(5.0 * Dr + Mr) + + 0.0013 * sin(13.0 * Dr) + 0.0013 * sin(20.0 * Dr - Mr) + + 0.0011 * sin(3.0 * Dr + 2.0 * Mr) + - 0.0011 * sin(4.0 * Dr + 2.0 * Fr - 2.0 * Mr) + - 0.0010 * sin(Dr + 2.0 * Mr) + - 0.0009 * sin(22.0 * Dr - Mr) - 0.0008 * sin(4.0 * Fr) + + 0.0008 * sin(6.0 * Dr - 2.0 * Fr) + + 0.0008 * sin(2.0 * Dr - 2.0 * Fr + Mr) + + 0.0007 * sin(2.0 * Mr) + 0.0007 * sin(2.0 * Fr - Mr) + + 0.0007 * sin(2.0 * Dr + 4.0 * Fr) + - 0.0006 * sin(2.0 * (Fr - Mr)) + - 0.0006 * sin(2.0 * (Dr - Fr + Mr)) + + 0.0006 * sin(24.0 * Dr) + 0.0005 * sin(4.0 * (Dr - Fr)) + + 0.0005 * sin(2.0 * (Dr + Mr)) - 0.0004 * sin(Dr - Mr)) + parallax = (3629.215 + 63.224 * cos(2.0 * Dr) + - 6.99 * cos(4.0 * Dr) + + (2.834 - 0.0071 * t) * cos(2.0 * Dr - Mr) + + 1.927 * cos(6.0 * Dr) - 1.263 * cos(Dr) + - 0.702 * cos(8.0 * Dr) + + (0.696 - 0.0017 * t) * cos(Mr) - 0.69 * cos(2.0 * Fr) + + (-0.629 + 0.0016 * t) * cos(4.0 * Dr - Mr) + - 0.392 * cos(2.0 * (Dr - Fr)) + 0.297 * cos(10.0 * Dr) + + 0.26 * cos(6.0 * Dr - Mr) + 0.201 * cos(3.0 * Dr) + - 0.161 * cos(2.0 * Dr + Mr) + 0.157 * cos(Dr + Mr) + - 0.138 * cos(12.0 * Dr) - 0.127 * cos(8.0 * Dr - Mr) + + 0.104 * cos(2.0 * (Dr + Fr)) + + 0.104 * cos(2.0 * (Dr - Mr)) - 0.079 * cos(5.0 * Dr) + + 0.068 * cos(14.0 * Dr) + 0.067 * cos(10.0 * Dr - Mr) + + 0.054 * cos(4.0 * Dr + Mr) + - 0.038 * cos(12.0 * Dr - Mr) + - 0.038 * cos(4.0 * Dr - 2.0 * Mr) + + 0.037 * cos(7.0 * Dr) + - 0.037 * cos(4.0 * Dr + 2.0 * Fr) + - 0.035 * cos(16.0 * Dr) - 0.03 * cos(3.0 * Dr + Mr) + + 0.029 * cos(Dr - Mr) - 0.025 * cos(6.0 * Dr + Mr) + + 0.023 * cos(2.0 * Mr) + 0.023 * cos(14.0 * Dr - Mr) + - 0.023 * cos(2.0 * (Dr + Mr)) + + 0.022 * cos(6.0 * Dr - 2.0 * Mr) + - 0.021 * cos(2.0 * (Dr - Fr) - Mr) + - 0.020 * cos(9.0 * Dr) + 0.019 * cos(18.0 * Dr) + + 0.017 * cos(6.0 * Dr + 2.0 * Fr) + + 0.014 * cos(2.0 * Fr - Mr) + - 0.014 * cos(16.0 * Dr - Mr) + + 0.013 * cos(4.0 * Dr - 2.0 * Fr) + + 0.012 * cos(8.0 * Dr + Mr) + 0.011 * cos(11.0 * Dr) + + 0.01 * cos(5.0 * Dr + Mr) - 0.01 * cos(20.0 * Dr)) + else: + corr = (0.4392 * sin(2.0 * Dr) + + 0.0684 * sin(4.0 * Dr) + + (0.0456 - 0.00011 * t) * sin(Mr) + + (0.0426 - 0.00011 * t) * sin(2.0 * Dr - Mr) + + 0.0212 * sin(2.0 * Fr) + - 0.0189 * sin(Dr) + + 0.0144 * sin(6.0 * Dr) + + 0.0113 * sin(4.0 * Dr - Mr) + + 0.0047 * sin(2.0 * (Dr + Fr)) + + 0.0036 * sin(Dr + Mr) + + 0.0035 * sin(8.0 * Dr) + + 0.0034 * sin(6.0 * Dr - Mr) + - 0.0034 * sin(2.0 * (Dr - Fr)) + + 0.0022 * sin(2.0 * (Dr - Mr)) + - 0.0017 * sin(3.0 * Dr) + + 0.0013 * sin(4.0 * Dr + 2.0 * Fr) + + 0.0011 * sin(8.0 * Dr - Mr) + + 0.0010 * sin(4.0 * Dr - 2.0 * Mr) + + 0.0009 * sin(10.0 * Dr) + + 0.0007 * sin(3.0 * Dr + Mr) + + 0.0006 * sin(2.0 * Mr) + + 0.0005 * sin(2.0 * Dr + Mr) + + 0.0005 * sin(2.0 * (Dr + Mr)) + + 0.0004 * sin(6.0 * Dr + 2.0 * Fr) + + 0.0004 * sin(6.0 * Dr - 2.0 * Mr) + + 0.0004 * sin(10.0 * Dr - Mr) + - 0.0004 * sin(5.0 * Dr) + - 0.0004 * sin(4.0 * Dr - 2.0 * Fr) + + 0.0003 * sin(2.0 * Fr + Mr) + + 0.0003 * sin(12.0 * Dr) + + 0.0003 * sin(2.0 * (Dr + Fr) - Mr) + - 0.0003 * sin(Dr - Mr)) + parallax = (3245.251 - 9.147 * cos(2.0 * Dr) - 0.841 * cos(Dr) + + 0.697 * cos(2.0 * Fr) + + (-0.656 + 0.0016 * t) * cos(Mr) + + 0.355 * cos(4.0 * Dr) + 0.159 * cos(2.0 * Dr - Mr) + + 0.127 * cos(Dr + Mr) + 0.065 * cos(4.0 * Dr - Mr) + + 0.052 * cos(6.0 * Dr) + 0.043 * cos(2.0 * Dr + Mr) + + 0.031 * cos(2.0 * (Dr + Fr)) + - 0.023 * cos(2.0 * (Dr - Fr)) + + 0.022 * cos(2.0 * (Dr - Mr)) + + 0.019 * cos(2.0 * (Dr + Mr)) - 0.016 * cos(2.0 * Mr) + + 0.014 * cos(6.0 * Dr - Mr) + 0.01 * cos(8.0 * Dr)) + jde += corr + jde = Epoch(jde) + parallax = Angle(0, 0, parallax) + return jde, parallax + + @staticmethod + def moon_passage_nodes(epoch, target="ascending"): + """This method computes the approximate times when the center of the + Moon passes through the ascending or descending node of its orbit. The + resulting times will be expressed in the uniform time scale of + Dynamical Time (TT). + + :param epoch: Approximate epoch we want to compute the Moon's passage + through the ascending or descending node. + :type year: :py:class:`Epoch` + :param target: Either 'ascending' or 'descending'. It is 'ascending' by + default. + :type target: str + + :returns: The instant of time when the Moon passes thhrough the + ascending or descending node. + :rtype: :py:class:`Epoch` + :raises: TypeError if input values are of wrong type. + :raises: ValueError if 'target' value is invalid. + + >>> epoch = Epoch(1987, 5, 15.0) + >>> passage = Moon.moon_passage_nodes(epoch, target="ascending") + >>> y, m, d, h, mi, s = passage.get_full_date() + >>> mi += s/60.0 + >>> print("{}/{}/{} {}:{}".format(y, m, d, h, round(mi))) + 1987/5/23 6:26 + """ + + # First check that input values are of correct types + if not (isinstance(epoch, Epoch) and isinstance(target, str)): + raise TypeError("Invalid input types") + # Second, check that the target is correct + if ( + (target != "ascending") + and (target != "descending") + ): + raise ValueError("'target' value is invalid") + # Let's start computing the year with decimals + y, m, d = epoch.get_date() + num_days_year = 365.0 + if Epoch.is_leap(y): + num_days_year = 366.0 + doy = Epoch.get_doy(y, m, d) + year = y + doy / num_days_year + # Compute the 'k' parameter + k = round((year - 2000.05) * 13.4223, 0) + if target == "descending": + k += 0.5 + t = k / 1342.23 + # Compute the time without the corrections + jde = (2451565.1619 + 27.212220817 * k + + (0.0002762 + (0.000000021 - 0.000000000088 * t) * t) * t * t) + # Compute the following angles in degrees + D = (183.638 + 331.73735682 * k + + (0.0014852 + (0.00000209 - 0.00000001 * t) * t) * t * t) + M = 17.4006 + 26.8203725 * k + (0.0001186 + 0.00000006 * t) * t * t + Mprime = (38.3776 + 355.52747313 * k + + (0.0123499 + (0.000014627 - 0.000000069 * t) * t) * t * t) + Omega = (123.9767 - 1.44098956 * k + + (0.0020608 + (0.00000214 - 0.000000016 * t) * t) * t * t) + V = 299.75 + (132.85 - 0.009173 * t) * t + P = Omega + 272.75 - 2.3 * t + # Reduce the angles to the [0 360] range, and convert to radians + D = Angle(Angle.reduce_deg(D)).to_positive() + Dr = D.rad() + M = Angle(Angle.reduce_deg(M)).to_positive() + Mr = M.rad() + Mprime = Angle(Angle.reduce_deg(Mprime)).to_positive() + Mprimer = Mprime.rad() + Omega = Angle(Angle.reduce_deg(Omega)).to_positive() + Omegar = Omega.rad() + V = Angle(Angle.reduce_deg(V)).to_positive() + Vr = V.rad() + P = Angle(Angle.reduce_deg(P)).to_positive() + Pr = P.rad() + # Eccentricity of Earth's orbit around the Sun + E = 1.0 + (-0.002516 - 0.0000074 * t) * t + # Compute the correction to jde + corr = (-0.4721 * sin(Mprimer) - 0.1649 * sin(2.0 * Dr) + - 0.0868 * sin(2.0 * Dr - Mprimer) + + 0.0084 * sin(2.0 * Dr + Mprimer) + - 0.0083 * E * sin(2.0 * Dr - Mr) + - 0.0039 * E * sin(2.0 * Dr - Mr - Mprimer) + + 0.0034 * sin(2.0 * Mprimer) + - 0.0031 * sin(2.0 * (Dr - Mprimer)) + + 0.0030 * E * sin(2.0 * Dr + Mr) + + 0.0028 * E * sin(Mr - Mprimer) + 0.0026 * E * sin(Mr) + + 0.0025 * sin(4.0 * Dr) + 0.0024 * sin(Dr) + + 0.0022 * E * sin(Mr + Mprimer) + 0.0017 * sin(Omegar) + + 0.0014 * sin(4.0 * Dr - Mprimer) + + 0.0005 * E * sin(2.0 * Dr + Mr - Mprimer) + + 0.0004 * E * sin(2.0 * Dr - Mr + Mprimer) + - 0.0003 * E * sin(2.0 * (Dr - Mr)) + + 0.0003 * E * sin(4.0 * Dr - Mr) + 0.0003 * sin(Vr) + + 0.0003 * sin(Pr)) + jde += corr + jde = Epoch(jde) + return jde + + @staticmethod + def moon_maximum_declination(epoch, target="northern"): + """This method computes the approximate times when the Moon reaches + its maximum declination (either 'northern' or 'southern'), as well as + the values of these extreme declinations. The resulting times will be + expressed in the uniform time scale of Dynamical Time (TT). + + :param epoch: Approximate epoch we want to compute the Moon's maximum + declination. + :type year: :py:class:`Epoch` + :param target: Either 'northern' or 'southern', depending on the + maximum declination being looked for. It is 'northern' by default. + :type target: str + + :returns: A tuple containing the instant of time when the maximum + declination happens, as a :py:class:`Epoch` object, and the angle + value of such declination, as a :py:class:`Angle` object. + :rtype: tuple + :raises: TypeError if input value is of wrong type. + + >>> epoch = Epoch(1988, 12, 15.0) + >>> epo, dec = Moon.moon_maximum_declination(epoch) + >>> y, m, d, h, mi, s = epo.get_full_date() + >>> print("{}/{}/{} {}:0{}".format(y, m, d, h, mi)) + 1988/12/22 20:01 + >>> print("{}".format(dec.dms_str(n_dec=0))) + 28d 9' 22.0'' + >>> epoch = Epoch(2049, 4, 15.0) + >>> epo, dec = Moon.moon_maximum_declination(epoch, target='southern') + >>> y, m, d, h, mi, s = epo.get_full_date() + >>> print("{}/{}/{} {}:{}".format(y, m, d, h, mi)) + 2049/4/21 14:0 + >>> print("{}".format(dec.dms_str(n_dec=0))) + -22d 8' 18.0'' + >>> epoch = Epoch(-4, 3, 15.0) + >>> epo, dec = Moon.moon_maximum_declination(epoch, target='northern') + >>> y, m, d, h, mi, s = epo.get_full_date() + >>> print("{}/{}/{} {}h".format(y, m, d, h)) + -4/3/16 15h + >>> print("{}".format(dec.dms_str(n_dec=0))) + 28d 58' 26.0'' + """ + + # First check that input values are of correct types + if not (isinstance(epoch, Epoch) and isinstance(target, str)): + raise TypeError("Invalid input types") + # Second, check that the target is correct + if ( + (target != "northern") + and (target != "southern") + ): + raise ValueError("'target' value is invalid") + # Let's start computing the year with decimals + y, m, d = epoch.get_date() + num_days_year = 365.0 + if Epoch.is_leap(y): + num_days_year = 366.0 + doy = Epoch.get_doy(y, m, d) + year = y + doy / num_days_year + # We compute the 'k' parameter + k = round((year - 2000.03) * 13.3686, 0) + t = k / 1336.86 + # Compute the following angles in degrees, plus 'jde' in days + D = 333.0705546 * k + (-0.0004214 + 0.00000011 * t) * t * t + M = 26.9281592 * k - (0.0000355 + 0.0000001 * t) * t * t + Mprime = 356.9562794 * k + (0.0103066 + 0.00001251 * t) * t * t + F = 1.4467807 * k - (0.002069 + 0.00000215 * t) * t * t + jde = 27.321582247 * k + (0.000119804 - 0.000000141 * t) * t * t + # Adjust the values according to northern of southern declination + if (target == 'northern'): + D += 152.2029 + M += 14.8591 + Mprime += 4.6881 + F += 325.8867 + jde += 2451562.5897 + else: + D += 345.6676 + M += 1.13951 + Mprime += 186.21 + F += 145.1633 + jde += 2451548.9289 + # Reduce the angles to the [0 360] range, and convert to radians + D = Angle(Angle.reduce_deg(D)).to_positive() + Dr = D.rad() + M = Angle(Angle.reduce_deg(M)).to_positive() + Mr = M.rad() + Mprime = Angle(Angle.reduce_deg(Mprime)).to_positive() + Mprimer = Mprime.rad() + F = Angle(Angle.reduce_deg(F)).to_positive() + Fr = F.rad() + # Eccentricity of Earth's orbit around the Sun + E = 1.0 + (-0.002516 - 0.0000074 * t) * t + corr = 0.0 + cor2 = 0.0 + # Compute the periodic terms for the time of maximum declination + if (target == 'northern'): + # Correction for the epoch + corr = (0.8975 * cos(Fr) - 0.4726 * sin(Mprimer) + - 0.1030 * sin(2.0 * Fr) - 0.0976 * sin(2.0 * Dr - Mprimer) + - 0.0462 * cos(Mprimer - Fr) - 0.0461 * cos(Mprimer + Fr) + - 0.0438 * sin(2.0 * Dr) + 0.0162 * E * sin(Mr) + - 0.0157 * cos(3.0 * Fr) + 0.0145 * sin(Mprimer + 2.0 * Fr) + + 0.0136 * cos(2.0 * Dr - Fr) + - 0.0095 * cos(2.0 * Dr - Mprimer - Fr) + - 0.0091 * cos(2.0 * Dr - Mprimer + Fr) + - 0.0089 * cos(2.0 * Dr + Fr) + 0.0075 * sin(2.0 * Mprimer) + - 0.0068 * sin(Mprimer - 2.0 * Fr) + + 0.0061 * cos(2.0 * Mprimer - Fr) + - 0.0047 * sin(Mprimer + 3.0 * Fr) + - 0.0043 * E * sin(2.0 * Dr - Mr - Mprimer) + - 0.0040 * cos(Mprimer - 2.0 * Fr) + - 0.0037 * sin(2.0 * (Dr - Mprimer)) + 0.0031 * sin(Fr) + + 0.0030 * sin(2.0 * Dr + Mprimer) + - 0.0029 * cos(Mprimer + 2.0 * Fr) + - 0.0029 * E * sin(2.0 * Dr - Mr) + - 0.0027 * sin(Mprimer + Fr) + + 0.0024 * E * sin(Mr - Mprimer) + - 0.0021 * sin(Mprimer - 3.0 * Fr) + + 0.0019 * sin(2.0 * Mprimer + Fr) + + 0.0018 * cos(2.0 * (Dr - Mprimer) - Fr) + + 0.0018 * sin(3.0 * Fr) + 0.0017 * cos(Mprimer + 3.0 * Fr) + + 0.0017 * cos(2.0 * Mprimer) + - 0.0014 * cos(2.0 * Dr - Mprimer) + + 0.0013 * cos(2.0 * Dr + Mprimer + Fr) + + 0.0013 * cos(Mprimer) + 0.0012 * sin(3.0 * Mprimer + Fr) + + 0.0011 * sin(2.0 * Dr - Mprimer + Fr) + - 0.0011 * cos(2.0 * (Dr - Mprimer)) + 0.001 * cos(Dr + Fr) + + 0.0010 * E * sin(Mr + Mprimer) + - 0.0009 * sin(2.0 * (Dr - Fr)) + + 0.0007 * cos(2.0 * Mprimer + Fr) + - 0.0007 * cos(3.0 * Mprimer + Fr)) + # Correction for the declination + cor2 = (5.1093 * sin(Fr) + 0.2658 * cos(2.0 * Fr) + + 0.1448 * sin(2.0 * Dr - Fr) - 0.0322 * sin(3.0 * Fr) + + 0.0133 * cos(2.0 * (Dr - Fr)) + 0.0125 * cos(2.0 * Dr) + - 0.0124 * sin(Mprimer - Fr) + - 0.0101 * sin(Mprimer + 2.0 * Fr) + 0.0097 * cos(Fr) + - 0.0087 * E * sin(2.0 * Dr + Mr - Fr) + + 0.0074 * sin(Mprimer + 3.0 * Fr) + 0.0067 * sin(Dr + Fr) + + 0.0063 * sin(Mprimer - 2.0 * Fr) + + 0.0060 * E * sin(2.0 * Dr - Mr - Fr) + - 0.0057 * sin(2.0 * Dr - Mprimer - Fr) + - 0.0056 * cos(Mprimer + Fr) + + 0.0052 * cos(Mprimer + 2.0 * Fr) + + 0.0041 * cos(2.0 * Mprimer + Fr) + - 0.0040 * cos(Mprimer - 3.0 * Fr) + + 0.0038 * cos(2.0 * Mprimer - Fr) + - 0.0034 * cos(Mprimer - 2.0 * Fr) + - 0.0029 * sin(2.0 * Mprimer) + + 0.0029 * sin(3.0 * Mprimer + Fr) + - 0.0028 * E * cos(2.0 * Dr + Mr - Fr) + - 0.0028 * cos(Mprimer - Fr) - 0.0023 * cos(3.0 * Fr) + - 0.0021 * sin(2.0 * Dr + Fr) + + 0.0019 * cos(Mprimer + 3.0 * Fr) + 0.0018 * cos(Dr + Fr) + + 0.0017 * sin(2.0 * Mprimer - Fr) + + 0.0015 * cos(3.0 * Mprimer + Fr) + + 0.0014 * cos(2.0 * (Dr + Mprimer) + Fr) + - 0.0012 * sin(2.0 * (Dr - Mprimer) - Fr) + - 0.0012 * cos(2.0 * Mprimer) - 0.0010 * cos(Mprimer) + - 0.0010 * sin(2.0 * Fr) + 0.0006 * sin(Mprimer + Fr)) + else: + # Correction for the epoch + corr = (-0.8975 * cos(Fr) - 0.4726 * sin(Mprimer) + - 0.1030 * sin(2.0 * Fr) - 0.0976 * sin(2.0 * Dr - Mprimer) + + 0.0541 * cos(Mprimer - Fr) + 0.0516 * cos(Mprimer + Fr) + - 0.0438 * sin(2.0 * Dr) + 0.0112 * E * sin(Mr) + + 0.0157 * cos(3.0 * Fr) + 0.0023 * sin(Mprimer + 2.0 * Fr) + - 0.0136 * cos(2.0 * Dr - Fr) + + 0.0110 * cos(2.0 * Dr - Mprimer - Fr) + + 0.0091 * cos(2.0 * Dr - Mprimer + Fr) + + 0.0089 * cos(2.0 * Dr + Fr) + 0.0075 * sin(2.0 * Mprimer) + - 0.0030 * sin(Mprimer - 2.0 * Fr) + - 0.0061 * cos(2.0 * Mprimer - Fr) + - 0.0047 * sin(Mprimer + 3.0 * Fr) + - 0.0043 * E * sin(2.0 * Dr - Mr - Mprimer) + + 0.0040 * cos(Mprimer - 2.0 * Fr) + - 0.0037 * sin(2.0 * (Dr - Mprimer)) - 0.0031 * sin(Fr) + + 0.0030 * sin(2.0 * Dr + Mprimer) + + 0.0029 * cos(Mprimer + 2.0 * Fr) + - 0.0029 * E * sin(2.0 * Dr - Mr) + - 0.0027 * sin(Mprimer + Fr) + + 0.0024 * E * sin(Mr - Mprimer) + - 0.0021 * sin(Mprimer - 3.0 * Fr) + - 0.0019 * sin(2.0 * Mprimer + Fr) + - 0.0006 * cos(2.0 * (Dr - Mprimer) - Fr) + - 0.0018 * sin(3.0 * Fr) - 0.0017 * cos(Mprimer + 3.0 * Fr) + + 0.0017 * cos(2.0 * Mprimer) + + 0.0014 * cos(2.0 * Dr - Mprimer) + - 0.0013 * cos(2.0 * Dr + Mprimer + Fr) + - 0.0013 * cos(Mprimer) + 0.0012 * sin(3.0 * Mprimer + Fr) + + 0.0011 * sin(2.0 * Dr - Mprimer + Fr) + + 0.0011 * cos(2.0 * (Dr - Mprimer)) + 0.001 * cos(Dr + Fr) + + 0.0010 * E * sin(Mr + Mprimer) + - 0.0009 * sin(2.0 * (Dr - Fr)) + - 0.0007 * cos(2.0 * Mprimer + Fr) + - 0.0007 * cos(3.0 * Mprimer + Fr)) + # Correction for the declination + cor2 = (-5.1093 * sin(Fr) + 0.2658 * cos(2.0 * Fr) + - 0.1448 * sin(2.0 * Dr - Fr) + 0.0322 * sin(3.0 * Fr) + + 0.0133 * cos(2.0 * (Dr - Fr)) + 0.0125 * cos(2.0 * Dr) + - 0.0015 * sin(Mprimer - Fr) + + 0.0101 * sin(Mprimer + 2.0 * Fr) - 0.0097 * cos(Fr) + + 0.0087 * E * sin(2.0 * Dr + Mr - Fr) + + 0.0074 * sin(Mprimer + 3.0 * Fr) + 0.0067 * sin(Dr + Fr) + - 0.0063 * sin(Mprimer - 2.0 * Fr) + - 0.0060 * E * sin(2.0 * Dr - Mr - Fr) + + 0.0057 * sin(2.0 * Dr - Mprimer - Fr) + - 0.0056 * cos(Mprimer + Fr) + - 0.0052 * cos(Mprimer + 2.0 * Fr) + - 0.0041 * cos(2.0 * Mprimer + Fr) + - 0.0040 * cos(Mprimer - 3.0 * Fr) + - 0.0038 * cos(2.0 * Mprimer - Fr) + + 0.0034 * cos(Mprimer - 2.0 * Fr) + - 0.0029 * sin(2.0 * Mprimer) + + 0.0029 * sin(3.0 * Mprimer + Fr) + + 0.0028 * E * cos(2.0 * Dr + Mr - Fr) + - 0.0028 * cos(Mprimer - Fr) + 0.0023 * cos(3.0 * Fr) + + 0.0021 * sin(2.0 * Dr + Fr) + + 0.0019 * cos(Mprimer + 3.0 * Fr) + 0.0018 * cos(Dr + Fr) + - 0.0017 * sin(2.0 * Mprimer - Fr) + + 0.0015 * cos(3.0 * Mprimer + Fr) + + 0.0014 * cos(2.0 * (Dr + Mprimer) + Fr) + + 0.0012 * sin(2.0 * (Dr - Mprimer) - Fr) + - 0.0012 * cos(2.0 * Mprimer) + 0.0010 * cos(Mprimer) + - 0.0010 * sin(2.0 * Fr) + 0.0037 * sin(Mprimer + Fr)) + # Add the correction to 'jde' + jde += corr + jde = Epoch(jde) + declination = 23.6961 - 0.013004 * t + cor2 + if (target == 'southern'): + declination *= -1.0 + declination = Angle(Angle.reduce_deg(declination)) + return jde, declination + + @staticmethod + def moon_librations(epoch): + """This method computes the librations in longitude and latitude of the + moon. There are several librations: The optical librations, that are + the apparent oscillations in the hemisphere that the Moon turns towards + the Earth, due to variations in the geometric position of the Earth + relative to the lunar surface during the course of the orbital motion + of the Moon. These variations allow to observe about 59% of the surface + of the Moon from the Earth. + + There is also the physical libration of the Moon, i.e., the libration + due to the actual rotational motion of the Moon about its mean + rotation. The physical libration is much smaller than the optical + libration, and can never be larger than 0.04 degree in both longitude + and latitude. + + Finally, there is the total libration, which is the sum of the two + librations mentioned above + + :param epoch: Epoch we want to compute the Moon's librations. + :type year: :py:class:`Epoch` + + :returns: A tuple containing the optical libration in longitude and in + latitude, the physical libration also in longitude and latitude, + and the total librations which is the sum of the previouse ones, + all of them as :py:class:`Angle` objects. + :rtype: tuple + :raises: TypeError if input value is of wrong type. + + >>> epoch = Epoch(1992, 4, 12.0) + >>> lopt, bopt, lphys, bphys, ltot, btot = Moon.moon_librations(epoch) + >>> print(round(lopt, 3)) + -1.206 + >>> print(round(bopt, 3)) + 4.194 + >>> print(round(lphys, 3)) + -0.025 + >>> print(round(bphys, 3)) + 0.006 + >>> print(round(ltot, 2)) + -1.23 + >>> print(round(btot, 3)) + 4.2 + """ + + # First check that input value is of correct type + if not isinstance(epoch, Epoch): + raise TypeError("Invalid input types") + # Let's start computing some constants + ir = Angle(1.54242).rad() + sinI = sin(ir) + cosI = cos(ir) + # Now, let's call the method apparent_ecliptical_pos() + Lambda, Beta, Delta, ppi = Moon.apparent_ecliptical_pos(epoch) + # Compute the nutation in longitude (deltaPsi) + deltaPsi = nutation_longitude(epoch) + # Get the time from J2000.0 in Julian centuries + t = (epoch - JDE2000) / 36525.0 + # Mean elongation of the Moon + D = 297.8501921 + (445267.1114034 + + (-0.0018819 + + (1.0/545868.0 - t/113065000.0) * t) * t) * t + # Sun's mean anomaly + M = 357.5291092 + (35999.0502909 + (-0.0001536 + t/24490000.0) * t) * t + # Moon's mean anomaly + Mprime = 134.9633964 + (477198.8675055 + + (0.0087414 + + (1.0/69699.9 + + t/14712000.0) * t) * t) * t + # Moon's argument of latitude + F = 93.2720950 + (483202.0175233 + + (-0.0036539 + + (-1.0/3526000.0 + t/863310000.0) * t) * t) * t + F = Angle(Angle.reduce_deg(F)).to_positive() + # Compute the mean longitude of the ascending node of lunar orbit + Omega = Moon.longitude_mean_ascending_node(epoch) + # Let's compute some additional arguments + k1 = 119.75 + 131.849 * t + k2 = 72.56 + 20.186 * t + # Eccentricity of Earth's orbit around the Sun + E = 1.0 + (-0.002516 - 0.0000074 * t) * t + # Reduce the angles to a [0 360] range + D = Angle(Angle.reduce_deg(D)).to_positive() + Dr = D.rad() + M = Angle(Angle.reduce_deg(M)).to_positive() + Mr = M.rad() + Mprime = Angle(Angle.reduce_deg(Mprime)).to_positive() + Mprimer = Mprime.rad() + F = Angle(Angle.reduce_deg(F)).to_positive() + Fr = F.rad() + Omegar = Omega.rad() + k1 = Angle(Angle.reduce_deg(k1)).to_positive() + k1r = k1.rad() + k2 = Angle(Angle.reduce_deg(k2)).to_positive() + k2r = k2.rad() + # Let's compute 'w' and some additional parameters + w = Lambda - deltaPsi - Omega + w = w.to_positive() + wr = w.rad() + sinW = sin(wr) + cosW = cos(wr) + betar = Beta.rad() + sinB = sin(betar) + cosB = cos(betar) + # Compute 'A' + Ar = atan2((sinW * cosB * cosI - sinB * sinI), (cosW * cosB)) + A = Angle(Ar, radians=True).to_positive() + lprime = A - F + bprimer = asin(-sinW * cosB * sinI - sinB * cosI) + bprime = Angle(bprimer, radians=True) + # Compute the expressions from D.H. Eckhardt 1981 + rho = (-0.02752 * cos(Mprimer) - 0.02245 * sin(Fr) + + 0.00684 * cos(Mprimer - 2.0 * Fr) - 0.00293 * cos(2.0 * Fr) + - 0.00085 * cos(2.0 * (Fr - Dr)) + - 0.00054 * cos(Mprimer - 2.0 * Dr) - 0.0002 * sin(Mprimer + Fr) + - 0.0002 * cos(Mprimer + 2.0 * Fr) - 0.0002 * cos(Mprimer - Fr) + + 0.00014 * cos(Mprimer + 2.0 * (Fr - Dr))) + rho = Angle(rho) + sigma = (-0.02816 * sin(Mprimer) + 0.02244 * cos(Fr) + - 0.00682 * sin(Mprimer - 2.0 * Fr) - 0.00279 * sin(2.0 * Fr) + - 0.00083 * sin(2.0 * (Fr - Dr)) + + 0.00069 * sin(Mprimer - 2.0 * Dr) + + 0.0004 * cos(Mprimer + Fr) - 0.00025 * sin(2.0 * Mprimer) + - 0.00023 * sin(Mprimer + 2.0 * Fr) + + 0.0002 * cos(Mprimer - Fr) + 0.00019 * sin(Mprimer - Fr) + + 0.00013 * sin(Mprimer + 2.0 * (Fr - Dr)) + - 0.0001 * cos(Mprimer - 3.0 * Fr)) + sigma = Angle(sigma) + tau = (0.0252 * E * sin(Mr) + 0.00473 * sin(2.0 * (Mprimer - Fr)) + - 0.00467 * sin(Mprimer) + 0.00396 * sin(k1r) + + 0.00276 * sin(2.0 * (Mprimer - Dr)) + 0.00196 * sin(Omegar) + - 0.00183 * cos(Mprimer - Fr) + + 0.00115 * sin(Mprimer - 2.0 * Dr) + - 0.00096 * sin(Mprimer - Dr) + 0.00046 * sin(2.0 * (Fr - Dr)) + - 0.00039 * sin(Mprimer - Fr) - 0.00032 * sin(Mprimer - Mr - Dr) + + 0.00027 * sin(2.0 * (Mprimer - Dr) - Mr) + 0.00023 * sin(k2r) + - 0.00014 * sin(2.0 * Dr) + 0.00014 * cos(2.0 * (Mprimer - Fr)) + - 0.00012 * sin(Mprimer - 2.0 * Fr) + - 0.00012 * sin(2.0 * Mprimer) + + 0.00011 * sin(2.0 * (Mprimer - Mr - Dr))) + tau = Angle(tau) + # Compute the physical librations + lpp = -tau + (rho * cos(Ar) + sigma * sin(Ar)) * tan(bprimer) + bpp = sigma * cos(Ar) - rho * sin(Ar) + lt = lprime + lpp + bt = bprime + bpp + return lprime, bprime, lpp, bpp, lt, bt + + @staticmethod + def moon_position_angle_axis(epoch): + """This method computes the position angle of the Moon's axis of + rotation. The effect of the physical libration is taken into account. + + :param epoch: Epoch we want to compute the position angle of the Moon's + axis of rotation. + :type year: :py:class:`Epoch` + + :returns: The position angle of the Moon's axis of rotation, as a + :py:class:`Angle` object. + :rtype: tuple + :raises: TypeError if input value is of wrong type. + + >>> epoch = Epoch(1992, 4, 12.0) + >>> p = Moon.moon_position_angle_axis(epoch) + >>> print(round(p, 2)) + 15.08 + """ + + # First check that input value is of correct type + if not isinstance(epoch, Epoch): + raise TypeError("Invalid input types") + # Let's start computing some constants + ir = Angle(1.54242).rad() + sinI = sin(ir) + # Compute the nutation in longitude (deltaPsi) + deltaPsi = nutation_longitude(epoch) + # Get the true obliquity of the ecliptic + epsilon = true_obliquity(epoch) + epsr = epsilon.rad() + # Get the time from J2000.0 in Julian centuries + t = (epoch - JDE2000) / 36525.0 + # Mean elongation of the Moon + D = 297.8501921 + (445267.1114034 + + (-0.0018819 + + (1.0/545868.0 - t/113065000.0) * t) * t) * t + # Moon's mean anomaly + Mprime = 134.9633964 + (477198.8675055 + + (0.0087414 + + (1.0/69699.9 + + t/14712000.0) * t) * t) * t + # Moon's argument of latitude + F = 93.2720950 + (483202.0175233 + + (-0.0036539 + + (-1.0/3526000.0 + t/863310000.0) * t) * t) * t + F = Angle(Angle.reduce_deg(F)).to_positive() + # Compute the mean longitude of the ascending node of lunar orbit + Omega = Moon.longitude_mean_ascending_node(epoch) + # Reduce the angles to a [0 360] range + D = Angle(Angle.reduce_deg(D)).to_positive() + Dr = D.rad() + Mprime = Angle(Angle.reduce_deg(Mprime)).to_positive() + Mprimer = Mprime.rad() + F = Angle(Angle.reduce_deg(F)).to_positive() + Fr = F.rad() + # Compute the expressions from D.H. Eckhardt 1981 + rho = (-0.02752 * cos(Mprimer) - 0.02245 * sin(Fr) + + 0.00684 * cos(Mprimer - 2.0 * Fr) - 0.00293 * cos(2.0 * Fr) + - 0.00085 * cos(2.0 * (Fr - Dr)) + - 0.00054 * cos(Mprimer - 2.0 * Dr) - 0.0002 * sin(Mprimer + Fr) + - 0.0002 * cos(Mprimer + 2.0 * Fr) - 0.0002 * cos(Mprimer - Fr) + + 0.00014 * cos(Mprimer + 2.0 * (Fr - Dr))) + rho = Angle(rho) + rhor = rho.rad() + sigma = (-0.02816 * sin(Mprimer) + 0.02244 * cos(Fr) + - 0.00682 * sin(Mprimer - 2.0 * Fr) - 0.00279 * sin(2.0 * Fr) + - 0.00083 * sin(2.0 * (Fr - Dr)) + + 0.00069 * sin(Mprimer - 2.0 * Dr) + + 0.0004 * cos(Mprimer + Fr) - 0.00025 * sin(2.0 * Mprimer) + - 0.00023 * sin(Mprimer + 2.0 * Fr) + + 0.0002 * cos(Mprimer - Fr) + 0.00019 * sin(Mprimer - Fr) + + 0.00013 * sin(Mprimer + 2.0 * (Fr - Dr)) + - 0.0001 * cos(Mprimer - 3.0 * Fr)) + sigma = Angle(sigma) + # Compute the parameters 'v', 'x', 'y' and 'w' + v = Omega + deltaPsi + (sigma / sinI) + vr = v.rad() + x = sin(ir + rhor) * sin(vr) + y = sin(ir + rhor) * cos(vr) * cos(epsr) - cos(ir + rhor) * sin(epsr) + w = atan2(x, y) + # Now, let's call the method apparent_equatorial_pos() + alpha, dec, Delta, ppi = Moon.apparent_equatorial_pos(epoch) + alphar = alpha.rad() + # Get the Moon librations + lopt, bopt, lphys, bphys, ltot, btot = Moon.moon_librations(epoch) + p = asin((sqrt(x * x + y * y) * cos(alphar - w)) / cos(btot.rad())) + return Angle(p, radians=True) + + +def main(): + + # Let's define a small helper function + def print_me(msg, val): + print("{}: {}".format(msg, val)) + + # Let's show some uses of Saturn class + print("\n" + 35 * "*") + print("*** Use of Moon class") + print(35 * "*" + "\n") + + # Let's compute the Moon geocentric ecliiptical position for a given epoch + epoch = Epoch(1992, 4, 12.0) + Lambda, Beta, Delta, ppi = Moon.geocentric_ecliptical_pos(epoch) + print_me("Longitude (Lambda)", round(Lambda, 6)) # 133.162655 + print_me("Latitude (Beta)", round(Beta, 6)) # -3.229126 + print_me("Distance (Delta)", round(Delta, 1)) # 368409.7 + print_me("Equatorial horizontal parallax (Pi)", round(ppi, 6)) # 0.991990 + + print("") + + # Now let's compute the apparent ecliptical position + epoch = Epoch(1992, 4, 12.0) + Lambda, Beta, Delta, ppi = Moon.apparent_ecliptical_pos(epoch) + print_me("Longitude (Lambda)", round(Lambda, 6)) # 133.167264 + print_me("Latitude (Beta)", round(Beta, 6)) # -3.229126 + print_me("Distance (Delta)", round(Delta, 1)) # 368409.7 + print_me("Equatorial horizontal parallax (Pi)", round(ppi, 6)) # 0.991990 + + print("") + + # Get the apparent equatorial position + epoch = Epoch(1992, 4, 12.0) + ra, dec, Delta, ppi = Moon.apparent_equatorial_pos(epoch) + print_me("Right Ascension (ra)", round(ra, 6)) # 134.688469 + print_me("Declination (dec)", round(dec, 6)) # 13.768367 + print_me("Distance (Delta)", round(Delta, 1)) # 368409.7 + print_me("Equatorial horizontal parallax (Pi)", round(ppi, 6)) # 0.991990 + + print("") + + # Compute the longitude of the Moon's mean ascending node + epoch = Epoch(1913, 5, 27.0) + Omega = Moon.longitude_mean_ascending_node(epoch) + print_me("Longitude of the mean ascending node", round(Omega, 1)) # 0.0 + epoch = Epoch(1959, 12, 7.0) + Omega = Moon.longitude_mean_ascending_node(epoch) + print_me("Longitude of the mean ascending node", round(Omega, 1)) # 180.0 + + print("") + + # Get the longitude of the Moonś true ascending node + epoch = Epoch(1913, 5, 27.0) + Omega = Moon.longitude_true_ascending_node(epoch) + print_me("Longitude of the true ascending node", round(Omega, 4)) # 0.8763 + + print("") + + # Compute the longitude of the Moon's mean perigee + epoch = Epoch(2021, 3, 5.0) + Pi = Moon.longitude_mean_perigee(epoch) + print_me("Longitude of the mean perigee", round(Pi, 5)) # 224.89194 + + print("") + + # Compute the approximate illuminated fraction of the Moon's disk + epoch = Epoch(1992, 4, 12.0) + k = Moon.illuminated_fraction_disk(epoch) + print_me("Approximate illuminated fraction of Moon's disk", round(k, 2)) + # 0.68 + + print("") + + # Compute the position angle of the bright limb of the Moon + epoch = Epoch(1992, 4, 12.0) + xi = Moon.position_bright_limb(epoch) + print_me("Position angle of the bright limb of the Moon", round(xi, 1)) + # 285.0 + + print("") + + # Calculate the instant of a New Moon + epoch = Epoch(1977, 2, 15.0) + new_moon = Moon.moon_phase(epoch, target="new") + y, m, d, h, mi, s = new_moon.get_full_date() + print("New Moon: {}/{}/{} {}:{}:{}".format(y, m, d, h, mi, round(s))) + # 1977/2/18 3:37:42 + + # Calculate the time of a Last Quarter + epoch = Epoch(2044, 1, 1.0) + new_moon = Moon.moon_phase(epoch, target="last") + y, m, d, h, mi, s = new_moon.get_full_date() + print("Last Quarter: {}/{}/{} {}:{}:{}".format(y, m, d, h, mi, round(s))) + # 2044/1/21 23:48:17 + + print("") + + # Compute the time and parallax of apogee + epoch = Epoch(1988, 10, 1.0) + apogee, parallax = Moon.moon_perigee_apogee(epoch, target="apogee") + y, m, d, h, mi, s = apogee.get_full_date() + print("Apogee epoch: {}/{}/{} {}:{}".format(y, m, d, h, mi)) + # 1988/10/7 20:30 + print_me("Equatorial horizontal parallax", parallax.dms_str(n_dec=3)) + # 54' 0.679'' + + print("") + + # Compute the time of passage by the ascending node + epoch = Epoch(1987, 5, 15.0) + passage = Moon.moon_passage_nodes(epoch, target="ascending") + y, m, d, h, mi, s = passage.get_full_date() + mi += s/60.0 + print("Passage by the ascending node: {}/{}/{} {}:{}".format(y, + m, + d, + h, + round(mi))) + # 1987/5/23 6:26 + + print("") + + # Compute the epoch and amplitude of maximum southern declination + epoch = Epoch(2049, 4, 15.0) + epo, dec = Moon.moon_maximum_declination(epoch, target='southern') + y, m, d, h, mi, s = epo.get_full_date() + print("Epoch of maximum declination: {}/{}/{} {}:{}".format(y, m, d, h, + mi)) + # 2049/4/21 14:0 + print_me("Amplitude of maximum declination", dec.dms_str(n_dec=0)) + # -22d 8' 18.0'' + + print("") + + # Compute the librations of the Moon + epoch = Epoch(1992, 4, 12.0) + lopt, bopt, lphys, bphys, ltot, btot = Moon.moon_librations(epoch) + print_me("Optical libration in longitude", round(lopt, 3)) + # -1.206 + print_me("Optical libration in latitude", round(bopt, 3)) + # 4.194 + print_me("Physical libration in longitude", round(lphys, 3)) + # -0.025 + print_me("Physical libration in latitude", round(bphys, 3)) + # 0.006 + print_me("Total libration in longitude", round(lphys, 2)) + # -1.23 + print_me("Total libration in latitude", round(bphys, 3)) + # 4.2 + + print("") + + # Let's calculate the position angle of the Moon's axis of rotation + epoch = Epoch(1992, 4, 12.0) + p = Moon.moon_position_angle_axis(epoch) + print_me("Position angle of Moon's axis of rotation", round(p, 2)) + # 15.08 + + +if __name__ == "__main__": + + main() diff -Nru pymeeus-0.4.3+dfsg1/pymeeus/Sun.py pymeeus-0.5.11+dfsg1/pymeeus/Sun.py --- pymeeus-0.4.3+dfsg1/pymeeus/Sun.py 2021-03-03 01:28:56.000000000 +0000 +++ pymeeus-0.5.11+dfsg1/pymeeus/Sun.py 2021-03-05 18:33:09.000000000 +0000 @@ -573,7 +573,7 @@ :type epoch: :py:class:`Epoch` :returns: Difference between apparent and mean time, as a tuple, in - minutes and seconds of time + minutes (int) and seconds (float) of time :rtype: tuple :raises: TypeError if input values are of wrong type. @@ -610,8 +610,8 @@ e = l0() - 0.0057183 - alpha + deltapsi * cos(epsilon.rad()) e *= 4.0 # Extract seconds - s = (abs(e) % 1) * 60.0 - m = int(e) + s = (abs(e()) % 1) * 60.0 + m = int(e()) return m, s @staticmethod diff -Nru pymeeus-0.4.3+dfsg1/PyMeeus.egg-info/PKG-INFO pymeeus-0.5.11+dfsg1/PyMeeus.egg-info/PKG-INFO --- pymeeus-0.4.3+dfsg1/PyMeeus.egg-info/PKG-INFO 2021-03-03 01:28:56.000000000 +0000 +++ pymeeus-0.5.11+dfsg1/PyMeeus.egg-info/PKG-INFO 2021-03-18 21:06:58.000000000 +0000 @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: PyMeeus -Version: 0.4.3 +Version: 0.5.11 Summary: Python implementation of Jean Meeus astronomical routines Home-page: https://github.com/architest/pymeeus Author: Dagoberto Salazar @@ -46,6 +46,13 @@ pip3 install --user pymeeus + If you have PyMeeus already installed, but want to upgrade to the latest + version: + + .. code:: sh + + pip3 install -U pymeeus + Meta ---- @@ -108,6 +115,59 @@ What's new ---------- + - 0.5.11 + + - Added parameter ``local`` to the ``Epoch`` class constructor and + the methods ``get_date()`` and ``get_full_date()``. + + - 0.5.10 + + - Added methods ``moon_librations()`` and + ``moon_position_angle_axis()``. + + - 0.5.9 + + - Added method ``moon_maximum_declination()``. + + - 0.5.8 + + - Fixed several bugs in ``Epoch`` class, and added method ``doy()``. + + - 0.5.7 + + - Added method ``moon_passage_nodes()``. + + - 0.5.6 + + - Added method ``moon_perigee_apogee()``. + + - 0.5.5 + + - Added method ``moon_phase()``. + + - 0.5.4 + + - Added methods ``illuminated_fraction_disk()`` and + ``position_bright_limb()`` to ``Moon`` class. + + - 0.5.3 + + - Fixed error in the return type of method + ``Sun.equation_of_time()``. + + - 0.5.2 + + - Added methods to compute the Moon's longitude of ascending node + and perigee. + + - 0.5.1 + + - Changes in the organization of the documentation. + + - 0.5.0 + + - Added ``Moon`` class and ``position()`` methods. + - 0.4.3 - Added method ``ring_parameters()`` to Saturn class. @@ -120,73 +180,73 @@ - 0.4.1 - Added funtionality to compute the positions of Jupiter's Galilean - moons + moons. - 0.4.0 - Added methods to compute Saturn's ring inclination and longitude - of ascending node + of ascending node. - 0.3.13 - - Additional encoding changes + - Additional encoding changes. - 0.3.12 - Deleted ``encoding`` keyword from setup.py, which was giving - problems + problems. - 0.3.11 - - Added encoding specification to setup.py + - Added encoding specification to setup.py. - 0.3.10 - - Fixed characters with the wrong encoding + - Fixed characters with the wrong encoding. - 0.3.9 - Relaxed requirements, added contributor molsen234, and fixed - format problems showed by flake8 + format problems showed by flake8. - 0.3.8 - - Fixed undefined variable in ``Epoch.tt2ut`` + - Fixed undefined variable in ``Epoch.tt2ut``. - 0.3.7 - Fix bug when using fractional seconds, minutes, hours or days, - plus documentation improvements + plus documentation improvements. - 0.3.6 - - Add method to compute rising and setting times of the Sun + - Add method to compute rising and setting times of the Sun. - 0.3.5 - - Add method ``magnitude()`` to planet classes + - Add method ``magnitude()`` to planet classes. - 0.3.4 - - Add method to compute the parallax correction to Earth class + - Add method to compute the parallax correction to Earth class. - 0.3.3 - - Add methods to compute the passage through the nodes + - Add methods to compute the passage through the nodes. - 0.3.2 - - Add methods to compute the perihelion and aphelion of all planets + - Add methods to compute the perihelion and aphelion of all planets. - 0.3.1 - Fix errors in the elongation computation, add tests and examples of use of methods ``geocentric_position()``, and tests and - examples for ``Pluto`` class + examples for ``Pluto`` class. - 0.3.0 - - Added ``Pluto`` class + - Added ``Pluto`` class. Keywords: Meeus astronomy module library Platform: UNKNOWN diff -Nru pymeeus-0.4.3+dfsg1/PyMeeus.egg-info/SOURCES.txt pymeeus-0.5.11+dfsg1/PyMeeus.egg-info/SOURCES.txt --- pymeeus-0.4.3+dfsg1/PyMeeus.egg-info/SOURCES.txt 2021-03-03 01:28:56.000000000 +0000 +++ pymeeus-0.5.11+dfsg1/PyMeeus.egg-info/SOURCES.txt 2021-03-18 21:06:59.000000000 +0000 @@ -13,42 +13,6 @@ docs/README.txt docs/build/html/.buildinfo docs/build/html/.nojekyll -docs/build/html/Angle.html -docs/build/html/Coordinates.html -docs/build/html/CurveFitting.html -docs/build/html/Earth.html -docs/build/html/Epoch.html -docs/build/html/Interpolation.html -docs/build/html/Jupiter.html -docs/build/html/JupiterMoons.html -docs/build/html/Mars.html -docs/build/html/Mercury.html -docs/build/html/Minor.html -docs/build/html/Neptune.html -docs/build/html/Pluto.html -docs/build/html/Saturn.html -docs/build/html/Sun.html -docs/build/html/Uranus.html -docs/build/html/Venus.html -docs/build/html/base.html -docs/build/html/ex-Angle.html -docs/build/html/ex-Coordinates.html -docs/build/html/ex-CurveFitting.html -docs/build/html/ex-Earth.html -docs/build/html/ex-Epoch.html -docs/build/html/ex-Interpolation.html -docs/build/html/ex-Jupiter.html -docs/build/html/ex-JupiterMoons.html -docs/build/html/ex-Mars.html -docs/build/html/ex-Mercury.html -docs/build/html/ex-Minor.html -docs/build/html/ex-Neptune.html -docs/build/html/ex-Pluto.html -docs/build/html/ex-Saturn.html -docs/build/html/ex-Sun.html -docs/build/html/ex-Uranus.html -docs/build/html/ex-Venus.html -docs/build/html/ex-base.html docs/build/html/genindex.html docs/build/html/index.html docs/build/html/objects.inv @@ -67,6 +31,7 @@ docs/build/html/_modules/pymeeus/Mars.html docs/build/html/_modules/pymeeus/Mercury.html docs/build/html/_modules/pymeeus/Minor.html +docs/build/html/_modules/pymeeus/Moon.html docs/build/html/_modules/pymeeus/Neptune.html docs/build/html/_modules/pymeeus/Pluto.html docs/build/html/_modules/pymeeus/Saturn.html @@ -74,43 +39,48 @@ docs/build/html/_modules/pymeeus/Uranus.html docs/build/html/_modules/pymeeus/Venus.html docs/build/html/_modules/pymeeus/base.html -docs/build/html/_sources/Angle.rst.txt -docs/build/html/_sources/Coordinates.rst.txt -docs/build/html/_sources/CurveFitting.rst.txt -docs/build/html/_sources/Earth.rst.txt -docs/build/html/_sources/Epoch.rst.txt -docs/build/html/_sources/Interpolation.rst.txt -docs/build/html/_sources/Jupiter.rst.txt -docs/build/html/_sources/JupiterMoons.rst.txt -docs/build/html/_sources/Mars.rst.txt -docs/build/html/_sources/Mercury.rst.txt -docs/build/html/_sources/Minor.rst.txt -docs/build/html/_sources/Neptune.rst.txt -docs/build/html/_sources/Pluto.rst.txt -docs/build/html/_sources/Saturn.rst.txt -docs/build/html/_sources/Sun.rst.txt -docs/build/html/_sources/Uranus.rst.txt -docs/build/html/_sources/Venus.rst.txt -docs/build/html/_sources/base.rst.txt -docs/build/html/_sources/ex-Angle.rst.txt -docs/build/html/_sources/ex-Coordinates.rst.txt -docs/build/html/_sources/ex-CurveFitting.rst.txt -docs/build/html/_sources/ex-Earth.rst.txt -docs/build/html/_sources/ex-Epoch.rst.txt -docs/build/html/_sources/ex-Interpolation.rst.txt -docs/build/html/_sources/ex-Jupiter.rst.txt -docs/build/html/_sources/ex-JupiterMoons.rst.txt -docs/build/html/_sources/ex-Mars.rst.txt -docs/build/html/_sources/ex-Mercury.rst.txt -docs/build/html/_sources/ex-Minor.rst.txt -docs/build/html/_sources/ex-Neptune.rst.txt -docs/build/html/_sources/ex-Pluto.rst.txt -docs/build/html/_sources/ex-Saturn.rst.txt -docs/build/html/_sources/ex-Sun.rst.txt -docs/build/html/_sources/ex-Uranus.rst.txt -docs/build/html/_sources/ex-Venus.rst.txt -docs/build/html/_sources/ex-base.rst.txt docs/build/html/_sources/index.rst.txt +docs/build/html/_sources/bodies/Earth.rst.txt +docs/build/html/_sources/bodies/Jupiter.rst.txt +docs/build/html/_sources/bodies/JupiterMoons.rst.txt +docs/build/html/_sources/bodies/Mars.rst.txt +docs/build/html/_sources/bodies/Mercury.rst.txt +docs/build/html/_sources/bodies/Minor.rst.txt +docs/build/html/_sources/bodies/Moon.rst.txt +docs/build/html/_sources/bodies/Neptune.rst.txt +docs/build/html/_sources/bodies/Pluto.rst.txt +docs/build/html/_sources/bodies/Saturn.rst.txt +docs/build/html/_sources/bodies/Sun.rst.txt +docs/build/html/_sources/bodies/Uranus.rst.txt +docs/build/html/_sources/bodies/Venus.rst.txt +docs/build/html/_sources/bodies/index.rst.txt +docs/build/html/_sources/core/Angle.rst.txt +docs/build/html/_sources/core/Coordinates.rst.txt +docs/build/html/_sources/core/CurveFitting.rst.txt +docs/build/html/_sources/core/Epoch.rst.txt +docs/build/html/_sources/core/Interpolation.rst.txt +docs/build/html/_sources/core/base.rst.txt +docs/build/html/_sources/core/index.rst.txt +docs/build/html/_sources/examples/ex-Angle.rst.txt +docs/build/html/_sources/examples/ex-Coordinates.rst.txt +docs/build/html/_sources/examples/ex-CurveFitting.rst.txt +docs/build/html/_sources/examples/ex-Earth.rst.txt +docs/build/html/_sources/examples/ex-Epoch.rst.txt +docs/build/html/_sources/examples/ex-Interpolation.rst.txt +docs/build/html/_sources/examples/ex-Jupiter.rst.txt +docs/build/html/_sources/examples/ex-JupiterMoons.rst.txt +docs/build/html/_sources/examples/ex-Mars.rst.txt +docs/build/html/_sources/examples/ex-Mercury.rst.txt +docs/build/html/_sources/examples/ex-Minor.rst.txt +docs/build/html/_sources/examples/ex-Moon.rst.txt +docs/build/html/_sources/examples/ex-Neptune.rst.txt +docs/build/html/_sources/examples/ex-Pluto.rst.txt +docs/build/html/_sources/examples/ex-Saturn.rst.txt +docs/build/html/_sources/examples/ex-Sun.rst.txt +docs/build/html/_sources/examples/ex-Uranus.rst.txt +docs/build/html/_sources/examples/ex-Venus.rst.txt +docs/build/html/_sources/examples/ex-base.rst.txt +docs/build/html/_sources/examples/index.rst.txt docs/build/html/_static/basic.css docs/build/html/_static/doctools.js docs/build/html/_static/documentation_options.js @@ -141,44 +111,90 @@ docs/build/html/_static/fonts/fontawesome-webfont.woff2 docs/build/html/_static/js/modernizr.min.js docs/build/html/_static/js/theme.js -docs/source/Angle.rst -docs/source/Coordinates.rst -docs/source/CurveFitting.rst -docs/source/Earth.rst -docs/source/Epoch.rst -docs/source/Interpolation.rst -docs/source/Jupiter.rst -docs/source/JupiterMoons.rst -docs/source/Mars.rst -docs/source/Mercury.rst -docs/source/Minor.rst -docs/source/Neptune.rst -docs/source/Pluto.rst -docs/source/Saturn.rst -docs/source/Sun.rst -docs/source/Uranus.rst -docs/source/Venus.rst -docs/source/base.rst +docs/build/html/bodies/Earth.html +docs/build/html/bodies/Jupiter.html +docs/build/html/bodies/JupiterMoons.html +docs/build/html/bodies/Mars.html +docs/build/html/bodies/Mercury.html +docs/build/html/bodies/Minor.html +docs/build/html/bodies/Moon.html +docs/build/html/bodies/Neptune.html +docs/build/html/bodies/Pluto.html +docs/build/html/bodies/Saturn.html +docs/build/html/bodies/Sun.html +docs/build/html/bodies/Uranus.html +docs/build/html/bodies/Venus.html +docs/build/html/bodies/index.html +docs/build/html/core/Angle.html +docs/build/html/core/Coordinates.html +docs/build/html/core/CurveFitting.html +docs/build/html/core/Epoch.html +docs/build/html/core/Interpolation.html +docs/build/html/core/base.html +docs/build/html/core/index.html +docs/build/html/examples/ex-Angle.html +docs/build/html/examples/ex-Coordinates.html +docs/build/html/examples/ex-CurveFitting.html +docs/build/html/examples/ex-Earth.html +docs/build/html/examples/ex-Epoch.html +docs/build/html/examples/ex-Interpolation.html +docs/build/html/examples/ex-Jupiter.html +docs/build/html/examples/ex-JupiterMoons.html +docs/build/html/examples/ex-Mars.html +docs/build/html/examples/ex-Mercury.html +docs/build/html/examples/ex-Minor.html +docs/build/html/examples/ex-Moon.html +docs/build/html/examples/ex-Neptune.html +docs/build/html/examples/ex-Pluto.html +docs/build/html/examples/ex-Saturn.html +docs/build/html/examples/ex-Sun.html +docs/build/html/examples/ex-Uranus.html +docs/build/html/examples/ex-Venus.html +docs/build/html/examples/ex-base.html +docs/build/html/examples/index.html docs/source/conf.py -docs/source/ex-Angle.rst -docs/source/ex-Coordinates.rst -docs/source/ex-CurveFitting.rst -docs/source/ex-Earth.rst -docs/source/ex-Epoch.rst -docs/source/ex-Interpolation.rst -docs/source/ex-Jupiter.rst -docs/source/ex-JupiterMoons.rst -docs/source/ex-Mars.rst -docs/source/ex-Mercury.rst -docs/source/ex-Minor.rst -docs/source/ex-Neptune.rst -docs/source/ex-Pluto.rst -docs/source/ex-Saturn.rst -docs/source/ex-Sun.rst -docs/source/ex-Uranus.rst -docs/source/ex-Venus.rst -docs/source/ex-base.rst docs/source/index.rst +docs/source/bodies/Earth.rst +docs/source/bodies/Jupiter.rst +docs/source/bodies/JupiterMoons.rst +docs/source/bodies/Mars.rst +docs/source/bodies/Mercury.rst +docs/source/bodies/Minor.rst +docs/source/bodies/Moon.rst +docs/source/bodies/Neptune.rst +docs/source/bodies/Pluto.rst +docs/source/bodies/Saturn.rst +docs/source/bodies/Sun.rst +docs/source/bodies/Uranus.rst +docs/source/bodies/Venus.rst +docs/source/bodies/index.rst +docs/source/core/Angle.rst +docs/source/core/Coordinates.rst +docs/source/core/CurveFitting.rst +docs/source/core/Epoch.rst +docs/source/core/Interpolation.rst +docs/source/core/base.rst +docs/source/core/index.rst +docs/source/examples/ex-Angle.rst +docs/source/examples/ex-Coordinates.rst +docs/source/examples/ex-CurveFitting.rst +docs/source/examples/ex-Earth.rst +docs/source/examples/ex-Epoch.rst +docs/source/examples/ex-Interpolation.rst +docs/source/examples/ex-Jupiter.rst +docs/source/examples/ex-JupiterMoons.rst +docs/source/examples/ex-Mars.rst +docs/source/examples/ex-Mercury.rst +docs/source/examples/ex-Minor.rst +docs/source/examples/ex-Moon.rst +docs/source/examples/ex-Neptune.rst +docs/source/examples/ex-Pluto.rst +docs/source/examples/ex-Saturn.rst +docs/source/examples/ex-Sun.rst +docs/source/examples/ex-Uranus.rst +docs/source/examples/ex-Venus.rst +docs/source/examples/ex-base.rst +docs/source/examples/index.rst pymeeus/Angle.py pymeeus/Coordinates.py pymeeus/CurveFitting.py @@ -190,6 +206,7 @@ pymeeus/Mars.py pymeeus/Mercury.py pymeeus/Minor.py +pymeeus/Moon.py pymeeus/Neptune.py pymeeus/Pluto.py pymeeus/Saturn.py @@ -210,6 +227,7 @@ tests/test_mars.py tests/test_mercury.py tests/test_minor.py +tests/test_moon.py tests/test_neptune.py tests/test_pluto.py tests/test_saturn.py diff -Nru pymeeus-0.4.3+dfsg1/README.md pymeeus-0.5.11+dfsg1/README.md --- pymeeus-0.4.3+dfsg1/README.md 2021-03-03 01:28:56.000000000 +0000 +++ pymeeus-0.5.11+dfsg1/README.md 2021-03-18 21:04:26.000000000 +0000 @@ -33,6 +33,12 @@ pip3 install --user pymeeus ``` +If you have PyMeeus already installed, but want to upgrade to the latest version: + +```sh +pip3 install -U pymeeus +``` + ## Meta Author: Dagoberto Salazar @@ -86,39 +92,63 @@ ## What's new +* 0.5.11 + * Added parameter `local` to the `Epoch` class constructor and the methods `get_date()` and `get_full_date()`. +* 0.5.10 + * Added methods ``moon_librations()`` and ``moon_position_angle_axis()``. +* 0.5.9 + * Added method ``moon_maximum_declination()``. +* 0.5.8 + * Fixed several bugs in ``Epoch`` class, and added method ``doy()``. +* 0.5.7 + * Added method ``moon_passage_nodes()``. +* 0.5.6 + * Added method ``moon_perigee_apogee()``. +* 0.5.5 + * Added method ``moon_phase()``. +* 0.5.4 + * Added methods ``illuminated_fraction_disk()`` and ``position_bright_limb()`` to ``Moon`` class. +* 0.5.3 + * Fixed error in the return type of method `Sun.equation_of_time()`. +* 0.5.2 + * Added methods to compute the Moon's longitude of ascending node and perigee. +* 0.5.1 + * Changes in the organization of the documentation. +* 0.5.0 + * Added `Moon` class and `position()` methods. * 0.4.3 * Added method `ring_parameters()` to Saturn class. * 0.4.2 * Added method `__hash__()` to Epoch. Now Epoch objects can be used as keys in a dictionary. * 0.4.1 - * Added funtionality to compute the positions of Jupiter's Galilean moons + * Added funtionality to compute the positions of Jupiter's Galilean moons. * 0.4.0 - * Added methods to compute Saturn's ring inclination and longitude of ascending node + * Added methods to compute Saturn's ring inclination and longitude of ascending node. * 0.3.13 - * Additional encoding changes + * Additional encoding changes. * 0.3.12 - * Deleted `encoding` keyword from setup.py, which was giving problems + * Deleted `encoding` keyword from setup.py, which was giving problems. * 0.3.11 - * Added encoding specification to setup.py + * Added encoding specification to setup.py. * 0.3.10 - * Fixed characters with the wrong encoding + * Fixed characters with the wrong encoding. * 0.3.9 - * Relaxed requirements, added contributor molsen234, and fixed format problems showed by flake8 + * Relaxed requirements, added contributor molsen234, and fixed format problems showed by flake8. * 0.3.8 - * Fixed undefined variable in `Epoch.tt2ut` + * Fixed undefined variable in `Epoch.tt2ut`. * 0.3.7 - * Fix bug when using fractional seconds, minutes, hours or days, plus documentation improvements + * Fix bug when using fractional seconds, minutes, hours or days, plus documentation improvements. * 0.3.6 - * Add method to compute rising and setting times of the Sun + * Add method to compute rising and setting times of the Sun. * 0.3.5 - * Add method `magnitude()` to planet classes + * Add method `magnitude()` to planet classes. * 0.3.4 - * Add method to compute the parallax correction to Earth class + * Add method to compute the parallax correction to Earth class. * 0.3.3 - * Add methods to compute the passage through the nodes + * Add methods to compute the passage through the nodes. * 0.3.2 - * Add methods to compute the perihelion and aphelion of all planets + * Add methods to compute the perihelion and aphelion of all planets. * 0.3.1 - * Fix errors in the elongation computation, add tests and examples of use of methods `geocentric_position()`, and tests and examples for `Pluto` class + * Fix errors in the elongation computation, add tests and examples of use of methods `geocentric_position()`, and tests and examples for `Pluto` class. * 0.3.0 - * Added `Pluto` class + * Added `Pluto` class. diff -Nru pymeeus-0.4.3+dfsg1/README.rst pymeeus-0.5.11+dfsg1/README.rst --- pymeeus-0.4.3+dfsg1/README.rst 2021-03-03 01:28:56.000000000 +0000 +++ pymeeus-0.5.11+dfsg1/README.rst 2021-03-18 21:04:38.000000000 +0000 @@ -37,6 +37,13 @@ pip3 install --user pymeeus +If you have PyMeeus already installed, but want to upgrade to the latest +version: + +.. code:: sh + + pip3 install -U pymeeus + Meta ---- @@ -99,6 +106,59 @@ What's new ---------- +- 0.5.11 + + - Added parameter ``local`` to the ``Epoch`` class constructor and + the methods ``get_date()`` and ``get_full_date()``. + +- 0.5.10 + + - Added methods ``moon_librations()`` and + ``moon_position_angle_axis()``. + +- 0.5.9 + + - Added method ``moon_maximum_declination()``. + +- 0.5.8 + + - Fixed several bugs in ``Epoch`` class, and added method ``doy()``. + +- 0.5.7 + + - Added method ``moon_passage_nodes()``. + +- 0.5.6 + + - Added method ``moon_perigee_apogee()``. + +- 0.5.5 + + - Added method ``moon_phase()``. + +- 0.5.4 + + - Added methods ``illuminated_fraction_disk()`` and + ``position_bright_limb()`` to ``Moon`` class. + +- 0.5.3 + + - Fixed error in the return type of method + ``Sun.equation_of_time()``. + +- 0.5.2 + + - Added methods to compute the Moon's longitude of ascending node + and perigee. + +- 0.5.1 + + - Changes in the organization of the documentation. + +- 0.5.0 + + - Added ``Moon`` class and ``position()`` methods. + - 0.4.3 - Added method ``ring_parameters()`` to Saturn class. @@ -111,70 +171,70 @@ - 0.4.1 - Added funtionality to compute the positions of Jupiter's Galilean - moons + moons. - 0.4.0 - Added methods to compute Saturn's ring inclination and longitude - of ascending node + of ascending node. - 0.3.13 - - Additional encoding changes + - Additional encoding changes. - 0.3.12 - Deleted ``encoding`` keyword from setup.py, which was giving - problems + problems. - 0.3.11 - - Added encoding specification to setup.py + - Added encoding specification to setup.py. - 0.3.10 - - Fixed characters with the wrong encoding + - Fixed characters with the wrong encoding. - 0.3.9 - Relaxed requirements, added contributor molsen234, and fixed - format problems showed by flake8 + format problems showed by flake8. - 0.3.8 - - Fixed undefined variable in ``Epoch.tt2ut`` + - Fixed undefined variable in ``Epoch.tt2ut``. - 0.3.7 - Fix bug when using fractional seconds, minutes, hours or days, - plus documentation improvements + plus documentation improvements. - 0.3.6 - - Add method to compute rising and setting times of the Sun + - Add method to compute rising and setting times of the Sun. - 0.3.5 - - Add method ``magnitude()`` to planet classes + - Add method ``magnitude()`` to planet classes. - 0.3.4 - - Add method to compute the parallax correction to Earth class + - Add method to compute the parallax correction to Earth class. - 0.3.3 - - Add methods to compute the passage through the nodes + - Add methods to compute the passage through the nodes. - 0.3.2 - - Add methods to compute the perihelion and aphelion of all planets + - Add methods to compute the perihelion and aphelion of all planets. - 0.3.1 - Fix errors in the elongation computation, add tests and examples of use of methods ``geocentric_position()``, and tests and - examples for ``Pluto`` class + examples for ``Pluto`` class. - 0.3.0 - - Added ``Pluto`` class + - Added ``Pluto`` class. diff -Nru pymeeus-0.4.3+dfsg1/requirements.txt pymeeus-0.5.11+dfsg1/requirements.txt --- pymeeus-0.4.3+dfsg1/requirements.txt 2021-03-03 01:28:56.000000000 +0000 +++ pymeeus-0.5.11+dfsg1/requirements.txt 2021-03-10 18:11:17.000000000 +0000 @@ -1,18 +1,6 @@ -atomicwrites>=1.2.1 -attrs>=18.2.0 -configparser>=3.5.0 -coverage>=4.5.2 -enum34>=1.1.6 -flake8>=3.6.0 -funcsigs>=1.0.2 -mccabe>=0.6.1 -more-itertools>=4.3.0 -pathlib2>=2.3.2 -pluggy>=0.8.0 -py>=1.7.0 -pycodestyle>=2.4.0 +flake8>=3.1.0 +mccabe>=0.5.1 +pycodestyle>=2.1.0 pyflakes>=2.0.0 -pytest>=4.0.1 -pytest-cov>=2.6.0 -scandir>=1.9.0 -six>=1.11.0 +pytest>=3.0.1 +pytest-cov>=2.0.0 diff -Nru pymeeus-0.4.3+dfsg1/setup.py pymeeus-0.5.11+dfsg1/setup.py --- pymeeus-0.4.3+dfsg1/setup.py 2021-03-03 01:28:56.000000000 +0000 +++ pymeeus-0.5.11+dfsg1/setup.py 2021-03-18 20:51:59.000000000 +0000 @@ -15,7 +15,7 @@ config = { 'name': 'PyMeeus', - 'version': '0.4.3', + 'version': '0.5.11', 'description': 'Python implementation of Jean Meeus astronomical routines', 'long_description': long_description, 'keywords': 'Meeus astronomy module library', diff -Nru pymeeus-0.4.3+dfsg1/tests/test_epoch.py pymeeus-0.5.11+dfsg1/tests/test_epoch.py --- pymeeus-0.4.3+dfsg1/tests/test_epoch.py 2021-03-03 01:28:56.000000000 +0000 +++ pymeeus-0.5.11+dfsg1/tests/test_epoch.py 2021-03-18 20:15:11.000000000 +0000 @@ -19,7 +19,7 @@ from pymeeus.base import TOL -from pymeeus.Epoch import Epoch +from pymeeus.Epoch import Epoch, JDE2000, DAY2SEC from pymeeus.Angle import Angle @@ -48,6 +48,26 @@ assert abs(a._jde - 0.0) < TOL, \ "ERROR: 5th constructor test, JDE value doesn't match" + e = Epoch(JDE2000, utc=True) + a = round((e - JDE2000) * DAY2SEC, 3) + assert abs(a - 64.184) < TOL, \ + "ERROR: 6th constructor test, difference value doesn't match" + + e = Epoch(2451545.0, utc=True) + a = round((e - JDE2000) * DAY2SEC, 3) + assert abs(a - 64.184) < TOL, \ + "ERROR: 7th constructor test, difference value doesn't match" + + e = Epoch(JDE2000, local=True) + a = round((e - JDE2000) * DAY2SEC - Epoch.utc2local(), 3) + assert abs(a - 64.184) < TOL, \ + "ERROR: 8th constructor test, difference value doesn't match" + + e = Epoch(JDE2000, local=True, leap_seconds=35.0) + a = round((e - JDE2000) * DAY2SEC - Epoch.utc2local(), 3) + assert abs(a - 77.184) < TOL, \ + "ERROR: 9th constructor test, difference value doesn't match" + def test_epoch_hashable(): a = Epoch(1987, 6, 19.5) @@ -131,6 +151,15 @@ "ERROR: 3rd get_doy() test, output doesn't match" +def test_epoch_doy(): + """Tests the doy() method of Epoch class""" + + e = Epoch(2017, 12, 31.7) + + assert round(e.doy(), 1) == 365.7, \ + "ERROR: 1st doy() test, output doesn't match" + + def test_epoch_doy2date(): """Tests the doy2date() static method of Epoch class""" @@ -484,3 +513,17 @@ assert h == 17, "ERROR: 3rd rise_set() test, output doesn't match" assert mi == 48, "ERROR: 3rd rise_set() test, output doesn't match" + + +def test_epoch_utc_constructor(): + """Tests that the Epoch constructor handles UTC conversion well""" + + e = Epoch(JDE2000, utc=True) + diff = round((e - JDE2000) * DAY2SEC, 3) + + assert diff == 64.184, "ERROR: 1st UTC test, output doesn't match" + + e = Epoch(2451545.0, utc=True) + diff = round((e - JDE2000) * DAY2SEC, 3) + + assert diff == 64.184, "ERROR: 2nd UTC test, output doesn't match" diff -Nru pymeeus-0.4.3+dfsg1/tests/test_jupiterMoons.py pymeeus-0.5.11+dfsg1/tests/test_jupiterMoons.py --- pymeeus-0.4.3+dfsg1/tests/test_jupiterMoons.py 2021-03-03 01:28:56.000000000 +0000 +++ pymeeus-0.5.11+dfsg1/tests/test_jupiterMoons.py 2021-03-10 17:36:22.000000000 +0000 @@ -144,7 +144,7 @@ """Epoch used for the calculations""" epoch = Epoch(1992, 12, 16, utc=True) - delta, tau, l, b, r = JupiterMoons.calculate_DELTA(epoch) + delta, tau, l, b, r = JupiterMoons.calculate_delta(epoch) # value_reference delta_reference = 5.6611211815432645 @@ -152,11 +152,11 @@ assert abs(round(delta, 4) - round(delta_reference, 4)) < TOL, \ """ERROR: Distance between earth and Jupiter of - JupiterMoons.calculate_DELTA() doesn't match""" + JupiterMoons.calculate_delta() doesn't match""" assert abs(round(tau, 4) - round(tau_reference, 4)) < TOL, \ """ERROR: Light time delay tau between earth and Jupiter of - JupiterMoons.calculate_DELTA()doesn't match""" + JupiterMoons.calculate_delta()doesn't match""" def test_correct_rectangular_positions(self): """This method tests the method correct_rectangular_positions() that @@ -244,7 +244,7 @@ right perspective distances between the Galilean satellites and Jupiter""" - utc_1992_12_16_00_00_00 = Epoch(EPOCH_1992_12_16_UTC, utc=True) + utc_1992_12_16_00_00_00 = Epoch(EPOCH_1992_12_16_UTC) result_matrix = JupiterMoons.check_phenomena(utc_1992_12_16_00_00_00) result_matrix_expect = [[-3.457757270630766, -2.553301264153796, 0.0], [-7.44770945299594, -8.33419997337025, 0.0], diff -Nru pymeeus-0.4.3+dfsg1/tests/test_moon.py pymeeus-0.5.11+dfsg1/tests/test_moon.py --- pymeeus-0.4.3+dfsg1/tests/test_moon.py 1970-01-01 00:00:00.000000000 +0000 +++ pymeeus-0.5.11+dfsg1/tests/test_moon.py 2021-03-14 17:44:12.000000000 +0000 @@ -0,0 +1,324 @@ +# -*- coding: utf-8 -*- + + +# PyMeeus: Python module implementing astronomical algorithms. +# Copyright (C) 2018 Dagoberto Salazar +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with this program. If not, see . + + +from pymeeus.base import TOL +from pymeeus.Moon import Moon +from pymeeus.Epoch import Epoch + + +# Moon class + +def test_moon_geocentric_ecliptical_pos(): + """Tests the method 'geocentric_ecliptical_pos()' of Moon class""" + + epoch = Epoch(1992, 4, 12.0) + Lambda, Beta, Delta, ppi = Moon.geocentric_ecliptical_pos(epoch) + Lambda = round(Lambda, 6) + Beta = round(Beta, 6) + Delta = round(Delta, 1) + ppi = round(ppi, 6) + + assert abs(Lambda - 133.162655) < TOL, \ + "ERROR: 1st 'geocentric_ecliptical_pos()' test, 'Lambda' value doesn't\ + match" + + assert abs(Beta - (-3.229126)) < TOL, \ + "ERROR: 2nd 'geocentric_ecliptical_pos()' test, 'Beta' value doesn't\ + match" + + assert abs(Delta - 368409.7) < TOL, \ + "ERROR: 3rd 'geocentric_ecliptical_pos()' test, 'Delta' value doesn't\ + match" + + assert abs(ppi - 0.991990) < TOL, \ + "ERROR: 4th 'geocentric_ecliptical_pos()' test, 'ppi' value doesn't\ + match" + + +def test_moon_apparent_ecliptical_pos(): + """Tests the method 'apparent_ecliptical_pos()' of Moon class""" + + epoch = Epoch(1992, 4, 12.0) + Lambda, Beta, Delta, ppi = Moon.apparent_ecliptical_pos(epoch) + Lambda = round(Lambda, 5) + Beta = round(Beta, 6) + Delta = round(Delta, 1) + ppi = round(ppi, 6) + + assert abs(Lambda - 133.16726) < TOL, \ + "ERROR: 1st 'apparent_ecliptical_pos()' test, 'Lambda' value doesn't\ + match" + + assert abs(Beta - (-3.229126)) < TOL, \ + "ERROR: 2nd 'apparent_ecliptical_pos()' test, 'Beta' value doesn't\ + match" + + assert abs(Delta - 368409.7) < TOL, \ + "ERROR: 3rd 'apparent_ecliptical_pos()' test, 'Delta' value doesn't\ + match" + + assert abs(ppi - 0.991990) < TOL, \ + "ERROR: 4th 'apparent_ecliptical_pos()' test, 'ppi' value doesn't\ + match" + + +def test_moon_apparent_equatorial_pos(): + """Tests the method 'apparent_equatorial_pos()' of Moon class""" + + epoch = Epoch(1992, 4, 12.0) + ra, dec, Delta, ppi = Moon.apparent_equatorial_pos(epoch) + ra = round(ra, 6) + dec = round(dec, 6) + Delta = round(Delta, 1) + ppi = round(ppi, 6) + + assert abs(ra - 134.688469) < TOL, \ + "ERROR: 1st 'apparent_equatorial_pos()' test, 'ra' value doesn't\ + match" + + assert abs(dec - 13.768367) < TOL, \ + "ERROR: 2nd 'apparent_equatorial_pos()' test, 'dec' value doesn't\ + match" + + assert abs(Delta - 368409.7) < TOL, \ + "ERROR: 3rd 'apparent_equatorial_pos()' test, 'Delta' value doesn't\ + match" + + assert abs(ppi - 0.991990) < TOL, \ + "ERROR: 4th 'apparent_equatorial_pos()' test, 'ppi' value doesn't\ + match" + + +def test_moon_longitude_mean_ascending_node(): + """Tests the method 'longitude_mean_ascending_node()' of Moon class""" + + epoch = Epoch(1913, 5, 27.0) + Omega1 = Moon.longitude_mean_ascending_node(epoch) + Omega1 = round(Omega1, 1) + epoch = Epoch(2043, 9, 10.0) + Omega2 = Moon.longitude_mean_ascending_node(epoch) + Omega2 = round(Omega2, 1) + epoch = Epoch(1959, 12, 7.0) + Omega3 = Moon.longitude_mean_ascending_node(epoch) + Omega3 = round(Omega3, 1) + epoch = Epoch(2108, 11, 3.0) + Omega4 = Moon.longitude_mean_ascending_node(epoch) + Omega4 = round(Omega4, 1) + + assert abs(Omega1 - 0.0) < TOL, \ + "ERROR: 1st 'longitude_mean_ascending_node()' test, 'Omega1' value\ + doesn't match" + + assert abs(Omega2 - 0.0) < TOL, \ + "ERROR: 2nd 'longitude_mean_ascending_node()' test, 'Omega2' value\ + doesn't match" + + assert abs(Omega3 - 180.0) < TOL, \ + "ERROR: 3rd 'longitude_mean_ascending_node()' test, 'Omega3' value\ + doesn't match" + + assert abs(Omega4 - 180.0) < TOL, \ + "ERROR: 4th 'longitude_mean_ascending_node()' test, 'Omega4' value\ + doesn't match" + + +def test_moon_longitude_true_ascending_node(): + """Tests the method 'longitude_true_ascending_node()' of Moon class""" + + epoch = Epoch(1913, 5, 27.0) + Omega = Moon.longitude_true_ascending_node(epoch) + Omega = round(Omega, 4) + + assert abs(Omega - 0.8763) < TOL, \ + "ERROR: 1st 'longitude_true_ascending_node()' test, 'Omega' value\ + doesn't match" + + +def test_moon_longitude_mean_perigee_node(): + """Tests the method 'longitude_mean_perigee()' of Moon class""" + + epoch = Epoch(2021, 3, 5.0) + Pi = Moon.longitude_mean_perigee(epoch) + Pi = round(Pi, 5) + + assert abs(Pi - 224.89194) < TOL, \ + "ERROR: 1st 'longitude_mean_perigee()' test, 'Pi' value doesn't match" + + +def test_moon_illuminated_fraction_disk(): + """Tests the method 'illuminated_fraction_disk()' of Moon class""" + + epoch = Epoch(1992, 4, 12.0) + k = Moon.illuminated_fraction_disk(epoch) + k = round(k, 2) + + assert abs(k - 0.68) < TOL, \ + "ERROR: 1st 'illuminated_fraction_disk()' test, 'k' value doesn't\ + match" + + +def test_moon_position_bright_limb(): + """Tests the method 'position_bright_limb()' of Moon class""" + + epoch = Epoch(1992, 4, 12.0) + xi = Moon.position_bright_limb(epoch) + xi = round(xi, 1) + + assert abs(xi - 285.0) < TOL, \ + "ERROR: 1st 'position_bright_limb()' test, 'xi' value doesn't match" + + +def test_moon_phase(): + """Tests the method 'moon_phase()' of Moon class""" + + epoch = Epoch(1977, 2, 15.0) + new_moon = Moon.moon_phase(epoch, target="new") + y, m, d, h, mi, s = new_moon.get_full_date() + res = (str(y) + "/" + str(m) + "/" + str(d) + " " + str(h) + ":" + str(mi) + + ":" + str(round(s, 0))) + + assert res == "1977/2/18 3:37:42.0", \ + "ERROR: 1st 'moon_phase()' test, 'res' value doesn't match" + + epoch = Epoch(2044, 1, 1.0) + new_moon = Moon.moon_phase(epoch, target="last") + y, m, d, h, mi, s = new_moon.get_full_date() + res = (str(y) + "/" + str(m) + "/" + str(d) + " " + str(h) + ":" + str(mi) + + ":" + str(round(s, 0))) + + assert res == "2044/1/21 23:48:17.0", \ + "ERROR: 2nd 'moon_phase()' test, 'res' value doesn't match" + + +def test_moon_perigee_apogee(): + """Tests the method 'moon_perigee_apogee()' of Moon class""" + + epoch = Epoch(1988, 10, 1.0) + apogee, parallax = Moon.moon_perigee_apogee(epoch, target="apogee") + y, m, d, h, mi, s = apogee.get_full_date() + apo = (str(y) + "/" + str(m) + "/" + str(d) + " " + str(h) + ":" + str(mi)) + para = parallax.dms_str(n_dec=3) + + assert apo == "1988/10/7 20:30", \ + "ERROR: 1st 'moon_perigee_apogee()' test, 'apo' value doesn't match" + + assert para == "54' 0.679''", \ + "ERROR: 2nd 'moon_perigee_apogee()' test, 'para' value doesn't match" + + +def test_moon_passage_nodes(): + """Tests the method 'moon_passage_nodes()' of Moon class""" + + epoch = Epoch(1987, 5, 15.0) + passage = Moon.moon_passage_nodes(epoch, target="ascending") + y, m, d, h, mi, s = passage.get_full_date() + mi = round(mi + s / 60.0, 0) + pas = (str(y) + "/" + str(m) + "/" + str(d) + " " + str(h) + ":" + str(mi)) + + assert pas == "1987/5/23 6:26.0", \ + "ERROR: 1st 'moon_passage_nodes()' test, 'pas' value doesn't match" + + +def test_moon_maximum_declination(): + """Tests the method 'moon_maximum_declination()' of Moon class""" + + epoch = Epoch(1988, 12, 15.0) + epo, dec = Moon.moon_maximum_declination(epoch) + y, m, d, h, mi, s = epo.get_full_date() + epochstr = "{}/{}/{} {}:0{}".format(y, m, d, h, mi) + decli = "{}".format(dec.dms_str(n_dec=0)) + + assert epochstr == "1988/12/22 20:01", \ + "ERROR: 1st 'moon_maximum_declination()' test, 'epochstr' value "\ + + "doesn't match" + + assert decli == "28d 9' 22.0''", \ + "ERROR: 2nd 'moon_maximum_declination()' test, 'decli' value doesn't "\ + + "match" + + epoch = Epoch(2049, 4, 15.0) + epo, dec = Moon.moon_maximum_declination(epoch, target='southern') + y, m, d, h, mi, s = epo.get_full_date() + epochstr = "{}/{}/{} {}:{}".format(y, m, d, h, mi) + decli = "{}".format(dec.dms_str(n_dec=0)) + + assert epochstr == "2049/4/21 14:0", \ + "ERROR: 3rd 'moon_maximum_declination()' test, 'epochstr' value "\ + + "doesn't match" + + assert decli == "-22d 8' 18.0''", \ + "ERROR: 4th 'moon_maximum_declination()' test, 'decli' value doesn't "\ + + "match" + + epoch = Epoch(-4, 3, 15.0) + epo, dec = Moon.moon_maximum_declination(epoch, target='northern') + y, m, d, h, mi, s = epo.get_full_date() + epochstr = "{}/{}/{} {}h".format(y, m, d, h) + decli = "{}".format(dec.dms_str(n_dec=0)) + + assert epochstr == "-4/3/16 15h", \ + "ERROR: 5th 'moon_maximum_declination()' test, 'epochstr' value "\ + + "doesn't match" + + assert decli == "28d 58' 26.0''", \ + "ERROR: 6th 'moon_maximum_declination()' test, 'decli' value doesn't "\ + + "match" + + +def test_moon_librations(): + """Tests the method 'moon_librations()' of Moon class""" + + epoch = Epoch(1992, 4, 12.0) + lopt, bopt, lphys, bphys, ltot, btot = Moon.moon_librations(epoch) + + assert abs(round(lopt, 3) - (-1.206)) < TOL, \ + "ERROR: 1st 'moon_librations()' test, 'lopt' value "\ + + "doesn't match" + + assert abs(round(bopt, 3) - 4.194) < TOL, \ + "ERROR: 2nd 'moon_librations()' test, 'bopt' value doesn't "\ + + "match" + + assert abs(round(lphys, 3) - (-0.025)) < TOL, \ + "ERROR: 3rd 'moon_librations()' test, 'lphys' value "\ + + "doesn't match" + + assert abs(round(bphys, 3) - 0.006) < TOL, \ + "ERROR: 4th 'moon_librations()' test, 'bphys' value doesn't "\ + + "match" + + assert abs(round(ltot, 2) - (-1.23)) < TOL, \ + "ERROR: 5th 'moon_librations()' test, 'ltot' value "\ + + "doesn't match" + + assert abs(round(btot, 3) - 4.2) < TOL, \ + "ERROR: 6th 'moon_librations()' test, 'btot' value doesn't "\ + + "match" + + +def test_moon_position_angle_axis(): + """Tests the method 'moon_position_angle_axis()' of Moon class""" + + epoch = Epoch(1992, 4, 12.0) + p = Moon.moon_position_angle_axis(epoch) + + assert abs(round(p, 2) - 15.08) < TOL, \ + "ERROR: 1st 'moon_position_angle_axis()' test, 'p' value "\ + + "doesn't match"