iqm-error-reduction-tools 0.2.2__tar.gz → 0.2.3__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 (65) hide show
  1. {iqm_error_reduction_tools-0.2.2 → iqm_error_reduction_tools-0.2.3}/CHANGELOG.md +10 -1
  2. {iqm_error_reduction_tools-0.2.2 → iqm_error_reduction_tools-0.2.3}/PKG-INFO +23 -23
  3. {iqm_error_reduction_tools-0.2.2 → iqm_error_reduction_tools-0.2.3}/pyproject.toml +33 -23
  4. {iqm_error_reduction_tools-0.2.2 → iqm_error_reduction_tools-0.2.3}/src/iqm/error_reduction_tools/readout_characterization/data_collection.py +5 -5
  5. {iqm_error_reduction_tools-0.2.2 → iqm_error_reduction_tools-0.2.3}/src/iqm/error_reduction_tools/readout_characterization/data_processing.py +15 -15
  6. {iqm_error_reduction_tools-0.2.2 → iqm_error_reduction_tools-0.2.3}/src/iqm/error_reduction_tools/readout_characterization/readout_error_characterization.py +2 -2
  7. {iqm_error_reduction_tools-0.2.2 → iqm_error_reduction_tools-0.2.3}/src/iqm/error_reduction_tools/twirling/twirling_modifiers.py +4 -2
  8. iqm_error_reduction_tools-0.2.2/changelog/.keep +0 -0
  9. iqm_error_reduction_tools-0.2.2/docs/API.rst +0 -10
  10. iqm_error_reduction_tools-0.2.2/docs/Quick_Start.ipynb +0 -215
  11. iqm_error_reduction_tools-0.2.2/docs/_static/images/favicon.ico +0 -0
  12. iqm_error_reduction_tools-0.2.2/docs/_static/images/logo.png +0 -0
  13. iqm_error_reduction_tools-0.2.2/docs/_templates/autosummary-class-template.rst +0 -30
  14. iqm_error_reduction_tools-0.2.2/docs/_templates/autosummary-module-template.rst +0 -75
  15. iqm_error_reduction_tools-0.2.2/docs/changelog.rst +0 -8
  16. iqm_error_reduction_tools-0.2.2/docs/charact.json +0 -339
  17. iqm_error_reduction_tools-0.2.2/docs/conf.py +0 -182
  18. iqm_error_reduction_tools-0.2.2/docs/examples.rst +0 -9
  19. iqm_error_reduction_tools-0.2.2/docs/index.rst +0 -29
  20. iqm_error_reduction_tools-0.2.2/docs/license.rst +0 -8
  21. iqm_error_reduction_tools-0.2.2/docs/readme.md +0 -5
  22. iqm_error_reduction_tools-0.2.2/docs/references.bib +0 -18
  23. iqm_error_reduction_tools-0.2.2/docs/references.rst +0 -6
  24. iqm_error_reduction_tools-0.2.2/docs/tutorial_rem_workflow_highlevel.ipynb +0 -325
  25. iqm_error_reduction_tools-0.2.2/docs/tutorial_twirling_workflow.ipynb +0 -498
  26. iqm_error_reduction_tools-0.2.2/docs/user_guide.rst +0 -8
  27. iqm_error_reduction_tools-0.2.2/mise/tasks/format +0 -6
  28. iqm_error_reduction_tools-0.2.2/mise/tasks/lint +0 -7
  29. iqm_error_reduction_tools-0.2.2/mise/tasks/test +0 -15
  30. iqm_error_reduction_tools-0.2.2/mise.toml +0 -0
  31. iqm_error_reduction_tools-0.2.2/tests/__init__.py +0 -15
  32. iqm_error_reduction_tools-0.2.2/tests/error_reduction_tools/__init__.py +0 -14
  33. iqm_error_reduction_tools-0.2.2/tests/error_reduction_tools/readout_characterization/__init__.py +0 -14
  34. iqm_error_reduction_tools-0.2.2/tests/error_reduction_tools/readout_characterization/test_data_collection.py +0 -319
  35. iqm_error_reduction_tools-0.2.2/tests/error_reduction_tools/readout_characterization/test_data_processing.py +0 -565
  36. iqm_error_reduction_tools-0.2.2/tests/error_reduction_tools/readout_characterization/test_readout_error_characterization.py +0 -743
  37. iqm_error_reduction_tools-0.2.2/tests/error_reduction_tools/readout_characterization/test_topologies.py +0 -174
  38. iqm_error_reduction_tools-0.2.2/tests/error_reduction_tools/rem/__init__.py +0 -0
  39. iqm_error_reduction_tools-0.2.2/tests/error_reduction_tools/rem/test_readout_twirling_strings.py +0 -152
  40. iqm_error_reduction_tools-0.2.2/tests/error_reduction_tools/rem/test_rem.py +0 -146
  41. iqm_error_reduction_tools-0.2.2/tests/error_reduction_tools/twirling/__init__.py +0 -14
  42. iqm_error_reduction_tools-0.2.2/tests/error_reduction_tools/twirling/test_twirling_api.py +0 -1340
  43. iqm_error_reduction_tools-0.2.2/tests/error_reduction_tools/twirling/test_twirling_modifiers.py +0 -246
  44. iqm_error_reduction_tools-0.2.2/tests/utils_test.py +0 -159
  45. {iqm_error_reduction_tools-0.2.2 → iqm_error_reduction_tools-0.2.3}/.gitignore +0 -0
  46. {iqm_error_reduction_tools-0.2.2 → iqm_error_reduction_tools-0.2.3}/LICENSE.txt +0 -0
  47. {iqm_error_reduction_tools-0.2.2 → iqm_error_reduction_tools-0.2.3}/README.md +0 -0
  48. {iqm_error_reduction_tools-0.2.2 → iqm_error_reduction_tools-0.2.3}/build/README.md +0 -0
  49. {iqm_error_reduction_tools-0.2.2 → iqm_error_reduction_tools-0.2.3}/src/iqm/error_reduction_tools/__init__.py +0 -0
  50. {iqm_error_reduction_tools-0.2.2 → iqm_error_reduction_tools-0.2.3}/src/iqm/error_reduction_tools/readout_characterization/__init__.py +0 -0
  51. {iqm_error_reduction_tools-0.2.2 → iqm_error_reduction_tools-0.2.3}/src/iqm/error_reduction_tools/readout_characterization/topologies.py +0 -0
  52. {iqm_error_reduction_tools-0.2.2 → iqm_error_reduction_tools-0.2.3}/src/iqm/error_reduction_tools/readout_characterization/visualization.py +0 -0
  53. {iqm_error_reduction_tools-0.2.2 → iqm_error_reduction_tools-0.2.3}/src/iqm/error_reduction_tools/rem/__init__.py +0 -0
  54. {iqm_error_reduction_tools-0.2.2 → iqm_error_reduction_tools-0.2.3}/src/iqm/error_reduction_tools/rem/rem_api.py +0 -0
  55. {iqm_error_reduction_tools-0.2.2 → iqm_error_reduction_tools-0.2.3}/src/iqm/error_reduction_tools/rem/rem_processors.py +0 -0
  56. {iqm_error_reduction_tools-0.2.2 → iqm_error_reduction_tools-0.2.3}/src/iqm/error_reduction_tools/twirling/__init__.py +0 -0
  57. {iqm_error_reduction_tools-0.2.2 → iqm_error_reduction_tools-0.2.3}/src/iqm/error_reduction_tools/twirling/twirling_api.py +0 -0
  58. {iqm_error_reduction_tools-0.2.2 → iqm_error_reduction_tools-0.2.3}/src/iqm/error_reduction_tools/twirling/twirling_processors.py +0 -0
  59. {iqm_error_reduction_tools-0.2.2 → iqm_error_reduction_tools-0.2.3}/src/iqm/error_reduction_tools/utils/__init__.py +0 -0
  60. {iqm_error_reduction_tools-0.2.2 → iqm_error_reduction_tools-0.2.3}/src/iqm/error_reduction_tools/utils/circuit_utils.py +0 -0
  61. {iqm_error_reduction_tools-0.2.2 → iqm_error_reduction_tools-0.2.3}/src/iqm/error_reduction_tools/utils/general_utils.py +0 -0
  62. {iqm_error_reduction_tools-0.2.2 → iqm_error_reduction_tools-0.2.3}/src/iqm/error_reduction_tools/utils/hadamard.py +0 -0
  63. {iqm_error_reduction_tools-0.2.2 → iqm_error_reduction_tools-0.2.3}/src/iqm/error_reduction_tools/utils/qiskit_utils.py +0 -0
  64. {iqm_error_reduction_tools-0.2.2 → iqm_error_reduction_tools-0.2.3}/src/iqm/error_reduction_tools/utils/readout_twirling_strings.py +0 -0
  65. {iqm_error_reduction_tools-0.2.2 → iqm_error_reduction_tools-0.2.3}/src/iqm/error_reduction_tools/utils/topology_utils.py +0 -0
@@ -1,6 +1,15 @@
1
1
  # Changelog
2
2
 
3
- ## Version 0.2.2 (2026-08-07)
3
+ ## Version 0.2.3 (2026-08-26)
4
+
5
+ ### Bug fixes
6
+
7
+ - Remove the nonexistent `iqm.readout_characterization` module from the API
8
+ reference, and fix the intersphinx links to `iqm-station-control-client`.
9
+ - Add the user guide and quick start to the documentation navigation; both were
10
+ unreachable, and the user guide linked to a nonexistent page.
11
+
12
+ ## Version 0.2.2 (2026-08-05)
4
13
 
5
14
  ### Bug fixes
6
15
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: iqm-error-reduction-tools
3
- Version: 0.2.2
3
+ Version: 0.2.3
4
4
  Summary: Client library for error reduction on IQM quantum computers.
5
5
  Author-email: IQM Finland Oy <developers@iqm.tech>
6
6
  License-File: LICENSE.txt
@@ -65,12 +65,12 @@ Requires-Dist: idna==3.11; extra == "notebook-pin-all"
65
65
  Requires-Dist: importlib-metadata==7.1.0; extra == "notebook-pin-all"
66
66
  Requires-Dist: ipykernel==7.1.0; extra == "notebook-pin-all"
67
67
  Requires-Dist: ipython==8.21.0; extra == "notebook-pin-all"
68
- Requires-Dist: iqm-client==35.0.1; extra == "notebook-pin-all"
69
- Requires-Dist: iqm-data-definitions==2.24; extra == "notebook-pin-all"
70
- Requires-Dist: iqm-exa-common==28.0.1; extra == "notebook-pin-all"
71
- Requires-Dist: iqm-pulla==14.0.1; extra == "notebook-pin-all"
72
- Requires-Dist: iqm-pulse==14.0.1; extra == "notebook-pin-all"
73
- Requires-Dist: iqm-station-control-client==13.0.1; extra == "notebook-pin-all"
68
+ Requires-Dist: iqm-client==35.0.2; extra == "notebook-pin-all"
69
+ Requires-Dist: iqm-data-definitions==3.0; extra == "notebook-pin-all"
70
+ Requires-Dist: iqm-exa-common==28.0.2; extra == "notebook-pin-all"
71
+ Requires-Dist: iqm-pulla==14.0.2; extra == "notebook-pin-all"
72
+ Requires-Dist: iqm-pulse==14.0.2; extra == "notebook-pin-all"
73
+ Requires-Dist: iqm-station-control-client==13.0.2; extra == "notebook-pin-all"
74
74
  Requires-Dist: isoduration==20.11.0; extra == "notebook-pin-all"
75
75
  Requires-Dist: jax==0.7.1; extra == "notebook-pin-all"
76
76
  Requires-Dist: jaxlib==0.7.1; extra == "notebook-pin-all"
@@ -195,11 +195,11 @@ Requires-Dist: webencodings==0.5.1; extra == "notebook-pin-all"
195
195
  Requires-Dist: websocket-client==1.9.0; extra == "notebook-pin-all"
196
196
  Requires-Dist: xarray==2024.10.0; extra == "notebook-pin-all"
197
197
  Requires-Dist: zipp==3.23.0; extra == "notebook-pin-all"
198
- Requires-Dist: iqm-client==35.0.1; extra == "notebook-pin-iqm"
199
- Requires-Dist: iqm-exa-common==28.0.1; extra == "notebook-pin-iqm"
200
- Requires-Dist: iqm-pulla==14.0.1; extra == "notebook-pin-iqm"
201
- Requires-Dist: iqm-pulse==14.0.1; extra == "notebook-pin-iqm"
202
- Requires-Dist: iqm-station-control-client==13.0.1; extra == "notebook-pin-iqm"
198
+ Requires-Dist: iqm-client==35.0.2; extra == "notebook-pin-iqm"
199
+ Requires-Dist: iqm-exa-common==28.0.2; extra == "notebook-pin-iqm"
200
+ Requires-Dist: iqm-pulla==14.0.2; extra == "notebook-pin-iqm"
201
+ Requires-Dist: iqm-pulse==14.0.2; extra == "notebook-pin-iqm"
202
+ Requires-Dist: iqm-station-control-client==13.0.2; extra == "notebook-pin-iqm"
203
203
  Requires-Dist: notebook<8,>=6.5.2; extra == "notebook-pin-iqm"
204
204
  Requires-Dist: annotated-types==0.7.0; extra == "pin-all"
205
205
  Requires-Dist: asttokens==3.0.1; extra == "pin-all"
@@ -222,12 +222,12 @@ Requires-Dist: ibm-platform-services==0.66.1; extra == "pin-all"
222
222
  Requires-Dist: idna==3.11; extra == "pin-all"
223
223
  Requires-Dist: importlib-metadata==7.1.0; extra == "pin-all"
224
224
  Requires-Dist: ipython==8.21.0; extra == "pin-all"
225
- Requires-Dist: iqm-client==35.0.1; extra == "pin-all"
226
- Requires-Dist: iqm-data-definitions==2.24; extra == "pin-all"
227
- Requires-Dist: iqm-exa-common==28.0.1; extra == "pin-all"
228
- Requires-Dist: iqm-pulla==14.0.1; extra == "pin-all"
229
- Requires-Dist: iqm-pulse==14.0.1; extra == "pin-all"
230
- Requires-Dist: iqm-station-control-client==13.0.1; extra == "pin-all"
225
+ Requires-Dist: iqm-client==35.0.2; extra == "pin-all"
226
+ Requires-Dist: iqm-data-definitions==3.0; extra == "pin-all"
227
+ Requires-Dist: iqm-exa-common==28.0.2; extra == "pin-all"
228
+ Requires-Dist: iqm-pulla==14.0.2; extra == "pin-all"
229
+ Requires-Dist: iqm-pulse==14.0.2; extra == "pin-all"
230
+ Requires-Dist: iqm-station-control-client==13.0.2; extra == "pin-all"
231
231
  Requires-Dist: jax==0.7.1; extra == "pin-all"
232
232
  Requires-Dist: jaxlib==0.7.1; extra == "pin-all"
233
233
  Requires-Dist: jedi==0.18.2; extra == "pin-all"
@@ -308,11 +308,11 @@ Requires-Dist: urllib3==2.6.3; extra == "pin-all"
308
308
  Requires-Dist: wcwidth==0.5.3; extra == "pin-all"
309
309
  Requires-Dist: xarray==2024.10.0; extra == "pin-all"
310
310
  Requires-Dist: zipp==3.23.0; extra == "pin-all"
311
- Requires-Dist: iqm-client==35.0.1; extra == "pin-iqm"
312
- Requires-Dist: iqm-exa-common==28.0.1; extra == "pin-iqm"
313
- Requires-Dist: iqm-pulla==14.0.1; extra == "pin-iqm"
314
- Requires-Dist: iqm-pulse==14.0.1; extra == "pin-iqm"
315
- Requires-Dist: iqm-station-control-client==13.0.1; extra == "pin-iqm"
311
+ Requires-Dist: iqm-client==35.0.2; extra == "pin-iqm"
312
+ Requires-Dist: iqm-exa-common==28.0.2; extra == "pin-iqm"
313
+ Requires-Dist: iqm-pulla==14.0.2; extra == "pin-iqm"
314
+ Requires-Dist: iqm-pulse==14.0.2; extra == "pin-iqm"
315
+ Requires-Dist: iqm-station-control-client==13.0.2; extra == "pin-iqm"
316
316
  Description-Content-Type: text/markdown
317
317
 
318
318
  # IQM Error Reduction Tools
@@ -33,18 +33,18 @@ dependencies = [
33
33
  authors = [
34
34
  { name = "IQM Finland Oy", email = "developers@iqm.tech" },
35
35
  ]
36
- version = "0.2.2"
36
+ version = "0.2.3"
37
37
 
38
38
  [project.optional-dependencies]
39
39
  notebook = [
40
40
  "notebook<8,>=6.5.2",
41
41
  ]
42
42
  pin-iqm = [
43
- "iqm-client==35.0.1",
44
- "iqm-exa-common==28.0.1",
45
- "iqm-pulla==14.0.1",
46
- "iqm-pulse==14.0.1",
47
- "iqm-station-control-client==13.0.1",
43
+ "iqm-client==35.0.2",
44
+ "iqm-exa-common==28.0.2",
45
+ "iqm-pulla==14.0.2",
46
+ "iqm-pulse==14.0.2",
47
+ "iqm-station-control-client==13.0.2",
48
48
  ]
49
49
  pin-all = [
50
50
  "annotated-types==0.7.0",
@@ -68,12 +68,12 @@ pin-all = [
68
68
  "idna==3.11",
69
69
  "importlib-metadata==7.1.0",
70
70
  "ipython==8.21.0",
71
- "iqm-client==35.0.1",
72
- "iqm-data-definitions==2.24",
73
- "iqm-exa-common==28.0.1",
74
- "iqm-pulla==14.0.1",
75
- "iqm-pulse==14.0.1",
76
- "iqm-station-control-client==13.0.1",
71
+ "iqm-client==35.0.2",
72
+ "iqm-data-definitions==3.0",
73
+ "iqm-exa-common==28.0.2",
74
+ "iqm-pulla==14.0.2",
75
+ "iqm-pulse==14.0.2",
76
+ "iqm-station-control-client==13.0.2",
77
77
  "jax==0.7.1",
78
78
  "jaxlib==0.7.1",
79
79
  "jedi==0.18.2",
@@ -156,11 +156,11 @@ pin-all = [
156
156
  "zipp==3.23.0",
157
157
  ]
158
158
  notebook-pin-iqm = [
159
- "iqm-client==35.0.1",
160
- "iqm-exa-common==28.0.1",
161
- "iqm-pulla==14.0.1",
162
- "iqm-pulse==14.0.1",
163
- "iqm-station-control-client==13.0.1",
159
+ "iqm-client==35.0.2",
160
+ "iqm-exa-common==28.0.2",
161
+ "iqm-pulla==14.0.2",
162
+ "iqm-pulse==14.0.2",
163
+ "iqm-station-control-client==13.0.2",
164
164
  "notebook<8,>=6.5.2",
165
165
  ]
166
166
  notebook-pin-all = [
@@ -204,12 +204,12 @@ notebook-pin-all = [
204
204
  "importlib-metadata==7.1.0",
205
205
  "ipykernel==7.1.0",
206
206
  "ipython==8.21.0",
207
- "iqm-client==35.0.1",
208
- "iqm-data-definitions==2.24",
209
- "iqm-exa-common==28.0.1",
210
- "iqm-pulla==14.0.1",
211
- "iqm-pulse==14.0.1",
212
- "iqm-station-control-client==13.0.1",
207
+ "iqm-client==35.0.2",
208
+ "iqm-data-definitions==3.0",
209
+ "iqm-exa-common==28.0.2",
210
+ "iqm-pulla==14.0.2",
211
+ "iqm-pulse==14.0.2",
212
+ "iqm-station-control-client==13.0.2",
213
213
  "isoduration==20.11.0",
214
214
  "jax==0.7.1",
215
215
  "jaxlib==0.7.1",
@@ -341,6 +341,16 @@ packages = [
341
341
  "src/iqm",
342
342
  ]
343
343
 
344
+ [tool.hatch.build.targets.sdist]
345
+ exclude = [
346
+ "tests/",
347
+ "changelog/",
348
+ "pytest.ini",
349
+ "mise.toml",
350
+ "mise/",
351
+ "docs/",
352
+ ]
353
+
344
354
  [tool.mypy]
345
355
  disallow_incomplete_defs = true
346
356
  disallow_untyped_defs = true
@@ -56,14 +56,14 @@ def generate_strings(
56
56
  """Generate random preparation strings of 'I' and 'X' characters.
57
57
 
58
58
  Each string encodes a preparation state for a multi-qubit system:
59
- 'I' = prepare |0>, 'X' = prepare |1> (via X gate).
59
+ 'I' = prepare ``|0>``, 'X' = prepare ``|1>`` (via X gate).
60
60
 
61
61
  Args:
62
62
  number_of_qubits: Length of each preparation string (number of qubits).
63
63
  number_of_circuits: Total number of preparation strings to generate.
64
64
  rgen: NumPy random number generator instance.
65
65
  symmetrize: If ``True``, generates pairs of complementary strings (I↔X)
66
- to balance |0> and |1> preparations.
66
+ to balance ``|0>`` and ``|1>`` preparations.
67
67
 
68
68
  Returns:
69
69
  List of preparation strings, each of length ``number_of_qubits``.
@@ -99,7 +99,7 @@ def create_calibration_circuits(
99
99
  ) -> tuple[list[Circuit], list[str]]:
100
100
  """Generate readout error characterization (REC) circuits and preparation strings.
101
101
 
102
- Creates circuits that prepare qubits in computational basis states (|0> or |1>)
102
+ Creates circuits that prepare qubits in computational basis states (``|0>`` or ``|1>``)
103
103
  using I (identity) or X gates, then measure all qubits. Optionally applies
104
104
  equatorial randomization to X gates for improved error characterization.
105
105
 
@@ -107,7 +107,7 @@ def create_calibration_circuits(
107
107
  qubits: IQM qubit names to characterize (e.g., ['QB1', 'QB2']).
108
108
  number_of_circuits: Number of calibration circuits to generate.
109
109
  symmetrize: If ``True``, generates complementary circuit pairs (I↔X) to
110
- balance |0> and |1> state preparations across all qubits.
110
+ balance ``|0>`` and ``|1>`` state preparations across all qubits.
111
111
  seed: Random seed for reproducible circuit generation.
112
112
  equatorial_randomization: If ``True``, randomize X gate phase angles (phi)
113
113
  around the Bloch sphere equator. This distributes state preparation over
@@ -116,7 +116,7 @@ def create_calibration_circuits(
116
116
  Returns:
117
117
  - Circuits ready for compilation.
118
118
  - Preparation strings (same length as circuits), where each
119
- character is 'I' (prepare |0>) or 'X' (prepare |1>).
119
+ character is 'I' (prepare ``|0>``) or 'X' (prepare ``|1>``).
120
120
 
121
121
  Raises:
122
122
  ValueError: If qubits list is empty or ``number_of_circuits`` < 1.
@@ -21,8 +21,8 @@ import numpy as np
21
21
  CountsByPrep: TypeAlias = dict[str, dict[str, float]]
22
22
  """Mapping from preparation string to measurement outcome counts.
23
23
 
24
- Outer key: preparation string where each character is ``'I'`` (prepare |0⟩) or
25
- ``'X'`` (prepare |1⟩). Inner key: measured bitstring (e.g. ``'0110'``).
24
+ Outer key: preparation string where each character is ``'I'`` (prepare ``|0⟩``) or
25
+ ``'X'`` (prepare ``|1⟩``). Inner key: measured bitstring (e.g. ``'0110'``).
26
26
  Value: number of shots (or normalized probability) for that outcome.
27
27
  """
28
28
 
@@ -31,10 +31,10 @@ ErrorId: TypeAlias = int | tuple[int, int]
31
31
 
32
32
  A single ``int`` (0–3) labels a single-qubit preparation/measurement outcome:
33
33
 
34
- - 0: prepared |0⟩, measured 0 (correct)
35
- - 1: prepared |1⟩, measured 1 (correct)
36
- - 2: prepared |0⟩, measured 1 (0→1 flip)
37
- - 3: prepared |1⟩, measured 0 (1→0 flip)
34
+ - 0: prepared ``|0⟩``, measured 0 (correct)
35
+ - 1: prepared ``|1⟩``, measured 1 (correct)
36
+ - 2: prepared ``|0⟩``, measured 1 (0→1 flip)
37
+ - 3: prepared ``|1⟩``, measured 0 (1→0 flip)
38
38
 
39
39
  A ``tuple[int, int]`` labels a joint two-qubit error pair,
40
40
  e.g. ``(2, 3)`` means qubit i had a 0→1 flip and qubit j had a 1→0 flip.
@@ -98,16 +98,16 @@ def _get_error_ids_for_shot(bitstring: str, prep_str: str) -> list[int]:
98
98
  for correlation analysis. Uses little-endian bit ordering (rightmost bit = qubit 0).
99
99
 
100
100
  Error ID encoding:
101
- 0: Prepared |0>, measured 0 (correct)
102
- 1: Prepared |1>, measured 1 (correct)
103
- 2: Prepared |0>, measured 1 (0→1 bit flip error)
104
- 3: Prepared |1>, measured 0 (1→0 bit flip error)
101
+ 0: Prepared ``|0>``, measured 0 (correct)
102
+ 1: Prepared ``|1>``, measured 1 (correct)
103
+ 2: Prepared ``|0>``, measured 1 (0→1 bit flip error)
104
+ 3: Prepared ``|1>``, measured 0 (1→0 bit flip error)
105
105
 
106
106
  Args:
107
107
  bitstring: Measurement outcome string (e.g., '0101'). In little-endian format,
108
108
  the rightmost bit corresponds to qubit 0.
109
109
  prep_str: Preparation string with same length as bitstring.
110
- 'I' = prepared |0>, 'X' = prepared |1>.
110
+ 'I' = prepared ``|0>``, 'X' = prepared ``|1>``.
111
111
 
112
112
  Returns:
113
113
  List of error IDs (0-3), one per qubit, in qubit index order.
@@ -239,7 +239,7 @@ def _compute_prep_counts(
239
239
  ) -> np.ndarray:
240
240
  """Compute total preparation state counts for each qubit.
241
241
 
242
- Aggregates how many times each qubit was prepared in |0> vs |1>
242
+ Aggregates how many times each qubit was prepared in ``|0>`` vs ``|1>``
243
243
  across all circuits and measurement outcomes.
244
244
 
245
245
  Args:
@@ -248,8 +248,8 @@ def _compute_prep_counts(
248
248
 
249
249
  Returns:
250
250
  Array of shape (2, ``num_qubits``) where:
251
- - prep_counts[0, q] = total |0> preparations for qubit q
252
- - prep_counts[1, q] = total |1> preparations for qubit q
251
+ - prep_counts[0, q] = total ``|0>`` preparations for qubit q
252
+ - prep_counts[1, q] = total ``|1>`` preparations for qubit q
253
253
 
254
254
  """
255
255
  prep_counts = np.zeros((2, num_qubits))
@@ -381,7 +381,7 @@ def _compute_prep_joint_counts(
381
381
  Returns:
382
382
  Array of shape (2, 2, ``num_qubits``, ``num_qubits``) where
383
383
  prep_joint_counts[prep_i, prep_j, i, j] = total shots with
384
- qubit i prepared in state prep_i (0=|0>, 1=|1>) and
384
+ qubit i prepared in state prep_i (0=``|0>``, 1=``|1>``) and
385
385
  qubit j prepared in state prep_j.
386
386
 
387
387
  .. note::
@@ -67,8 +67,8 @@ class RECConfiguration:
67
67
  """Random seed for reproducible circuit generation. ``None`` produces non-deterministic results."""
68
68
 
69
69
  symmetrize: bool = True
70
- """When ``True``, generates complementary preparation pairs so that each qubit is prepared in |0⟩ and |1⟩ equally
71
- often."""
70
+ """When ``True``, generates complementary preparation pairs so that each qubit is prepared in
71
+ ``|0⟩`` and ``|1⟩`` equally often."""
72
72
 
73
73
  equatorial_randomization: bool = True
74
74
  """When ``True``, randomizes the phase angle of every X gate to average out coherent phase errors."""
@@ -433,6 +433,7 @@ def randomize_circuit(
433
433
  **Algorithm overview** (gate-by-gate processing):
434
434
 
435
435
  1. **PRX (single-qubit R gate)** — handled by `process_r_gate`:
436
+
436
437
  a. Absorb any pending virtual-Z and π rotations (stored in the `TrackingRegisters`)
437
438
  into the gate parameters (see `take_care_of_pending_operations`,
438
439
  `absorb_pending_pi_rotation`).
@@ -440,6 +441,7 @@ def randomize_circuit(
440
441
  the gate and combine the two together (see `insert_twirling_pi_rotation`).
441
442
  On the last SQG of each qubit, the probability may be overridden to enforce a desired
442
443
  readout twirling basis.
444
+
443
445
  2. **CZ (two-qubit gate)** — handled by `process_cz_gate`:
444
446
  Propagate (pending) operations through the CZ gate, updating the `TrackingRegisters`.
445
447
  3. **Measure** — handled by `process_measure_gate`:
@@ -454,8 +456,8 @@ def randomize_circuit(
454
456
 
455
457
  .. note::
456
458
 
457
- Right now, there is no support for MOVE gates. If the input circuit contains MOVE operations,
458
- a ``ValueError`` will be raised.
459
+ Right now, there is no support for MOVE gates. If the input circuit contains MOVE operations,
460
+ a ``ValueError`` will be raised.
459
461
 
460
462
 
461
463
  Args:
File without changes
@@ -1,10 +0,0 @@
1
- API Reference
2
- =============
3
-
4
- .. autosummary::
5
- :toctree: api
6
- :template: autosummary-module-template.rst
7
- :recursive:
8
-
9
- iqm.error_reduction_tools
10
- iqm.readout_characterization
@@ -1,215 +0,0 @@
1
- {
2
- "cells": [
3
- {
4
- "cell_type": "markdown",
5
- "id": "c369ec22",
6
- "metadata": {},
7
- "source": [
8
- "# Quick Start Guide for IQM Error Reduction Tools\n",
9
- "\n",
10
- "IQM Error Reduction Tools is a library providing techniques to avoid noise and mitigate errors in quantum computation.\n",
11
- "It operates by postprocessing measurement results after the execution to improve their accuracy.\n",
12
- "With this library, you can:\n",
13
- "\n",
14
- "- apply readout error mitigation (REM) to correct measurement errors\n",
15
- "- characterize readout noise and build calibration models\n",
16
- "- use Pauli twirling to tailor noise into more tractable forms\n",
17
- "- combine all steps into a unified workflow via the high-level `REMWorkflow` API\n",
18
- "\n",
19
- "This notebook walks through the minimal steps to get started. For a deeper dive into each technique, see `tutorial_rem_workflow_highlevel.ipynb` and the other tutorials in this docs folder."
20
- ]
21
- },
22
- {
23
- "cell_type": "markdown",
24
- "id": "cb12c99a",
25
- "metadata": {},
26
- "source": [
27
- "## Authentication\n",
28
- "\n",
29
- "IQM uses bearer token authentication to manage access to quantum computers.\n",
30
- "Get your personal token from the web dashboard and pass it when constructing the backend objects:\n",
31
- "\n",
32
- "```python\n",
33
- "server_url = \"https://<your-station-url>\"\n",
34
- "api_token = \"<YOUR TOKEN HERE>\"\n",
35
- "```\n",
36
- "\n",
37
- "Alternatively, set the `IQM_TOKEN` environment variable and omit the `token` argument."
38
- ]
39
- },
40
- {
41
- "cell_type": "code",
42
- "execution_count": null,
43
- "id": "c9f0ba2042c37b5a",
44
- "metadata": {
45
- "ExecuteTime": {
46
- "end_time": "2024-07-15T09:37:29.282407Z",
47
- "start_time": "2024-07-15T09:37:17.932145Z"
48
- },
49
- "scrolled": true
50
- },
51
- "outputs": [],
52
- "source": [
53
- "import numpy as np\n",
54
- "import matplotlib.pyplot as plt\n",
55
- "\n",
56
- "from qiskit import QuantumCircuit, transpile\n",
57
- "from qiskit.quantum_info import Statevector\n",
58
- "\n",
59
- "from iqm.qiskit_iqm import IQMProvider\n",
60
- "from iqm.pulla.pulla import Pulla\n",
61
- "\n",
62
- "from iqm.error_reduction_tools.rem import REMWorkflow, WorkflowConfiguration\n",
63
- "from iqm.error_reduction_tools.twirling.twirling_api import TwirlingConfiguration\n",
64
- "from iqm.error_reduction_tools.utils.general_utils import total_variational_distance"
65
- ]
66
- },
67
- {
68
- "cell_type": "code",
69
- "execution_count": null,
70
- "id": "f5ec2e1e5925aead",
71
- "metadata": {},
72
- "outputs": [],
73
- "source": [
74
- "provider = IQMProvider(url=server_url, token=api_token)\n",
75
- "backend = provider.get_backend()\n",
76
- "client = Pulla(server_url, token=api_token)"
77
- ]
78
- },
79
- {
80
- "cell_type": "code",
81
- "execution_count": null,
82
- "id": "c4fb1a1d07d20ab",
83
- "metadata": {
84
- "scrolled": true
85
- },
86
- "outputs": [],
87
- "source": [
88
- "def generate_circuit(\n",
89
- " num_qubits: int, scale: float = 2, seed: int = None\n",
90
- ") -> tuple[QuantumCircuit, dict[str, float]]:\n",
91
- " \"\"\"Generate a circuit with a single layer of random R gates.\"\"\"\n",
92
- " rgen = np.random.default_rng(seed)\n",
93
- " rotations = (\n",
94
- " np.pi\n",
95
- " / 2\n",
96
- " * (1 + np.tanh(scale * (rgen.random(num_qubits) - 0.5) * 2) / np.tanh(scale))\n",
97
- " )\n",
98
- " qc = QuantumCircuit(num_qubits)\n",
99
- " for q, theta in enumerate(rotations):\n",
100
- " qc.r(theta, 0, q)\n",
101
- " probs = Statevector.from_instruction(qc).probabilities()\n",
102
- " ideal_counts = {\n",
103
- " f\"{i:0{num_qubits}b}\": float(p)\n",
104
- " for i, p in enumerate(probs)\n",
105
- " if p > 1e-15\n",
106
- " }\n",
107
- " qc.measure_all()\n",
108
- " return qc, ideal_counts\n",
109
- "\n",
110
- "\n",
111
- "target_circuit, exact_counts = generate_circuit(num_qubits=4, seed=0)\n",
112
- "transpiled_circ = transpile(\n",
113
- " target_circuit, backend=backend, initial_layout=np.arange(1, 5)\n",
114
- ")\n",
115
- "transpiled_circ.draw(\"mpl\", fold=0)"
116
- ]
117
- },
118
- {
119
- "cell_type": "markdown",
120
- "id": "09952db9",
121
- "metadata": {},
122
- "source": [
123
- "## Run the REM Workflow\n",
124
- "\n",
125
- "The simplest usage is a single call to `REMWorkflow.run()`. It automatically:\n",
126
- "1. Runs readout error characterization circuits on the QPU.\n",
127
- "2. Twirls and executes your circuits.\n",
128
- "3. Post-processes the counts to produce mitigated results.\n",
129
- "\n",
130
- "For finer control (e.g. reusing a saved characterization, setting shot counts, or choosing a twirling strategy), see `tutorial_rem_workflow_highlevel.ipynb`."
131
- ]
132
- },
133
- {
134
- "cell_type": "code",
135
- "execution_count": null,
136
- "id": "1a325b95",
137
- "metadata": {},
138
- "outputs": [],
139
- "source": [
140
- "# One-liner: characterization + twirled execution + mitigation in a single call\n",
141
- "results = REMWorkflow(client).run([transpiled_circ])\n",
142
- "\n",
143
- "print(\"Mitigated counts:\")\n",
144
- "print(dict(sorted(results.mitigated_counts[0].items(), key=lambda x: -x[1])[:10]))"
145
- ]
146
- },
147
- {
148
- "cell_type": "code",
149
- "execution_count": null,
150
- "id": "cf80e8eefc8cb48d",
151
- "metadata": {},
152
- "outputs": [],
153
- "source": [
154
- "# Compare mitigated results against raw (unmitigated) execution\n",
155
- "raw_counts = backend.run(transpiled_circ, shots=10_000).result().get_counts()\n",
156
- "\n",
157
- "tvd_raw = total_variational_distance(raw_counts, exact_counts)\n",
158
- "tvd_mitigated = total_variational_distance(results.mitigated_counts[0], exact_counts)\n",
159
- "\n",
160
- "labels = [\"Raw (no REM)\", \"Twirled + REM\"]\n",
161
- "values = [tvd_raw, tvd_mitigated]\n",
162
- "colors = [\"tab:blue\", \"tab:green\"]\n",
163
- "\n",
164
- "plt.figure(figsize=(5, 4))\n",
165
- "bars = plt.bar(labels, values, color=colors)\n",
166
- "for bar, v in zip(bars, values):\n",
167
- " plt.text(\n",
168
- " bar.get_x() + bar.get_width() / 2,\n",
169
- " bar.get_height(),\n",
170
- " f\"{v:.3f}\",\n",
171
- " ha=\"center\",\n",
172
- " va=\"bottom\",\n",
173
- " fontsize=10,\n",
174
- " )\n",
175
- "plt.ylabel(\"Total Variational Distance (TVD)\")\n",
176
- "plt.title(\"Lower TVD = closer to ideal\")\n",
177
- "plt.ylim(0, max(values) * 1.4)\n",
178
- "plt.tight_layout()\n",
179
- "plt.show()"
180
- ]
181
- },
182
- {
183
- "cell_type": "markdown",
184
- "id": "aa127167",
185
- "metadata": {},
186
- "source": [
187
- "## Next Steps\n",
188
- "\n",
189
- "- **`tutorial_rem_workflow_highlevel.ipynb`** — reusing characterization, observable estimation, workflow metadata\n",
190
- "- **API reference** — full documentation of `REMWorkflow`, `WorkflowConfiguration`, and `TwirlingConfiguration`"
191
- ]
192
- }
193
- ],
194
- "metadata": {
195
- "kernelspec": {
196
- "display_name": "Python 3 (ipykernel)",
197
- "language": "python",
198
- "name": "python3"
199
- },
200
- "language_info": {
201
- "codemirror_mode": {
202
- "name": "ipython",
203
- "version": 3
204
- },
205
- "file_extension": ".py",
206
- "mimetype": "text/x-python",
207
- "name": "python",
208
- "nbconvert_exporter": "python",
209
- "pygments_lexer": "ipython3",
210
- "version": "3.11.14"
211
- }
212
- },
213
- "nbformat": 4,
214
- "nbformat_minor": 5
215
- }
@@ -1,30 +0,0 @@
1
- {{ fullname | escape | underline}}
2
-
3
- .. currentmodule:: {{ module }}
4
-
5
- .. autoclass:: {{ objname }}
6
- :members:
7
- :show-inheritance:
8
-
9
- {% block attributes %}
10
- {% if attributes %}
11
- .. rubric:: {{ _('Attributes') }}
12
-
13
- .. autosummary::
14
- {% for item in attributes if item not in inherited_members %}
15
- ~{{ name }}.{{ item }}
16
- {%- endfor %}
17
- {% endif %}
18
- {% endblock %}
19
-
20
-
21
- {% block methods %}
22
- {% if all_methods %}
23
- .. rubric:: {{ _('Methods') }}
24
-
25
- .. autosummary::
26
- {% for item in all_methods if item not in inherited_members and item not in ['__init__'] %}
27
- ~{{ name }}.{{ item }}
28
- {%- endfor %}
29
- {% endif %}
30
- {% endblock %}