https://github.com/lzkelley/cosmopy
A simple cosmological calculator in python (API or command-line).
Science Score: 23.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
-
○DOI references
-
○Academic publication links
-
✓Committers with academic emails
1 of 4 committers (25.0%) from academic institutions -
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (9.7%) to scientific vocabulary
Keywords
astronomy
astrophysics
calculator
cosmology
physics
utility
Keywords from Contributors
resample
Last synced: 9 months ago
·
JSON representation
Repository
A simple cosmological calculator in python (API or command-line).
Basic Info
Statistics
- Stars: 11
- Watchers: 1
- Forks: 4
- Open Issues: 1
- Releases: 0
Topics
astronomy
astrophysics
calculator
cosmology
physics
utility
Created over 8 years ago
· Last pushed about 2 years ago
Metadata Files
Readme
Changelog
License
README.rst
cosmopy
=======
|version| |build-status| |coverage|
Quickly calculate cosmological parameters.
- Provides both command-line and API interfaces.
- Uses the machinery from the `astropy.cosmology` package.
The user provides an input parameter (e.g. redshift or luminosity-distance) and recieves the entire set of cosmological measures corresponding to the epoch thus specified.
The below gif shows three examples: inputting a redshift, a luminosity distance (`-dl 400Mpc`), and an age of the universe (`-ta 3.2Gyr`).
.. image:: https://raw.githubusercontent.com/lzkelley/cosmopy/dev/docs/cosmopy_demo.gif
:height: 600px
Installation
------------
Using `pip`:
::
pip install cosmopy
From source:
::
git clone git@github.com:lzkelley/cosmopy.git
pip install cosmopy
Usage
-----
`cosmopy` can be used via the command-line `cosmo` command, or via python API by importing the module directly.
- Command Line:
::
$ cosmo --help
usage: cosmo [-h] [-z Z] [-a A] [-dc DC] [-dl DL] [-tl TL] [-ta TA] [-v]
cosmopy: cosmological calculator.
optional arguments:
-h, --help show this help message and exit
-z Z target redshift z
-a A target scale factor a
-dc DC, -cd DC target coming distance D_C
-dl DL, -ld DL target luminosity distance D_L
-tl TL, -lt TL target look-back time T_L
-ta TA, -at TA target universe age T_A
-v, --version print version information.
For example, entering an input redshift of 0.2:
::
$ cosmo -z 0.2
z = 0.2000 : Redshift
a = 0.8333 : Scale-factor
D_c = 815.3960 Mpc ~ 2.5160e+27 cm : Comoving Distance
D_L = 978.4752 Mpc ~ 3.0193e+27 cm : Luminosity Distance
D_A = 679.4967 Mpc ~ 2.0967e+27 cm : Angular Diameter Distance
Arcsec = 3294.2928 pc ~ 1.0165e+22 cm : Arcsecond Scale
T_lb = 2.4277 Gyr ~ 7.6613e+16 s : Lookback Time
T_a = 11.3235 Gyr ~ 3.5734e+17 s : Age of the Universe
DM = 39.9527 : Distance Modulus
or an input luminosity-distance of 400 Mpc:
::
$ cosmo -dl 400Mpc
z = 0.0880 : Redshift
a = 0.9192 : Scale-factor
D_c = 367.6631 Mpc ~ 1.1345e+27 cm : Comoving Distance
D_L = 400.0000 Mpc ~ 1.2343e+27 cm : Luminosity Distance
D_A = 337.9403 Mpc ~ 1.0428e+27 cm : Angular Diameter Distance
Arcsec = 1638.3809 pc ~ 5.0555e+21 cm : Arcsecond Scale
T_lb = 1.1496 Gyr ~ 3.6280e+16 s : Lookback Time
T_a = 12.6016 Gyr ~ 3.9768e+17 s : Age of the Universe
DM = 38.0103 : Distance Modulus
- Python API
The module can be imported as `cosmopy`, from which the primary access point is the `api` function which accepts two arguments: a `key` (a target cosmological parameter) and a `value` of that parameter (optionally including units). The function returns a dictionary with the computed values as key: value pairs (both strings). For example:
::
$ python -c "import cosmopy; print(cosmopy.api('dl', '1.2 Gpc'))"
{'z': '0.2396', 'dl': '1200.0000 Mpc', 'tl': '2.8359 Gyr', 'dc': '968.0336 Mpc', 'ta': '10.9153 Gyr', 'da': '780.9075 Mpc', 'dm': '40.3959', 'arc': '3785.9464 pc', 'a': '0.8067'}
.. |version| image:: https://img.shields.io/pypi/v/cosmopy
:alt: PyPI
:target: https://pypi.org/project/cosmopy/
.. |build-status| image:: https://github.com/lzkelley/cosmopy/actions/workflows/build-status.yml/badge.svg
:alt: build-status
:target: https://github.com/lzkelley/cosmopy/actions/workflows/build-status.yml
.. |coverage| image:: https://codecov.io/gh/lzkelley/cosmopy/branch/main/graph/badge.svg?token=ZRPgCWUaVW
:alt: coverage
:target: https://codecov.io/gh/lzkelley/cosmopy
Owner
- Name: Luke Zoltan Kelley
- Login: lzkelley
- Kind: user
- Location: Berkeley, CA
- Website: www.lzkelley.com
- Repositories: 23
- Profile: https://github.com/lzkelley
Theoretical astrophysics at the interface of gravitational waves, transients and cosmological environments.
GitHub Events
Total
- Watch event: 2
Last Year
- Watch event: 2
Committers
Last synced: 11 months ago
Top Committers
| Name | Commits | |
|---|---|---|
| lzkelley | l****y@c****u | 103 |
| Luke Zoltan Kelley | l****y@g****m | 52 |
| haaspt | p****s@g****m | 3 |
| A. Cingoranelli | 4****d | 1 |
Committer Domains (Top 20 + Academic)
Issues and Pull Requests
Last synced: 9 months ago
All Time
- Total issues: 1
- Total pull requests: 4
- Average time to close issues: N/A
- Average time to close pull requests: 2 months
- Total issue authors: 1
- Total pull request authors: 3
- Average comments per issue: 5.0
- Average comments per pull request: 1.0
- Merged pull requests: 2
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 0
- Pull requests: 0
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Issue authors: 0
- Pull request authors: 0
- Average comments per issue: 0
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- camarman (1)
Pull Request Authors
- haaspt (2)
- minifold (1)
- camarman (1)
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 1
-
Total downloads:
- pypi 195 last-month
- Total dependent packages: 1
- Total dependent repositories: 1
- Total versions: 11
- Total maintainers: 1
pypi.org: cosmopy
- Homepage: https://github.com/lzkelley/cosmopy
- Documentation: https://cosmopy.readthedocs.io/
- License: MIT
-
Latest release: 3.5.5
published almost 4 years ago
Rankings
Dependent packages count: 4.8%
Forks count: 15.4%
Average: 17.4%
Stargazers count: 19.4%
Dependent repos count: 21.6%
Downloads: 26.1%
Maintainers (1)
Last synced:
9 months ago
Dependencies
requirements-dev.txt
pypi
- flake8 * development
- jupyter * development
- nbconvert * development
- pytest * development
- pytest-cov * development
- tox * development
- tox-conda * development
requirements.txt
pypi
- astropy *
- click *
- future *
- numpy *
- scipy *
.github/workflows/build-status.yml
actions
- actions/checkout v3 composite
- actions/setup-python v3 composite
.github/workflows/coverage.yaml
actions
- actions/checkout v2 composite
- actions/setup-python v2 composite
- codecov/codecov-action v3 composite
.github/workflows/publish-to-pypi.yml
actions
- actions/checkout v3 composite
- actions/setup-python v3 composite
- pypa/gh-action-pypi-publish release/v1 composite
pyproject.toml
pypi
setup.py
pypi