https://github.com/colmtalbot/wcosmo
Backend agnostic cosmology tools
Science Score: 26.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
○Academic publication links
-
○Academic email domains
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (12.5%) to scientific vocabulary
Last synced: 10 months ago
·
JSON representation
Repository
Backend agnostic cosmology tools
Basic Info
- Host: GitHub
- Owner: ColmTalbot
- License: mit
- Language: Python
- Default Branch: main
- Homepage: https://wcosmo.readthedocs.io/en/latest/
- Size: 22.4 MB
Statistics
- Stars: 6
- Watchers: 2
- Forks: 3
- Open Issues: 6
- Releases: 13
Created about 2 years ago
· Last pushed 10 months ago
Metadata Files
Readme
License
README.rst
Backend agnostic astropy-like cosmology
=======================================
An efficient implementation of :code:`astropy`-like cosmology compatible
with :code:`numpy`-like backends, e.g., :code:`jax` and :code:`cupy`.
There are two main features leading to superior efficiency to :code:`astropy`:
- Integrals of :math:`E(z)` and related functions are performed analytically
with Pade approximations or analytic expressions using hypergeometric functions.
- Support for :code:`jax` and :code:`cupy` backends allow hardware
acceleration, just-in-time compilation, and automatic differentiation.
The primary limitations are:
- Only flat cosmologies are supported with two components with constant
equations of state, e.g., :code:`FlatwCDM`.
- Approximations to the various integrals generally agree with :code:`astropy`
at the <0.1% level.
- The :code:`astropy` units are incompatible with the :code:`cupy` backend.
Units are supported with the :code:`jax` backend using :code:`unxt`.
Installation and contribution
-----------------------------
:code:`wcosmo` can be installed via :code:`conda-forge`, :code:`pypi` or from
source.
.. code-block:: console
$ mamba install -c conda-forge wcosmo
$ pip install wcosmo
$ 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 :code:`github.com/UserName/wcosmo`.
- Clone your fork
.. code-block:: console
$ git clone git@github.com:UserName/wcosmo.git
or use a GitHub codespace.
- Install the local version with
.. code-block:: console
$ python -m pip install .
- Make any desired edits and push to your fork.
- Open a pull request into :code:`git@github.com:ColmTalbot/wcosmo.git`.
Basic usage
-----------
To import an astropy-like cosmology
.. code-block:: python
>>> from wcosmo import FlatwCDM
>>> cosmology = FlatwCDM(H0=70, Om0=0.3, w0=-1)
>>> cosmology.luminosity_distance(1)
The built-in cosmologies in :code:`astropy` are all available, e.g.,
.. code-block:: python
>>> from wcosmo import Planck18
>>> Planck18.luminosity_distance(1)
they can also be accessed using :code:`wcosmo.available`
.. code-block:: python
>>> from wcosmo import available
>>> available["Planck18"].luminosity_distance(1)
Explicit usage of :code:`astropy` units can be freely enabled/disabled.
In this case, the values will have the default units for each method.
.. code-block:: python
>>> from wcosmo import FlatwCDM
>>> from wcosmo.utils import disable_units, enable_units
>>> cosmology = FlatwCDM(H0=70, Om0=0.3, w0=-1)
>>> disable_units()
>>> cosmology.luminosity_distance(1)
6607.657732077576
>>> enable_units()
>>> cosmology.luminosity_distance(1)
Changing backend
^^^^^^^^^^^^^^^^
:code:`wcosmo` mostly relies on implicit backend switching. The backend is
determined automatically based on the input arguments. When an input value is
a :code:`Python` built-in type, the default backend is chosen using the
environment variable :code:`WCOSMO_ARRAY_API`. The default is :code:`numpy`.
GWPopulation
^^^^^^^^^^^^
The original intention for this package was for use with :code:`GWPopulation`.
This code is automatically used in :code:`GWPopulation` when using either
:code:`gwpopulation.experimental.cosmo_models.CosmoModel` and/or
:code:`PowerLawRedshift`
Owner
- Name: Colm Talbot
- Login: ColmTalbot
- Kind: user
- Website: https://colmtalbot.github.io/
- Repositories: 6
- Profile: https://github.com/ColmTalbot
GitHub Events
Total
- Create event: 14
- Issues event: 5
- Release event: 6
- Watch event: 3
- Delete event: 10
- Issue comment event: 11
- Push event: 38
- Pull request review event: 2
- Pull request event: 21
- Fork event: 1
Last Year
- Create event: 14
- Issues event: 5
- Release event: 6
- Watch event: 3
- Delete event: 10
- Issue comment event: 11
- Push event: 38
- Pull request review event: 2
- Pull request event: 21
- Fork event: 1
Issues and Pull Requests
Last synced: 10 months ago
All Time
- Total issues: 8
- Total pull requests: 25
- Average time to close issues: 4 days
- Average time to close pull requests: 10 days
- Total issue authors: 4
- Total pull request authors: 3
- Average comments per issue: 1.75
- Average comments per pull request: 0.44
- Merged pull requests: 21
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 5
- Pull requests: 10
- Average time to close issues: 5 days
- Average time to close pull requests: 1 day
- Issue authors: 3
- Pull request authors: 1
- Average comments per issue: 1.8
- Average comments per pull request: 0.0
- Merged pull requests: 9
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- ColmTalbot (3)
- Qazalbash (3)
- jacobgolomb (1)
- HuiTong5 (1)
Pull Request Authors
- ColmTalbot (23)
- afarah18 (1)
- HuiTong5 (1)
Top Labels
Issue Labels
bug (2)
Pull Request Labels
enhancement (1)
Packages
- Total packages: 1
-
Total downloads:
- pypi 664 last-month
- Total dependent packages: 0
- Total dependent repositories: 0
- Total versions: 13
- Total maintainers: 1
pypi.org: wcosmo
A package for cosmology calculations with arbitrary numpy-like APIs
- Documentation: https://wcosmo.readthedocs.io/
- License: MIT
-
Latest release: 0.5.4
published 10 months ago
Rankings
Dependent packages count: 10.9%
Average: 36.1%
Dependent repos count: 61.3%
Maintainers (1)
Last synced:
10 months ago
Dependencies
pyproject.toml
pypi
- gwpopulation *
- numpy *
setup.py
pypi
.github/workflows/pages.yml
actions
- actions/checkout v4 composite
- actions/deploy-pages v4 composite
- actions/setup-python v5 composite
- actions/upload-pages-artifact v3 composite
- s-weigand/setup-conda v1 composite
.github/workflows/release.yaml
actions
- actions/checkout v4 composite
- actions/download-artifact v4 composite
- actions/setup-python v5 composite
- actions/upload-artifact v4 composite
- pypa/gh-action-pypi-publish release/v1 composite
.github/workflows/unittest.yml
actions
- actions/checkout v4 composite
- actions/setup-python v5 composite
- actions/upload-artifact v4 composite
- codecov/codecov-action v4 composite
- s-weigand/setup-conda v1 composite
doc/pages_requirements.txt
pypi
- ipython_genutils *
- jinja2 *
- nbsphinx *
- numpydoc *
- pandoc *
- pydata-sphinx-theme *
- pygments *
- sphinx *
- sphinx_rtd_theme *