hilbertbench 1.0.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 (41) hide show
  1. hilbertbench-1.0.0/LICENSE +21 -0
  2. hilbertbench-1.0.0/PKG-INFO +208 -0
  3. hilbertbench-1.0.0/README.md +155 -0
  4. hilbertbench-1.0.0/hilbertbench/__init__.py +78 -0
  5. hilbertbench-1.0.0/hilbertbench/active/__init__.py +38 -0
  6. hilbertbench-1.0.0/hilbertbench/active/probe.py +408 -0
  7. hilbertbench-1.0.0/hilbertbench/analysis/__init__.py +105 -0
  8. hilbertbench-1.0.0/hilbertbench/analysis/_util.py +129 -0
  9. hilbertbench-1.0.0/hilbertbench/analysis/circuit.py +293 -0
  10. hilbertbench-1.0.0/hilbertbench/analysis/expressibility.py +292 -0
  11. hilbertbench-1.0.0/hilbertbench/analysis/measurement.py +270 -0
  12. hilbertbench-1.0.0/hilbertbench/analysis/noise.py +312 -0
  13. hilbertbench-1.0.0/hilbertbench/analysis/optimization.py +257 -0
  14. hilbertbench-1.0.0/hilbertbench/analysis/trainability.py +157 -0
  15. hilbertbench-1.0.0/hilbertbench/integrations/__init__.py +0 -0
  16. hilbertbench-1.0.0/hilbertbench/integrations/pennylane.py +560 -0
  17. hilbertbench-1.0.0/hilbertbench/integrations/qiskit.py +1177 -0
  18. hilbertbench-1.0.0/hilbertbench/models/__init__.py +42 -0
  19. hilbertbench-1.0.0/hilbertbench/models/v1_0/__init__.py +4 -0
  20. hilbertbench-1.0.0/hilbertbench/models/v1_0/artifact.py +79 -0
  21. hilbertbench-1.0.0/hilbertbench/models/v1_0/catalog.py +33 -0
  22. hilbertbench-1.0.0/hilbertbench/models/v1_0/span.py +126 -0
  23. hilbertbench-1.0.0/hilbertbench/models/v1_0/trace.py +92 -0
  24. hilbertbench-1.0.0/hilbertbench/py.typed +0 -0
  25. hilbertbench-1.0.0/hilbertbench/reader/__init__.py +0 -0
  26. hilbertbench-1.0.0/hilbertbench/reader/verify.py +453 -0
  27. hilbertbench-1.0.0/hilbertbench/recorder/__init__.py +26 -0
  28. hilbertbench-1.0.0/hilbertbench/recorder/storage/__init__.py +0 -0
  29. hilbertbench-1.0.0/hilbertbench/recorder/storage/writer.py +267 -0
  30. hilbertbench-1.0.0/hilbertbench/recorder/tape.py +848 -0
  31. hilbertbench-1.0.0/hilbertbench/trace/__init__.py +29 -0
  32. hilbertbench-1.0.0/hilbertbench/trace/span.py +412 -0
  33. hilbertbench-1.0.0/hilbertbench/trace/trace.py +738 -0
  34. hilbertbench-1.0.0/hilbertbench.egg-info/PKG-INFO +208 -0
  35. hilbertbench-1.0.0/hilbertbench.egg-info/SOURCES.txt +39 -0
  36. hilbertbench-1.0.0/hilbertbench.egg-info/dependency_links.txt +1 -0
  37. hilbertbench-1.0.0/hilbertbench.egg-info/entry_points.txt +3 -0
  38. hilbertbench-1.0.0/hilbertbench.egg-info/requires.txt +32 -0
  39. hilbertbench-1.0.0/hilbertbench.egg-info/top_level.txt +1 -0
  40. hilbertbench-1.0.0/pyproject.toml +134 -0
  41. hilbertbench-1.0.0/setup.cfg +4 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Md. Abdullah Al Mamun
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,208 @@
1
+ Metadata-Version: 2.4
2
+ Name: hilbertbench
3
+ Version: 1.0.0
4
+ Summary: Non-intrusive diagnostic framework for evaluating scientific claims in quantum machine learning
5
+ Author-email: "Md. Abdullah Al Mamun" <mamun.cseian@gmail.com>
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://mamuncseru.github.io/hilbertbench/
8
+ Project-URL: Documentation, https://hilbertbench.readthedocs.io
9
+ Project-URL: Repository, https://github.com/mamuncseru/hilbertbench
10
+ Project-URL: Issues, https://github.com/mamuncseru/hilbertbench/issues
11
+ Project-URL: Research Group, https://www.nedcdata.org/
12
+ Keywords: quantum-machine-learning,quantum-computing,diagnostics,barren-plateau,expressibility,nisq,qiskit,observability,reproducibility
13
+ Classifier: Development Status :: 5 - Production/Stable
14
+ Classifier: Intended Audience :: Science/Research
15
+ Classifier: Topic :: Scientific/Engineering :: Physics
16
+ Classifier: Topic :: Scientific/Engineering :: Information Analysis
17
+ Classifier: Programming Language :: Python :: 3
18
+ Classifier: Programming Language :: Python :: 3.10
19
+ Classifier: Programming Language :: Python :: 3.11
20
+ Classifier: Programming Language :: Python :: 3.12
21
+ Classifier: Operating System :: OS Independent
22
+ Classifier: Typing :: Typed
23
+ Requires-Python: >=3.10
24
+ Description-Content-Type: text/markdown
25
+ License-File: LICENSE
26
+ Requires-Dist: pydantic>=2.6.0
27
+ Requires-Dist: qiskit>=1.0.0
28
+ Requires-Dist: pyarrow>=14.0.0
29
+ Provides-Extra: storage
30
+ Requires-Dist: pyarrow>=14.0.0; extra == "storage"
31
+ Provides-Extra: qiskit
32
+ Requires-Dist: qiskit>=1.0.0; extra == "qiskit"
33
+ Provides-Extra: pennylane
34
+ Requires-Dist: pennylane>=0.38.0; extra == "pennylane"
35
+ Provides-Extra: full
36
+ Requires-Dist: hilbertbench[pennylane,qiskit,storage]; extra == "full"
37
+ Provides-Extra: dev
38
+ Requires-Dist: pytest>=7.4.0; extra == "dev"
39
+ Requires-Dist: pytest-cov>=4.1.0; extra == "dev"
40
+ Requires-Dist: mypy>=1.7.0; extra == "dev"
41
+ Requires-Dist: ruff>=0.4.0; extra == "dev"
42
+ Requires-Dist: jsonschema>=4.21.0; extra == "dev"
43
+ Requires-Dist: datamodel-code-generator; extra == "dev"
44
+ Requires-Dist: pennylane>=0.38.0; extra == "dev"
45
+ Requires-Dist: qiskit-ibm-runtime>=0.20.0; extra == "dev"
46
+ Requires-Dist: qiskit-aer>=0.13.0; extra == "dev"
47
+ Requires-Dist: pandas>=2.0.0; extra == "dev"
48
+ Requires-Dist: build>=1.0.0; extra == "dev"
49
+ Requires-Dist: twine>=5.0.0; extra == "dev"
50
+ Provides-Extra: docs
51
+ Requires-Dist: mkdocs-material>=9.5.0; extra == "docs"
52
+ Dynamic: license-file
53
+
54
+ # HilbertBench
55
+
56
+ > Diagnose quantum ML experiments without changing a line of algorithm code.
57
+
58
+ [![Python](https://img.shields.io/badge/python-3.10%2B-blue)](https://www.python.org)
59
+ [![License: MIT](https://img.shields.io/badge/license-MIT-green)](LICENSE)
60
+ [![Tests](https://github.com/mamuncseru/hilbertbench/actions/workflows/tests.yml/badge.svg)](https://github.com/mamuncseru/hilbertbench/actions/workflows/tests.yml)
61
+ [![Docs](https://img.shields.io/badge/docs-readthedocs-blueviolet)](https://hilbertbench.readthedocs.io)
62
+
63
+ HilbertBench is a **non-intrusive diagnostic framework** for quantum machine
64
+ learning. You wrap one object — an Estimator, Sampler, or PennyLane device —
65
+ and every circuit execution is silently recorded into an append-only,
66
+ cryptographically sealed trace. Nothing else in your code changes.
67
+
68
+ After the run you call built-in analyzers to diagnose trainability, shot
69
+ noise, optimization convergence, circuit structure, expressibility, and
70
+ hardware noise — all from the evidence already in the trace.
71
+
72
+ ---
73
+
74
+ ## Install
75
+
76
+ ```bash
77
+ # Default: runs the Qiskit workflow out of the box
78
+ # (trace core + Qiskit integration + Parquet storage)
79
+ pip install hilbertbench
80
+
81
+ # Add the PennyLane integration
82
+ pip install hilbertbench[pennylane]
83
+
84
+ # Everything (Qiskit + PennyLane + storage)
85
+ pip install hilbertbench[full]
86
+ ```
87
+
88
+ The default install covers the documented Qiskit path. PennyLane is the
89
+ one optional integration; if you use it without installing it, the
90
+ error tells you exactly which extra to add.
91
+
92
+ ---
93
+
94
+ ## The one-line change
95
+
96
+ ```python
97
+ from hilbertbench.integrations.qiskit import HilbertEstimatorProxy
98
+ from hilbertbench.recorder.tape import HilbertTape
99
+ from hilbertbench.analysis import detect_barren_plateau
100
+ from hilbertbench import HilbertTrace
101
+
102
+ # Wrap the estimator — everything else stays the same
103
+ with HilbertTape("runs/my_vqe", tags={"algorithm": "vqe"}) as tape:
104
+ estimator = HilbertEstimatorProxy(tape) # ← the only change
105
+ # ... your existing optimizer loop, completely unchanged ...
106
+
107
+ # Analyze the sealed trace
108
+ trace = HilbertTrace(tape.dir_path)
109
+ print(detect_barren_plateau(trace))
110
+ # {'status': 'Trainable', 'variance': 0.215, 'variance_ci': [0.098, 0.371], ...}
111
+ ```
112
+
113
+ ---
114
+
115
+ ## Built-in analyzers
116
+
117
+ | Function | What it answers |
118
+ |---|---|
119
+ | `detect_barren_plateau` | Is the cost-landscape variance exponentially suppressed? |
120
+ | `shot_noise_ratio` | Is the optimizer chasing signal or shot noise? |
121
+ | `optimization_convergence` | Is the parameter trajectory still moving? |
122
+ | `circuit_structure` | How deep, how many qubits, what gate composition? |
123
+ | `kl_expressibility` | How uniformly does the ansatz cover Hilbert space? |
124
+ | `noise_profile` | What hardware noise levels did the run experience? |
125
+
126
+ ```python
127
+ from hilbertbench.analysis import summary
128
+
129
+ report = summary(trace) # runs all analyzers, returns one dict
130
+ ```
131
+
132
+ ---
133
+
134
+ ## Integrations
135
+
136
+ | Framework | Proxy class | Install extra |
137
+ |---|---|---|
138
+ | Qiskit V2 Estimator | `HilbertEstimatorProxy` | `hilbertbench[qiskit]` |
139
+ | Qiskit V2 Sampler | `HilbertSamplerProxy` | `hilbertbench[qiskit]` |
140
+ | IBM Quantum hardware | `HilbertEstimatorProxy` with `EstimatorV2(mode=backend)` | `hilbertbench[qiskit]` |
141
+ | PennyLane | `HilbertPennyLaneDeviceProxy` | `hilbertbench[pennylane]` |
142
+
143
+ ---
144
+
145
+ ## Tutorials
146
+
147
+ Four end-to-end tutorials, each diagnosing a real quantum ML failure mode:
148
+
149
+ | # | Tutorial | Concepts |
150
+ |---|---|---|
151
+ | 01 | [Why Isn't My VQE Converging?](https://mamuncseru.github.io/hilbertbench/tutorials/vqe-barren-plateau/) | Barren plateau, cost-landscape variance |
152
+ | 02 | [Am I Using Enough Shots?](https://mamuncseru.github.io/hilbertbench/tutorials/shot-noise/) | Shot noise floor, SNR, shot budget |
153
+ | 03 | [Expressibility vs Trainability](https://mamuncseru.github.io/hilbertbench/tutorials/expressibility-vs-trainability/) | Active Mode, KL expressibility, Holmes 2022 |
154
+ | 04 | [How Hardware Noise Degrades Your Results](https://mamuncseru.github.io/hilbertbench/tutorials/hardware-noise/) | Circuit fidelity, gate error, noise profile |
155
+
156
+ ---
157
+
158
+ ## Documentation
159
+
160
+ | Resource | Contents |
161
+ |---|---|
162
+ | **[End-to-End Guide](docs/end-to-end.md)** | The whole tool in one document — top-down, layered, no quantum background assumed |
163
+ | **[mamuncseru.github.io/hilbertbench](https://mamuncseru.github.io/hilbertbench/)** | Learning site: getting started, tutorials, concept guides |
164
+ | **[hilbertbench.readthedocs.io](https://hilbertbench.readthedocs.io)** | Reference site: analyzer internals, trace format, architecture, and the [test catalog](docs/reference/test-catalog.md) — all 319 tests explained |
165
+
166
+ The learning site builds from `mkdocs.yml`, the reference site from
167
+ `mkdocs-rtd.yml`. After adding tests, refresh the catalog with
168
+ `python tools/gen_test_catalog.py`.
169
+
170
+ ---
171
+
172
+ ## Design guarantees
173
+
174
+ - **Non-intrusive** — the proxy never re-executes circuits, modifies shot counts, or alters your algorithm (INV-001)
175
+ - **Immutable traces** — every trace is append-only and sealed with a SHA-256 hash on close (INV-002)
176
+ - **Evidence, not verdicts** — raw execution data is stored; diagnostic conclusions are computed at read time and never written back (INV-006)
177
+ - **No silent failures** — every initiated span ends with a `COMPLETED` or `ERROR` event (INV-007)
178
+
179
+ Those `INV-NNN` codes appear throughout the source comments and docstrings.
180
+ Each is a numbered, non-negotiable guarantee; the **complete, canonical list
181
+ (INV-001 … INV-008)** lives in
182
+ **[docs/reference/invariants.md](docs/reference/invariants.md)** (rendered on
183
+ the [reference site](https://hilbertbench.readthedocs.io)). When you see an
184
+ `INV-NNN` tag in the code, that is where it is defined.
185
+
186
+ ---
187
+
188
+ ## Acknowledgments
189
+
190
+ HilbertBench was developed by **Md. Abdullah Al Mamun** in the
191
+ **[Neural Engineering Data Consortium (NEDC)](https://nedcdata.org/)**,
192
+ lab at **Temple University**, under the advisorship of
193
+ **Prof. Joseph Picone** (Department of Electrical and Computer
194
+ Engineering). The author is grateful to Dr. Picone for his guidance
195
+ and for the research environment in which this work was carried out.
196
+
197
+ ## Citing HilbertBench
198
+
199
+ If you use HilbertBench in your research, please cite it using the
200
+ metadata in [`CITATION.cff`](CITATION.cff). On the GitHub project page,
201
+ that file makes a **"Cite this repository"** button appear automatically
202
+ in the right-hand sidebar (it is a GitHub feature, not a README badge,
203
+ and only shows once the repository is on GitHub). A DOI badge will be
204
+ added here once the first release is archived on Zenodo.
205
+
206
+ ## License
207
+
208
+ MIT. See [LICENSE](LICENSE).
@@ -0,0 +1,155 @@
1
+ # HilbertBench
2
+
3
+ > Diagnose quantum ML experiments without changing a line of algorithm code.
4
+
5
+ [![Python](https://img.shields.io/badge/python-3.10%2B-blue)](https://www.python.org)
6
+ [![License: MIT](https://img.shields.io/badge/license-MIT-green)](LICENSE)
7
+ [![Tests](https://github.com/mamuncseru/hilbertbench/actions/workflows/tests.yml/badge.svg)](https://github.com/mamuncseru/hilbertbench/actions/workflows/tests.yml)
8
+ [![Docs](https://img.shields.io/badge/docs-readthedocs-blueviolet)](https://hilbertbench.readthedocs.io)
9
+
10
+ HilbertBench is a **non-intrusive diagnostic framework** for quantum machine
11
+ learning. You wrap one object — an Estimator, Sampler, or PennyLane device —
12
+ and every circuit execution is silently recorded into an append-only,
13
+ cryptographically sealed trace. Nothing else in your code changes.
14
+
15
+ After the run you call built-in analyzers to diagnose trainability, shot
16
+ noise, optimization convergence, circuit structure, expressibility, and
17
+ hardware noise — all from the evidence already in the trace.
18
+
19
+ ---
20
+
21
+ ## Install
22
+
23
+ ```bash
24
+ # Default: runs the Qiskit workflow out of the box
25
+ # (trace core + Qiskit integration + Parquet storage)
26
+ pip install hilbertbench
27
+
28
+ # Add the PennyLane integration
29
+ pip install hilbertbench[pennylane]
30
+
31
+ # Everything (Qiskit + PennyLane + storage)
32
+ pip install hilbertbench[full]
33
+ ```
34
+
35
+ The default install covers the documented Qiskit path. PennyLane is the
36
+ one optional integration; if you use it without installing it, the
37
+ error tells you exactly which extra to add.
38
+
39
+ ---
40
+
41
+ ## The one-line change
42
+
43
+ ```python
44
+ from hilbertbench.integrations.qiskit import HilbertEstimatorProxy
45
+ from hilbertbench.recorder.tape import HilbertTape
46
+ from hilbertbench.analysis import detect_barren_plateau
47
+ from hilbertbench import HilbertTrace
48
+
49
+ # Wrap the estimator — everything else stays the same
50
+ with HilbertTape("runs/my_vqe", tags={"algorithm": "vqe"}) as tape:
51
+ estimator = HilbertEstimatorProxy(tape) # ← the only change
52
+ # ... your existing optimizer loop, completely unchanged ...
53
+
54
+ # Analyze the sealed trace
55
+ trace = HilbertTrace(tape.dir_path)
56
+ print(detect_barren_plateau(trace))
57
+ # {'status': 'Trainable', 'variance': 0.215, 'variance_ci': [0.098, 0.371], ...}
58
+ ```
59
+
60
+ ---
61
+
62
+ ## Built-in analyzers
63
+
64
+ | Function | What it answers |
65
+ |---|---|
66
+ | `detect_barren_plateau` | Is the cost-landscape variance exponentially suppressed? |
67
+ | `shot_noise_ratio` | Is the optimizer chasing signal or shot noise? |
68
+ | `optimization_convergence` | Is the parameter trajectory still moving? |
69
+ | `circuit_structure` | How deep, how many qubits, what gate composition? |
70
+ | `kl_expressibility` | How uniformly does the ansatz cover Hilbert space? |
71
+ | `noise_profile` | What hardware noise levels did the run experience? |
72
+
73
+ ```python
74
+ from hilbertbench.analysis import summary
75
+
76
+ report = summary(trace) # runs all analyzers, returns one dict
77
+ ```
78
+
79
+ ---
80
+
81
+ ## Integrations
82
+
83
+ | Framework | Proxy class | Install extra |
84
+ |---|---|---|
85
+ | Qiskit V2 Estimator | `HilbertEstimatorProxy` | `hilbertbench[qiskit]` |
86
+ | Qiskit V2 Sampler | `HilbertSamplerProxy` | `hilbertbench[qiskit]` |
87
+ | IBM Quantum hardware | `HilbertEstimatorProxy` with `EstimatorV2(mode=backend)` | `hilbertbench[qiskit]` |
88
+ | PennyLane | `HilbertPennyLaneDeviceProxy` | `hilbertbench[pennylane]` |
89
+
90
+ ---
91
+
92
+ ## Tutorials
93
+
94
+ Four end-to-end tutorials, each diagnosing a real quantum ML failure mode:
95
+
96
+ | # | Tutorial | Concepts |
97
+ |---|---|---|
98
+ | 01 | [Why Isn't My VQE Converging?](https://mamuncseru.github.io/hilbertbench/tutorials/vqe-barren-plateau/) | Barren plateau, cost-landscape variance |
99
+ | 02 | [Am I Using Enough Shots?](https://mamuncseru.github.io/hilbertbench/tutorials/shot-noise/) | Shot noise floor, SNR, shot budget |
100
+ | 03 | [Expressibility vs Trainability](https://mamuncseru.github.io/hilbertbench/tutorials/expressibility-vs-trainability/) | Active Mode, KL expressibility, Holmes 2022 |
101
+ | 04 | [How Hardware Noise Degrades Your Results](https://mamuncseru.github.io/hilbertbench/tutorials/hardware-noise/) | Circuit fidelity, gate error, noise profile |
102
+
103
+ ---
104
+
105
+ ## Documentation
106
+
107
+ | Resource | Contents |
108
+ |---|---|
109
+ | **[End-to-End Guide](docs/end-to-end.md)** | The whole tool in one document — top-down, layered, no quantum background assumed |
110
+ | **[mamuncseru.github.io/hilbertbench](https://mamuncseru.github.io/hilbertbench/)** | Learning site: getting started, tutorials, concept guides |
111
+ | **[hilbertbench.readthedocs.io](https://hilbertbench.readthedocs.io)** | Reference site: analyzer internals, trace format, architecture, and the [test catalog](docs/reference/test-catalog.md) — all 319 tests explained |
112
+
113
+ The learning site builds from `mkdocs.yml`, the reference site from
114
+ `mkdocs-rtd.yml`. After adding tests, refresh the catalog with
115
+ `python tools/gen_test_catalog.py`.
116
+
117
+ ---
118
+
119
+ ## Design guarantees
120
+
121
+ - **Non-intrusive** — the proxy never re-executes circuits, modifies shot counts, or alters your algorithm (INV-001)
122
+ - **Immutable traces** — every trace is append-only and sealed with a SHA-256 hash on close (INV-002)
123
+ - **Evidence, not verdicts** — raw execution data is stored; diagnostic conclusions are computed at read time and never written back (INV-006)
124
+ - **No silent failures** — every initiated span ends with a `COMPLETED` or `ERROR` event (INV-007)
125
+
126
+ Those `INV-NNN` codes appear throughout the source comments and docstrings.
127
+ Each is a numbered, non-negotiable guarantee; the **complete, canonical list
128
+ (INV-001 … INV-008)** lives in
129
+ **[docs/reference/invariants.md](docs/reference/invariants.md)** (rendered on
130
+ the [reference site](https://hilbertbench.readthedocs.io)). When you see an
131
+ `INV-NNN` tag in the code, that is where it is defined.
132
+
133
+ ---
134
+
135
+ ## Acknowledgments
136
+
137
+ HilbertBench was developed by **Md. Abdullah Al Mamun** in the
138
+ **[Neural Engineering Data Consortium (NEDC)](https://nedcdata.org/)**,
139
+ lab at **Temple University**, under the advisorship of
140
+ **Prof. Joseph Picone** (Department of Electrical and Computer
141
+ Engineering). The author is grateful to Dr. Picone for his guidance
142
+ and for the research environment in which this work was carried out.
143
+
144
+ ## Citing HilbertBench
145
+
146
+ If you use HilbertBench in your research, please cite it using the
147
+ metadata in [`CITATION.cff`](CITATION.cff). On the GitHub project page,
148
+ that file makes a **"Cite this repository"** button appear automatically
149
+ in the right-hand sidebar (it is a GitHub feature, not a README badge,
150
+ and only shows once the repository is on GitHub). A DOI badge will be
151
+ added here once the first release is archived on Zenodo.
152
+
153
+ ## License
154
+
155
+ MIT. See [LICENSE](LICENSE).
@@ -0,0 +1,78 @@
1
+ #!/usr/bin/env python
2
+ #
3
+ # file: hilbertbench/__init__.py
4
+ #
5
+ # revision history:
6
+ # 20260604 (am): cleaned up to project coding standards
7
+ #
8
+ # HilbertBench — non-intrusive diagnostic framework for quantum machine
9
+ # learning. The recorder, reader, and models import only the standard
10
+ # library. The analysis layer is exposed lazily so that recorder-only
11
+ # users never pay for numpy/pandas imports.
12
+ #
13
+ # from hilbertbench import HilbertTrace
14
+ # trace = HilbertTrace("runs/20260605_xxx")
15
+ #
16
+ # Source comments reference architectural invariants as INV-NNN (e.g.
17
+ # INV-001). These are the framework's non-negotiable guarantees; the
18
+ # canonical list lives in docs/reference/invariants.md.
19
+ #------------------------------------------------------------------------------
20
+
21
+ # import system modules
22
+ #
23
+ from typing import Any
24
+
25
+ #------------------------------------------------------------------------------
26
+ #
27
+ # global variables are listed here
28
+ #
29
+ #------------------------------------------------------------------------------
30
+
31
+ # define the public API
32
+ #
33
+ __all__ = ["HilbertTrace", "SpanView"]
34
+
35
+ #------------------------------------------------------------------------------
36
+ #
37
+ # functions are listed here
38
+ #
39
+ #------------------------------------------------------------------------------
40
+
41
+ def __getattr__(name: str) -> Any:
42
+ """
43
+ function: __getattr__
44
+
45
+ arguments:
46
+ name: the attribute name being accessed
47
+
48
+ return:
49
+ the requested attribute object
50
+
51
+ description:
52
+ PEP 562 lazy attribute access — keeps `import hilbertbench`
53
+ lightweight. The analysis layer (numpy/pandas) is only imported
54
+ when explicitly requested by the caller.
55
+ """
56
+
57
+ # resolve HilbertTrace lazily
58
+ #
59
+ if name == "HilbertTrace":
60
+ from hilbertbench.trace import HilbertTrace
61
+ return HilbertTrace
62
+
63
+ # resolve SpanView lazily
64
+ #
65
+ if name == "SpanView":
66
+ from hilbertbench.trace import SpanView
67
+ return SpanView
68
+
69
+ # exit ungracefully — unknown attribute
70
+ #
71
+ raise AttributeError(
72
+ f"module 'hilbertbench' has no attribute {name!r}"
73
+ )
74
+ #
75
+ # end of function
76
+
77
+ #
78
+ # end of file
@@ -0,0 +1,38 @@
1
+ #!/usr/bin/env python
2
+ #
3
+ # file: hilbertbench/active/__init__.py
4
+ #
5
+ # revision history:
6
+ # 20260604 (am): cleaned up to project coding standards
7
+ #
8
+ # hilbertbench.active — Active Mode: controlled, explicitly-authorized
9
+ # sampling for diagnostics (e.g. expressibility) that passive observation
10
+ # cannot provide.
11
+ #
12
+ # from hilbertbench.active import active_probe_qiskit
13
+ #------------------------------------------------------------------------------
14
+
15
+ # import active mode components
16
+ #
17
+ from hilbertbench.active.probe import (
18
+ active_probe_pennylane,
19
+ active_probe_qiskit,
20
+ probe_expressibility,
21
+ )
22
+
23
+ #------------------------------------------------------------------------------
24
+ #
25
+ # global variables are listed here
26
+ #
27
+ #------------------------------------------------------------------------------
28
+
29
+ # define the public API
30
+ #
31
+ __all__ = [
32
+ "probe_expressibility",
33
+ "active_probe_qiskit",
34
+ "active_probe_pennylane",
35
+ ]
36
+
37
+ #
38
+ # end of file