AstroConst
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.
Installation
This package can be installed using pip install astroconst. This should automatically install the
dependency package numpy, if it has't been installed already. If you are installing by hand, ensure that
this package is installed as well.
Example use
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.).
The submodule 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[5]+' is '+str(ac.pl_d[5]/ac.km)+' km')
# The diameter of Jupiter is 142984 km
print('a_'+ac.plname_en[0]+' = '+str(ac.pl_a[0]/ac.km)+' km')
# a_Moon = 384400.0 km (Moon = planet #0)
print(ac.dow_en_abr[0]) # Sun
print(ac.months_en[3]) # March
AstroConst pages
- Pypi: AstroConst Python package
- GitHub: AstroConst source code
- ReadTheDocs: AstroConst documentation
Author and licence
- Author: Marc van der Sluys
- Contact: http://marc.vandersluys.nl
- Licence: EUPL 1.2
References
Copyright (c) 2022-2025 Marc van der Sluys
Metadata
Release files for astroconst 0.0.14
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| astroconst-0.0.14.tar.gz | 17.3 kB | Without provenance | Details for astroconst-0.0.14.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| astroconst-0.0.14-py3-none-any.whl | Python 3 | none | any | Details for astroconst-0.0.14-py3-none-any.whl |
Total release size: 34.3 kB
Release files / astroconst-0.0.14.tar.gz
| Download URL | astroconst-0.0.14.tar.gz |
|---|---|
| Size | 17.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4f9c21fe19983e95295acfdb92361f5fdafd6bdad6ae22cbbda25e998e4b288c
|
|
BLAKE2b-256 checksum How to use checksums |
5cb2d47e03a9aed9e1432bcdb35edc9d505b2d8fd713d35cb9e288009330a52f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.11
|
Release files / astroconst-0.0.14-py3-none-any.whl
| Download URL | astroconst-0.0.14-py3-none-any.whl |
|---|---|
| Size | 16.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
99e25fb1db6bd117c216759435ab9224a78eeddd65d36f52389bb757481be3a0
|
|
BLAKE2b-256 checksum How to use checksums |
dc96c5f825e767ef6f5b3c91a2f1519138b6f10c82fc226601f38c222b555dfd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.11
|
Security for astroconst 0.0.14
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.