qiskit-waveform-sim 0.1.1__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.
@@ -0,0 +1,159 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting this License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) the power, direct or indirect, to cause
22
+ the direction or management of such entity, whether by contract or
23
+ otherwise, or (iv) ownership of fifty percent (50%) or more of the
24
+ outstanding shares, or (iii) the power, direct or indirect, to cause
25
+ the direction or management of such entity, whether by contract or
26
+ otherwise, or (iv) ownership of fifty percent (50%) or more of the
27
+ outstanding shares, or (iii) the power, direct or indirect, to cause
28
+ the direction or management of such entity, whether by contract or
29
+ otherwise, or (iv) ownership of fifty percent (50%) or more of the
30
+ outstanding shares.
31
+
32
+ "Work" shall mean the work of authorship, whether in digital or
33
+ analog form, that is the subject of the copyright license granted
34
+ herein.
35
+
36
+ "Derivative Works" shall mean any work, whether in digital or analog
37
+ form, that is based on (or derived from) the Work and for which the
38
+ editorial revisions, annotations, elaborations, or other modifications
39
+ represent, as a whole, an original work of authorship. For the purposes
40
+ of this License, Derivative Works shall not include works that remain
41
+ substantially the same as the Work and for which the editorial
42
+ revisions, annotations, elaborations, or other modifications represent
43
+ an original work of authorship.
44
+
45
+ "Contribution" shall mean any work of authorship, including
46
+ the original version of the Work and any modifications or additions
47
+ to that Work or Derivative Works thereof, that is intentionally
48
+ submitted to Licensor for inclusion in the Work by the copyright owner
49
+ or by any individual or entity authorized to submit on behalf of
50
+ the copyright owner. For the purposes of this definition, "submitted"
51
+ means any form of electronic, verbal, or written communication sent
52
+ to the Licensor or its representatives, including but not limited to
53
+ communication on electronic mailing lists, system bulletin boards,
54
+ regular mail, or telephone communication that the Licensor or its
55
+ representatives have explicitly agreed to receive.
56
+
57
+ 2. Grant of Copyright License. Subject to the terms and conditions of
58
+ this License, each Licensor hereby grants to you a perpetual,
59
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
60
+ copyright license to reproduce, prepare Derivative Works of,
61
+ publicly display, publicly perform, sublicense, and distribute the
62
+ Work and such Derivative Works in Source or Object form.
63
+
64
+ 3. Grant of Patent License. Subject to the terms and conditions of
65
+ this License, each Licensor hereby grants to you a perpetual,
66
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
67
+ (patent) license to make, have made, use, offer to sell, sell,
68
+ import, and otherwise transfer the Work, where such license applies
69
+ only to those patent claims licensable by such Licensor that are
70
+ necessarily infringed by the Contribution alone or by combination
71
+ of the Contribution with the Work; provided, however, that this
72
+ patent license shall not apply to any patent claims that are
73
+ infringed by Derivative Works other than the Work, or that are
74
+ infringed by Contributions other than the Contribution.
75
+
76
+ 4. Redistribution. You may reproduce and distribute copies of the
77
+ Work or Derivative Works of the Work in any medium, with or without
78
+ modifications, and in Source or Object form, provided that You
79
+ meet the following conditions:
80
+
81
+ (a) You must give any other recipients of the Work or
82
+ Derivative Works a copy of this License; and
83
+
84
+ (b) You must cause any modified files to carry prominent notices
85
+ stating that You changed the files; and
86
+
87
+ (c) You must retain, in the Derivative Works, all copyright,
88
+ patent, trademark, and attribution notices from the Source form of
89
+ the Work, excluding those notices that do not remain on the
90
+ Derivative Works; and
91
+
92
+ (d) If the Work includes a "NOTICE" text file as part of its
93
+ distribution, then any Derivative Works that you distribute must
94
+ include a readable copy of the NOTICE file as part of its
95
+ distribution, unless the Licensor has explicitly waived this requirement
96
+ in writing.
97
+
98
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
99
+ any Contribution submitted to the Licensor for inclusion in the
100
+ Work by You shall be treated as a Contribution under the terms of this
101
+ License, without any additional terms or conditions. Notwithstanding
102
+ the above, nothing herein shall supersede or modify the terms of any
103
+ separate license agreement you may have with the Licensor regarding
104
+ such Contribution.
105
+
106
+ 6. Trademarks. This License does not grant permission to use the trade
107
+ names, trademarks, service marks, or product names of the Licensor,
108
+ except as necessary for reasonable and customary use in describing the
109
+ origin of the Work and distributing the Derivative Works.
110
+
111
+ 7. Disclaimer of Warranty. Unless required by applicable law, the
112
+ Work is provided on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
113
+ OF ANY KIND, either express or implied, including, without limitation,
114
+ warranties of merchantability, fitness for a particular purpose,
115
+ and non-infringement. In no event shall the Licensor be liable for any
116
+ claim, damages, or other losses arising out of or in connection with
117
+ the use of the Work, including without limitation, special, incidental,
118
+ or consequential damages, except as required by applicable law.
119
+
120
+ 8. Limitation of Liability. In no event and under no legal theory,
121
+ whether in tort (including negligence), contract, or otherwise,
122
+ unless required by applicable law, the Licensor shall not be liable
123
+ for any direct, indirect, incidental, special, exemplary, or
124
+ consequential damages (including lost profits, lost data, or loss of
125
+ business opportunity) arising out of or related to the use of the
126
+ Work, even if the Licensor has been advised of the possibility of
127
+ such damages.
128
+
129
+ 9. Accepting Warranty or Additional Liability. While redistributing
130
+ the Work or Derivative Works of the Work, You may choose to offer,
131
+ and charge a fee for, acceptance of Warranty or Additional Liability
132
+ associated with the use of the Work, but only if such acceptance
133
+ does not violate the terms of this License.
134
+
135
+ END OF TERMS AND CONDITIONS
136
+
137
+ APPENDIX: How to apply the Apache License to your work.
138
+
139
+ To apply the Apache License to your work, attach the following
140
+ boilerplate notice, with the fields enclosed by brackets "[]"
141
+ replaced with your own identifying information. (Don't include
142
+ the brackets!) The text should be printed in the next-to-last
143
+ line of the first page of the document (using the regular font)
144
+ and if the document is used on a regular page, the text should be
145
+ centered.
146
+
147
+ Copyright [2026] [Qiskit Community]
148
+
149
+ Licensed under the Apache License, Version 2.0 (the "License");
150
+ you may not use this file except in compliance with the License.
151
+ You may obtain a copy of the License at
152
+
153
+ http://www.apache.org/licenses/LICENSE-2.0
154
+
155
+ Unless required by applicable law or agreed to in writing, software
156
+ distributed under the License is distributed on an "AS IS" BASIS,
157
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
158
+ See the License for the specific language governing permissions and
159
+ limitations under the License.
@@ -0,0 +1,255 @@
1
+ Metadata-Version: 2.4
2
+ Name: qiskit-waveform-sim
3
+ Version: 0.1.1
4
+ Summary: Zero-bloat Classical Control Waveform Simulator & Interactive Pulse Sheet Viewer for Qiskit 2.5+
5
+ Author-email: Qiskit Community <qiskit@us.ibm.com>
6
+ Maintainer-email: Qiskit Waveform Sim Team <qiskit-waveform-sim@example.com>
7
+ License-Expression: Apache-2.0
8
+ Project-URL: Homepage, https://github.com/Qiskit/qiskit-waveform-sim
9
+ Project-URL: Repository, https://github.com/Qiskit/qiskit-waveform-sim
10
+ Project-URL: Documentation, https://qiskit-waveform-sim.readthedocs.io
11
+ Project-URL: Changelog, https://github.com/Qiskit/qiskit-waveform-sim/blob/main/CHANGELOG.md
12
+ Project-URL: Issues, https://github.com/Qiskit/qiskit-waveform-sim/issues
13
+ Keywords: qiskit,quantum-computing,waveform-simulation,pulse-sheet,quantum-control,ibm-quantum
14
+ Classifier: Development Status :: 3 - Alpha
15
+ Classifier: Intended Audience :: Science/Research
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Topic :: Scientific/Engineering :: Physics
20
+ Requires-Python: >=3.11
21
+ Description-Content-Type: text/markdown
22
+ License-File: LICENSE
23
+ Requires-Dist: qiskit>=2.0.0
24
+ Requires-Dist: numpy>=1.24
25
+ Requires-Dist: matplotlib>=3.7
26
+ Requires-Dist: plotly>=5.18
27
+ Provides-Extra: test
28
+ Requires-Dist: pytest>=7.4; extra == "test"
29
+ Requires-Dist: pytest-cov>=4.1; extra == "test"
30
+ Requires-Dist: pytest-xdist>=3.3; extra == "test"
31
+ Requires-Dist: hypothesis>=6.8; extra == "test"
32
+ Provides-Extra: dev
33
+ Requires-Dist: ruff>=0.1.0; extra == "dev"
34
+ Requires-Dist: black>=23.0; extra == "dev"
35
+ Requires-Dist: mypy>=1.5; extra == "dev"
36
+ Requires-Dist: pre-commit>=3.5; extra == "dev"
37
+ Provides-Extra: docs
38
+ Requires-Dist: sphinx>=7.0; extra == "docs"
39
+ Requires-Dist: sphinx-rtd-theme>=1.3; extra == "docs"
40
+ Requires-Dist: myst-parser>=2.0; extra == "docs"
41
+ Requires-Dist: nbsphinx>=0.9; extra == "docs"
42
+ Requires-Dist: jupyter>=1.0; extra == "docs"
43
+ Requires-Dist: ipykernel>=6.0; extra == "docs"
44
+ Provides-Extra: export
45
+ Requires-Dist: kaleido>=0.2; extra == "export"
46
+ Requires-Dist: h5py>=3.0; extra == "export"
47
+ Dynamic: license-file
48
+
49
+ # qiskit-waveform-sim
50
+
51
+ [![PyPI](https://img.shields.io/pypi/v/qiskit-waveform-sim.svg)](https://pypi.org/project/qiskit-waveform-sim/)
52
+ [![Python](https://img.shields.io/pypi/pyversions/qiskit-waveform-sim.svg)](https://pypi.org/project/qiskit-waveform-sim/)
53
+ [![License](https://img.shields.io/pypi/l/qiskit-waveform-sim.svg)](https://www.apache.org/licenses/LICENSE-2.0)
54
+ [![Tests](https://github.com/Qiskit/qiskit-waveform-sim/workflows/Tests/badge.svg)](https://github.com/Qiskit/qiskit-waveform-sim/actions)
55
+
56
+ **Zero-bloat Classical Control Waveform Simulator & Interactive Pulse Sheet Viewer for Qiskit 2.5+**
57
+
58
+ `qiskit-waveform-sim` bridges the post-Pulse waveform gap in Qiskit 2.5+ by providing a native, offline, lazy-evaluated waveform simulator that works directly with Qiskit's modern `Target`, `op_start_times`, `BoxOp`, fractional gates (`RX`, `RZZ`), and the new `qiskit.circuit.annotation.Annotation` API.
59
+
60
+ ---
61
+
62
+ ## The Problem
63
+
64
+ With Qiskit 2.0–2.5, IBM completed a major architectural overhaul:
65
+ - Core circuit structures moved to Rust (`QkCircuit`, `QkTarget`)
66
+ - `qiskit.pulse` module was deprecated and removed
67
+ - `qiskit-dynamics` was archived (Oct 31, 2025)
68
+
69
+ This created a **structural visibility gap**:
70
+ | Tool | Offline? | Dynamic Circuits | Fractional Gates | Virtual-Z Tracking | Sample-Precise I/Q |
71
+ |------|----------|------------------|------------------|--------------------|---------------------|
72
+ | `qiskit.visualization.timeline` | ✅ | ❌ | ❌ | ❌ (markers only) | ❌ |
73
+ | `qiskit-ibm-runtime` `CircuitSchedule` | ❌ (cloud only) | ✅ (server) | ❌ | ❌ | ❌ |
74
+ | **qiskit-waveform-sim** | ✅ | ✅ | ✅ | ✅ Exact | ✅ Lazy/Windowed |
75
+
76
+ ---
77
+
78
+ ## Features
79
+
80
+ - **Lazy Windowed Evaluation**: `O(W)` memory for snippet extraction, independent of total circuit depth
81
+ - **Exact Virtual-Z Frame Tracking**: Per-qubit phase accumulation propagated to drive and cross-resonance channels
82
+ - **Analytical Envelope Synthesis**: DRAG (with leakage suppression), GaussianSquare (flat-top with pedestal correction)
83
+ - **Fractional Gate Support**: Continuous parametric amplitude/duration scaling for `RX(θ)`, `RZZ(θ)`
84
+ - **BoxOp & Annotation Native**: Custom `PulseEnvelopeAnnotation` with OpenQASM 3 & QPY serialization
85
+ - **Interactive Visualization**: Plotly-based Pulse Sheet + synchronized I/Q Oscilloscope
86
+ - **LabOne Q Compatible Architecture**: `OutputSimulator.get_snippet()`-style API
87
+
88
+ ---
89
+
90
+ ## Installation
91
+
92
+ ```bash
93
+ pip install qiskit-waveform-sim
94
+ ```
95
+
96
+ For development:
97
+ ```bash
98
+ git clone https://github.com/Qiskit/qiskit-waveform-sim
99
+ cd qiskit-waveform-sim
100
+ pip install -e ".[dev,test,docs]"
101
+ ```
102
+
103
+ Requires Python 3.11+ and Qiskit 2.0+.
104
+
105
+ ---
106
+
107
+ ## Quickstart
108
+
109
+ ```python
110
+ from qiskit import QuantumCircuit
111
+ from qiskit.providers.fake_provider import GenericBackendV2
112
+ from qiskit.transpiler import generate_preset_pass_manager
113
+ from qiskit_waveform_sim import TargetWaveformSimulator
114
+
115
+ # 1. Create backend and circuit
116
+ backend = GenericBackendV2(num_qubits=2, seed=42)
117
+
118
+ qc = QuantumCircuit(2, 2)
119
+ qc.h(0) # Decomposes to rz(π/2) → sx → rz(π/2)
120
+ qc.cx(0, 1)
121
+ qc.measure([0, 1], [0, 1])
122
+
123
+ # 2. Transpile & schedule (ALAP)
124
+ pm = generate_preset_pass_manager(optimization_level=1, backend=backend, scheduling_method="alap")
125
+ scheduled_qc = pm.run(qc)
126
+
127
+ # 3. Compile waveform simulator
128
+ sim = TargetWaveformSimulator(backend.target).compile(scheduled_qc)
129
+
130
+ # 4. Extract sample-precise I/Q snippets (lazy, windowed)
131
+ d0_snip = sim.get_snippet("d0", start_dt=0, length_dt=2500)
132
+ cr_snip = sim.get_snippet("u(0,1)", start_dt=0, length_dt=2500)
133
+
134
+ # 5. Plot interactive Pulse Sheet + I/Q Oscilloscope
135
+ from qiskit_waveform_sim.visualization import show_pulse_sheet, show_iq_oscilloscope
136
+ show_pulse_sheet(sim, interactive=True)
137
+ show_iq_oscilloscope(sim, "d0", start_dt=0, length_dt=1000, interactive=True)
138
+ ```
139
+
140
+ ### Custom Pulse Annotations (Unscheduled Preview)
141
+
142
+ For custom pulse shapes, use `BoxOp` with `PulseEnvelopeAnnotation`. Note: scheduling with `BoxOp` is not yet supported in Qiskit 2.5's transpiler. Use the unscheduled circuit for OpenQASM 3 export and manual waveform compilation.
143
+
144
+ ```python
145
+ from qiskit_waveform_sim import PulseEnvelopeAnnotation, PulseAnnotationSerializer
146
+ from qiskit import qasm3
147
+
148
+ qc = QuantumCircuit(2, 2)
149
+ qc.h(0)
150
+ qc.cx(0, 1)
151
+
152
+ # Custom high-beta DRAG for SX gate
153
+ with qc.box(
154
+ duration=160,
155
+ unit="dt",
156
+ annotations=[PulseEnvelopeAnnotation(shape="drag", amp=0.55, beta=0.25, sigma_ratio=0.2)]
157
+ ):
158
+ qc.sx(0)
159
+
160
+ qc.measure([0, 1], [0, 1])
161
+
162
+ # Export to OpenQASM 3 with pulse annotations (works without scheduling)
163
+ qasm3_str = qasm3.dumps(
164
+ qc, annotation_handlers={"pulse_sim.envelope": PulseAnnotationSerializer()}
165
+ )
166
+ print(qasm3_str)
167
+ ```
168
+
169
+ ---
170
+
171
+ ## Architecture
172
+
173
+ ```
174
+ ┌─────────────────────────────────────────────────────────────────┐
175
+ │ qiskit-waveform-sim │
176
+ ├─────────────────────────────────────────────────────────────────┤
177
+ │ Input: Scheduled QuantumCircuit + Target │
178
+ ├─────────────────────────────────────────────────────────────────┤
179
+ │ Pillar 1: Target Parametric Binding │
180
+ │ ┌───────────────────────────────────────────────────────────┐ │
181
+ │ │ • sx/x → DRAG envelope (σ = D/4, β leakage suppression) │ │
182
+ │ │ • rx(θ) → DRAG with A(θ) = A_π · (θ/π) │ │
183
+ │ │ • ecr/cx/rzz → GaussianSquare on ControlChannel │ │
184
+ │ │ • measure → GaussianSquare on MeasureChannel + Acquire │ │
185
+ │ └───────────────────────────────────────────────────────────┘ │
186
+ │ Pillar 2: PulseAnnotation Override (OpenQASM3 + QPY) │
187
+ │ ┌───────────────────────────────────────────────────────────┐ │
188
+ │ │ @pulse_sim.drag(amp=0.5, beta=0.1, σ_ratio=0.25) │ │
189
+ │ │ box { sx q[0]; } │ │
190
+ │ └───────────────────────────────────────────────────────────┘ │
191
+ ├─────────────────────────────────────────────────────────────────┤
192
+ │ Engine: FrameTracker + AnalyticalEnvelopes + Interval Indexing │
193
+ │ ┌───────────────────────────────────────────────────────────┐ │
194
+ │ │ • Virtual-Z: φ_q(t⁺) = φ_q(t⁻) - λ │ │
195
+ │ │ • CR phase-locked to target qubit frame φ_t │ │
196
+ │ │ • I(t) + iQ(t) = Ω_env(t) · e^{i(2πf_IF t + φ_q)} │ │
197
+ │ │ • Binary search over ChannelEvent start_dt (O(log N)) │ │
198
+ │ └───────────────────────────────────────────────────────────┘ │
199
+ ├─────────────────────────────────────────────────────────────────┤
200
+ │ Output: WaveformSnippet(channel, time_ns, wave=I+iQ, phase) │
201
+ │ Visualization: Pulse Sheet (Plotly/HTML) + I/Q Oscilloscope │
202
+ └─────────────────────────────────────────────────────────────────┘
203
+ ```
204
+
205
+ ---
206
+
207
+ ## Documentation
208
+
209
+ - [Quickstart Tutorial](https://qiskit-waveform-sim.readthedocs.io/en/latest/tutorials/quickstart.html)
210
+ - [Custom Pulse Annotations & OpenQASM 3 Export](https://qiskit-waveform-sim.readthedocs.io/en/latest/tutorials/annotations.html)
211
+ - [LabOne Q / RFSoC Integration](https://qiskit-waveform-sim.readthedocs.io/en/latest/tutorials/hardware_export.html)
212
+ - [API Reference](https://qiskit-waveform-sim.readthedocs.io/en/latest/api.html)
213
+
214
+ ---
215
+
216
+ ## Contributing
217
+
218
+ We welcome contributions! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.
219
+
220
+ 1. Fork the repository
221
+ 2. Create a feature branch
222
+ 3. Run tests: `pytest -v`
223
+ 4. Run linters: `ruff check . && black --check . && mypy .`
224
+ 5. Submit a PR
225
+
226
+ ---
227
+
228
+ ## License
229
+
230
+ Apache License 2.0 — see [LICENSE](LICENSE) for details.
231
+
232
+ ---
233
+
234
+ ## Citation
235
+
236
+ If you use `qiskit-waveform-sim` in your research, please cite:
237
+
238
+ ```bibtex
239
+ @software{qiskit_waveform_sim,
240
+ author = {Qiskit Community},
241
+ title = {qiskit-waveform-sim: Classical Control Waveform Simulator for Qiskit 2.5+},
242
+ year = {2026},
243
+ url = {https://github.com/Qiskit/qiskit-waveform-sim},
244
+ version = {0.1.0},
245
+ doi = {10.5281/zenodo.XXXXXXX}
246
+ }
247
+ ```
248
+
249
+ ---
250
+
251
+ ## Acknowledgments
252
+
253
+ - IBM Quantum team for Qiskit 2.x architecture and `Annotation` API
254
+ - Zurich Instruments for LabOne Q `OutputSimulator` architectural inspiration
255
+ - Qiskit Advocates and Unitary Foundation for ecosystem support
@@ -0,0 +1,207 @@
1
+ # qiskit-waveform-sim
2
+
3
+ [![PyPI](https://img.shields.io/pypi/v/qiskit-waveform-sim.svg)](https://pypi.org/project/qiskit-waveform-sim/)
4
+ [![Python](https://img.shields.io/pypi/pyversions/qiskit-waveform-sim.svg)](https://pypi.org/project/qiskit-waveform-sim/)
5
+ [![License](https://img.shields.io/pypi/l/qiskit-waveform-sim.svg)](https://www.apache.org/licenses/LICENSE-2.0)
6
+ [![Tests](https://github.com/Qiskit/qiskit-waveform-sim/workflows/Tests/badge.svg)](https://github.com/Qiskit/qiskit-waveform-sim/actions)
7
+
8
+ **Zero-bloat Classical Control Waveform Simulator & Interactive Pulse Sheet Viewer for Qiskit 2.5+**
9
+
10
+ `qiskit-waveform-sim` bridges the post-Pulse waveform gap in Qiskit 2.5+ by providing a native, offline, lazy-evaluated waveform simulator that works directly with Qiskit's modern `Target`, `op_start_times`, `BoxOp`, fractional gates (`RX`, `RZZ`), and the new `qiskit.circuit.annotation.Annotation` API.
11
+
12
+ ---
13
+
14
+ ## The Problem
15
+
16
+ With Qiskit 2.0–2.5, IBM completed a major architectural overhaul:
17
+ - Core circuit structures moved to Rust (`QkCircuit`, `QkTarget`)
18
+ - `qiskit.pulse` module was deprecated and removed
19
+ - `qiskit-dynamics` was archived (Oct 31, 2025)
20
+
21
+ This created a **structural visibility gap**:
22
+ | Tool | Offline? | Dynamic Circuits | Fractional Gates | Virtual-Z Tracking | Sample-Precise I/Q |
23
+ |------|----------|------------------|------------------|--------------------|---------------------|
24
+ | `qiskit.visualization.timeline` | ✅ | ❌ | ❌ | ❌ (markers only) | ❌ |
25
+ | `qiskit-ibm-runtime` `CircuitSchedule` | ❌ (cloud only) | ✅ (server) | ❌ | ❌ | ❌ |
26
+ | **qiskit-waveform-sim** | ✅ | ✅ | ✅ | ✅ Exact | ✅ Lazy/Windowed |
27
+
28
+ ---
29
+
30
+ ## Features
31
+
32
+ - **Lazy Windowed Evaluation**: `O(W)` memory for snippet extraction, independent of total circuit depth
33
+ - **Exact Virtual-Z Frame Tracking**: Per-qubit phase accumulation propagated to drive and cross-resonance channels
34
+ - **Analytical Envelope Synthesis**: DRAG (with leakage suppression), GaussianSquare (flat-top with pedestal correction)
35
+ - **Fractional Gate Support**: Continuous parametric amplitude/duration scaling for `RX(θ)`, `RZZ(θ)`
36
+ - **BoxOp & Annotation Native**: Custom `PulseEnvelopeAnnotation` with OpenQASM 3 & QPY serialization
37
+ - **Interactive Visualization**: Plotly-based Pulse Sheet + synchronized I/Q Oscilloscope
38
+ - **LabOne Q Compatible Architecture**: `OutputSimulator.get_snippet()`-style API
39
+
40
+ ---
41
+
42
+ ## Installation
43
+
44
+ ```bash
45
+ pip install qiskit-waveform-sim
46
+ ```
47
+
48
+ For development:
49
+ ```bash
50
+ git clone https://github.com/Qiskit/qiskit-waveform-sim
51
+ cd qiskit-waveform-sim
52
+ pip install -e ".[dev,test,docs]"
53
+ ```
54
+
55
+ Requires Python 3.11+ and Qiskit 2.0+.
56
+
57
+ ---
58
+
59
+ ## Quickstart
60
+
61
+ ```python
62
+ from qiskit import QuantumCircuit
63
+ from qiskit.providers.fake_provider import GenericBackendV2
64
+ from qiskit.transpiler import generate_preset_pass_manager
65
+ from qiskit_waveform_sim import TargetWaveformSimulator
66
+
67
+ # 1. Create backend and circuit
68
+ backend = GenericBackendV2(num_qubits=2, seed=42)
69
+
70
+ qc = QuantumCircuit(2, 2)
71
+ qc.h(0) # Decomposes to rz(π/2) → sx → rz(π/2)
72
+ qc.cx(0, 1)
73
+ qc.measure([0, 1], [0, 1])
74
+
75
+ # 2. Transpile & schedule (ALAP)
76
+ pm = generate_preset_pass_manager(optimization_level=1, backend=backend, scheduling_method="alap")
77
+ scheduled_qc = pm.run(qc)
78
+
79
+ # 3. Compile waveform simulator
80
+ sim = TargetWaveformSimulator(backend.target).compile(scheduled_qc)
81
+
82
+ # 4. Extract sample-precise I/Q snippets (lazy, windowed)
83
+ d0_snip = sim.get_snippet("d0", start_dt=0, length_dt=2500)
84
+ cr_snip = sim.get_snippet("u(0,1)", start_dt=0, length_dt=2500)
85
+
86
+ # 5. Plot interactive Pulse Sheet + I/Q Oscilloscope
87
+ from qiskit_waveform_sim.visualization import show_pulse_sheet, show_iq_oscilloscope
88
+ show_pulse_sheet(sim, interactive=True)
89
+ show_iq_oscilloscope(sim, "d0", start_dt=0, length_dt=1000, interactive=True)
90
+ ```
91
+
92
+ ### Custom Pulse Annotations (Unscheduled Preview)
93
+
94
+ For custom pulse shapes, use `BoxOp` with `PulseEnvelopeAnnotation`. Note: scheduling with `BoxOp` is not yet supported in Qiskit 2.5's transpiler. Use the unscheduled circuit for OpenQASM 3 export and manual waveform compilation.
95
+
96
+ ```python
97
+ from qiskit_waveform_sim import PulseEnvelopeAnnotation, PulseAnnotationSerializer
98
+ from qiskit import qasm3
99
+
100
+ qc = QuantumCircuit(2, 2)
101
+ qc.h(0)
102
+ qc.cx(0, 1)
103
+
104
+ # Custom high-beta DRAG for SX gate
105
+ with qc.box(
106
+ duration=160,
107
+ unit="dt",
108
+ annotations=[PulseEnvelopeAnnotation(shape="drag", amp=0.55, beta=0.25, sigma_ratio=0.2)]
109
+ ):
110
+ qc.sx(0)
111
+
112
+ qc.measure([0, 1], [0, 1])
113
+
114
+ # Export to OpenQASM 3 with pulse annotations (works without scheduling)
115
+ qasm3_str = qasm3.dumps(
116
+ qc, annotation_handlers={"pulse_sim.envelope": PulseAnnotationSerializer()}
117
+ )
118
+ print(qasm3_str)
119
+ ```
120
+
121
+ ---
122
+
123
+ ## Architecture
124
+
125
+ ```
126
+ ┌─────────────────────────────────────────────────────────────────┐
127
+ │ qiskit-waveform-sim │
128
+ ├─────────────────────────────────────────────────────────────────┤
129
+ │ Input: Scheduled QuantumCircuit + Target │
130
+ ├─────────────────────────────────────────────────────────────────┤
131
+ │ Pillar 1: Target Parametric Binding │
132
+ │ ┌───────────────────────────────────────────────────────────┐ │
133
+ │ │ • sx/x → DRAG envelope (σ = D/4, β leakage suppression) │ │
134
+ │ │ • rx(θ) → DRAG with A(θ) = A_π · (θ/π) │ │
135
+ │ │ • ecr/cx/rzz → GaussianSquare on ControlChannel │ │
136
+ │ │ • measure → GaussianSquare on MeasureChannel + Acquire │ │
137
+ │ └───────────────────────────────────────────────────────────┘ │
138
+ │ Pillar 2: PulseAnnotation Override (OpenQASM3 + QPY) │
139
+ │ ┌───────────────────────────────────────────────────────────┐ │
140
+ │ │ @pulse_sim.drag(amp=0.5, beta=0.1, σ_ratio=0.25) │ │
141
+ │ │ box { sx q[0]; } │ │
142
+ │ └───────────────────────────────────────────────────────────┘ │
143
+ ├─────────────────────────────────────────────────────────────────┤
144
+ │ Engine: FrameTracker + AnalyticalEnvelopes + Interval Indexing │
145
+ │ ┌───────────────────────────────────────────────────────────┐ │
146
+ │ │ • Virtual-Z: φ_q(t⁺) = φ_q(t⁻) - λ │ │
147
+ │ │ • CR phase-locked to target qubit frame φ_t │ │
148
+ │ │ • I(t) + iQ(t) = Ω_env(t) · e^{i(2πf_IF t + φ_q)} │ │
149
+ │ │ • Binary search over ChannelEvent start_dt (O(log N)) │ │
150
+ │ └───────────────────────────────────────────────────────────┘ │
151
+ ├─────────────────────────────────────────────────────────────────┤
152
+ │ Output: WaveformSnippet(channel, time_ns, wave=I+iQ, phase) │
153
+ │ Visualization: Pulse Sheet (Plotly/HTML) + I/Q Oscilloscope │
154
+ └─────────────────────────────────────────────────────────────────┘
155
+ ```
156
+
157
+ ---
158
+
159
+ ## Documentation
160
+
161
+ - [Quickstart Tutorial](https://qiskit-waveform-sim.readthedocs.io/en/latest/tutorials/quickstart.html)
162
+ - [Custom Pulse Annotations & OpenQASM 3 Export](https://qiskit-waveform-sim.readthedocs.io/en/latest/tutorials/annotations.html)
163
+ - [LabOne Q / RFSoC Integration](https://qiskit-waveform-sim.readthedocs.io/en/latest/tutorials/hardware_export.html)
164
+ - [API Reference](https://qiskit-waveform-sim.readthedocs.io/en/latest/api.html)
165
+
166
+ ---
167
+
168
+ ## Contributing
169
+
170
+ We welcome contributions! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.
171
+
172
+ 1. Fork the repository
173
+ 2. Create a feature branch
174
+ 3. Run tests: `pytest -v`
175
+ 4. Run linters: `ruff check . && black --check . && mypy .`
176
+ 5. Submit a PR
177
+
178
+ ---
179
+
180
+ ## License
181
+
182
+ Apache License 2.0 — see [LICENSE](LICENSE) for details.
183
+
184
+ ---
185
+
186
+ ## Citation
187
+
188
+ If you use `qiskit-waveform-sim` in your research, please cite:
189
+
190
+ ```bibtex
191
+ @software{qiskit_waveform_sim,
192
+ author = {Qiskit Community},
193
+ title = {qiskit-waveform-sim: Classical Control Waveform Simulator for Qiskit 2.5+},
194
+ year = {2026},
195
+ url = {https://github.com/Qiskit/qiskit-waveform-sim},
196
+ version = {0.1.0},
197
+ doi = {10.5281/zenodo.XXXXXXX}
198
+ }
199
+ ```
200
+
201
+ ---
202
+
203
+ ## Acknowledgments
204
+
205
+ - IBM Quantum team for Qiskit 2.x architecture and `Annotation` API
206
+ - Zurich Instruments for LabOne Q `OutputSimulator` architectural inspiration
207
+ - Qiskit Advocates and Unitary Foundation for ecosystem support