Constants for CU Boulder's ASEN 6008
Project description
About
This library encodes all of the information provided in the handouts Coefficient Data and Ephemeris_Meeus from ASEN 6008 (CU Boudler). This library was created in Spring 2021 when the course was taught by Professor Kate Davis.
Installation
pip install asen_6008
API
This library provides 10 classes (the 8 planets, Pluto, and the Sun) and 2 constants, AU and Days_per_year.
The classes are all instances of the class Planet which has the following layout (note this is pseudocode)
class Planet:
L # deg
a # AU
e
i #deg
Omega # deg
Pi # deg
mu # km3/s2
r # km
Elements L, a, e, i, Omega, and Pi are of type OrbitalElement which has the following layout
class OrbitalElement:
a0
a1
a2
a3
Elements mu and r are simply floating point values.
To access any of the data for a planet would look something like this
import asen_6008
print(asen_6008.Mars.L)
print(asen_6008.Earth.e.a1)
print(asen_6008.Sun.mu)
The names of all the classes and constants provided are listed below
AU
Days_per_year
Sun
Mercury
Venus
Earth
Mars
Jupiter
Saturn
Uranus
Neptune
Pluto
Also, both the Planet and OrbitalElement class have overridden the __repr__
class attribute, so they can be printed directly, for example:
>>> import asen_6008
>>> print(asen_6008.Jupiter)
L (deg): 34.351484, 3034.9056746, -8.501e-05, 4e-09
a (AU): 5.202603191, 1.913e-07, 0, 0
e: 0.04849485, 0.000163244, -4.719e-07, -1.97e-09
i (deg): 1.30327, -0.0019872, 3.318e-05, 9.2e-08
Ω (deg): 100.464441, 0.1766828, 0.00090387, -7.032e-06
Π (deg): 14.331309, 0.2155525, 0.00072252, -4.59e-06
μ (km3/s2): 126686536.1
r (km): 71492
Usage
Because the professor requested that no equations be placed in the library, only constants, the user will have to supply their own equations for calculating the ephemeris information as a function of time. There are many ways to do this, but one way which leads to a fairly clean API is to wrap the classes provided in your own class, like this
import asen_6008
class MyPlanet():
def __init__(self, planet):
self.planet = planet
def e(self, t):
return self.planet.e.a0 + self.planet.e.a1 * t + self.planet.e.a2 * t**2 + self.planet.e.a3 * t**3
Earth = MyPlanet(asen_6008.Earth)
Mars = MyPlanet(asen_6008.Mars)
print(Mars.e(some_julian_date))
You'll want to put this class and the instance of it in a separate file that you then import into your main Python project.
This way you can access various properties of the planet with a simple interface that accepts a time value. But you can also reach in directly to the underlying class provided by the asen_6008 library, as follows:
print(Earth.planet.e) # Here Earth is the same instance that was defined above.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file asen_6008-2.0.0.tar.gz
.
File metadata
- Download URL: asen_6008-2.0.0.tar.gz
- Upload date:
- Size: 4.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.24.0 setuptools/52.0.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.8.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a4997af85e00d734d1909774bd4d21705d44c32e91b6c014fb0f6d6b6a7a47cd |
|
MD5 | 1b7f25ce9a10f0c15cf7d70974046625 |
|
BLAKE2b-256 | e9d4c83716a6e455c591dad8c30f0793cdbaf72820a0630bbdf0339b6d59390a |
File details
Details for the file asen_6008-2.0.0-py3-none-any.whl
.
File metadata
- Download URL: asen_6008-2.0.0-py3-none-any.whl
- Upload date:
- Size: 4.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.24.0 setuptools/52.0.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.8.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a1b816d630004aca9d5ad08a73622e501094537a97d5ce2712255c7e6942ac6c |
|
MD5 | e7f4dc9f90e13ecd917838d3f76c6a87 |
|
BLAKE2b-256 | fdc64c0cfe12e65ca235f59ce57eeb69ca6bf9466393011611f69eea03fd9d30 |