A package for cosmology calculations with arbitrary numpy-like APIs
Project description
The primary intention for this package is for use with GWPopulation
but the main functionality can be used externally.
Installation and contribution
Currently installation is only available from source
$ pip install git+https://github.com/ColmTalbot/wcosmo.git
for development you should follow a standard fork-and-pull workflow.
First create a new fork at
github.com/UserName/wcosmo
.Clone your fork
$ git clone git@github.com:UserName/wcosmo.git
or use a GitHub codespace.
Install the local version with
$ python -m pip install .
Make any desired edits and push to your fork.
Open a pull request into
git@github.com:ColmTalbot/wcosmo.git
.
Basic usage
To import an astropy-like cosmology (without units)
from wcosmo import FlatwCDM
cosmology = FlatwCDM(H0=70, Om0=0.3, w0=-1)
This code is automatically used in GWPopulation
when using either
gwpopulation.experimental.cosmo_models.CosmoModel
and/or
PowerLawRedshift
Changing backend
The backend can be switched automatically using, e.g.,
import gwpopulation
gwpopulation.backend.set_backend("jax")
Manual backend setting can be done as follows:
import jax.numpy as jnp
from jax.scipy.linalg.toeplitz import toeplitz
from wcosmo import wcosmo, utils
wcosmo.xp = jnp
utils.xp = jnp
utils.toeplitz = toeplitz
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.