Feat/add cr and cz macros#14
Conversation
…y call on the z line, not the coupler line.
| from quam.components.pulses import Pulse, ReadoutPulse | ||
| from quam.core import quam_dataclass | ||
| from quam.utils.qua_types import QuaVariableBool, QuaVariableFloat, QuaVariableInt | ||
|
|
There was a problem hiding this comment.
Is there a reason for not using the framework that the IQCC team is using?
Especially with
@quam_dataclass
class TwoQubitGate(QuamComponent, ABC):
extras: Dict[str, Any] = field(default_factory=dict)
@property
def transmon_pair(self):
from ..transmon_pair import TransmonPair
if isinstance(self.parent, TransmonPair):
return self.parent
elif hasattr(self.parent, "parent") and isinstance(self.parent.parent, TransmonPair):
return self.parent.parent
else:
raise AttributeError("TwoQubitGate is not attached to a QubitPair. 2Q_gate: {self}")
@property
def qubit_control(self):
return self.transmon_pair.qubit_control
@property
def qubit_target(self):
return self.transmon_pair.qubit_target
@property
def coupler(self):
return self.transmon_pair.coupler
def __call__(self):
self.execute()
@quam_dataclass
class CZGate(TwoQubitGate):
"""CZ Operation for a qubit pair"""
There was a problem hiding this comment.
The implementation here seems to be more general and can be attached to any qubit type. Any recommendation for when to extend the class and when to use macro?
There was a problem hiding this comment.
In terms of consistency with the other custom_gates, cross_resonance is also implemented as macro. We could refactor this, but what is your current thought? My thought right now is that macro works because the implementation depends on what user have and can choose which appropriate gate to attached rather than being pre-defined.
There was a problem hiding this comment.
I recently discussed it with @nulinspiratie and his advice is to use the Gate macros for 1 and 2 qubit gates and keep using the standard methods for other functions such as reset, readout...
There was a problem hiding this comment.
@TheoLaudatQM I'd prefer consistency and open for changes. Here the class inherits quam.components.macro.QubitPairMacro. The IQCC implementation inherits TwoQubitGate(QuamComponent, ABC). Which approach should we take here? @nulinspiratie
| qua_T = QuaVariable | QuaExpression | ||
|
|
||
|
|
||
| @quam_dataclass |
There was a problem hiding this comment.
The apply method in this class seems too big. I would recommend splitting it up into several methods. For example, each cr_type should be its own method or function. Also, I would expect that many of the parameters in apply are actually gate parameters similar to zz_correction_phase
There was a problem hiding this comment.
@nulinspiratie Refactored the macro and decomposed them to methods. There are many parameters but many of them are for the operations (pulses) of involved elements. Is there a better way to manage these?
The location of the file was moved to: custom_gates/fixed_transmon_pair/two_qubit_gates.py following the changes in the flux tunable one.
…rm/quam-builder into feat/add-cr-cz-macros
commit a08bf66 Author: Kyung-hoon-Jung0 <kyunghoon.jung@quantum-machines.co> Date: Wed Jun 17 12:17:29 2026 +0900 feat: add CRGate macro + CR gate-level fields (cross-resonance on flux-tunable pairs) - CrossResonanceBase: add drive/cancel amplitude_scaling + phase and qc/qt correction_phase gate-level fields (defaults = identity; keeps target_qubit_LO/IF so the populate builder stays compatible). - custom_gates/fixed_transmon_pair/two_qubit_gates.py: CRGate + StarkInducedCZGate macros (self-contained: quam macro + qm.qua only). Enables qp.apply('cr', ...) for direct / direct+echo / direct+cancel(+echo) on any pair carrying a cross_resonance element + qubit_control/target. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> commit 9133369 Author: Kyung-hoon-Jung0 <kyunghoon.jung@quantum-machines.co> Date: Tue Jun 16 23:41:29 2026 +0900 feat: add cross_resonance and zz_drive to FluxTunableTransmonPair Mirror FixedFrequencyTransmonPair: add optional CrossResonanceMW/IQ and ZZDriveMW/IQ components (default None, backwards-compatible) and include them in align()/wait(). Enables microwave cross-resonance two-qubit gates on flux-tunable transmon pairs (CR drive reuses the control qubit's xy MW-FEM port via a second upconverter), without affecting existing CZ-via-coupler states. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> commit 7c10f88 Author: Kyung-hoon-Jung0 <kyunghoon.jung@quantum-machines.co> Date: Wed Jun 3 08:11:05 2026 +0900 feat: add TWPA component build pipeline Build TWPAs from the wiring spec so they participate in the same build_quam pass as qubits and qubit_pairs. Each TWPA pump line is materialized as two MW elements that share a single physical port: - pump : sticky -- continuous output for use during measurements - pump_ : non-sticky -- used during TWPA calibration sweeps Changes - arch: add active_twpa_names on BaseQuam; bind TWPA as twpa_type on FluxTunableQuam so build_quam can instantiate the right class. - wirer: register TWPA_PUMP ("p") -> ElementCategory.TWPA and add TwpaWiringStrategy, which emits both pump/ and pump_/ sub-paths pointing to the same allocated port (matches the known-good KRISS TWPA state layout). Note: TWPA_PUMP.value collides with PLUNGER_GATE.value; registering TWPA last makes "p" mean TWPA for superconducting setups (intended). Quantum-dot setups using plunger gates should pass a custom registry to create_wiring. - builder: new add_twpa_pump_component(twpa, wiring_path, ports, *, attr, sticky) that builds an MWChannel on the requested TWPA attribute. build_quam.add_twpas() calls it for "pump" and "pump_" line types and appends to machine.active_twpa_names. - pulses: add_default_twpa_pulses registers the default 20000 ns / amp=1 SquarePulse "pump" / "pump_" operations (amplitude is scaled at play time by pump_amplitude). - add_pulses now invokes add_default_twpa_pulses for every twpa. No changes to existing qubit / qubit_pair / readout behavior; the new add_twpas pass is a no-op when the wiring has no "twpas" section. commit 02cb9ce Author: Kyung-hoon-Jung0 <Kyunghoon.Jung@quantum-machines.co> Date: Sun May 17 10:48:43 2026 +0900 fix: correct reset_qubit_active_gef bugs Co-authored-by: Cursor <cursoragent@cursor.com> commit 2ae52d0 Merge: 205f58b 54981bd Author: paulQM <paul.jamet@quantum-machines.co> Date: Mon May 11 22:43:13 2026 +0200 Merge branch 'refactor/add-moving-qubit' of https://github.com/qua-platform/quam-builder into refactor/add-moving-qubit commit 205f58b Author: paulQM <paul.jamet@quantum-machines.co> Date: Mon May 11 22:42:51 2026 +0200 use readout_GEF commit 54981bd Merge: 75aea34 8f6c120 Author: Kyung-hoon-Jung0 <Kyunghoon.Jung@quantum-machines.co> Date: Mon May 11 16:27:09 2026 +0900 Merge pull request #113 from qua-platform/Kyung-hoon-Jung0-patch-1 add attribute 'moving_qubit' in CZ commit 8f6c120 Author: Kyung-hoon-Jung0 <Kyunghoon.Jung@quantum-machines.co> Date: Mon May 11 16:26:24 2026 +0900 add attribute 'moving_qubit' in CZ Added support for moving qubit attribute and updated method signatures. commit 75aea34 Author: paulQM <paul.jamet@quantum-machines.co> Date: Wed Apr 8 09:26:34 2026 -0700 fix: align coupler element with qubits in CZGate apply Use qm.qua.align directly with channel names so the coupler (a SingleChannel, not a Qubit) is properly included in the initial and final alignment of the CZ gate. Made-with: Cursor commit 984e686 Author: paulQM <paul.jamet@quantum-machines.co> Date: Thu Apr 2 14:31:06 2026 -0700 fix commit 67ea0bb Author: Paul Jamet <113030828+paulQM@users.noreply.github.com> Date: Mon Mar 30 23:44:52 2026 +0200 bug fix. bad attribute commit 0c051e0 Author: Paul Jamet <113030828+paulQM@users.noreply.github.com> Date: Sun Mar 29 19:16:45 2026 -0400 Modify qualang-tools dependency source Updated the qualang-tools dependency to use the main branch. commit 8fdf0a6 Author: paulQM <paul.jamet@quantum-machines.co> Date: Mon Feb 16 09:55:57 2026 +0100 feat: add moving qubit to qubit pair commit f84e622 Author: KU-QM <kalid.ulas@quantum-machines.co> Date: Fri Feb 6 19:59:59 2026 +0000 feat: quantum dots architecture, wiring infrastructure, and test suite (#23) Add comprehensive quantum dot support including: - Architecture: components (barriers, sensors, plungers, reservoirs, XY drives), QPU hierarchy (BaseQuamQD, LossDiVincenzoQuam), qubit/qubit-pair definitions, voltage sequence and virtual gate management, operations and macros - Builder: two-stage QPU build pipeline (wiring → assembly), QOP connectivity with automatic port allocation and line-type strategies - Tools: voltage macro system (step/ramp/conditional/measure macros), composable macro framework, voltage sequence enhancements - Tests: component tests, builder tests, macro tests, virtual gate tests, wiring integration tests, pylint plugin tests - Infrastructure: pre-commit hooks, CI workflow, pylint QUA plugin, GitHub issue/PR templates Co-authored-by: sebastianorbell-qm <Sebastian.Orbell@quantum-machines.co> Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> commit 0d00b15 Author: TorbjornRasmussenQM <torbjorn.rasmussen@quantum-machines.co> Date: Fri Feb 6 17:30:26 2026 +0100 Fixed ordering of ramp_duration and duration arguements to VoltageSequence.ramp_to_voltages and ramp_to_point. (#78) commit a7cb1ae Author: KU-QM <kalid.ulas@quantum-machines.co> Date: Fri Jan 9 09:54:03 2026 +0000 Fixed to only calculate ramp rate in QUA if the rate is already a QUA variable (#59) commit e3683ff Author: Cheng-Han-iqcc <Cheng-Han.Lo@quantum-machines.co> Date: Fri Dec 19 10:12:44 2025 +0200 Add spectator qubit control to cz (#38) * Add spectator qubit support in CZGate class - Introduced optional parameters for spectator qubits, including names, control pulses, and phase shifts. - Updated the alignment logic to incorporate spectator qubits during flux operations. - Enhanced documentation to reflect the new attributes and their usage. * Fix typo in CZGate class for spectator qubits phase shift dictionary - Corrected the spelling of 'spectator_qubits_phase_shift' in the CZGate class to ensure proper functionality. - Updated the corresponding reference in the phase shift application loop. * Enhance CZGate phase shift handling for spectator qubits - Added a condition to apply phase shifts only if their absolute value exceeds a small threshold, improving numerical stability and performance. - This change ensures that negligible phase shifts do not affect the gate operations. * Add duration_control parameter and fix spectator qubit pulse handling in CZ gate * Bump version to 0.2.2 in pyproject.toml * Update CHANGELOG for version 0.2.2 * Remove unused sdist sources configuration from pyproject.toml * Update version to 0.2.0 in pyproject.toml and updated changelog * Add spectator qubit control to CZ gate Add detailed spectator qubit documentation and clean up imports --------- Co-authored-by: omrieoqm <omrie.ovdat@quantum-machines.co> commit 2877a70 Author: Jeongwon Kim <kim.jeongwon@quantum-machines.co> Date: Wed Dec 10 12:32:01 2025 +0200 Add TWPA component and integrate into QPU initialization (#48) * Add TWPA component and integrate into QPU initialization - Introduced a new TWPA class for handling TWPA components. - Updated BaseQuam to include a dictionary for TWPA instances. - Enhanced FluxTunableQuam to initialize TWPA components during QPU setup. - Added frequency update logic for TWPA pumps in the initialization process. * Refactor TWPA initialization logic in FluxTunableQuam - Simplified the initialization of TWPA components by delegating the frequency update and pump play logic to the TWPA class. - Removed direct frequency update calls from FluxTunableQuam and replaced them with a call to the new initialize method in the TWPA class. - Enhanced the TWPA class to manage its own initialization state and frequency updates. * twpa.py moved to componenets * small import fix * Refactor TWPA initialization and state management - Renamed the initialization flag from `initialize` to `with_initialization` for clarity. - Introduced a class-level set `_initialized_ids` to track initialized TWPA instances, preventing redundant initialization. - Updated the `initialize` method to utilize the new flag and manage initialization state more effectively. - Adjusted the `initialize_twpas` method in `FluxTunableQuam` to call the updated initialization logic. * twpa initialization integrated into intialize_qpu() * removed reference! --------- Co-authored-by: omrieoqm <omrie.ovdat@quantum-machines.co> Co-authored-by: KimJeongwon <kimjeongwon315@mail.com> commit 1bd02cf Author: TheoLaudatQM <98808790+TheoLaudatQM@users.noreply.github.com> Date: Tue Dec 9 09:51:28 2025 +0100 Bump version 0.2.1 (#53) commit 87bd52a Author: omrieoqm <omrie.ovdat@quantum-machines.co> Date: Fri Dec 5 12:23:43 2025 +0200 fix active reset bug (#37) * Refactor alignment calls in BaseTransmon class * Replace direct calls to self.align() with self.xy.align(self.resonator.name) for improved performance. * Update CHANGELOG and bump version to 0.2.1 * Updated version in pyproject.toml to 0.2.1. * bumped version back to 0.2.0 * changelog --------- Co-authored-by: TheoQM <theo@quantum-machines.co> commit e160d9c Author: KU-QM <kalid.ulas@quantum-machines.co> Date: Tue Dec 2 10:25:26 2025 +0000 feat/attenuation handling (#35) * Changed half_max_square validation and attenuation handling * simplified code * remove imports * Minor tweaks * fixed capitalisation * fixed compensation pulse * delete comments * remove prefactor * changed attenuation default to 8 * updated tests with attenuation * remove plot from one test * smaller default max_voltage for the compensation, and validator * added bool check * Clearer error message * Removed division from QUA programme. Now pre-computed upon init * delta_v a newly declared QUA variable * enforce qua calcs added to voltage_sequence (#36) * enforce qua calcs added to voltage_sequence * attenuation handling improvements --------- Co-authored-by: KU-QM <kalid.ulas@quantum-machines.co> * Bug fixes --------- Co-authored-by: TorbjornRasmussenQM <torbjorn.rasmussen@quantum-machines.co> commit 9c92471 Author: Serwan Asaad <serwan.asaad@quantum-machines.co> Date: Mon Nov 10 20:27:02 2025 +0100 Refactor QMM connection logic with use_custom_qmm flag (#29) * Refactor QMM connection logic with use_custom_qmm flag - Add use_custom_qmm boolean flag to network configuration for explicit QMM control - Refactor settings handling into separate methods for better separation of concerns: - _get_default_qmm_settings(): Only uses host, cluster_name, octave, port (ignores qmm_settings) - _get_custom_qmm_settings(): Requires and returns qmm_settings directly - Add _is_custom_qmm() helper method to determine QMM type - Update _get_qmm_class() to handle use_custom_qmm flag logic: - True: requires qmm_class - False: always uses default QuantumMachinesManager - Undefined: checks for qmm_class presence (backward compatible) - Update connect() method to use new structure with clear branching - Improve documentation with detailed docstrings * update changelog commit eb7b690 Author: Nicolas Staudenmaier <33688677+NicolasStaudenmaier@users.noreply.github.com> Date: Thu Nov 6 09:31:18 2025 +0100 Add analog output to SPCM analog input (#28) * Add analog output to SPCM analog input. commit b819655 Author: TorbjornRasmussenQM <torbjorn.rasmussen@quantum-machines.co> Date: Fri Oct 31 15:41:52 2025 +0100 Feat/voltage-sequence (#20) Working VoltageSequence for GateSet and VirtualGateSet. Default behaviour for VoltageSequence is now to remember it's last point and update virtual gates as required instead of setting unspecified ones to 0, can be turned off when instantiating VoltageSequence. Also some enforced setting voltages to 0 occurs when applying the compensation pulse, this is to ensure calculations are performed at 0 offset. commit 361e888 Author: Serwan Asaad <serwan.asaad@quantum-machines.co> Date: Fri Oct 31 11:14:14 2025 +0100 Feat: Support Cloud-Based Quantum Machines Manager (#11) * Feat: Support cloud-based QMM * separate connect method * update docstring * Update changelog commit 971f138 Author: TheoLaudatQM <98808790+TheoLaudatQM@users.noreply.github.com> Date: Wed Oct 29 10:42:06 2025 +0100 Bump version 0.2.0 (#25) commit a9a69b6 Author: TheoLaudatQM <98808790+TheoLaudatQM@users.noreply.github.com> Date: Mon Oct 27 11:24:59 2025 +0100 Feat/gate fidelity (#21) * Add fidelity and extras and dict * changelog
Implements macros for CR and CZ gates on transmons (both flux tunable and fixed with fixed and tunable couplers)
Contains also fixes: