Skip to main content

siquant: Simple Dimensional Analysis

PyPi Package Build Status Code Coverage

siquant is a simple pure python 3 library to make dimensional analysis painless.

Getting Started

Dimensional Analysis

>>> from siquant.systems import si
>>> force = 100 * si.kilonewtons
>>> moment_arm = 50 * si.meters
>>> torque = force * moment_arm
>>> torque.quantity
5000
>>> str(torque.units)
'1000*kg**1*m**2*s**-2'
>>> torque.get_as(si.newtons * si.meters)
5000000.0
>>> torque.get_as(si.newtons)
Traceback (most recent call last):
  ...
siquant.exceptions.UnitMismatchError: ...

>>> torque = torque.cvt_to(si.newtons * si.meters)
>>> torque.quantity
5000000.0
>>> str(torque.units)
'1*kg**1*m**2*s**-2'

Validation

>>> from siquant.dimensions import force, area, stress
>>> from siquant.systems import si

>>> def normal_stress(force_q, area_q):
...     assert force_q.is_of(force)
...     assert area_q.is_of(area)
...     return force_q / area_q

>>> stress_q = normal_stress(1 * si.newtons, 1 * si.meters ** 2)
>>> stress_q.is_of(stress)
True
>>> stress_q.is_of(area)
False

Sometimes you might want to check for dimensions that aren’t provided by default.

>>> from siquant.dimensions import SIDimensions
>>> from siquant.systems import si

>>> new_dim = SIDimensions(kg=1, m=1, s=1, k=1, a=1, mol=1, cd=1)
>>> dist_q = 1 * si.meters
>>> dist_q.is_of(new_dim)
False

Normalization

>>> from siquant import ScalarQuantity
>>> from siquant.systems import si

>>> meters_cvt = ScalarQuantity.As(si.meters)

>>> dist_q = meters_cvt(1000 * si.millimeters)
>>> dist_q.quantity
1

>>> dist_q = meters_cvt(1000 * si.meters)
>>> dist_q.quantity
1000

>>> dist_q = meters_cvt(1000)
>>> dist_q.quantity
1000

New Units

SIUnit can be created directly by factory:

>>> from siquant.units import SIUnit
>>> fathom = SIUnit.Unit(1.8288, m=1)
SIUnit(1.8288, (0, 1, 0, 0, 0, 0, 0))

Alternatively they can be derived:

>>> from siquant.systems import si
>>> rpm = si.unity / si.minutes
>>> rpm
SIUnit(0.016667, (0, 0, -1, 0, 0, 0, 0))

Metadata

Release files for siquant 3.0.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for siquant 3.0.5
File Size Uploaded Provenance Actions
siquant-3.0.5.tar.gz 10.2 kB Without provenance Details for siquant-3.0.5.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for siquant 3.0.5
File Interpreter ABI Platform Actions
siquant-3.0.5-py3-none-any.whl Python 3 none any Details for siquant-3.0.5-py3-none-any.whl

Total release size: 19.0 kB

Release files / siquant-3.0.5.tar.gz

Download URL siquant-3.0.5.tar.gz
Size 10.2 kB
Tags Source
SHA-256 checksum
How to use checksums
d8150072b43ec1f604ef0ab35807946be3c30f71da0515657fdb8c7079d17ebe
BLAKE2b-256 checksum
How to use checksums
9b07bb486e5080e4997ffa5f2f79209e1cc36337b4b5b5fc6e62cdb6dd8502ee
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/39.1.0 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.6.5

Release files / siquant-3.0.5-py3-none-any.whl

Download URL siquant-3.0.5-py3-none-any.whl
Size 8.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7efc36503c09186b259290a456373a0b605c0b4244fa02352821cc702fa3eb85
BLAKE2b-256 checksum
How to use checksums
f8820353dc6cd951e58e3e82e9190942031cf0cc94186a8b6832e44283b4ba9f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/39.1.0 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.6.5

Security for siquant 3.0.5

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page