Feature: modify existing quam + formatting#121
Conversation
nulinspiratie
left a comment
There was a problem hiding this comment.
I'll skip reviewing the code itself since it's hard to see what changed with the formatting changes also included.
Regarding the UX, we don't need to follow the request verbatim. It's perhaps worth thinking about what the best UX would be.
For example, how to specify the type? Currently a string is expected, but the user is prone to make mistakes for values such as mw_fem_output. Perhaps there's a way to avoid this confusion. Some examples:
machine.add_mw_port(con = 1, slot = 2, port = 1, type="output")
machine.add_mw_output_port(con = 1, slot = 2, port = 1)Similar arguments could be made for add_channel etc. I'm not sure what the best would be, but it's worth thinking it through once more: What's the most intuitive way for a user to add/remove a qubit/channel/port after a QUAM state has already been created?
148dc7e to
7228403
Compare
|
Before delving deeper into design implementation, I am trying to understand the issue this PR is solving. Lets take an example: when a user needs to add a new qubit to an existing machine that already has calibrated state, they have two paths: Path A: Edit wiring + re-run machine.wiring["qubits"]["q5"] = {
"xy": {"opx_output": "#/ports/mw_outputs/con1/1/5"},
"rr": {...}
}
build_quam(machine)The advantage of this path is that we dont need a no new API surface and Wiring is always the source of truth
Path B: This PR — Advantages:
Cons:
Path A fails because |
|
@Deepakkhurrana You have it basically correct. One slight note: the new helpers don't fully duplicate the In general, my proposal in the PR is short term anyway because the helpers are only applicable to the superconducting side of the repo. Currently, the machines for quantum_dots largely have a different architecture and there is no unified I'm open to changing the structure of this PR to make @nulinspiratie Also curious to hear your take on this design choice. |
Deepakkhurrana
left a comment
There was a problem hiding this comment.
The overall direction makes sense as a pragmatic short-term helper, but I think we should fix a few state-safety issues before merging.
Couple of general comments:
- I agree with @nulinspiratie point about naming the helpers.
- The new
add_qubit() / add_channel()helpers currently only materialize#/ports/...references. They do not materialize#/octaves/...or#/mixers/...dependencies, even though the underlying transmon adders support wiring withfrequency_converter_up/down. So Octave/external-mixer wiring is either unsupported right now or can produce channels with unresolved frequency-converter references. The helpers should either support those dependencies or explicitly reject/document that only direct port wiring is supported.
Add standalone helper functions to modify an existing QUAM machine without re-running build_quam: - modify_quam.py: add_qubit, remove_qubit, add_channel, remove_channel - modify_ports.py: add_port, remove_port - Comprehensive tests for all helpers including equivalence checks
…y the new channel
8d276f9 to
f8e3428
Compare
|
@Deepakkhurrana @nulinspiratie
We can open an issue to make |
Deepakkhurrana
left a comment
There was a problem hiding this comment.
Thanks for addressing the previous comments, I have a comment on new changes.
Pull Request
Description
Customers use quam_builder package to initialize quam instance from scratch. Some have expressed the need to modify an existing quam instance when connections have been updated, qubits are added, etc. This feature adds the ability to add/remove qubit/channel/port from existing quam instances.
Type of Change
Checklist
Code Quality
pre-commithooks and all checks pass (pre-commit run --all-files)Testing
pytest)Documentation
Does this PR introduce breaking changes? No
Testing Details
Unit tests in test_modify_quam.py
Reviewer Notes
I'm not sure where to include documentation on the usage of these helpers. The module docstrings have usage examples but I don't know if there is a better place to include that information.