cosmopy


Namecosmopy JSON
Version 3.6 PyPI version JSON
download
home_pagehttps://github.com/lzkelley/cosmopy
SummaryNone
upload_time2024-04-13 19:13:25
maintainerNone
docs_urlNone
authorLuke Zoltan Kelley
requires_python>=3.8
licenseMIT
keywords utilities physics astronomy cosmology astrophysics calculator
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            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

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/lzkelley/cosmopy",
    "name": "cosmopy",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "utilities, physics, astronomy, cosmology, astrophysics, calculator",
    "author": "Luke Zoltan Kelley",
    "author_email": "lzkelley@berkeley.edu",
    "download_url": "https://files.pythonhosted.org/packages/fa/86/655e86e19255b26b9537460883b078fe0118a8bf3b92930a5b1595ab9b6c/cosmopy-3.6.tar.gz",
    "platform": null,
    "description": "cosmopy\n=======\n\n|version| |build-status| |coverage|\n\n\nQuickly calculate cosmological parameters.\n\n- Provides both command-line and API interfaces.\n\n- Uses the machinery from the `astropy.cosmology` package.\n\nThe 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.\n\n\nThe below gif shows three examples: inputting a redshift, a luminosity distance (`-dl 400Mpc`), and an age of the universe (`-ta 3.2Gyr`).\n\n.. image:: https://raw.githubusercontent.com/lzkelley/cosmopy/dev/docs/cosmopy_demo.gif\n   :height: 600px\n\n\nInstallation\n------------\n\nUsing `pip`:\n\n::\n\n    pip install cosmopy\n\nFrom source:\n\n::\n\n git clone git@github.com:lzkelley/cosmopy.git\n pip install cosmopy\n\n\nUsage\n-----\n`cosmopy` can be used via the command-line `cosmo` command, or via python API by importing the module directly.\n\n- Command Line:\n\n    ::\n\n        $ cosmo --help\n\n         usage: cosmo [-h] [-z Z] [-a A] [-dc DC] [-dl DL] [-tl TL] [-ta TA] [-v]\n\n         cosmopy: cosmological calculator.\n\n         optional arguments:\n           -h, --help      show this help message and exit\n           -z Z            target redshift z\n           -a A            target scale factor a\n           -dc DC, -cd DC  target coming distance D_C\n           -dl DL, -ld DL  target luminosity distance D_L\n           -tl TL, -lt TL  target look-back time T_L\n           -ta TA, -at TA  target universe age T_A\n           -v, --version   print version information.\n\n    For example, entering an input redshift of 0.2:\n\n    ::\n\n        $ cosmo -z 0.2\n\n               z = 0.2000                                : Redshift\n               a = 0.8333                                : Scale-factor\n             D_c = 815.3960 Mpc      ~ 2.5160e+27 cm     : Comoving Distance\n             D_L = 978.4752 Mpc      ~ 3.0193e+27 cm     : Luminosity Distance\n             D_A = 679.4967 Mpc      ~ 2.0967e+27 cm     : Angular Diameter Distance\n          Arcsec = 3294.2928 pc      ~ 1.0165e+22 cm     : Arcsecond Scale\n            T_lb = 2.4277 Gyr        ~ 7.6613e+16 s      : Lookback Time\n             T_a = 11.3235 Gyr       ~ 3.5734e+17 s      : Age of the Universe\n              DM = 39.9527                               : Distance Modulus\n\n    or an input luminosity-distance of 400 Mpc:\n\n    ::\n\n        $ cosmo -dl 400Mpc\n\n               z = 0.0880                                : Redshift\n               a = 0.9192                                : Scale-factor\n             D_c = 367.6631 Mpc      ~ 1.1345e+27 cm     : Comoving Distance\n             D_L = 400.0000 Mpc      ~ 1.2343e+27 cm     : Luminosity Distance\n             D_A = 337.9403 Mpc      ~ 1.0428e+27 cm     : Angular Diameter Distance\n          Arcsec = 1638.3809 pc      ~ 5.0555e+21 cm     : Arcsecond Scale\n            T_lb = 1.1496 Gyr        ~ 3.6280e+16 s      : Lookback Time\n             T_a = 12.6016 Gyr       ~ 3.9768e+17 s      : Age of the Universe\n              DM = 38.0103                               : Distance Modulus\n\n- Python API\n\n    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:\n\n    ::\n\n        $ python -c \"import cosmopy; print(cosmopy.api('dl', '1.2 Gpc'))\"\n         {'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'}\n\n\n.. |version| image:: https://img.shields.io/pypi/v/cosmopy\n    :alt: PyPI\n    :target: https://pypi.org/project/cosmopy/\n\n.. |build-status| image:: https://github.com/lzkelley/cosmopy/actions/workflows/build-status.yml/badge.svg\n    :alt: build-status\n    :target: https://github.com/lzkelley/cosmopy/actions/workflows/build-status.yml\n\n.. |coverage| image:: https://codecov.io/gh/lzkelley/cosmopy/branch/main/graph/badge.svg?token=ZRPgCWUaVW\n    :alt: coverage\n    :target: https://codecov.io/gh/lzkelley/cosmopy\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": null,
    "version": "3.6",
    "project_urls": {
        "Download": "https://github.com/lzkelley/cosmopy/archive/v3.6.tar.gz",
        "Homepage": "https://github.com/lzkelley/cosmopy"
    },
    "split_keywords": [
        "utilities",
        " physics",
        " astronomy",
        " cosmology",
        " astrophysics",
        " calculator"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "5d218bcf6f988062a3ad8e1b1489e2576382ed710ab3025442696af98816d08f",
                "md5": "5d7abbe5511fc25d11dbc6f376baf5cb",
                "sha256": "79a645ff51a0b852abc5eb1a85e5a51021096d79859839b8f55dc85bdf356dc9"
            },
            "downloads": -1,
            "filename": "cosmopy-3.6-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "5d7abbe5511fc25d11dbc6f376baf5cb",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 17342,
            "upload_time": "2024-04-13T19:13:23",
            "upload_time_iso_8601": "2024-04-13T19:13:23.609356Z",
            "url": "https://files.pythonhosted.org/packages/5d/21/8bcf6f988062a3ad8e1b1489e2576382ed710ab3025442696af98816d08f/cosmopy-3.6-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "fa86655e86e19255b26b9537460883b078fe0118a8bf3b92930a5b1595ab9b6c",
                "md5": "eafa4c3498bb879b4f6d305e457baa2d",
                "sha256": "081a1932a1dca799c70343a7e607e91b476811f90a79246081a1b7ef3778b49b"
            },
            "downloads": -1,
            "filename": "cosmopy-3.6.tar.gz",
            "has_sig": false,
            "md5_digest": "eafa4c3498bb879b4f6d305e457baa2d",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 1747648,
            "upload_time": "2024-04-13T19:13:25",
            "upload_time_iso_8601": "2024-04-13T19:13:25.851676Z",
            "url": "https://files.pythonhosted.org/packages/fa/86/655e86e19255b26b9537460883b078fe0118a8bf3b92930a5b1595ab9b6c/cosmopy-3.6.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-04-13 19:13:25",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "lzkelley",
    "github_project": "cosmopy",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "tox": true,
    "lcname": "cosmopy"
}
        
Elapsed time: 0.27244s