Skip to main content

Geometric units conversions made easy

Project description

geounit

geounit makes conversion of geometric units (G=c=1) easy and hassle-free. Geometric units are commonplace in numerical relativity and gravitational wave astrophysics.

At its core, geounit uses wonderful astropy.units package and operates with quantities with units.

Installation

pip install geounit

Currently implemented quantities:

  • Mass
  • Length
  • Time
  • Energy
  • Luminosity
  • Density
  • Pressure
  • Frequency

Examples

For the total mass of M = 5Msun, calculate how much 12M is in ms:

>>> import geounit
>>> M = 5
>>> gu = geounit.GU(M)
>>> 12 * gu.Time.to("ms")
<Quantity 0.29552946 ms>
>>> 12 * gu.Time.to("ms").value
np.float64(0.29552945685847604)

In units of one solar mass, there is a convinience variable:

>>> from geounit import one as gu
>>> gu.Frequency.to("kHz")
<Quantity 203.02544673 kHz>

One can operate with fundamental mass-length-time (MLT) units:

>>> import geounit
>>> energy = geounit.one.MLT(1, 2, -2) # mc**2
>>> energy.to("erg")
<Quantity 1.78709367e+54 erg>

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

geounit-1.0.1.tar.gz (2.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

geounit-1.0.1-py3-none-any.whl (3.3 kB view details)

Uploaded Python 3

File details

Details for the file geounit-1.0.1.tar.gz.

File metadata

  • Download URL: geounit-1.0.1.tar.gz
  • Upload date:
  • Size: 2.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for geounit-1.0.1.tar.gz
Algorithm Hash digest
SHA256 7c3c2bf8ff8abc9966457b28c0ce1966b515864b8a5da8fe292a0fd1a7154128
MD5 dd2fe5145cebfbea7f3a6a9df700b9ae
BLAKE2b-256 0e247f5f73a10f8c8ef8eb47b15f5eb7906fdd1118b83579a1a71ca7ca4a4eed

See more details on using hashes here.

File details

Details for the file geounit-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: geounit-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 3.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for geounit-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 cac2f7bb78cae61520d79d7f02926e746cdc21f0c62f24f7c863d69501eeeadc
MD5 974a9b21f15cf432d981801278569a58
BLAKE2b-256 863d62d9cb0ae956f252512599eea5c0104fcf9894746d8d1b23efcea1d1d24d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page