qprogram-qdac 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. qprogram_qdac-0.1.0/.gitignore +45 -0
  2. qprogram_qdac-0.1.0/CHANGELOG.md +24 -0
  3. qprogram_qdac-0.1.0/LICENSE +201 -0
  4. qprogram_qdac-0.1.0/PKG-INFO +149 -0
  5. qprogram_qdac-0.1.0/README.md +117 -0
  6. qprogram_qdac-0.1.0/docs/developer/contributing.md +240 -0
  7. qprogram_qdac-0.1.0/docs/developer/index.md +21 -0
  8. qprogram_qdac-0.1.0/docs/developer/lowering.md +710 -0
  9. qprogram_qdac-0.1.0/docs/getting-started.md +218 -0
  10. qprogram_qdac-0.1.0/docs/guide/capabilities.md +423 -0
  11. qprogram_qdac-0.1.0/docs/guide/index.md +20 -0
  12. qprogram_qdac-0.1.0/docs/guide/operations.md +323 -0
  13. qprogram_qdac-0.1.0/docs/guide/serialization.md +441 -0
  14. qprogram_qdac-0.1.0/docs/index.md +96 -0
  15. qprogram_qdac-0.1.0/docs/reference/api.md +80 -0
  16. qprogram_qdac-0.1.0/docs/reference/index.md +21 -0
  17. qprogram_qdac-0.1.0/pyproject.toml +223 -0
  18. qprogram_qdac-0.1.0/src/qprogram_qdac/__init__.py +140 -0
  19. qprogram_qdac-0.1.0/src/qprogram_qdac/mixin.py +71 -0
  20. qprogram_qdac-0.1.0/src/qprogram_qdac/namespace.py +137 -0
  21. qprogram_qdac-0.1.0/src/qprogram_qdac/operations.py +213 -0
  22. qprogram_qdac-0.1.0/src/qprogram_qdac/profiles.py +234 -0
  23. qprogram_qdac-0.1.0/src/qprogram_qdac/py.typed +0 -0
  24. qprogram_qdac-0.1.0/tests/conftest.py +55 -0
  25. qprogram_qdac-0.1.0/tests/test_docstring_style.py +69 -0
  26. qprogram_qdac-0.1.0/tests/test_mixin.py +90 -0
  27. qprogram_qdac-0.1.0/tests/test_namespace.py +238 -0
  28. qprogram_qdac-0.1.0/tests/test_operations.py +287 -0
  29. qprogram_qdac-0.1.0/tests/test_profile.py +371 -0
  30. qprogram_qdac-0.1.0/tests/test_registration.py +112 -0
  31. qprogram_qdac-0.1.0/tests/test_serialization.py +250 -0
  32. qprogram_qdac-0.1.0/zensical.toml +140 -0
@@ -0,0 +1,45 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+
6
+ # Distribution / packaging
7
+ build/
8
+ dist/
9
+ *.egg-info/
10
+ .eggs/
11
+
12
+ # Environments
13
+ .venv/
14
+ venv/
15
+ env/
16
+
17
+ # Tooling caches
18
+ .cache/
19
+ .hypothesis/
20
+ .mypy_cache/
21
+ .pytest_cache/
22
+ .ruff_cache/
23
+ .ty_cache/
24
+
25
+ # Test and coverage output
26
+ .coverage
27
+ .coverage.*
28
+ coverage.xml
29
+ htmlcov/
30
+ junit.xml
31
+
32
+ # Documentation build output
33
+ site/
34
+
35
+ # Editors
36
+ .idea/
37
+ .vscode/
38
+ *.swp
39
+
40
+ # OS
41
+ .DS_Store
42
+ Thumbs.db
43
+
44
+ # Scratch space for local experiments and notebooks
45
+ .tmp/
@@ -0,0 +1,24 @@
1
+ # Changelog
2
+
3
+ Notable changes to QProgram QDAC, newest first. Each entry starts life as a news
4
+ fragment under `changelog/`, and `towncrier build` assembles the fragments into
5
+ a release section here. See
6
+ [Contributing](https://qilimanjaro-tech.github.io/qprogram-qdac/developer/contributing.html)
7
+ for how to add one.
8
+
9
+ <!-- towncrier release notes start -->
10
+
11
+ ## 0.1.0 (2026-08-25)
12
+
13
+ ### Added
14
+
15
+ - First release. QProgram QDAC adds the `qdac` vendor namespace to the core DSL,
16
+ covering the QDevil QDAC, a slow high-precision DAC used most often for flux
17
+ biasing. Importing the package is what turns it on.
18
+ - Four operations covering DC offsets, the waveform engine, and the chassis
19
+ trigger network.
20
+ - A capability profile describing what a QDAC channel can do, so a program is
21
+ validated against the hardware before it is run.
22
+ - `.qp` serialization for everything the package adds, registered so that a file
23
+ naming the `qdac` vendor resolves without the caller importing this package
24
+ first.
@@ -0,0 +1,201 @@
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 the 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) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2025 Qilimanjaro Quantum Tech
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1,149 @@
1
+ Metadata-Version: 2.5
2
+ Name: qprogram-qdac
3
+ Version: 0.1.0
4
+ Summary: QDevil QDAC vendor extensions for the QProgram pulse-level quantum programming DSL.
5
+ Project-URL: Homepage, https://github.com/qilimanjaro-tech/qprogram-qdac
6
+ Project-URL: Documentation, https://qilimanjaro-tech.github.io/qprogram-qdac/
7
+ Project-URL: Source, https://github.com/qilimanjaro-tech/qprogram-qdac
8
+ Project-URL: Issues, https://github.com/qilimanjaro-tech/qprogram-qdac/issues
9
+ Author-email: Qilimanjaro Quantum Tech <info@qilimanjaro.tech>
10
+ License-Expression: Apache-2.0
11
+ License-File: LICENSE
12
+ Keywords: dsl,pulse programming,qdac,qdevil,qilimanjaro,quantum computing,quantum control
13
+ Classifier: Development Status :: 3 - Alpha
14
+ Classifier: Environment :: Console
15
+ Classifier: Intended Audience :: Developers
16
+ Classifier: Intended Audience :: Science/Research
17
+ Classifier: Operating System :: MacOS
18
+ Classifier: Operating System :: Microsoft :: Windows
19
+ Classifier: Operating System :: POSIX :: Linux
20
+ Classifier: Programming Language :: Python :: 3
21
+ Classifier: Programming Language :: Python :: 3.11
22
+ Classifier: Programming Language :: Python :: 3.12
23
+ Classifier: Programming Language :: Python :: 3.13
24
+ Classifier: Programming Language :: Python :: 3.14
25
+ Classifier: Topic :: Scientific/Engineering
26
+ Classifier: Topic :: Scientific/Engineering :: Physics
27
+ Classifier: Topic :: Scientific/Engineering :: Quantum Computing
28
+ Classifier: Typing :: Typed
29
+ Requires-Python: >=3.11
30
+ Requires-Dist: qprogram>=0.1.0
31
+ Description-Content-Type: text/markdown
32
+
33
+ # QProgram QDAC
34
+
35
+ [![Tests](https://github.com/qilimanjaro-tech/qprogram-qdac/actions/workflows/tests.yml/badge.svg)](https://github.com/qilimanjaro-tech/qprogram-qdac/actions/workflows/tests.yml)
36
+ [![Code Quality](https://github.com/qilimanjaro-tech/qprogram-qdac/actions/workflows/code_quality.yml/badge.svg)](https://github.com/qilimanjaro-tech/qprogram-qdac/actions/workflows/code_quality.yml)
37
+ [![Python](https://img.shields.io/badge/python-3.11%20%7C%203.12%20%7C%203.13%20%7C%203.14-blue)](https://www.python.org/)
38
+ [![License](https://img.shields.io/badge/license-Apache%202.0-blue)](LICENSE)
39
+
40
+ QDevil QDAC extensions for
41
+ [QProgram](https://github.com/qilimanjaro-tech/qprogram), the pulse-level
42
+ quantum programming DSL. The QDAC is a slow high-precision DAC, used most
43
+ often for flux biasing.
44
+
45
+ The core DSL knows nothing about any instrument. This package adds the
46
+ `qdac` vendor namespace to it: four operations covering DC offsets, the
47
+ waveform engine, and the chassis trigger network, a capability profile that
48
+ says what a QDAC channel can do, and `.qp` serialization for all of it.
49
+ Importing the package is what turns those on.
50
+
51
+ ## Installation
52
+
53
+ ```bash
54
+ pip install qprogram-qdac
55
+ ```
56
+
57
+ The only dependency is `qprogram` itself.
58
+
59
+ ## A first program
60
+
61
+ ```python
62
+ import qprogram as qp
63
+ from qprogram import BusSchema
64
+ from qprogram.waveforms import IQPair, Square
65
+ from qprogram_qdac import QProgram
66
+
67
+ schema = BusSchema.flux_tunable_transmon()
68
+ q = schema.q
69
+
70
+ program = QProgram(label="flux-spectroscopy", schema=schema)
71
+ bias = program.variable("bias", units="V")
72
+
73
+ with program.sweep(bias).from_range(-0.2, 0.2, 0.01):
74
+ program.qdac.set_offset(q[0].flux, bias)
75
+ with program.average(shots=100):
76
+ program.play(q[0].drive, "pi_pulse")
77
+ program.sync([q[0].drive, q[0].readout])
78
+ m0 = program.measure(q[0].readout, "readout", "weights")
79
+
80
+ resolved = program.with_waveforms(
81
+ {
82
+ "pi_pulse": IQPair(Square(0.5, 40), Square(0.0, 40)),
83
+ "readout": IQPair(Square(1.0, 2000), Square(0.0, 2000)),
84
+ "weights": IQPair(Square(1.0, 2000), Square(1.0, 2000)),
85
+ }
86
+ )
87
+
88
+ result = qp.simulate(resolved)
89
+ data = result.get(m0)
90
+ print(data.dims, data.shape) # ('bias', 'IQ') (41, 2)
91
+ ```
92
+
93
+ The flux bias comes from the QDAC, the drive and readout from whatever
94
+ vendor owns those buses. One program describes both, and the nesting is
95
+ what makes a mixed platform accept it: the bias sweep dispatches from the
96
+ host, one upload per point, while the `average` block under it runs in the
97
+ real-time sequencer. Flatten the two into one block and no domain runs
98
+ both. `sync` names its buses because the argument-less form syncs every bus
99
+ in the program, and a QDAC channel is not something a real-time barrier can
100
+ wait on.
101
+
102
+ ## What you get
103
+
104
+ - **Four operations under one namespace.** `set_offset` holds a DC voltage
105
+ on a channel, `play` uploads an envelope to the channel's waveform engine
106
+ with explicit dwell, delay, repetitions and stepped mode, and
107
+ `set_trigger` / `wait_trigger` wire the channel into the chassis trigger
108
+ network so QDAC sequences line up with instruments driving other buses.
109
+ - **Host-side sweeps, declared rather than guessed.** The QDAC has no FPGA,
110
+ so a swept parameter has to be re-uploaded from the host between
111
+ iterations. The `qdac-default-v1` profile says so through a domain
112
+ constraint, and `qp.explain(program, capabilities)` prints the enclosing
113
+ loop as `[host]` instead of failing at compile time.
114
+ - **Single-channel by declaration.** The profile lists only single-channel
115
+ waveform tokens. An IQ waveform on a QDAC bus is a `missing-capability`
116
+ error from `qp.validate`, not a runtime surprise.
117
+ - **Serialization included.** Every operation round-trips through the `.qp`
118
+ text format, under a `require qdac 0.1` header line. A file that names
119
+ `qdac` activates this package on load through its entry point, so the
120
+ reader does not have to import it first.
121
+ - **Typed access.** `QProgram` from this package is the core builder with a
122
+ typed `.qdac` property. `QdacMixin` composes with other vendor mixins
123
+ when a platform spans several instruments.
124
+
125
+ ## Documentation
126
+
127
+ Full documentation, including the operation reference, the capability
128
+ profile, and the generated API reference, lives at
129
+ <https://qilimanjaro-tech.github.io/qprogram-qdac/>.
130
+
131
+ ## Development
132
+
133
+ The project uses [uv](https://docs.astral.sh/uv/).
134
+
135
+ ```bash
136
+ git clone https://github.com/qilimanjaro-tech/qprogram-qdac
137
+ cd qprogram-qdac
138
+
139
+ uv sync --group dev # create .venv and install everything
140
+ uv run pytest # run the test suite
141
+ uv run ruff check . # lint
142
+ uv run ruff format . # format
143
+ uv run ty check # type-check
144
+ uv run --group docs zensical serve # preview the documentation
145
+ ```
146
+
147
+ ## License
148
+
149
+ Apache License 2.0 - see [LICENSE](LICENSE).
@@ -0,0 +1,117 @@
1
+ # QProgram QDAC
2
+
3
+ [![Tests](https://github.com/qilimanjaro-tech/qprogram-qdac/actions/workflows/tests.yml/badge.svg)](https://github.com/qilimanjaro-tech/qprogram-qdac/actions/workflows/tests.yml)
4
+ [![Code Quality](https://github.com/qilimanjaro-tech/qprogram-qdac/actions/workflows/code_quality.yml/badge.svg)](https://github.com/qilimanjaro-tech/qprogram-qdac/actions/workflows/code_quality.yml)
5
+ [![Python](https://img.shields.io/badge/python-3.11%20%7C%203.12%20%7C%203.13%20%7C%203.14-blue)](https://www.python.org/)
6
+ [![License](https://img.shields.io/badge/license-Apache%202.0-blue)](LICENSE)
7
+
8
+ QDevil QDAC extensions for
9
+ [QProgram](https://github.com/qilimanjaro-tech/qprogram), the pulse-level
10
+ quantum programming DSL. The QDAC is a slow high-precision DAC, used most
11
+ often for flux biasing.
12
+
13
+ The core DSL knows nothing about any instrument. This package adds the
14
+ `qdac` vendor namespace to it: four operations covering DC offsets, the
15
+ waveform engine, and the chassis trigger network, a capability profile that
16
+ says what a QDAC channel can do, and `.qp` serialization for all of it.
17
+ Importing the package is what turns those on.
18
+
19
+ ## Installation
20
+
21
+ ```bash
22
+ pip install qprogram-qdac
23
+ ```
24
+
25
+ The only dependency is `qprogram` itself.
26
+
27
+ ## A first program
28
+
29
+ ```python
30
+ import qprogram as qp
31
+ from qprogram import BusSchema
32
+ from qprogram.waveforms import IQPair, Square
33
+ from qprogram_qdac import QProgram
34
+
35
+ schema = BusSchema.flux_tunable_transmon()
36
+ q = schema.q
37
+
38
+ program = QProgram(label="flux-spectroscopy", schema=schema)
39
+ bias = program.variable("bias", units="V")
40
+
41
+ with program.sweep(bias).from_range(-0.2, 0.2, 0.01):
42
+ program.qdac.set_offset(q[0].flux, bias)
43
+ with program.average(shots=100):
44
+ program.play(q[0].drive, "pi_pulse")
45
+ program.sync([q[0].drive, q[0].readout])
46
+ m0 = program.measure(q[0].readout, "readout", "weights")
47
+
48
+ resolved = program.with_waveforms(
49
+ {
50
+ "pi_pulse": IQPair(Square(0.5, 40), Square(0.0, 40)),
51
+ "readout": IQPair(Square(1.0, 2000), Square(0.0, 2000)),
52
+ "weights": IQPair(Square(1.0, 2000), Square(1.0, 2000)),
53
+ }
54
+ )
55
+
56
+ result = qp.simulate(resolved)
57
+ data = result.get(m0)
58
+ print(data.dims, data.shape) # ('bias', 'IQ') (41, 2)
59
+ ```
60
+
61
+ The flux bias comes from the QDAC, the drive and readout from whatever
62
+ vendor owns those buses. One program describes both, and the nesting is
63
+ what makes a mixed platform accept it: the bias sweep dispatches from the
64
+ host, one upload per point, while the `average` block under it runs in the
65
+ real-time sequencer. Flatten the two into one block and no domain runs
66
+ both. `sync` names its buses because the argument-less form syncs every bus
67
+ in the program, and a QDAC channel is not something a real-time barrier can
68
+ wait on.
69
+
70
+ ## What you get
71
+
72
+ - **Four operations under one namespace.** `set_offset` holds a DC voltage
73
+ on a channel, `play` uploads an envelope to the channel's waveform engine
74
+ with explicit dwell, delay, repetitions and stepped mode, and
75
+ `set_trigger` / `wait_trigger` wire the channel into the chassis trigger
76
+ network so QDAC sequences line up with instruments driving other buses.
77
+ - **Host-side sweeps, declared rather than guessed.** The QDAC has no FPGA,
78
+ so a swept parameter has to be re-uploaded from the host between
79
+ iterations. The `qdac-default-v1` profile says so through a domain
80
+ constraint, and `qp.explain(program, capabilities)` prints the enclosing
81
+ loop as `[host]` instead of failing at compile time.
82
+ - **Single-channel by declaration.** The profile lists only single-channel
83
+ waveform tokens. An IQ waveform on a QDAC bus is a `missing-capability`
84
+ error from `qp.validate`, not a runtime surprise.
85
+ - **Serialization included.** Every operation round-trips through the `.qp`
86
+ text format, under a `require qdac 0.1` header line. A file that names
87
+ `qdac` activates this package on load through its entry point, so the
88
+ reader does not have to import it first.
89
+ - **Typed access.** `QProgram` from this package is the core builder with a
90
+ typed `.qdac` property. `QdacMixin` composes with other vendor mixins
91
+ when a platform spans several instruments.
92
+
93
+ ## Documentation
94
+
95
+ Full documentation, including the operation reference, the capability
96
+ profile, and the generated API reference, lives at
97
+ <https://qilimanjaro-tech.github.io/qprogram-qdac/>.
98
+
99
+ ## Development
100
+
101
+ The project uses [uv](https://docs.astral.sh/uv/).
102
+
103
+ ```bash
104
+ git clone https://github.com/qilimanjaro-tech/qprogram-qdac
105
+ cd qprogram-qdac
106
+
107
+ uv sync --group dev # create .venv and install everything
108
+ uv run pytest # run the test suite
109
+ uv run ruff check . # lint
110
+ uv run ruff format . # format
111
+ uv run ty check # type-check
112
+ uv run --group docs zensical serve # preview the documentation
113
+ ```
114
+
115
+ ## License
116
+
117
+ Apache License 2.0 - see [LICENSE](LICENSE).