Skip to main content

A Python library that deals with astronomy and mathematical calculations. It also helps with Julian Dates

Project description

astronomica

Introduction and Purpose

Astronomica is a simple python library based on formulas pioneered at https://www.aa.quae.nl/en/reken/zonpositie.html, and https://astronomica.w3spaces.com/. Scroll below to check out the documentation. This library does not depend on Astropy or Skyfield, but requires their installation for conversion purposes - some of our functions include interoperability of libraries - skyfield units to astropy units, etc.

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/

Usage:

Here is a very simple usage example of Astronomica:

from astronomica import *
lunar_phase = getLunarPhase()
planting_time = False
if lunar_phase == 'Full':
  planting_time = True
  sendNotificationToFarmers("It is a full Moon, planting should begin")
else:
  waitForFullMoon()

Here is another example:

from astronomica import *
PyndyalaCoder = Observer(47.6, -122.2, 'earth')
print(PyndyalaCoder.mean_anomaly())

Methods

fahrenheit_to_celsius(f)
celsius_to_fahrenheit(c)
miles_to_kilometers(m)
pounds_to_kilograms(lb)
kilometers_to_miles(km)
kilograms_to_pounds(kg)
inches_to_centimeters(inch)
centimeters_to_inches(cm)
au_to_km(au)
km_to_au(km)
light_years_to_km(ly)
km_to_light_years(km)
parsecs_to_light_years(pc)
light_years_to_parsecs(ly)
astropy_length_to_skyfield_length(length)
astropy_time_to_skyfield_time(time)
skyfield_time_to_astropy_time(time)

These functions all deal with conversions of units. The last three are for interoperability of astronomy libraries.

time()

returns the current time

date()

returns the current date

now = Date()
now.now().__insert_time_element_here__

returns an object containing the time

local_julian_date(date=datetime.datetime.now())

This method returns the current local julian date

fromJulian(j) # j is the julian date to convert

This method returns the gregorian date from a given julian date

get_lunar_age()

This method returns the current age of the moon (in days)

get_lunar_age_percent()

This method returns the current percentage of the lunar cycle completed by the moon

getLunarPhase()

This method returns the current lunar phase

daysSinceJ2000()

This method returns the days since Jan 1st 2000 Epoch

definition_of(word)

This method returns the definition of an astronomy word for amateurs who are confused on what something means.

sun = Sun(lat, long)
sun.get_local_sunrise_time()
sun.get_local_sunset_time()

These methods return the sunrise and sunset time

decimalHours(now) # now is the chosen time

This method returns the decimal hours for a given time

localSiderealTime(long)

This method returns the local sidereal time for a given longitude east

altitude(lat, long)

This method returns the current solar altitude on earth for a given longitude east and a latitude north

azimuth(lat, long)

This method returns the current solar azimuth in degrees for a given latitude and longitude east

map_star(star)

This method returns the type of star based on its name.

Observer Class

observer = Observer(lat, long, desired_planet_for_calculations, date=datetime.datetime.now())

Methods in class

julian_date()

returns the current julian date

mean_anomaly()

returns the mean anomaly of the chosen planet specified when initializing the object (see the initialization for details)

equation_of_center()

returns the current equation of center to correct the mean anomaly of the planet.

true_anomaly()

returns the true anomaly of the chosen planet

set_perihelion_and_obliquity()

sets the longitude of the perihelion of the planet's orbit, and its obliquity

ecliptical_longitude()

returns the ecliptical longitude of the sun

equatorial_coordinates()

returns the equatorial coordinates of the sun from the planet (right ascension and declination) as a dictionary.

local_solar_transit()

returns the solar noon julian date for the current day. It can be converted to regular time by fromJulian(j) function

distance_to_sun()

returns the distance to the sun from that planet.

planet_heliocentric_coordinates()

returns the planets rectangular ecliptical heliocentric coordinates (x, y, z)

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

astronomica-0.0.7.tar.gz (12.7 kB view hashes)

Uploaded Source

Built Distribution

astronomica-0.0.7-py3-none-any.whl (12.1 kB view hashes)

Uploaded Python 3

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