A Python package that provides astronomical constants.
A Python package that provides astronomical constants. The code is being developed by Marc van der Sluys of the department of Astrophysics at the Radboud University Nijmegen, the Institute of Nuclear and High-Energy Physics (Nikhef), and the Institute for Gravitational and Subatomic Physics (GRASP) at Utrecht University, all in The Netherlands. The AstroConst package can be used under the conditions of the EUPL 1.2 licence.
Note that the package is currently is its alpha stage, and things may still change as I start using this.
This package can be installed using
pip install astroconst. This should automatically install the
numpy, if it has't been installed already. If you are installing by hand, ensure that
this package is installed as well.
SI units should be used everywhere - no ergs, dyn or cm (sorry!). Values include mathematical constants (like π), angle-conversion factors (from/to radians, degrees, hours, arcseconds, ...), calendar stuff (names of weekdays and months, JDs, lengths of days, months and years), solar-system objects (Sun, Moon, planet names diameters, orbital separations, etc. - note that Moon = planet #0), and some basic physical constants ((Stefan-)Bolzmann, Planck, speed of light, etc.).
aa contains constants published by the Astronomical Almanac, converted to Python.
"""Example Python script using the AstroConst package.""" import astroconst as ac print(ac.c) # 299792458 (speed of light, quick access) print(ac.aa.c) # Access constants from Astronomical Almanac print(ac.jd2000) # 2451545 print(ac.m_sun) # 1.9891e+30 (kg) print(ac.sol_const) # 1361.5 (W/m2) print(ac.year_jul) # 31557600.0 (s) print(ac.year_jul/ac.day) # 365.25 (days) print(ac.month_syn/ac.day) # 29.530588853 (days) print('The diameter of '+ac.plname_en+' is '+str(ac.pl_d/ac.km)+' km') # The diameter of Jupiter is 142984 km print('a_'+ac.plname_en+' = '+str(ac.pl_a/ac.km)+' km') # a_Moon = 384400.0 km (Moon = planet #0) print(ac.dow_en_abr) # Sun print(ac.months_en) # March
- Pypi: AstroConst Python package
- GitHub: AstroConst source code
- ReadTheDocs: AstroConst documentation
Author and licence
Copyright (c) 2022 Marc van der Sluys
Release history Release notifications | RSS feed
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Hashes for astroconst-0.0.8-py3-none-any.whl