Metadata-Version: 2.4
Name: scuq
Version: 1.0.6
Summary: Real and complex physical quantities with units with numpy support.
Author: Thomas Reidemeister
Author-email: Hans Georg Krauthäuser <hgk@ieee.org>
Maintainer-email: Hans Georg Krauthäuser <hgk@ieee.org>
License-Expression: GPL-3.0-or-later
Project-URL: Homepage, https://www.tu-dresden.de/et/tet
Project-URL: Repository, https://gitlab.hrz.tu-chemnitz.de/chair-of-electromagnetic-theory-and-compatibility-at-tu-dresden/mpylab/scuq.git
Project-URL: Documentation, https://scuq-b5d96a.gp.hrz.tu-chemnitz.de/
Keywords: measurements,laboratory
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Education
Classifier: Intended Audience :: Science/Research
Classifier: Topic :: Scientific/Engineering
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy>=1.24.4
Provides-Extra: docs
Requires-Dist: sphinx<8.0,>=7.1; python_version < "3.10" and extra == "docs"
Requires-Dist: sphinx>=8.0; python_version >= "3.10" and extra == "docs"
Provides-Extra: dev
Requires-Dist: pytest>=7.0; extra == "dev"
Requires-Dist: black; extra == "dev"
Provides-Extra: release
Requires-Dist: build>=1.2; extra == "release"
Requires-Dist: twine>=6.2; extra == "release"
Dynamic: license-file

# scuq

This is **scuq**. Scuq provides scalar (real) and complex physical quantities with units.


This software is distributed unter GPL-3 or higher. See LICENSE for details.

## Installation

```
pip3 install scuq
```

## Command line

The package installs a small diagnostic command:

```bash
scuq-info
```

It prints the installed scuq version, Python and NumPy versions, the package
path, the current strict-mode setting, and a few quick smoke-check results. Use
`scuq-info --json` for machine-readable output.

## Quick examples

Create quantities and combine them in calculations:

```python
from scuq.quantities import Quantity
from scuq.si import AMPERE, METER, SECOND, VOLT

voltage = Quantity(VOLT, 12.0)
current = Quantity(AMPERE, 0.25)
resistance = voltage / current

speed = Quantity(METER, 10.0) / Quantity(SECOND, 2.0)

print(resistance)  # 48.0 V*A^(-1)
print(speed)       # 5.0 m*s^(-1)
```

Use compatible units with automatic conversion by disabling strict mode:

```python
from scuq.quantities import Quantity, set_strict
from scuq.si import VOLT
from scuq.units import AlternateUnit

mV = AlternateUnit("mV", VOLT / 1000)

set_strict(False)
signal = Quantity(VOLT, 2.0) + Quantity(mV, 500.0)

print(signal)                 # 2.5 V
print(signal.get_value(mV))   # 2500.0
```

Propagate uncertainties through a measurement model:

```python
from scuq.quantities import Quantity
from scuq.si import METER
from scuq.ucomponents import Context, UncertainInput

length = Quantity(METER, UncertainInput(2.0, 0.02))
width = Quantity(METER, UncertainInput(3.0, 0.03))

area = length * width
area_uncertainty = Context().uncertainty(area)

print(area)              # 6.0 +/- 0.08485281374238571 [NC] m^(2)
print(area_uncertainty)  # 0.08485281374238571 m^(2)
```

`[NC]` means "no context" in the string representation. It appears when an
uncertain expression is printed without an assigned uncertainty `Context`; the
explicit `Context().uncertainty(...)` call uses the provided context and does
not include this marker.

## License

GPL-3 or higher

## Repository

[https://gitlab.hrz.tu-chemnitz.de/chair-of-electromagnetic-theory-and-compatibility-at-tu-dresden/mpylab/scuq.git](https://gitlab.hrz.tu-chemnitz.de/chair-of-electromagnetic-theory-and-compatibility-at-tu-dresden/mpylab/scuq.git)

The documentation is also available from the gitlab server of TU Chemnitz:

[https://scuq-b5d96a.gp.hrz.tu-chemnitz.de/](https://scuq-b5d96a.gp.hrz.tu-chemnitz.de/)

## Contact

Prof. Dr. Hans Georg Krauthäuser (hgk@ieee.org)  
Chair for Electromagnetic Theory and Compatibility  
Technische Universität Dresden, Dresden, Germany
