Skip to main content

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.

PyPI Release PyPI Downloads pipeline status Coverage (main) Docs


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 as ufloat (via metas_unclib) and units via dsi_unit, ensuring correct propagation in calculations.

  • Object‑Oriented Arithmetic
    Standard operators (+, -, *, /, **) are overloaded on:

    • DccQuantityType: single or tabulated quantities
    • SiRealList, SiComplexList, SiHybrid: 1D/2D arrays
  • Tables & Fancy Indexing The classes DccLongTable and DccFlatTable transparently 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:

  1. From PyPI (core functionality):
pip install dccQuantities

This will install the latest released changes at the 'main' branch.

  1. 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.

  1. 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:

  1. Core Parsing (tests/test_parser.py): reads <DccQuantityTable> and <DccQuantityType> elements, building Python objects.
  2. Naming (tests/test_dccName.py): parses and normalizes <DccLangName> entries for multilingual support.
  3. Quantity Discovery (tests/test_quantityTypeCollector.py): auto‑registers data handlers via AbstractQuantityTypeData subclasses.
  4. List Types (tests/test_SiRealList_*.py): handles real, complex, and hybrid lists, including broadcasting and label merging.
  5. Table Flattening (tests/test_tables.py): cover the tables.
  6. Round‑Trip Serialization (tests/test_serilizer.py): ensures parse→serialize yields equivalent XML.
  7. JSON Interchange (tests/test_dccQuantTabJSONDumpingAndLoadingFromFile.json): lossless JSON dump/load.

Contributing & Contact

We welcome improvements, bug reports, and new features. To contribute:

  1. Fork the repository.
  2. Create a feature branch.
  3. Add tests for new functionality.
  4. 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:

License

This project is licensed under the LGPL‑2.1‑or‑later.

Download files

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

Source Distribution

dccquantities-3.0.3.tar.gz (60.2 kB view details)

Uploaded Source

Built Distribution

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

dccquantities-3.0.3-py3-none-any.whl (58.2 kB view details)

Uploaded Python 3

File details

Details for the file dccquantities-3.0.3.tar.gz.

File metadata

  • Download URL: dccquantities-3.0.3.tar.gz
  • Upload date:
  • Size: 60.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.12.13

File hashes

Hashes for dccquantities-3.0.3.tar.gz
Algorithm Hash digest
SHA256 a5716d5aa92679642c8e64d8a2d9fb37f693f8f104c17ec0579dc3e80bffd68b
MD5 816720c5b3b9002af82732b9783925a3
BLAKE2b-256 af96d2a7748dcd29d7aa9939e8676b1bda5a8ec43b7bafc5118dde2609f96a90

See more details on using hashes here.

File details

Details for the file dccquantities-3.0.3-py3-none-any.whl.

File metadata

  • Download URL: dccquantities-3.0.3-py3-none-any.whl
  • Upload date:
  • Size: 58.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.12.13

File hashes

Hashes for dccquantities-3.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 917ea02ba4a5bc5c3b3057ecc3b2d02807476ee1be9ce6aec5c8d3c7deaf1d2d
MD5 cd6a06b36b22d97f2e02a68f22748fb9
BLAKE2b-256 64a066b9a3140b13a4bc7acb0ca82fea14031feb544b3cb1a292997b4333adfa

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 Sentry Error logging StatusPage Status page