Skip to main content

Algorithms from Practical Astronomy, implemented in Python

Project description

practical-astronomy-python

Algorithms from Practical Astronomy with your Calculator or Spreadsheet by Peter Duffett-Smith, implemented in Python 3. API documentation is published here.

If you're interested in this topic, please buy the book! It provides far more detail and context.

Quick Start

Install:

pip install practical-astronomy

Create easter.py:

import practical_astronomy.pa_datetime as pd

print(pd.get_date_of_easter(2024))

Run it:

python easter.py

Result:

(3, 31, 2024)

Unit Tests

If you clone the repo locally, you can run unit tests with the Make utility:

make all-tests

Library Functions

Documentation here.

Date/Time

Type Description
Calculate Date of Easter
Convert Civil Date to Day Number
Convert Greenwich Date <-> Julian Date
Convert Julian Date to Day-of-Week
Extract Day, Month, and Year parts of Julian Date
Convert Civil Time <-> Decimal Hours
Extract Hour, Minutes, and Seconds parts of Decimal Hours
Convert Local Civil Time <-> Universal Time
Convert Universal Time <-> Greenwich Sidereal Time
Convert Greenwich Sidereal Time <-> Local Sidereal Time

Coordinates

Type Description
Convert Angle <-> Decimal Degrees
Convert Right Ascension <-> Hour Angle
Convert Equatorial Coordinates <-> Horizon Coordinates
Calculate Obliquity of the Ecliptic
Convert Ecliptic Coordinates <-> Equatorial Coordinates
Convert Equatorial Coordinates <-> Galactic Coordinates
Calculate Angle between two objects
Calculate Rising and Setting times for an object
Calculate Precession (corrected coordinates between two epochs)
Calculate Nutation (in ecliptic longitude and obliquity) for a Greenwich date
Calculate Effects of aberration for ecliptic coordinates
Calculate RA and Declination values, corrected for atmospheric refraction and geocentric parallax
Calculate Heliographic coordinates
Calculate Carrington rotation number
Calculate Selenographic (lunar) coordinates (sub-Earth and sub-Solar)

The Sun

Type Description
Calculate Approximate and precise positions of the Sun
Calculate Sun's distance and angular size
Calculate Local sunrise and sunset
Calculate Morning and evening twilight
Calculate Equation of time
Calculate Solar elongation

Planets

Type Description
Calculate Approximate and precise position of planet
Calculate Visual aspects of planet (distance, angular diameter, phase, light time, position angle of bright limb, and apparent magnitude)
Calculate Position of comet (elliptical and parabolic)
Calculate Binary star orbit data

The Moon

Type Description
Calculate Approximate and precise position of Moon
Calculate Moon phase and position angle of bright limb
Calculate Times of new Moon and full Moon
Calculate Moon's distance, angular diameter, and horizontal parallax
Calculate Local moonrise and moonset

Eclipses

Type Description
Calculate Lunar eclipse occurrence and circumstances
Calculate Solar eclipse occurrence and circumstances

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

practical_astronomy-0.0.4.tar.gz (298.2 kB view details)

Uploaded Source

Built Distribution

practical_astronomy-0.0.4-py3-none-any.whl (49.3 kB view details)

Uploaded Python 3

File details

Details for the file practical_astronomy-0.0.4.tar.gz.

File metadata

  • Download URL: practical_astronomy-0.0.4.tar.gz
  • Upload date:
  • Size: 298.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.10.12

File hashes

Hashes for practical_astronomy-0.0.4.tar.gz
Algorithm Hash digest
SHA256 4bf9af88a88ee11612540687f252c0c77c1c6c25e1d3a54647809c01d0d10d1d
MD5 fda337928821e5cc73c5c01d40bf6e51
BLAKE2b-256 7ee26bd05793ab4503bbc5c33226f79f8c672afdf7f1b59fca6444c8d13287bd

See more details on using hashes here.

File details

Details for the file practical_astronomy-0.0.4-py3-none-any.whl.

File metadata

File hashes

Hashes for practical_astronomy-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 eb8755a7af6233466f645ef3bdc15e87120653b3de9f0c54891ca7cc14477ff5
MD5 6beb7aa240ec33b66a417a63feb916af
BLAKE2b-256 876ed78883f1bdcd37b102cd162fe404d0b63b55e297a658484793a16fddd2a7

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page