dccQuantities 2.0.0.dev2__tar.gz → 2.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (98) hide show
  1. dccquantities-2.1.0/PKG-INFO +141 -0
  2. dccquantities-2.1.0/README.md +108 -0
  3. dccquantities-2.1.0/pyproject.toml +62 -0
  4. dccquantities-2.1.0/src/dccQuantities.egg-info/PKG-INFO +141 -0
  5. dccquantities-2.1.0/src/dccQuantities.egg-info/SOURCES.txt +54 -0
  6. dccquantities-2.1.0/src/dccQuantities.egg-info/entry_points.txt +2 -0
  7. dccquantities-2.1.0/src/dccQuantities.egg-info/requires.txt +14 -0
  8. dccquantities-2.1.0/src/dccQuantities.egg-info/top_level.txt +1 -0
  9. dccquantities-2.1.0/src/dcc_quantities/__init__.py +19 -0
  10. dccquantities-2.1.0/src/dcc_quantities/_abc/__init__.py +4 -0
  11. dccquantities-2.1.0/src/dcc_quantities/_abc/abstract_list_type.py +20 -0
  12. dccquantities-2.1.0/src/dcc_quantities/_abc/abstract_quantity_type_data.py +27 -0
  13. dccquantities-2.1.0/src/dcc_quantities/_cli.py +32 -0
  14. dccquantities-2.1.0/src/dcc_quantities/_config.py +53 -0
  15. dccquantities-2.1.0/src/dcc_quantities/_helpers.py +297 -0
  16. dccquantities-2.1.0/src/dcc_quantities/_version.py +3 -0
  17. dccquantities-2.1.0/src/dcc_quantities/dcc_chars_xml_list.py +47 -0
  18. dccquantities-2.1.0/src/dcc_quantities/dcc_lang_text.py +218 -0
  19. dccquantities-2.1.0/src/dcc_quantities/dcc_math.py +424 -0
  20. dccquantities-2.1.0/src/dcc_quantities/dcc_no_quantity.py +81 -0
  21. dccquantities-2.1.0/src/dcc_quantities/dcc_quantity_parser.py +136 -0
  22. dccquantities-2.1.0/src/dcc_quantities/dcc_quantity_table.py +794 -0
  23. dccquantities-2.1.0/src/dcc_quantities/dcc_quantity_type.py +326 -0
  24. dccquantities-2.1.0/src/dcc_quantities/dcc_rich_content_type.py +34 -0
  25. dccquantities-2.1.0/src/dcc_quantities/exceptions.py +23 -0
  26. dccquantities-2.1.0/src/dcc_quantities/parse_uncertainties.py +307 -0
  27. dccquantities-2.1.0/src/dcc_quantities/query/__init__.py +3 -0
  28. dccquantities-2.1.0/src/dcc_quantities/query/_operators.py +29 -0
  29. dccquantities-2.1.0/src/dcc_quantities/query/slices.py +33 -0
  30. dccquantities-2.1.0/src/dcc_quantities/serializers/__init__.py +7 -0
  31. dccquantities-2.1.0/src/dcc_quantities/serializers/_explicit_serializer_mixin.py +53 -0
  32. dccquantities-2.1.0/src/dcc_quantities/serializers/_field_spec.py +26 -0
  33. dccquantities-2.1.0/src/dcc_quantities/serializers/dcc_element_key.py +67 -0
  34. dccquantities-2.1.0/src/dcc_quantities/serializers/dcc_element_parser.py +213 -0
  35. dccquantities-2.1.0/src/dcc_quantities/serializers/dcc_json_encoder.py +22 -0
  36. dccquantities-2.1.0/src/dcc_quantities/si_data/__init__.py +5 -0
  37. dccquantities-2.1.0/src/dcc_quantities/si_data/_base_si_type.py +287 -0
  38. dccquantities-2.1.0/src/dcc_quantities/si_data/si_data_type.py +585 -0
  39. dccquantities-2.1.0/src/dcc_quantities/si_data/si_hybrid.py +34 -0
  40. dccquantities-2.1.0/tests/test_dcc_chars_xml_list.py +28 -0
  41. dccquantities-2.1.0/tests/test_dcc_no_quantity.py +8 -0
  42. dccquantities-2.1.0/tests/test_dcc_text.py +55 -0
  43. dccquantities-2.1.0/tests/test_generate_example_table_data.py +20 -0
  44. dccquantities-2.1.0/tests/test_helpers.py +100 -0
  45. dccquantities-2.1.0/tests/test_math.py +118 -0
  46. dccquantities-2.1.0/tests/test_parser.py +93 -0
  47. dccquantities-2.1.0/tests/test_quantity_type_collector.py +23 -0
  48. dccquantities-2.1.0/tests/test_serilizer.py +26 -0
  49. dccquantities-2.1.0/tests/test_si_real_list.py +416 -0
  50. dccquantities-2.1.0/tests/test_si_real_list_parse_data.py +29 -0
  51. dccquantities-2.1.0/tests/test_surface_flat_table_generation.py +46 -0
  52. dccquantities-2.1.0/tests/test_tables.py +344 -0
  53. dccquantities-2.0.0.dev2/PKG-INFO +0 -106
  54. dccquantities-2.0.0.dev2/README.md +0 -70
  55. dccquantities-2.0.0.dev2/pyproject.toml +0 -52
  56. dccquantities-2.0.0.dev2/src/AbstractListType.py +0 -27
  57. dccquantities-2.0.0.dev2/src/AbstractQuantityTypeData.py +0 -4
  58. dccquantities-2.0.0.dev2/src/AbstractValueType.py +0 -116
  59. dccquantities-2.0.0.dev2/src/DccCharsXMLList.py +0 -63
  60. dccquantities-2.0.0.dev2/src/DccFormulaType.py +0 -15
  61. dccquantities-2.0.0.dev2/src/DccName.py +0 -127
  62. dccquantities-2.0.0.dev2/src/DccNoQuantity.py +0 -126
  63. dccquantities-2.0.0.dev2/src/DccQuantityTable.py +0 -783
  64. dccquantities-2.0.0.dev2/src/DccQuantityType.py +0 -226
  65. dccquantities-2.0.0.dev2/src/DccRichContentType.py +0 -112
  66. dccquantities-2.0.0.dev2/src/SiComplexList.py +0 -42
  67. dccquantities-2.0.0.dev2/src/SiHybrid.py +0 -66
  68. dccquantities-2.0.0.dev2/src/SiList.py +0 -59
  69. dccquantities-2.0.0.dev2/src/SiRealList.py +0 -856
  70. dccquantities-2.0.0.dev2/src/__init__.py +0 -0
  71. dccquantities-2.0.0.dev2/src/dccQuantities.egg-info/PKG-INFO +0 -106
  72. dccquantities-2.0.0.dev2/src/dccQuantities.egg-info/SOURCES.txt +0 -44
  73. dccquantities-2.0.0.dev2/src/dccQuantities.egg-info/requires.txt +0 -20
  74. dccquantities-2.0.0.dev2/src/dccQuantities.egg-info/top_level.txt +0 -19
  75. dccquantities-2.0.0.dev2/src/dccQuantityParser.py +0 -163
  76. dccquantities-2.0.0.dev2/src/helpers.py +0 -850
  77. dccquantities-2.0.0.dev2/src/parseUncertainties.py +0 -370
  78. dccquantities-2.0.0.dev2/src/testHelpers.py +0 -34
  79. dccquantities-2.0.0.dev2/tests/test_DccCharsXMLList.py +0 -35
  80. dccquantities-2.0.0.dev2/tests/test_DccNoQuantity.py +0 -17
  81. dccquantities-2.0.0.dev2/tests/test_DccQuantityType.py +0 -12
  82. dccquantities-2.0.0.dev2/tests/test_SiList.py +0 -15
  83. dccquantities-2.0.0.dev2/tests/test_SiRealList.py +0 -588
  84. dccquantities-2.0.0.dev2/tests/test_SiRealList_parseData.py +0 -166
  85. dccquantities-2.0.0.dev2/tests/test_SiRealList_toDict.py +0 -94
  86. dccquantities-2.0.0.dev2/tests/test_dccName.py +0 -61
  87. dccquantities-2.0.0.dev2/tests/test_generateExampleTableData.py +0 -22
  88. dccquantities-2.0.0.dev2/tests/test_getAndProperties.py +0 -56
  89. dccquantities-2.0.0.dev2/tests/test_helpers.py +0 -144
  90. dccquantities-2.0.0.dev2/tests/test_parser.py +0 -219
  91. dccquantities-2.0.0.dev2/tests/test_quantityTypeCollector.py +0 -25
  92. dccquantities-2.0.0.dev2/tests/test_serilizer.py +0 -49
  93. dccquantities-2.0.0.dev2/tests/test_surfaceFlatTableGeneration.py +0 -557
  94. dccquantities-2.0.0.dev2/tests/test_tables.py +0 -364
  95. {dccquantities-2.0.0.dev2 → dccquantities-2.1.0}/LICENSE +0 -0
  96. {dccquantities-2.0.0.dev2 → dccquantities-2.1.0}/MANIFEST.in +0 -0
  97. {dccquantities-2.0.0.dev2 → dccquantities-2.1.0}/setup.cfg +0 -0
  98. {dccquantities-2.0.0.dev2 → dccquantities-2.1.0}/src/dccQuantities.egg-info/dependency_links.txt +0 -0
@@ -0,0 +1,141 @@
1
+ Metadata-Version: 2.4
2
+ Name: dccQuantities
3
+ Version: 2.1.0
4
+ Summary: Python classes for working with DDC calibration data
5
+ Author: Vanessa Stehr, Thomas Bruns
6
+ Author-email: Benedikt Seeger <benedikt.seeger@ptb.de>, Jaime Gonzalez Gomez <jaime.gonzalez-gomez@ptb.de>
7
+ License-Expression: LGPL-2.1-or-later
8
+ Project-URL: Homepage, https://gitlab1.ptb.de/digitaldynamicmeasurement/dccQuantities
9
+ Project-URL: Repository, https://gitlab1.ptb.de/digitaldynamicmeasurement/dccQuantities
10
+ Project-URL: Documentation, https://gitlab-pages.ptb.de/digitaldynamicmeasurement/dcc-and-dsi/dccQuantities/
11
+ Classifier: Programming Language :: Python :: 3
12
+ Classifier: Programming Language :: Python :: 3.9
13
+ Classifier: Programming Language :: Python :: 3.10
14
+ Classifier: Programming Language :: Python :: 3.11
15
+ Classifier: Programming Language :: Python :: 3.12
16
+ Classifier: Programming Language :: Python :: 3.13
17
+ Classifier: Operating System :: OS Independent
18
+ Requires-Python: <3.14,>=3.9
19
+ Description-Content-Type: text/markdown
20
+ License-File: LICENSE
21
+ Requires-Dist: dsiUnits~=3.1
22
+ Requires-Dist: dccXMLJSONConv~=3.0.0.dev8
23
+ Requires-Dist: metas_unclib
24
+ Requires-Dist: numpy
25
+ Requires-Dist: PyBackport; python_version < "3.11"
26
+ Requires-Dist: pythonnet
27
+ Provides-Extra: docs
28
+ Requires-Dist: mkdocs; extra == "docs"
29
+ Requires-Dist: mkdocstrings-python; extra == "docs"
30
+ Requires-Dist: mike; extra == "docs"
31
+ Requires-Dist: ruff; extra == "docs"
32
+ Dynamic: license-file
33
+
34
+ # dccQuantities
35
+
36
+ `dccQuantities` is a Python library designed for users of PTB’s [Digital Calibration Certificates (DCC)](https://wiki.dcc.ptb.de/) 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.
37
+
38
+ [![Latest Release](https://gitlab1.ptb.de/digitaldynamicmeasurement/dcc-and-dsi/dccQuantities/-/badges/release.svg)](https://gitlab1.ptb.de/digitaldynamicmeasurement/dcc-and-dsi/dccQuantities/-/releases)
39
+ ![pipeline status](https://gitlab1.ptb.de/digitaldynamicmeasurement/dcc-and-dsi/dccQuantities/badges/main/pipeline.svg)
40
+ ![pipeline status](https://gitlab1.ptb.de/digitaldynamicmeasurement/dcc-and-dsi/dccQuantities/badges/main/coverage.svg)
41
+ [![Docs](https://img.shields.io/badge/Read_the_docs-blue)](https://gitlab-pages.ptb.de/digitaldynamicmeasurement/dcc-and-dsi/dccQuantities/)
42
+
43
+ ---
44
+
45
+ ## Key Features
46
+
47
+ - **DCC XML Parsing & Serialization**
48
+ Import certificates from XML into Python objects and export back to XML, JSON, CSV, Excel, or pandas DataFrames.
49
+
50
+ - **Uncertainty & Unit Awareness**
51
+ All quantity objects wrap values as `ufloat` (via `metas_unclib`) and units via `dsi_unit`, ensuring correct propagation in calculations.
52
+
53
+ - **Object‑Oriented Arithmetic**
54
+ Standard operators (`+`, `-`, `*`, `/`, `**`) are overloaded on:
55
+ - **`DccQuantityType`**: single or tabulated quantities
56
+ - **`SiRealList`**, **`SiComplexList`**, **`SiHybrid`**: 1D/2D arrays
57
+
58
+ - **Tables & Fancy Indexing**
59
+ The classes `DccLongTable` and `DccFlatTable` transparently implement numpy like indexing on efficient table structures described in the [table document](doc/tabellen/tables-de.md). Fancy indexing is supported, return type are always new tables.
60
+ ---
61
+
62
+ ## Linux dependencies
63
+
64
+ The package requires the Linux .NET library. For that reason, it is required to have installed the `mono` library:
65
+ ```
66
+ sudo apt install mono-runtime
67
+ ```
68
+
69
+ ## Installation
70
+
71
+ There are multiple ways to install the package.
72
+ Read them all and choose the best one for your case:
73
+
74
+ 1. From PyPI (core functionality):
75
+ ```bash
76
+ pip install dccQuantities
77
+ ```
78
+ This will install the latest released changes at the 'main' branch.
79
+
80
+ 2. Installing unreleased changes:
81
+ ```bash
82
+ pip install git+https://gitlab1.ptb.de/digitaldynamicmeasurement/dcc-and-dsi/dccQuantities.git@devel
83
+ ```
84
+ Please consider that unreleased changes might be unstable and can break your code.
85
+
86
+ 3. Cloning the repository:
87
+ ```bash
88
+ git clone https://gitlab1.ptb.de/digitaldynamicmeasurement/dccQuantities.git
89
+ cd dccQuantities
90
+ pip install -e .
91
+ ```
92
+ This is the best option for developers.
93
+
94
+ ## Deploy local documentation
95
+
96
+ It is possible to deploy and read the local documentation.
97
+ To do so, it is required to clone the repository as stated at '2.' in the _Installation_ section.
98
+
99
+ Once the repository is cloned and the current working directory is `dccQuantities/`, install the optional dependencies for documentation:
100
+ ````
101
+ pip install .[docs]
102
+ ````
103
+
104
+ Now you can deploy and open the documentation by running the following command at your terminal:
105
+ ```
106
+ quantity-docs
107
+ ```
108
+
109
+ ## Under the Hood (Test‑Driven Behavior)
110
+
111
+ The library’s design is guided by its test suite:
112
+
113
+ 1. **Core Parsing** (`tests/test_parser.py`): reads `<DccQuantityTable>` and `<DccQuantityType>` elements, building Python objects.
114
+ 2. **Naming** (`tests/test_dccName.py`): parses and normalizes `<DccLangName>` entries for multilingual support.
115
+ 3. **Quantity Discovery** (`tests/test_quantityTypeCollector.py`): auto‑registers data handlers via `AbstractQuantityTypeData` subclasses.
116
+ 4. **List Types** (`tests/test_SiRealList_*.py`): handles real, complex, and hybrid lists, including broadcasting and label merging.
117
+ 5. **Table Flattening** (`tests/test_tables.py`): cover the tables.
118
+ 6. **Round‑Trip Serialization** (`tests/test_serilizer.py`): ensures parse→serialize yields equivalent XML.
119
+ 7. **JSON Interchange** (`tests/test_dccQuantTabJSONDumpingAndLoadingFromFile.json`): lossless JSON dump/load.
120
+
121
+ ---
122
+
123
+ ## Contributing & Contact
124
+
125
+ We welcome improvements, bug reports, and new features. To contribute:
126
+
127
+ 1. **Fork** the repository.
128
+ 2. **Create** a feature branch.
129
+ 3. **Add** tests for new functionality.
130
+ 4. **Submit** a merge request.
131
+
132
+ 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!
133
+
134
+ Or reach out to the maintainer:
135
+ - **Benedikt Seeger**: benedikt.seeger@ptb.de
136
+ directly
137
+
138
+ ## License
139
+
140
+ This project is licensed under the [LGPL‑2.1‑or‑later](LICENSE).
141
+
@@ -0,0 +1,108 @@
1
+ # dccQuantities
2
+
3
+ `dccQuantities` is a Python library designed for users of PTB’s [Digital Calibration Certificates (DCC)](https://wiki.dcc.ptb.de/) 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.
4
+
5
+ [![Latest Release](https://gitlab1.ptb.de/digitaldynamicmeasurement/dcc-and-dsi/dccQuantities/-/badges/release.svg)](https://gitlab1.ptb.de/digitaldynamicmeasurement/dcc-and-dsi/dccQuantities/-/releases)
6
+ ![pipeline status](https://gitlab1.ptb.de/digitaldynamicmeasurement/dcc-and-dsi/dccQuantities/badges/main/pipeline.svg)
7
+ ![pipeline status](https://gitlab1.ptb.de/digitaldynamicmeasurement/dcc-and-dsi/dccQuantities/badges/main/coverage.svg)
8
+ [![Docs](https://img.shields.io/badge/Read_the_docs-blue)](https://gitlab-pages.ptb.de/digitaldynamicmeasurement/dcc-and-dsi/dccQuantities/)
9
+
10
+ ---
11
+
12
+ ## Key Features
13
+
14
+ - **DCC XML Parsing & Serialization**
15
+ Import certificates from XML into Python objects and export back to XML, JSON, CSV, Excel, or pandas DataFrames.
16
+
17
+ - **Uncertainty & Unit Awareness**
18
+ All quantity objects wrap values as `ufloat` (via `metas_unclib`) and units via `dsi_unit`, ensuring correct propagation in calculations.
19
+
20
+ - **Object‑Oriented Arithmetic**
21
+ Standard operators (`+`, `-`, `*`, `/`, `**`) are overloaded on:
22
+ - **`DccQuantityType`**: single or tabulated quantities
23
+ - **`SiRealList`**, **`SiComplexList`**, **`SiHybrid`**: 1D/2D arrays
24
+
25
+ - **Tables & Fancy Indexing**
26
+ The classes `DccLongTable` and `DccFlatTable` transparently implement numpy like indexing on efficient table structures described in the [table document](doc/tabellen/tables-de.md). Fancy indexing is supported, return type are always new tables.
27
+ ---
28
+
29
+ ## Linux dependencies
30
+
31
+ The package requires the Linux .NET library. For that reason, it is required to have installed the `mono` library:
32
+ ```
33
+ sudo apt install mono-runtime
34
+ ```
35
+
36
+ ## Installation
37
+
38
+ There are multiple ways to install the package.
39
+ Read them all and choose the best one for your case:
40
+
41
+ 1. From PyPI (core functionality):
42
+ ```bash
43
+ pip install dccQuantities
44
+ ```
45
+ This will install the latest released changes at the 'main' branch.
46
+
47
+ 2. Installing unreleased changes:
48
+ ```bash
49
+ pip install git+https://gitlab1.ptb.de/digitaldynamicmeasurement/dcc-and-dsi/dccQuantities.git@devel
50
+ ```
51
+ Please consider that unreleased changes might be unstable and can break your code.
52
+
53
+ 3. Cloning the repository:
54
+ ```bash
55
+ git clone https://gitlab1.ptb.de/digitaldynamicmeasurement/dccQuantities.git
56
+ cd dccQuantities
57
+ pip install -e .
58
+ ```
59
+ This is the best option for developers.
60
+
61
+ ## Deploy local documentation
62
+
63
+ It is possible to deploy and read the local documentation.
64
+ To do so, it is required to clone the repository as stated at '2.' in the _Installation_ section.
65
+
66
+ Once the repository is cloned and the current working directory is `dccQuantities/`, install the optional dependencies for documentation:
67
+ ````
68
+ pip install .[docs]
69
+ ````
70
+
71
+ Now you can deploy and open the documentation by running the following command at your terminal:
72
+ ```
73
+ quantity-docs
74
+ ```
75
+
76
+ ## Under the Hood (Test‑Driven Behavior)
77
+
78
+ The library’s design is guided by its test suite:
79
+
80
+ 1. **Core Parsing** (`tests/test_parser.py`): reads `<DccQuantityTable>` and `<DccQuantityType>` elements, building Python objects.
81
+ 2. **Naming** (`tests/test_dccName.py`): parses and normalizes `<DccLangName>` entries for multilingual support.
82
+ 3. **Quantity Discovery** (`tests/test_quantityTypeCollector.py`): auto‑registers data handlers via `AbstractQuantityTypeData` subclasses.
83
+ 4. **List Types** (`tests/test_SiRealList_*.py`): handles real, complex, and hybrid lists, including broadcasting and label merging.
84
+ 5. **Table Flattening** (`tests/test_tables.py`): cover the tables.
85
+ 6. **Round‑Trip Serialization** (`tests/test_serilizer.py`): ensures parse→serialize yields equivalent XML.
86
+ 7. **JSON Interchange** (`tests/test_dccQuantTabJSONDumpingAndLoadingFromFile.json`): lossless JSON dump/load.
87
+
88
+ ---
89
+
90
+ ## Contributing & Contact
91
+
92
+ We welcome improvements, bug reports, and new features. To contribute:
93
+
94
+ 1. **Fork** the repository.
95
+ 2. **Create** a feature branch.
96
+ 3. **Add** tests for new functionality.
97
+ 4. **Submit** a merge request.
98
+
99
+ 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!
100
+
101
+ Or reach out to the maintainer:
102
+ - **Benedikt Seeger**: benedikt.seeger@ptb.de
103
+ directly
104
+
105
+ ## License
106
+
107
+ This project is licensed under the [LGPL‑2.1‑or‑later](LICENSE).
108
+
@@ -0,0 +1,62 @@
1
+ [build-system]
2
+ requires = ["setuptools>=77.0.0", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "dccQuantities"
7
+ description = "Python classes for working with DDC calibration data"
8
+ dynamic = ["readme", "version"]
9
+ requires-python = ">=3.9,<3.14"
10
+
11
+ # SPDX license expression + point at your LICENSE file
12
+ license = "LGPL-2.1-or-later"
13
+ license-files = ["LICENSE"]
14
+
15
+ classifiers = [
16
+ "Programming Language :: Python :: 3",
17
+ "Programming Language :: Python :: 3.9",
18
+ "Programming Language :: Python :: 3.10",
19
+ "Programming Language :: Python :: 3.11",
20
+ "Programming Language :: Python :: 3.12",
21
+ "Programming Language :: Python :: 3.13",
22
+ "Operating System :: OS Independent",
23
+ ]
24
+
25
+ authors = [
26
+ { name = "Benedikt Seeger", email = "benedikt.seeger@ptb.de" },
27
+ { name = "Jaime Gonzalez Gomez", email = "jaime.gonzalez-gomez@ptb.de" },
28
+ { name = "Vanessa Stehr" },
29
+ { name = "Thomas Bruns" },
30
+ ]
31
+ dependencies = [
32
+ "dsiUnits~=3.1",
33
+ "dccXMLJSONConv~=3.0.0.dev8",
34
+ "metas_unclib",
35
+ "numpy",
36
+ "PyBackport ; python_version < '3.11'",
37
+ "pythonnet",
38
+ ]
39
+
40
+ [project.urls]
41
+ Homepage = "https://gitlab1.ptb.de/digitaldynamicmeasurement/dccQuantities"
42
+ Repository = "https://gitlab1.ptb.de/digitaldynamicmeasurement/dccQuantities"
43
+ Documentation = "https://gitlab-pages.ptb.de/digitaldynamicmeasurement/dcc-and-dsi/dccQuantities/"
44
+
45
+ [project.optional-dependencies]
46
+ docs = ["mkdocs", "mkdocstrings-python", "mike", "ruff"]
47
+
48
+ [tool.setuptools.dynamic]
49
+ version = { attr = "dcc_quantities._version.__version__" }
50
+ readme = { file = ["README.md"], content-type = "text/markdown" }
51
+
52
+ [project.scripts]
53
+ quantity-docs = "dcc_quantities._cli:deploy_local_docs"
54
+
55
+ [tool.coverage.run]
56
+ omit = ["_cli.py", "_version.py"]
57
+
58
+ [tool.coverage.report]
59
+ exclude_also = [
60
+ # Don't complain about missing debug-only code:
61
+ "def __repr__",
62
+ ]
@@ -0,0 +1,141 @@
1
+ Metadata-Version: 2.4
2
+ Name: dccQuantities
3
+ Version: 2.1.0
4
+ Summary: Python classes for working with DDC calibration data
5
+ Author: Vanessa Stehr, Thomas Bruns
6
+ Author-email: Benedikt Seeger <benedikt.seeger@ptb.de>, Jaime Gonzalez Gomez <jaime.gonzalez-gomez@ptb.de>
7
+ License-Expression: LGPL-2.1-or-later
8
+ Project-URL: Homepage, https://gitlab1.ptb.de/digitaldynamicmeasurement/dccQuantities
9
+ Project-URL: Repository, https://gitlab1.ptb.de/digitaldynamicmeasurement/dccQuantities
10
+ Project-URL: Documentation, https://gitlab-pages.ptb.de/digitaldynamicmeasurement/dcc-and-dsi/dccQuantities/
11
+ Classifier: Programming Language :: Python :: 3
12
+ Classifier: Programming Language :: Python :: 3.9
13
+ Classifier: Programming Language :: Python :: 3.10
14
+ Classifier: Programming Language :: Python :: 3.11
15
+ Classifier: Programming Language :: Python :: 3.12
16
+ Classifier: Programming Language :: Python :: 3.13
17
+ Classifier: Operating System :: OS Independent
18
+ Requires-Python: <3.14,>=3.9
19
+ Description-Content-Type: text/markdown
20
+ License-File: LICENSE
21
+ Requires-Dist: dsiUnits~=3.1
22
+ Requires-Dist: dccXMLJSONConv~=3.0.0.dev8
23
+ Requires-Dist: metas_unclib
24
+ Requires-Dist: numpy
25
+ Requires-Dist: PyBackport; python_version < "3.11"
26
+ Requires-Dist: pythonnet
27
+ Provides-Extra: docs
28
+ Requires-Dist: mkdocs; extra == "docs"
29
+ Requires-Dist: mkdocstrings-python; extra == "docs"
30
+ Requires-Dist: mike; extra == "docs"
31
+ Requires-Dist: ruff; extra == "docs"
32
+ Dynamic: license-file
33
+
34
+ # dccQuantities
35
+
36
+ `dccQuantities` is a Python library designed for users of PTB’s [Digital Calibration Certificates (DCC)](https://wiki.dcc.ptb.de/) 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.
37
+
38
+ [![Latest Release](https://gitlab1.ptb.de/digitaldynamicmeasurement/dcc-and-dsi/dccQuantities/-/badges/release.svg)](https://gitlab1.ptb.de/digitaldynamicmeasurement/dcc-and-dsi/dccQuantities/-/releases)
39
+ ![pipeline status](https://gitlab1.ptb.de/digitaldynamicmeasurement/dcc-and-dsi/dccQuantities/badges/main/pipeline.svg)
40
+ ![pipeline status](https://gitlab1.ptb.de/digitaldynamicmeasurement/dcc-and-dsi/dccQuantities/badges/main/coverage.svg)
41
+ [![Docs](https://img.shields.io/badge/Read_the_docs-blue)](https://gitlab-pages.ptb.de/digitaldynamicmeasurement/dcc-and-dsi/dccQuantities/)
42
+
43
+ ---
44
+
45
+ ## Key Features
46
+
47
+ - **DCC XML Parsing & Serialization**
48
+ Import certificates from XML into Python objects and export back to XML, JSON, CSV, Excel, or pandas DataFrames.
49
+
50
+ - **Uncertainty & Unit Awareness**
51
+ All quantity objects wrap values as `ufloat` (via `metas_unclib`) and units via `dsi_unit`, ensuring correct propagation in calculations.
52
+
53
+ - **Object‑Oriented Arithmetic**
54
+ Standard operators (`+`, `-`, `*`, `/`, `**`) are overloaded on:
55
+ - **`DccQuantityType`**: single or tabulated quantities
56
+ - **`SiRealList`**, **`SiComplexList`**, **`SiHybrid`**: 1D/2D arrays
57
+
58
+ - **Tables & Fancy Indexing**
59
+ The classes `DccLongTable` and `DccFlatTable` transparently implement numpy like indexing on efficient table structures described in the [table document](doc/tabellen/tables-de.md). Fancy indexing is supported, return type are always new tables.
60
+ ---
61
+
62
+ ## Linux dependencies
63
+
64
+ The package requires the Linux .NET library. For that reason, it is required to have installed the `mono` library:
65
+ ```
66
+ sudo apt install mono-runtime
67
+ ```
68
+
69
+ ## Installation
70
+
71
+ There are multiple ways to install the package.
72
+ Read them all and choose the best one for your case:
73
+
74
+ 1. From PyPI (core functionality):
75
+ ```bash
76
+ pip install dccQuantities
77
+ ```
78
+ This will install the latest released changes at the 'main' branch.
79
+
80
+ 2. Installing unreleased changes:
81
+ ```bash
82
+ pip install git+https://gitlab1.ptb.de/digitaldynamicmeasurement/dcc-and-dsi/dccQuantities.git@devel
83
+ ```
84
+ Please consider that unreleased changes might be unstable and can break your code.
85
+
86
+ 3. Cloning the repository:
87
+ ```bash
88
+ git clone https://gitlab1.ptb.de/digitaldynamicmeasurement/dccQuantities.git
89
+ cd dccQuantities
90
+ pip install -e .
91
+ ```
92
+ This is the best option for developers.
93
+
94
+ ## Deploy local documentation
95
+
96
+ It is possible to deploy and read the local documentation.
97
+ To do so, it is required to clone the repository as stated at '2.' in the _Installation_ section.
98
+
99
+ Once the repository is cloned and the current working directory is `dccQuantities/`, install the optional dependencies for documentation:
100
+ ````
101
+ pip install .[docs]
102
+ ````
103
+
104
+ Now you can deploy and open the documentation by running the following command at your terminal:
105
+ ```
106
+ quantity-docs
107
+ ```
108
+
109
+ ## Under the Hood (Test‑Driven Behavior)
110
+
111
+ The library’s design is guided by its test suite:
112
+
113
+ 1. **Core Parsing** (`tests/test_parser.py`): reads `<DccQuantityTable>` and `<DccQuantityType>` elements, building Python objects.
114
+ 2. **Naming** (`tests/test_dccName.py`): parses and normalizes `<DccLangName>` entries for multilingual support.
115
+ 3. **Quantity Discovery** (`tests/test_quantityTypeCollector.py`): auto‑registers data handlers via `AbstractQuantityTypeData` subclasses.
116
+ 4. **List Types** (`tests/test_SiRealList_*.py`): handles real, complex, and hybrid lists, including broadcasting and label merging.
117
+ 5. **Table Flattening** (`tests/test_tables.py`): cover the tables.
118
+ 6. **Round‑Trip Serialization** (`tests/test_serilizer.py`): ensures parse→serialize yields equivalent XML.
119
+ 7. **JSON Interchange** (`tests/test_dccQuantTabJSONDumpingAndLoadingFromFile.json`): lossless JSON dump/load.
120
+
121
+ ---
122
+
123
+ ## Contributing & Contact
124
+
125
+ We welcome improvements, bug reports, and new features. To contribute:
126
+
127
+ 1. **Fork** the repository.
128
+ 2. **Create** a feature branch.
129
+ 3. **Add** tests for new functionality.
130
+ 4. **Submit** a merge request.
131
+
132
+ 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!
133
+
134
+ Or reach out to the maintainer:
135
+ - **Benedikt Seeger**: benedikt.seeger@ptb.de
136
+ directly
137
+
138
+ ## License
139
+
140
+ This project is licensed under the [LGPL‑2.1‑or‑later](LICENSE).
141
+
@@ -0,0 +1,54 @@
1
+ LICENSE
2
+ MANIFEST.in
3
+ README.md
4
+ pyproject.toml
5
+ src/dccQuantities.egg-info/PKG-INFO
6
+ src/dccQuantities.egg-info/SOURCES.txt
7
+ src/dccQuantities.egg-info/dependency_links.txt
8
+ src/dccQuantities.egg-info/entry_points.txt
9
+ src/dccQuantities.egg-info/requires.txt
10
+ src/dccQuantities.egg-info/top_level.txt
11
+ src/dcc_quantities/__init__.py
12
+ src/dcc_quantities/_cli.py
13
+ src/dcc_quantities/_config.py
14
+ src/dcc_quantities/_helpers.py
15
+ src/dcc_quantities/_version.py
16
+ src/dcc_quantities/dcc_chars_xml_list.py
17
+ src/dcc_quantities/dcc_lang_text.py
18
+ src/dcc_quantities/dcc_math.py
19
+ src/dcc_quantities/dcc_no_quantity.py
20
+ src/dcc_quantities/dcc_quantity_parser.py
21
+ src/dcc_quantities/dcc_quantity_table.py
22
+ src/dcc_quantities/dcc_quantity_type.py
23
+ src/dcc_quantities/dcc_rich_content_type.py
24
+ src/dcc_quantities/exceptions.py
25
+ src/dcc_quantities/parse_uncertainties.py
26
+ src/dcc_quantities/_abc/__init__.py
27
+ src/dcc_quantities/_abc/abstract_list_type.py
28
+ src/dcc_quantities/_abc/abstract_quantity_type_data.py
29
+ src/dcc_quantities/query/__init__.py
30
+ src/dcc_quantities/query/_operators.py
31
+ src/dcc_quantities/query/slices.py
32
+ src/dcc_quantities/serializers/__init__.py
33
+ src/dcc_quantities/serializers/_explicit_serializer_mixin.py
34
+ src/dcc_quantities/serializers/_field_spec.py
35
+ src/dcc_quantities/serializers/dcc_element_key.py
36
+ src/dcc_quantities/serializers/dcc_element_parser.py
37
+ src/dcc_quantities/serializers/dcc_json_encoder.py
38
+ src/dcc_quantities/si_data/__init__.py
39
+ src/dcc_quantities/si_data/_base_si_type.py
40
+ src/dcc_quantities/si_data/si_data_type.py
41
+ src/dcc_quantities/si_data/si_hybrid.py
42
+ tests/test_dcc_chars_xml_list.py
43
+ tests/test_dcc_no_quantity.py
44
+ tests/test_dcc_text.py
45
+ tests/test_generate_example_table_data.py
46
+ tests/test_helpers.py
47
+ tests/test_math.py
48
+ tests/test_parser.py
49
+ tests/test_quantity_type_collector.py
50
+ tests/test_serilizer.py
51
+ tests/test_si_real_list.py
52
+ tests/test_si_real_list_parse_data.py
53
+ tests/test_surface_flat_table_generation.py
54
+ tests/test_tables.py
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ quantity-docs = dcc_quantities._cli:deploy_local_docs
@@ -0,0 +1,14 @@
1
+ dsiUnits~=3.1
2
+ dccXMLJSONConv~=3.0.0.dev8
3
+ metas_unclib
4
+ numpy
5
+ pythonnet
6
+
7
+ [:python_version < "3.11"]
8
+ PyBackport
9
+
10
+ [docs]
11
+ mkdocs
12
+ mkdocstrings-python
13
+ mike
14
+ ruff
@@ -0,0 +1 @@
1
+ dcc_quantities
@@ -0,0 +1,19 @@
1
+ """DccQuantity package."""
2
+
3
+ from dcc_quantities.dcc_lang_text import DccLangName
4
+ from dcc_quantities.dcc_quantity_table import DccFlatTable, DccLongTable, DccQuantityTable
5
+ from dcc_quantities.dcc_quantity_type import DccQuantityType
6
+ from dcc_quantities.serializers.dcc_element_key import DccElementKey
7
+ from dcc_quantities.serializers.dcc_element_parser import extract_dcc_elements
8
+ from dcc_quantities.si_data import SiRealList
9
+
10
+ __all__ = [
11
+ "DccElementKey",
12
+ "DccFlatTable",
13
+ "DccLangName",
14
+ "DccLongTable",
15
+ "DccQuantityTable",
16
+ "DccQuantityType",
17
+ "SiRealList",
18
+ "extract_dcc_elements",
19
+ ]
@@ -0,0 +1,4 @@
1
+ from dcc_quantities._abc.abstract_list_type import AbstractListType
2
+ from dcc_quantities._abc.abstract_quantity_type_data import AbstractQuantityTypeData
3
+
4
+ __all__ = ["AbstractListType", "AbstractQuantityTypeData"]
@@ -0,0 +1,20 @@
1
+ from __future__ import annotations
2
+
3
+ from dcc_quantities._abc.abstract_quantity_type_data import AbstractQuantityTypeData
4
+
5
+
6
+ class AbstractListType(AbstractQuantityTypeData):
7
+ def __init__(self, children: list[AbstractListType]):
8
+ super().__init__()
9
+ self.children = children
10
+
11
+ def to_json_dict(self) -> dict:
12
+ result = {}
13
+ for child in self.children:
14
+ child_json = child.to_json_dict()
15
+ for key, value in child_json.items():
16
+ result.setdefault(key, []).append(value)
17
+ return result
18
+
19
+ def __len__(self) -> int:
20
+ return len(self.children)
@@ -0,0 +1,27 @@
1
+ from typing import Any, Iterator
2
+
3
+
4
+ class AbstractQuantityTypeData:
5
+ def __init__(self):
6
+ self.data = "None"
7
+ self._sorted = None
8
+
9
+ def _iter_items(self) -> Iterator[tuple[str, Any]]:
10
+ """Iterator over all the class' items.
11
+
12
+ Iterates over all the non-empty (different to 'None') attributes or items contained within the class.
13
+ The items are returned as the attribute name and its value.
14
+ """
15
+ for k, v in vars(self).items():
16
+ if v is not None:
17
+ yield k, v
18
+
19
+ def __str__(self) -> str:
20
+ """String representation of the class' stored values."""
21
+ param_str = ", ".join(f"{key}: {value!s}" for key, value in self._iter_items())
22
+ if len(param_str) > 0:
23
+ param_str = " (" + param_str + ")"
24
+ return f"{self.data!s}{param_str}"
25
+
26
+ def __repr__(self) -> str:
27
+ return ", ".join(f"{key}={value!s}" for key, value in self._iter_items())
@@ -0,0 +1,32 @@
1
+ """Functions to be invoked from the command line interface."""
2
+
3
+ import argparse
4
+ import subprocess
5
+ import webbrowser
6
+ from pathlib import Path
7
+
8
+
9
+ def deploy_local_docs():
10
+ """Deployment of local documentation.
11
+
12
+ The deployment consists of:
13
+ 1. Searching if the document folder exists.
14
+ 2. Creating the documentation files when the folder doesn't exist or when '--force' is provided.
15
+ 3. Open the documentation on the default HTML viewer.
16
+ """
17
+ parser = argparse.ArgumentParser(
18
+ description="Deployment of local documentation at folder 'public/'. Make sure to have installed the "
19
+ "package as `pip install .[docs]`"
20
+ )
21
+ parser.add_argument("--force", action="store_true", help="Rebuilding the whole documentation.")
22
+ parser.add_argument("--no-show", action="store_true", help="Don't show the documentation once it is built.")
23
+ args = parser.parse_args()
24
+
25
+ docs_folder_path = Path("public")
26
+
27
+ if not docs_folder_path.exists() or args.force:
28
+ print("Building documentation...")
29
+ subprocess.run("mkdocs build", check=True)
30
+ if not args.no_show:
31
+ home_path = docs_folder_path / "index.html"
32
+ webbrowser.open(home_path)