Dimensional Analysis and Unit Tracking Library
Project description
siquant is a simple pure python 3 library to make dimensional analysis painless.
It is a small, flexible codebase aimed at 2 specific related problems: implicit unit tracking, and ensuring semantic correctness (fail fast) with minimal overhead.
Getting Started
Install siquant
pip3 install siquant==4.0.0b7
Implicit Unit Tracking:
>>> from siquant import si
>>> a = 10 * si.millimeters
>>> b = 10 * si.kilometers
>>> ab = a * b
>>> ab.quantity
100
>>> str(ab.units)
'1*m**2'
>>> ab.get_as(si.millimeters ** 2)
100000000.0
Dimensional Analysis:
>>> from siquant.dimensions import area_t
>>> from siquant import imperial, si
>>> def real_estate_price(area):
... assert area.is_of(area_t) # or raise if at application/lib dmz
... monies_per_square_foot = 100 / imperial.feet ** 2
... return area * monies_per_square_foot
...
>>> house_price = real_estate_price(100 * si.meters ** 2)
>>> house_price
Quantity(10000, SIUnit(10.763910, (0, 0, 0, 0, 0, 0, 0)))
>>> round(house_price.get_as(si.unity))
107639
Online Resources
siquant is released under the MIT LICENSE.
Releases are hosted in the pypi package repository.
More detailed documentation and examples can be found on readthedocs.
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
siquant-4.0.0b7.tar.gz
(19.8 kB
view hashes)
Built Distribution
siquant-4.0.0b7-py3-none-any.whl
(11.0 kB
view hashes)
Close
Hashes for siquant-4.0.0b7-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8e4220b4e12fa39c3aa8fbedc63b399dba706dff44657b587b7aed8de09e0fca |
|
MD5 | 3cd35468197d7900adbb94301de706b1 |
|
BLAKE2b-256 | d0b4ab8e5f980c2c6b5842a1951f5104c2b73a8f72e760b36951e6075a390366 |