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

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: practical_astronomy-1.0.0.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.0.tar.gz
Algorithm Hash digest
SHA256 01a57eff09bc7d77bf9552a07a4e529ddcedd8fd264802532a6da59ca28c1bdc
MD5 b2c7f1f7e16e87c459c70cea431d7dec
BLAKE2b-256 57f152960c1f60fd77bd67023a46b51cbb094cd1824a9b76414336cd91f3fd70

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for practical_astronomy-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5d0dc391c964a57a71f384e5939249700c7fd84e9e93ed877dfd4c853b5a530d
MD5 a6eefda72848d1ee8ddf707fee7b979b
BLAKE2b-256 a43efce08597aca6cef14a002bf2cc8c4da949544cfb51e3ddc2743547e969c1

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