Skip to content

refactor: catalog-based macro registry for quantum dots#106

Open
sebastianorbell-qm wants to merge 20 commits into
release/nightlyfrom
refactor/macro-registry
Open

refactor: catalog-based macro registry for quantum dots#106
sebastianorbell-qm wants to merge 20 commits into
release/nightlyfrom
refactor/macro-registry

Conversation

@sebastianorbell-qm

Copy link
Copy Markdown
Contributor

Summary

  • Replace the old global-state macro registry with a clean, extensible catalog-protocol system (MacroCatalog protocol, MacroRegistry, MacroWirer, PulseWirer)
  • New wire_machine_macros() entry point (renamed from wire_machine) with catalogs and instance_overrides parameters for type-level and instance-level macro customization
  • Full documentation and tutorials: rewritten operations/README.md, new tutorials/calibration_workflow.ipynb (post-calibration guide), updated tutorials/macro_customization.ipynb
  • Serialization fix: added @quam_dataclass to all single-qubit macro classes so custom fields persist through save/load
  • Default readout discrimination params initialized in the build pipeline (build_qpu_stage2.py) so PSB measurement chain compiles before calibration
  • Updated all examples to use build_tutorial_machine() and the new API
  • Complete type annotations on all public API surfaces (build_quam.py builders, MacroDispatchMixin, catalog demo)

Breaking changes

  • wire_machine renamed to wire_machine_macros
  • macro_profile_path / component_overrides parameters replaced with catalogs / instance_overrides
  • Old modules removed: macro_registry.py, component_macro_catalog.py, component_pulse_catalog.py, overrides.py
  • strict parameter removed (always strict — invalid paths and DISABLED on missing macros raise KeyError)

Test plan

  • All architecture and builder tests pass (300 passed, 14 pre-existing failures from qualang_tools API drift)
  • tutorials/calibration_workflow.ipynb executes end-to-end
  • tutorials/macro_customization.ipynb executes end-to-end
  • All example files (macro_defaults_example.py, macro_overrides_example.py, full_workflow_example.py, pulse_overrides_example.py, external_macro_package_example.py) run successfully
  • Black formatting applied to all changed files
  • Pylint clean on all changed files (10.00/10)

Replace the old global-state macro registry with a clean, extensible
catalog-protocol system for quantum-dot components.

Architecture:
- MacroCatalog protocol for external package integration
- MacroRegistry aggregates catalogs by priority (low→high)
- Built-in UtilityMacroCatalog (align/wait) and DefaultMacroCatalog (MRO-based)
- TypeOverrideCatalog for ad-hoc type-level overrides
- DISABLED sentinel for macro removal via instance_overrides
- MacroWirer + PulseWirer with clean separation of concerns
- wire_machine_macros() as single user-facing entry point

Key changes:
- New macro_catalog.py and pulse_catalog.py (replace old registry modules)
- Rewritten macro_engine/wiring.py with MacroWirer and PulseWirer classes
- Renamed wire_machine to wire_machine_macros globally
- Removed strict parameter (always strict)
- Added @quam_dataclass to single-qubit macro classes for serialization
- Default readout discrimination params initialized in build pipeline
- Tutorial machine rewritten to use combined wiring workflow
- All examples updated to use build_tutorial_machine()
- Updated qualang_tools Connectivity API calls
- Complete type annotations on all public API surfaces

Documentation:
- Rewritten operations/README.md with architecture diagrams
- New tutorials/calibration_workflow.ipynb (post-calibration guide)
- Updated tutorials/macro_customization.ipynb
Migrate all test files from the deprecated Connectivity kwargs
(use_mw_fem, add_drive_lines, shared_drive_line) to the split
add_quantum_dots / add_quantum_dot_drive_lines API.
Defines a pure QuAM-reference approach where LDQubit.larmor_frequency
is the single source of truth for RF, XY drive references it, and IF
is always derived via inferred_intermediate_frequency.
Replace recenter_LO usage with direct larmor_frequency setting.
Update parameter table to reflect new frequency model.
…e values

The builder was passing intermediate_frequency as a concrete value to
XYDriveMW/IQ constructors, bypassing the reference-based auto-derivation
chain (RF_frequency → larmor_frequency, IF → inferred_intermediate_frequency).

- Remove explicit intermediate_frequency from IQ/MW constructors in
  _create_xy_drive_from_wiring so class-default references take effect
- Add _set_initial_larmor_frequency to seed larmor = LO + desired_IF
  after qubit registration, enabling the reference chain
- Set IF_LIMIT = 500 MHz on XYDriveMW (MW FEM NCO supports ±500 MHz)
- Use self.xy.IF_LIMIT in LDQubit.__setattr__ instead of hardcoded 400 MHz
- Update tutorial assertions to verify larmor and auto-derived IF
- Update MW validation tests for the new 500 MHz limit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant