Python classes for working with DDC calibration data
Project description
dccQuantities
dccQuantities is a Python library designed for users of PTB’s Digital Calibration Certificates (DCC) in XML format. It provides an object‑oriented interface to parse, serialize, and manipulate calibration data with full support for uncertainties and units. Arithmetic works naturally on scalars, scalar‑vector mixes, and same‑length vectors element‑wise, preserving uncertainty propagation and metadata throughout.
Key Features
-
DCC XML Parsing & Serialization
Import certificates from XML into Python objects and export back to XML, JSON, CSV, Excel, or pandas DataFrames. -
Uncertainty & Unit Awareness
All quantity objects wrap values asufloat(viametas_unclib) and units viadsi_unit, ensuring correct propagation in calculations. -
Object‑Oriented Arithmetic
Standard operators (+,-,*,/,**) are overloaded on:DccQuantityType: single or tabulated quantitiesSiRealList,SiComplexList,SiHybrid: 1D/2D arrays
-
Tables & Fancy Indexing The classes
DccLongTableandDccFlatTabletransparently implement numpy like indexing on efficient table structures described in the table document. Fancy indexing is supported, return type are always new tables.
Linux dependencies
The package requires the Linux .NET library. For that reason, it is required to have installed the mono library:
sudo apt install mono-runtime
Installation
There are multiple ways to install the package. Read them all and choose the best one for your case:
- From PyPI (core functionality):
pip install dccQuantities
This will install the latest released changes at the 'main' branch.
- Installing unreleased changes:
pip install git+https://gitlab1.ptb.de/digitaldynamicmeasurement/dcc-and-dsi/dccQuantities.git@devel
Please consider that unreleased changes might be unstable and can break your code.
- Cloning the repository:
git clone https://gitlab1.ptb.de/digitaldynamicmeasurement/dccQuantities.git
cd dccQuantities
pip install -e .
This is the best option for developers.
Deploy local documentation
It is possible to deploy and read the local documentation. To do so, it is required to clone the repository as stated at '2.' in the Installation section.
Once the repository is cloned and the current working directory is dccQuantities/, install the optional dependencies for documentation:
pip install .[docs]
Now you can deploy and open the documentation by running the following command at your terminal:
quantity-docs
Under the Hood (Test‑Driven Behavior)
The library’s design is guided by its test suite:
- Core Parsing (
tests/test_parser.py): reads<DccQuantityTable>and<DccQuantityType>elements, building Python objects. - Naming (
tests/test_dccName.py): parses and normalizes<DccLangName>entries for multilingual support. - Quantity Discovery (
tests/test_quantityTypeCollector.py): auto‑registers data handlers viaAbstractQuantityTypeDatasubclasses. - List Types (
tests/test_SiRealList_*.py): handles real, complex, and hybrid lists, including broadcasting and label merging. - Table Flattening (
tests/test_tables.py): cover the tables. - Round‑Trip Serialization (
tests/test_serilizer.py): ensures parse→serialize yields equivalent XML. - JSON Interchange (
tests/test_dccQuantTabJSONDumpingAndLoadingFromFile.json): lossless JSON dump/load.
Contributing & Contact
We welcome improvements, bug reports, and new features. To contribute:
- Fork the repository.
- Create a feature branch.
- Add tests for new functionality.
- Submit a merge request.
We highly encourage direct personal contact for design discussions or questions. Feel free to create Issues, even if you think your question/comment is not worth an issue, it is allways!
Or reach out to the maintainer:
- Benedikt Seeger: benedikt.seeger@ptb.de directly
License
This project is licensed under the LGPL‑2.1‑or‑later.
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file dccquantities-2.2.0.post1.tar.gz.
File metadata
- Download URL: dccquantities-2.2.0.post1.tar.gz
- Upload date:
- Size: 64.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7f4c6cbd38c6a3ac06dbfe8c222483e718a001bd45a2528ee7a40d38860424a2
|
|
| MD5 |
5ac018d8a3a29229602fa5e56750ef72
|
|
| BLAKE2b-256 |
6b0d33752811f86891dc1b331ae48e8a7b0d04bd8b3259ee171e2d3c3aac229d
|
File details
Details for the file dccquantities-2.2.0.post1-py3-none-any.whl.
File metadata
- Download URL: dccquantities-2.2.0.post1-py3-none-any.whl
- Upload date:
- Size: 61.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
497ff3048e7004bd7230c698af4908e084628f6bb2142e7d12b91ab17bc4acb0
|
|
| MD5 |
7998c44d4b1be479d8e7807f1fd81825
|
|
| BLAKE2b-256 |
390ce69a4087f8770ffbcb6e69d8112f19cd75cd949a54e25b0568d43bb3e4a9
|