File size: 3,460 Bytes
84f2155
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
# practical-astronomy-python

Algorithms from [Practical Astronomy with your Calculator or Spreadsheet](https://www.amazon.com/Practical-Astronomy-your-Calculator-Spreadsheet/dp/1108436072) by Peter Duffett-Smith, implemented in Python 3.  API documentation is published [here](https://jfcarr.github.io/practical-astronomy-python/).

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

## Quick Start

Install:

```bash
pip install practical-astronomy
```

Create `easter.py`:

```python
import practical_astronomy.pa_datetime as pd

print(pd.get_date_of_easter(2024))
```

Run it:

```bash
python easter.py
```

Result:

```
(3, 31, 2024)
```

## Unit Tests

If you clone the [repo](https://github.com/jfcarr/practical-astronomy-python) locally, you can run unit tests with the Make utility:

```
make all-tests
```

## Library Functions

Documentation [here](https://jfcarr.github.io/practical-astronomy-python/).

### 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