A Python library that deals with astronomy and mathematical calculations. It also helps with Julian Dates
Project description
astronomica
logo created with kittl.com
Introduction and Purpose
The purpose of astronomica is to provide a set of tools for analyzing, generating, searching and visualizing astronomical data. This library aims to make it easy for astronomers, researchers, and students to explore and understand the universe using Python. By providing a comprehensive set of tools and a user-friendly interface, this library aims to empower astronomers and researchers to gain new insights into the universe and advance our understanding of the cosmos.
Note of Usage:
Astronomica is 100% free!! It is also driven by the community, so we welcome tips, bug fixes, and more methods added by users and the general python & astronomy community. You can also join our reddit community at https://www.reddit.com/r/pythonlibraries/
Example usage:
For example, use the following piece of information:
- Heliocentric coordinates are coordinates that are measured relative to the center of the Sun, which is the primary source of gravitational attraction in the Solar System. Astronomers need heliocentric coordinates of Mars to study the planet's motion relative to the Sun, as well as to understand the dynamics of the Solar System.
The Helicocentric coordinates of any planet can be computed easily with astronomica -
from astronomica import * # import all the tools offered by astronomica
xmars, ymars, zmars = planet_heliocentric_coordinates('mars') # get the coordinates of mars right now
print(f"The Heliocentric Coordinates of Mars right now are: ({xmars}, {ymars}, {zmars}).")
Here is another usage example:
- Astronomers need to know when astronomical night is so they can see the stars the best:
# Import datetime module
import datetime
from astronomica import *
def get_astronomical_night():
# Get the local sunset time as a datetime object
sun = Sun(47.6, -122.2)
sunset_time = sun.get_local_sunset_time(datetime.datetime.now())
print(f"The local sunset time is {sunset_time}")
# Calculate duration of the day in hours and minutes
day_duration = datetime.timedelta(hours=24) - datetime.timedelta(hours=sunset_time.hour, minutes=sunset_time.minute)
day_duration_hours, day_duration_minutes = divmod(day_duration.seconds // 60, 60)
# Calculate the duration of astronomical twilight as a timedelta object
twilight_duration = datetime.timedelta(minutes=day_duration.total_seconds() * 0.2666 / 60)
# Calculate the duration of astronomical night as a timedelta object
night_duration = day_duration - twilight_duration
# Calculate the time of astronomical night as a datetime object
night_time = sunset_time + night_duration
# Format the time of astronomical night as a string in the format "HH:MM"
night_time_str = night_time.strftime("%H:%M")
print(f"The time of astronomical night is {night_time_str}")
get_astronomical_night()
Utilities:
astronomica provides a wide range of functions and tools that extend not only into astronomy, but physics and mathematics as well. Here are some of the things astronomica offers:
-
Mathematics:
- astronomica provides a wide range of trigonometry functions such as sine, cosine, tangent, arcsine, arccosine, arctangent, and more. It can also calculate a nth root of a number or raise a number to the nth power.
-
Visualization:
- astronomica provides visualization tools for a growing amount of astronomical data. As of Wednesday April 12th, Astronomica provides visualization for the mean anomaly of all nine planets, and more tools for plotting your own lists.
-
Time:
- astronomica provides two accurate functions for getting the current date and time as an str. They can be used in advanced calculations, as they are accurate to the second. Astronomica also has functions for getting the current julian date, local sidereal time, and conversions between gregorian and julian calendars.
-
Astronomy:
- astronomica provides a strong set of methods developed to make astronomy observations easier. It includes a host of general sun calculations, sunrise and set times, heliocentric coordinates (see the example), geocentric coordinates, geocentric latitude and longitude, star calculations (including the ability to map star names to their type), scraping astronomical databases for equatorial coordinates of stars, lunar phase calculation, lunar age and percent of age calculation, and finally, a method for getting the definition of a hard astronomy word.
-
Physics:
- astronomica currently has one function to get the gravitational force experienced by the earth from another object given its distance in astronomical units (the distance from the sun to earth is around 1 AU), and mass in kilograms.
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 astronomica-0.0.9.tar.gz
.
File metadata
- Download URL: astronomica-0.0.9.tar.gz
- Upload date:
- Size: 18.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.16
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e830e75224d4b6b3756fee53bf2911433b2f49cf86db8c459d0ea5bb30807546 |
|
MD5 | 27c703f763b93e0895b3053f7b3cb1e9 |
|
BLAKE2b-256 | 7e1ff2cd7b957af545990b9521dbd80823c6d0707c6fe13b50314bfc321f2bc4 |
File details
Details for the file astronomica-0.0.9-py3-none-any.whl
.
File metadata
- Download URL: astronomica-0.0.9-py3-none-any.whl
- Upload date:
- Size: 16.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.16
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3a00c1c3cfa572a12d636587b659097cbc881ecd9c018779aad5d5ed221eb25e |
|
MD5 | 6ed124eda075f2f22005f0cc763ab359 |
|
BLAKE2b-256 | d549247dd462928710b72418ada8b6984b83c4b476bc62f4fb67179f7fca9e3b |