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

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: practical_astronomy-1.0.2.tar.gz
  • Upload date:
  • Size: 298.5 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.2.tar.gz
Algorithm Hash digest
SHA256 b3d472480d8bc7e17040f4d31cf39d8df159e2275010bd74ea0190a666ca291c
MD5 6566aa79adcdbfd099fcac3dfd03cc7a
BLAKE2b-256 114982d974feb13937d28567c277c34ec46f142a9c0ec32df44f005d3800414b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for practical_astronomy-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 be7b2f89b288fc79db74c62f0929bac80a4e1534deb6cb25d5ffbd76a6b0a1e8
MD5 6c630cdf10cc0f496f0a942048a4ffd2
BLAKE2b-256 d4d5ba074161da197be5163d7d0a6778f86262db0defbab630d9cd7614c78932

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