There are a lot of (Python) cosmology libraries out there, from big projects – including Astropy, CLASS, and CAMB – down to small personal scripts. These libraries perform many of the same tasks, but they all have different interfaces, and different ways of doing things. This makes it hard to switch between libraries, and nearly impossible to write code that works with multiple libraries.
The Cosmology API for Python solves this problem, providing detailed interfaces for cosmology codes, from individual methods and functions up to fully-featured cosmology objects, even whole libraries. Best of all, using the Cosmology API does not require any run-time dependencies, even this library!
With the Cosmology API you can write code that works with anything that implements the API, i.e many different cosmology libraries. We provide the easy-to-use, well-defined descriptions, you can build functions that work with any supporting library. For example
# No implementation, just a description of the interface!
from cosmology.api import StandardCosmology
def flat_angular_diameter_distance(
cosmo: StandardCosmology[Array, Array], z: Array
) -> Array:
# Do some cosmology with any object that implements the API
if cosmo.Omega_k != 0:
raise ValueError("This function only works for flat cosmologies")
return cosmo.comoving_distance(z) / (1 + z)
Metadata
Release files for cosmology.api 0.3.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| cosmology_api-0.3.2.tar.gz | 17.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| cosmology_api-0.3.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 36.0 kB
Release files / cosmology_api-0.3.2.tar.gz
| Download URL | cosmology_api-0.3.2.tar.gz |
|---|---|
| Size | 17.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7ccdfdf20f91dfc2282aee059adf2530bea6e194a0f8d01487e15a7497cf4694
|
|
BLAKE2b-256 checksum How to use checksums |
f0f4801cab91dab5b2e8102ed54cc4e2bd257f319c9047db182fcaf53706df6a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.0.1 CPython/3.12.8
|
Release files / cosmology_api-0.3.2-py3-none-any.whl
| Download URL | cosmology_api-0.3.2-py3-none-any.whl |
|---|---|
| Size | 18.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9391ef0b2616bbf4217fefdb94a72370766d59a2f0558b5ade224a92ea093a61
|
|
BLAKE2b-256 checksum How to use checksums |
bf8c6cc73fafff9f4d75e77a9c3cf5b9c34aa42841cfc7da5c89737daa2c3bd7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.0.1 CPython/3.12.8
|