Skip to content

feat: Introduce default single-qubit macros for transmons#101

Merged
arthurostrauss merged 9 commits into
mainfrom
feat/adding_gate_macros_sc_qubits
Jun 11, 2026
Merged

feat: Introduce default single-qubit macros for transmons#101
arthurostrauss merged 9 commits into
mainfrom
feat/adding_gate_macros_sc_qubits

Conversation

@arthurostrauss

Copy link
Copy Markdown
Contributor

Pull Request

Description

This PR introduces a set of default single-qubit gate macros for superconducting transmons, enhancing the quam_builder's gate library. It includes MeasureMacro, ResetMacro, VirtualZMacro, DelayMacro, and IdMacro, which are automatically added to transmon qubits during the QUAM build process. This simplifies the definition and application of common single-qubit operations.

Additionally, helper functions for pulse management (get_pulse_name, get_pulse) have been refactored into a new utility module (flux_tunable_transmon_pair/utils.py) to improve code organization and reusability across different custom gates.

Type of Change

  • 🐛 Bug fix (non-breaking change which fixes an issue)
  • ✨ New feature (non-breaking change which adds functionality)
  • 💥 Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • 📚 Documentation update
  • 🔧 Refactoring (no functional changes)
  • ✅ Test addition/update
  • 🎨 Code style/formatting update

Related Issues

Checklist

Code Quality

  • My code follows the project's style guidelines
  • I have run pre-commit hooks and all checks pass (pre-commit run --all-files)
  • My commits follow the Conventional Commits format
  • I have performed a self-review of my code
  • My changes generate no new warnings

Testing

  • I have added tests that prove my fix/feature works
  • All new and existing tests pass locally (pytest)
  • I have tested my changes with the example scripts (if applicable)

Documentation

  • I have updated the documentation (if needed)
  • I have added docstrings to new functions/classes
  • I have updated the CHANGELOG.md (if applicable)
  • I have checked my code and corrected any misspellings

Breaking Changes

Does this PR introduce breaking changes? No

Testing Details

Screenshots/Examples

Additional Context

This feature was developed on the feat/adding_gate_macros_sc_qubits branch, aligning with the goal of expanding the built-in gate library for superconducting qubits.

Reviewer Notes

…mons

This commit introduces a set of standardized single-qubit operation macros for superconducting transmon qubits.

Key API changes:
- Adds `MeasureMacro`, `ResetMacro`, `VirtualZMacro`, `DelayMacro`, and `IdMacro` as new `QubitMacro` implementations, located in `quam_builder.architecture.superconducting.custom_gates.single_qubit_gates`. These provide high-level abstractions for common gate operations.
- Refactors the `get_pulse_name` utility function into a new shared module: `quam_builder.architecture.superconducting.custom_gates.flux_tunable_transmon_pair.utils.py`.
- Introduces a new `get_pulse` utility in the same module, facilitating flexible pulse retrieval by name or direct object within macros.
- Integrates these macros into the QUAM build process: `add_default_transmon_macros` now automatically assigns these new single-qubit macros (along with `PulseMacro`s for X, Y, SX, SY gates) to `AnyTransmon` qubits when `build_quam` is called. This enhances usability and standardizes gate definitions for built architectures.
@arthurostrauss arthurostrauss requested a review from OziEgri April 3, 2026 15:07
@arthurostrauss arthurostrauss added the enhancement New feature or request label Apr 3, 2026
@OziEgri

OziEgri commented Apr 9, 2026

Copy link
Copy Markdown
Collaborator

@arthurostrauss Did you check why CI/CD tests fail?

@arthurostrauss

arthurostrauss commented May 20, 2026

Copy link
Copy Markdown
Contributor Author

@arthurostrauss Did you check why CI/CD tests fail?

It has to do with some pre-commit stuff I fail to resolve. Any help would be appreciated

arthurostrauss and others added 5 commits May 24, 2026 11:15
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Added section 5 to architecture/superconducting/README.md covering
  single-qubit macros (MeasureMacro, ResetMacro, VirtualZMacro,
  DelayMacro, IdMacro) and the CZGate two-qubit macro with pulse naming
  conventions and usage examples. Noted that gate macros are SC-only
  and CZGate requires FluxTunableTransmonPair.
- Fixed add_default_transmon_pair_macros to pass flux_pulse_qubit="const"
  (was flux_pulse_control="const"), matching the field rename in v0.4.0
  and the "const" pulse seeded by add_default_transmon_pulses.
- Updated CHANGELOG.md [Unreleased] with Added and Fixed entries.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@arthurostrauss arthurostrauss marked this pull request as ready for review May 28, 2026 04:41
@arthurostrauss

Copy link
Copy Markdown
Contributor Author

@OziEgri , this is ready for review.

@OziEgri OziEgri requested a review from Deepakkhurrana June 1, 2026 15:52
@OziEgri

OziEgri commented Jun 8, 2026

Copy link
Copy Markdown
Collaborator

@Deepakkhurrana please take a look as well.

@OziEgri OziEgri left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, asked for @Deepakkhurrana review as well

@Deepakkhurrana Deepakkhurrana left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea of the macros! I think the macro seeding needs one more pass before merge.

A general comment:

Can you add/confirm a test that runs build_quam() on a minimal SC machine and then verifies the default macros are usable, not just attached? In particular, after build_quam(), q.apply("x"), q.apply("reset"), or at least q.macros["x"].inferred_duration should not fail due to missing x180/x90/y180/y90 pulses. If the expected workflow is “run populate script first”, then we should say somewhere that these macros are only usable after population/calibration pulse seeding.

Comment thread quam_builder/builder/superconducting/add_default_macros.py
Comment thread quam_builder/architecture/superconducting/custom_gates/single_qubit_gates.py Outdated
arthurostrauss and others added 2 commits June 9, 2026 18:15
Co-authored-by: Cursor <cursoragent@cursor.com>
Rename macros.py to add_default_macros.py to match the add_default_pulses
convention. Remove add_macros from build_quam since macros should only be
populated when users add the dedicated pulse operations they reference,
which is typically done in qua-libs rather than in quam-builder.

Co-authored-by: Cursor <cursoragent@cursor.com>

@Deepakkhurrana Deepakkhurrana left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@arthurostrauss arthurostrauss merged commit d168dc5 into main Jun 11, 2026
5 checks passed
@arthurostrauss arthurostrauss deleted the feat/adding_gate_macros_sc_qubits branch June 11, 2026 01:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants