dccQuantities 2.0.0.dev2__tar.gz → 2.0.0.post1__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.0.0.post1/PKG-INFO +139 -0
  2. dccquantities-2.0.0.post1/README.md +108 -0
  3. dccquantities-2.0.0.post1/pyproject.toml +60 -0
  4. dccquantities-2.0.0.post1/src/dccQuantities.egg-info/PKG-INFO +139 -0
  5. dccquantities-2.0.0.post1/src/dccQuantities.egg-info/SOURCES.txt +54 -0
  6. dccquantities-2.0.0.post1/src/dccQuantities.egg-info/entry_points.txt +2 -0
  7. dccquantities-2.0.0.post1/src/dccQuantities.egg-info/requires.txt +14 -0
  8. dccquantities-2.0.0.post1/src/dccQuantities.egg-info/top_level.txt +1 -0
  9. dccquantities-2.0.0.post1/src/dcc_quantities/__init__.py +19 -0
  10. dccquantities-2.0.0.post1/src/dcc_quantities/_abc/__init__.py +5 -0
  11. dccquantities-2.0.0.post1/src/dcc_quantities/_abc/abstract_list_type.py +25 -0
  12. dccquantities-2.0.0.post1/src/dcc_quantities/_abc/abstract_quantity_type_data.py +27 -0
  13. dccquantities-2.0.0.post1/src/dcc_quantities/_abc/abstract_value_type.py +92 -0
  14. dccquantities-2.0.0.post1/src/dcc_quantities/_cli.py +32 -0
  15. dccquantities-2.0.0.post1/src/dcc_quantities/_config.py +53 -0
  16. dccquantities-2.0.0.post1/src/dcc_quantities/_helpers.py +295 -0
  17. dccquantities-2.0.0.post1/src/dcc_quantities/_version.py +3 -0
  18. dccquantities-2.0.0.post1/src/dcc_quantities/dcc_chars_xml_list.py +52 -0
  19. dccquantities-2.0.0.post1/src/dcc_quantities/dcc_lang_name.py +221 -0
  20. dccquantities-2.0.0.post1/src/dcc_quantities/dcc_math.py +424 -0
  21. dccquantities-2.0.0.post1/src/dcc_quantities/dcc_no_quantity.py +78 -0
  22. dccquantities-2.0.0.post1/src/dcc_quantities/dcc_quantity_parser.py +153 -0
  23. dccquantities-2.0.0.post1/src/dcc_quantities/dcc_quantity_table.py +790 -0
  24. dccquantities-2.0.0.post1/src/dcc_quantities/dcc_quantity_type.py +320 -0
  25. dccquantities-2.0.0.post1/src/dcc_quantities/dcc_rich_content_type.py +34 -0
  26. dccquantities-2.0.0.post1/src/dcc_quantities/exceptions.py +23 -0
  27. dccquantities-2.0.0.post1/src/dcc_quantities/parse_uncertainties.py +307 -0
  28. dccquantities-2.0.0.post1/src/dcc_quantities/query/__init__.py +3 -0
  29. dccquantities-2.0.0.post1/src/dcc_quantities/query/_operators.py +29 -0
  30. dccquantities-2.0.0.post1/src/dcc_quantities/query/slices.py +33 -0
  31. dccquantities-2.0.0.post1/src/dcc_quantities/serializers/__init__.py +7 -0
  32. dccquantities-2.0.0.post1/src/dcc_quantities/serializers/_explicit_serializer_mixin.py +54 -0
  33. dccquantities-2.0.0.post1/src/dcc_quantities/serializers/_field_spec.py +26 -0
  34. dccquantities-2.0.0.post1/src/dcc_quantities/serializers/dcc_element_key.py +67 -0
  35. dccquantities-2.0.0.post1/src/dcc_quantities/serializers/dcc_element_parser.py +211 -0
  36. dccquantities-2.0.0.post1/src/dcc_quantities/serializers/dcc_json_encoder.py +22 -0
  37. dccquantities-2.0.0.post1/src/dcc_quantities/si_complex_list.py +35 -0
  38. dccquantities-2.0.0.post1/src/dcc_quantities/si_hybrid.py +43 -0
  39. dccquantities-2.0.0.post1/src/dcc_quantities/si_real_list.py +615 -0
  40. dccquantities-2.0.0.post1/tests/test_dcc_chars_xml_list.py +28 -0
  41. dccquantities-2.0.0.post1/tests/test_dcc_name.py +51 -0
  42. dccquantities-2.0.0.post1/tests/test_dcc_no_quantity.py +8 -0
  43. dccquantities-2.0.0.post1/tests/test_generate_example_table_data.py +20 -0
  44. dccquantities-2.0.0.post1/tests/test_helpers.py +100 -0
  45. dccquantities-2.0.0.post1/tests/test_math.py +118 -0
  46. dccquantities-2.0.0.post1/tests/test_parser.py +97 -0
  47. dccquantities-2.0.0.post1/tests/test_quantity_type_collector.py +23 -0
  48. dccquantities-2.0.0.post1/tests/test_serilizer.py +29 -0
  49. dccquantities-2.0.0.post1/tests/test_si_real_list.py +416 -0
  50. dccquantities-2.0.0.post1/tests/test_si_real_list_parse_data.py +29 -0
  51. dccquantities-2.0.0.post1/tests/test_surface_flat_table_generation.py +46 -0
  52. dccquantities-2.0.0.post1/tests/test_tables.py +316 -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.0.0.post1}/LICENSE +0 -0
  96. {dccquantities-2.0.0.dev2 → dccquantities-2.0.0.post1}/MANIFEST.in +0 -0
  97. {dccquantities-2.0.0.dev2 → dccquantities-2.0.0.post1}/setup.cfg +0 -0
  98. {dccquantities-2.0.0.dev2 → dccquantities-2.0.0.post1}/src/dccQuantities.egg-info/dependency_links.txt +0 -0
@@ -0,0 +1,139 @@
1
+ Metadata-Version: 2.4
2
+ Name: dccQuantities
3
+ Version: 2.0.0.post1
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: Operating System :: OS Independent
16
+ Requires-Python: >=3.9
17
+ Description-Content-Type: text/markdown
18
+ License-File: LICENSE
19
+ Requires-Dist: dsiUnits~=3.1
20
+ Requires-Dist: dccXMLJSONConv~=3.0.0.dev8
21
+ Requires-Dist: metas_unclib
22
+ Requires-Dist: numpy
23
+ Requires-Dist: PyBackport; python_version < "3.11"
24
+ Requires-Dist: pythonnet
25
+ Provides-Extra: docs
26
+ Requires-Dist: mkdocs; extra == "docs"
27
+ Requires-Dist: mkdocstrings-python; extra == "docs"
28
+ Requires-Dist: mike; extra == "docs"
29
+ Requires-Dist: ruff; extra == "docs"
30
+ Dynamic: license-file
31
+
32
+ # dccQuantities
33
+
34
+ `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.
35
+
36
+ [![Latest Release](https://gitlab1.ptb.de/digitaldynamicmeasurement/dcc-and-dsi/dccQuantities/-/badges/release.svg)](https://gitlab1.ptb.de/digitaldynamicmeasurement/dcc-and-dsi/dccQuantities/-/releases)
37
+ ![pipeline status](https://gitlab1.ptb.de/digitaldynamicmeasurement/dcc-and-dsi/dccQuantities/badges/main/pipeline.svg)
38
+ ![pipeline status](https://gitlab1.ptb.de/digitaldynamicmeasurement/dcc-and-dsi/dccQuantities/badges/main/coverage.svg)
39
+ [![Docs](https://img.shields.io/badge/Read_the_docs-blue)](https://gitlab-pages.ptb.de/digitaldynamicmeasurement/dcc-and-dsi/dccQuantities/)
40
+
41
+ ---
42
+
43
+ ## Key Features
44
+
45
+ - **DCC XML Parsing & Serialization**
46
+ Import certificates from XML into Python objects and export back to XML, JSON, CSV, Excel, or pandas DataFrames.
47
+
48
+ - **Uncertainty & Unit Awareness**
49
+ All quantity objects wrap values as `ufloat` (via `metas_unclib`) and units via `dsi_unit`, ensuring correct propagation in calculations.
50
+
51
+ - **Object‑Oriented Arithmetic**
52
+ Standard operators (`+`, `-`, `*`, `/`, `**`) are overloaded on:
53
+ - **`DccQuantityType`**: single or tabulated quantities
54
+ - **`SiRealList`**, **`SiComplexList`**, **`SiHybrid`**: 1D/2D arrays
55
+
56
+ - **Tables & Fancy Indexing**
57
+ 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.
58
+ ---
59
+
60
+ ## Linux dependencies
61
+
62
+ The package requires the Linux .NET library. For that reason, it is required to have installed the `mono` library:
63
+ ```
64
+ sudo apt install mono-runtime
65
+ ```
66
+
67
+ ## Installation
68
+
69
+ There are multiple ways to install the package.
70
+ Read them all and choose the best one for your case:
71
+
72
+ 1. From PyPI (core functionality):
73
+ ```bash
74
+ pip install dccQuantities
75
+ ```
76
+ This will install the latest released changes at the 'main' branch.
77
+
78
+ 2. Installing unreleased changes:
79
+ ```bash
80
+ pip install git+https://gitlab1.ptb.de/digitaldynamicmeasurement/dcc-and-dsi/dccQuantities.git@devel
81
+ ```
82
+ Please consider that unreleased changes might be unstable and can break your code.
83
+
84
+ 3. Cloning the repository:
85
+ ```bash
86
+ git clone https://gitlab1.ptb.de/digitaldynamicmeasurement/dccQuantities.git
87
+ cd dccQuantities
88
+ pip install -e .
89
+ ```
90
+ This is the best option for developers.
91
+
92
+ ## Deploy local documentation
93
+
94
+ It is possible to deploy and read the local documentation.
95
+ To do so, it is required to clone the repository as stated at '2.' in the _Installation_ section.
96
+
97
+ Once the repository is cloned and the current working directory is `dccQuantities/`, install the optional dependencies for documentation:
98
+ ````
99
+ pip install .[docs]
100
+ ````
101
+
102
+ Now you can deploy and open the documentation by running the following command at your terminal:
103
+ ```
104
+ quantity-docs
105
+ ```
106
+
107
+ ## Under the Hood (Test‑Driven Behavior)
108
+
109
+ The library’s design is guided by its test suite:
110
+
111
+ 1. **Core Parsing** (`tests/test_parser.py`): reads `<DccQuantityTable>` and `<DccQuantityType>` elements, building Python objects.
112
+ 2. **Naming** (`tests/test_dccName.py`): parses and normalizes `<DccLangName>` entries for multilingual support.
113
+ 3. **Quantity Discovery** (`tests/test_quantityTypeCollector.py`): auto‑registers data handlers via `AbstractQuantityTypeData` subclasses.
114
+ 4. **List Types** (`tests/test_SiRealList_*.py`): handles real, complex, and hybrid lists, including broadcasting and label merging.
115
+ 5. **Table Flattening** (`tests/test_tables.py`): cover the tables.
116
+ 6. **Round‑Trip Serialization** (`tests/test_serilizer.py`): ensures parse→serialize yields equivalent XML.
117
+ 7. **JSON Interchange** (`tests/test_dccQuantTabJSONDumpingAndLoadingFromFile.json`): lossless JSON dump/load.
118
+
119
+ ---
120
+
121
+ ## Contributing & Contact
122
+
123
+ We welcome improvements, bug reports, and new features. To contribute:
124
+
125
+ 1. **Fork** the repository.
126
+ 2. **Create** a feature branch.
127
+ 3. **Add** tests for new functionality.
128
+ 4. **Submit** a merge request.
129
+
130
+ 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!
131
+
132
+ Or reach out to the maintainer:
133
+ - **Benedikt Seeger**: benedikt.seeger@ptb.de
134
+ directly
135
+
136
+ ## License
137
+
138
+ This project is licensed under the [LGPL‑2.1‑or‑later](LICENSE).
139
+
@@ -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,60 @@
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"
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
+ "Operating System :: OS Independent",
21
+ ]
22
+
23
+ authors = [
24
+ { name = "Benedikt Seeger", email = "benedikt.seeger@ptb.de" },
25
+ { name = "Jaime Gonzalez Gomez", email = "jaime.gonzalez-gomez@ptb.de" },
26
+ { name = "Vanessa Stehr" },
27
+ { name = "Thomas Bruns" },
28
+ ]
29
+ dependencies = [
30
+ "dsiUnits~=3.1",
31
+ "dccXMLJSONConv~=3.0.0.dev8",
32
+ "metas_unclib",
33
+ "numpy",
34
+ "PyBackport ; python_version < '3.11'",
35
+ "pythonnet",
36
+ ]
37
+
38
+ [project.urls]
39
+ Homepage = "https://gitlab1.ptb.de/digitaldynamicmeasurement/dccQuantities"
40
+ Repository = "https://gitlab1.ptb.de/digitaldynamicmeasurement/dccQuantities"
41
+ Documentation = "https://gitlab-pages.ptb.de/digitaldynamicmeasurement/dcc-and-dsi/dccQuantities/"
42
+
43
+ [project.optional-dependencies]
44
+ docs = ["mkdocs", "mkdocstrings-python", "mike", "ruff"]
45
+
46
+ [tool.setuptools.dynamic]
47
+ version = { attr = "dcc_quantities._version.__version__" }
48
+ readme = { file = ["README.md"], content-type = "text/markdown" }
49
+
50
+ [project.scripts]
51
+ quantity-docs = "dcc_quantities._cli:deploy_local_docs"
52
+
53
+ [tool.coverage.run]
54
+ omit = ["_cli.py", "_version.py"]
55
+
56
+ [tool.coverage.report]
57
+ exclude_also = [
58
+ # Don't complain about missing debug-only code:
59
+ "def __repr__",
60
+ ]
@@ -0,0 +1,139 @@
1
+ Metadata-Version: 2.4
2
+ Name: dccQuantities
3
+ Version: 2.0.0.post1
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: Operating System :: OS Independent
16
+ Requires-Python: >=3.9
17
+ Description-Content-Type: text/markdown
18
+ License-File: LICENSE
19
+ Requires-Dist: dsiUnits~=3.1
20
+ Requires-Dist: dccXMLJSONConv~=3.0.0.dev8
21
+ Requires-Dist: metas_unclib
22
+ Requires-Dist: numpy
23
+ Requires-Dist: PyBackport; python_version < "3.11"
24
+ Requires-Dist: pythonnet
25
+ Provides-Extra: docs
26
+ Requires-Dist: mkdocs; extra == "docs"
27
+ Requires-Dist: mkdocstrings-python; extra == "docs"
28
+ Requires-Dist: mike; extra == "docs"
29
+ Requires-Dist: ruff; extra == "docs"
30
+ Dynamic: license-file
31
+
32
+ # dccQuantities
33
+
34
+ `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.
35
+
36
+ [![Latest Release](https://gitlab1.ptb.de/digitaldynamicmeasurement/dcc-and-dsi/dccQuantities/-/badges/release.svg)](https://gitlab1.ptb.de/digitaldynamicmeasurement/dcc-and-dsi/dccQuantities/-/releases)
37
+ ![pipeline status](https://gitlab1.ptb.de/digitaldynamicmeasurement/dcc-and-dsi/dccQuantities/badges/main/pipeline.svg)
38
+ ![pipeline status](https://gitlab1.ptb.de/digitaldynamicmeasurement/dcc-and-dsi/dccQuantities/badges/main/coverage.svg)
39
+ [![Docs](https://img.shields.io/badge/Read_the_docs-blue)](https://gitlab-pages.ptb.de/digitaldynamicmeasurement/dcc-and-dsi/dccQuantities/)
40
+
41
+ ---
42
+
43
+ ## Key Features
44
+
45
+ - **DCC XML Parsing & Serialization**
46
+ Import certificates from XML into Python objects and export back to XML, JSON, CSV, Excel, or pandas DataFrames.
47
+
48
+ - **Uncertainty & Unit Awareness**
49
+ All quantity objects wrap values as `ufloat` (via `metas_unclib`) and units via `dsi_unit`, ensuring correct propagation in calculations.
50
+
51
+ - **Object‑Oriented Arithmetic**
52
+ Standard operators (`+`, `-`, `*`, `/`, `**`) are overloaded on:
53
+ - **`DccQuantityType`**: single or tabulated quantities
54
+ - **`SiRealList`**, **`SiComplexList`**, **`SiHybrid`**: 1D/2D arrays
55
+
56
+ - **Tables & Fancy Indexing**
57
+ 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.
58
+ ---
59
+
60
+ ## Linux dependencies
61
+
62
+ The package requires the Linux .NET library. For that reason, it is required to have installed the `mono` library:
63
+ ```
64
+ sudo apt install mono-runtime
65
+ ```
66
+
67
+ ## Installation
68
+
69
+ There are multiple ways to install the package.
70
+ Read them all and choose the best one for your case:
71
+
72
+ 1. From PyPI (core functionality):
73
+ ```bash
74
+ pip install dccQuantities
75
+ ```
76
+ This will install the latest released changes at the 'main' branch.
77
+
78
+ 2. Installing unreleased changes:
79
+ ```bash
80
+ pip install git+https://gitlab1.ptb.de/digitaldynamicmeasurement/dcc-and-dsi/dccQuantities.git@devel
81
+ ```
82
+ Please consider that unreleased changes might be unstable and can break your code.
83
+
84
+ 3. Cloning the repository:
85
+ ```bash
86
+ git clone https://gitlab1.ptb.de/digitaldynamicmeasurement/dccQuantities.git
87
+ cd dccQuantities
88
+ pip install -e .
89
+ ```
90
+ This is the best option for developers.
91
+
92
+ ## Deploy local documentation
93
+
94
+ It is possible to deploy and read the local documentation.
95
+ To do so, it is required to clone the repository as stated at '2.' in the _Installation_ section.
96
+
97
+ Once the repository is cloned and the current working directory is `dccQuantities/`, install the optional dependencies for documentation:
98
+ ````
99
+ pip install .[docs]
100
+ ````
101
+
102
+ Now you can deploy and open the documentation by running the following command at your terminal:
103
+ ```
104
+ quantity-docs
105
+ ```
106
+
107
+ ## Under the Hood (Test‑Driven Behavior)
108
+
109
+ The library’s design is guided by its test suite:
110
+
111
+ 1. **Core Parsing** (`tests/test_parser.py`): reads `<DccQuantityTable>` and `<DccQuantityType>` elements, building Python objects.
112
+ 2. **Naming** (`tests/test_dccName.py`): parses and normalizes `<DccLangName>` entries for multilingual support.
113
+ 3. **Quantity Discovery** (`tests/test_quantityTypeCollector.py`): auto‑registers data handlers via `AbstractQuantityTypeData` subclasses.
114
+ 4. **List Types** (`tests/test_SiRealList_*.py`): handles real, complex, and hybrid lists, including broadcasting and label merging.
115
+ 5. **Table Flattening** (`tests/test_tables.py`): cover the tables.
116
+ 6. **Round‑Trip Serialization** (`tests/test_serilizer.py`): ensures parse→serialize yields equivalent XML.
117
+ 7. **JSON Interchange** (`tests/test_dccQuantTabJSONDumpingAndLoadingFromFile.json`): lossless JSON dump/load.
118
+
119
+ ---
120
+
121
+ ## Contributing & Contact
122
+
123
+ We welcome improvements, bug reports, and new features. To contribute:
124
+
125
+ 1. **Fork** the repository.
126
+ 2. **Create** a feature branch.
127
+ 3. **Add** tests for new functionality.
128
+ 4. **Submit** a merge request.
129
+
130
+ 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!
131
+
132
+ Or reach out to the maintainer:
133
+ - **Benedikt Seeger**: benedikt.seeger@ptb.de
134
+ directly
135
+
136
+ ## License
137
+
138
+ This project is licensed under the [LGPL‑2.1‑or‑later](LICENSE).
139
+
@@ -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_name.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/si_complex_list.py
27
+ src/dcc_quantities/si_hybrid.py
28
+ src/dcc_quantities/si_real_list.py
29
+ src/dcc_quantities/_abc/__init__.py
30
+ src/dcc_quantities/_abc/abstract_list_type.py
31
+ src/dcc_quantities/_abc/abstract_quantity_type_data.py
32
+ src/dcc_quantities/_abc/abstract_value_type.py
33
+ src/dcc_quantities/query/__init__.py
34
+ src/dcc_quantities/query/_operators.py
35
+ src/dcc_quantities/query/slices.py
36
+ src/dcc_quantities/serializers/__init__.py
37
+ src/dcc_quantities/serializers/_explicit_serializer_mixin.py
38
+ src/dcc_quantities/serializers/_field_spec.py
39
+ src/dcc_quantities/serializers/dcc_element_key.py
40
+ src/dcc_quantities/serializers/dcc_element_parser.py
41
+ src/dcc_quantities/serializers/dcc_json_encoder.py
42
+ tests/test_dcc_chars_xml_list.py
43
+ tests/test_dcc_name.py
44
+ tests/test_dcc_no_quantity.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,19 @@
1
+ """DccQuantity package."""
2
+
3
+ from dcc_quantities.dcc_lang_name 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_real_list 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,5 @@
1
+ from dcc_quantities._abc.abstract_list_type import AbstractListType
2
+ from dcc_quantities._abc.abstract_quantity_type_data import AbstractQuantityTypeData
3
+ from dcc_quantities._abc.abstract_value_type import AbstractValueType
4
+
5
+ __all__ = ["AbstractListType", "AbstractQuantityTypeData", "AbstractValueType"]
@@ -0,0 +1,25 @@
1
+ from __future__ import annotations
2
+
3
+ from typing import TYPE_CHECKING
4
+
5
+ from dcc_quantities._abc.abstract_quantity_type_data import AbstractQuantityTypeData
6
+
7
+ if TYPE_CHECKING:
8
+ from dcc_quantities._abc.abstract_value_type import AbstractValueType
9
+
10
+
11
+ class AbstractListType(AbstractQuantityTypeData):
12
+ def __init__(self, children: list[AbstractListType | AbstractValueType]):
13
+ super().__init__()
14
+ self.children = children
15
+
16
+ def to_json_dict(self) -> dict:
17
+ result = {}
18
+ for child in self.children:
19
+ child_json = child.to_json_dict()
20
+ for key, value in child_json.items():
21
+ result.setdefault(key, []).append(value)
22
+ return result
23
+
24
+ def __len__(self) -> int:
25
+ 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())