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-1.0.1.tar.gz (298.3 kB view details)

Uploaded Source

Built Distribution

practical_astronomy-1.0.1-py3-none-any.whl (49.1 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for practical_astronomy-1.0.1.tar.gz
Algorithm Hash digest
SHA256 f31ae581bdd96b83c42ee0a8752be4c7c16ebbc663fd44cde9907463ffd0dd40
MD5 7de13f392672fb73b3d785ff64c11235
BLAKE2b-256 d03e6f858eca12861bebee1d585e6e06d2719ee808c7f1867c1d9e7ebbf865c5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for practical_astronomy-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3560664c97a91a1e423eea61310ab8b951b84f9fc55fbc2208325964648a77bc
MD5 c977bb6e28ed46719bb8270c96f67cd3
BLAKE2b-256 2e32cb20c2413a1225f5a663ae5f67b0cd5f0b6a1ae8696a505b1477d26725e9

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