Find properties of objects in our universe (and others) without leaving Python
Project description
The Verse – Find properties of objects in our universe (and others) without leaving Python
The Verse is a Python library of properties of objects in our universe, such as the mass and radius of the Earth and other planets.
Though The Verse can be useful for reference purposes, it is primarily being developed for use in generating physics, astronomy, and chemistry problems with realistic parameters. For example, a random planet can be chosen from the Solar System, and then its mass and radius can be used to generate a problem that involves calculating gravitational acceleration based on those properties.
The Verse is currently at an early stage of development. At present, it only contains part of the Solar System—the Sun and a few planets, with only a few properties each. Eventually, it will contain a broader range of things from our universe, such as more planetary data, stars, exoplanets, spacecraft and other vehicles, animals, elements, and particles. It will also eventually contain things from various fictional verses.
Example
>>> import theverse
>>> print(theverse.earth.equatorial_radius)
6378137.0 m
>>> for planet_name, planet_obj in theverse.solar_system.planets.items():
... print(f'{planet_name: <10} {planet_obj.mass}')
...
Mercury 3.3011e+23 kg
Venus 4.8675e+24 kg
Earth 5.9724e+24 kg
>>> print(theverse.earth.primary.name)
Sun
>>> print(theverse.earth.primary.mass)
1.9885e+30 kg
>>> print(theverse.sun.reference_url)
https://nssdc.gsfc.nasa.gov/planetary/factsheet/sunfact.html
>>> for star_name in theverse.universe.stars:
... print(star_name)
...
Sun
Installation
Install Python 3.6+ if it is not already available on your machine. See https://www.python.org/, or use the package manager or app store for your operating system. Because The Verse requires Astropy and its dependencies (which include NumPy), you may want to consider a Python distribution like Anaconda instead.
Install setuptools for Python if it is not already installed. This can be accomplished by running
python -m pip install setuptools
on the command line. Depending on your system, you may need to use python3
instead of python
. This will often be the case for Linux and OS X.
Install Astropy if it is not already installed.
Install theverse
by running this on the command line:
python -m pip install theverse
Depending on your system, you may need to use python3
instead of python
.
This will often be the case for Linux and OS X.
Upgrading
python -m pip install theverse --upgrade
Depending on your system, you may need to use python3
instead of python
.
This will often be the case for Linux and OS X.
Installing the development version
If you want to install the development version to use the latest features,
download theverse
from GitHub, extract
the files, and then run
python setup.py install
Depending on your system, you may need to use python3
instead of python
.
This will often be the case for Linux and OS X.
Technical details
Objects in the universe are represented as class instances. For example, the
Sun is an instance of the class Star
.
Physical properties are represented via a subclass of
astropy.units.Quantity
.
This ensures that all quantities have associated units. Quantities also have
reference
and reference_url
attributes that provide information about the
source of values.
Collections of objects, like theverse.universe.stars
, are instances of a
dict subclass. For example, theverse.universe.stars
maps star names
(strings) to instances of the class Star
. The dict subclass used in these
cases allows values to be accessed normally (theverse.universe.stars['Sun']
)
and also as lowercased attributes (theverse.universe.stars.sun
). The dict
subclass does not support standard dict methods for adding or deleting keys;
data should typically be treated as immutable once it is loaded.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file theverse-0.1.1.tar.gz
.
File metadata
- Download URL: theverse-0.1.1.tar.gz
- Upload date:
- Size: 14.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/47.1.1.post20200604 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.7.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1c001c9c287356bb8d8543cd4d155530600ee0c10a65d9eeba7ffd76299dff8d |
|
MD5 | 1ddf67bff3b2d6fe42b4ecc18606ea45 |
|
BLAKE2b-256 | 8f3df42560f39f75819590be0e9ac2326c994276c4659863b86cb68a20739c0e |
File details
Details for the file theverse-0.1.1-py3-none-any.whl
.
File metadata
- Download URL: theverse-0.1.1-py3-none-any.whl
- Upload date:
- Size: 17.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/47.1.1.post20200604 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.7.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 661d8bac062d2ba44e3cfff1a275e7e966b8b6f1e3f56c11330c9ecee1955757 |
|
MD5 | 5ee38ea4975a1e3b435cda6835d04665 |
|
BLAKE2b-256 | d0368980b8570bb4c9050e847f37cad66b66dad501c58517d495ebdd952900ff |