iqm.cpc.compiler.dd.apply_dd_strategy#
- iqm.cpc.compiler.dd.apply_dd_strategy(schedules, builder, context, dd_is_disabled=True, qubit_specific_dd=None, idling_specific_dd=None, DDStrategy_merge_contiguous_waits=True, DDStrategy_target_qubits=None, DDStrategy_skip_leading_wait=True, DDStrategy_skip_trailing_wait=True, DDStrategy_gate_sequences_ratio=[9, 5, 2], DDStrategy_gate_sequences_gate_pattern_xy=['XYXYYXYX', 'YXYX', 'XX'], DDStrategy_gate_sequences_align=['asap', 'asap', 'center'])#
Insert dynamical decoupling sequences into the schedules iff
dd_is_disabledis False.By default DD is controlled by a
DDStrategy, which can be provided incontext["DDStrategy"], or as individual fields in the settings tree (theDDStrategy_*parameters). Alternatively you can override this with qubit-specific DD strategies, or idling window -specific DD strategies. The precedence of the parameters to this function (highest first) isidling_specific_dd— per-idle-window DD. May be eitheran
IdleDDMapmappingIdleWindowKeykeys toDDGateSequencelists (the longest sequence that fits in the idle window is applied) or toNone(no DD for this window).a callable
IdleDDMapBuilder. Invoked inside the pass after waits are merged and idle windows enumerated, but before any DD pulse is applied.
Idle windows not in the map use the default DD sequence defined in
DDStrategy, if any.To inspect the idle windows before choosing an
idling_specific_ddmap, see the workflow iniqm.cpc.compiler.dd.qubit_specific_dd— per-qubit DD. Maps qubit name to the DD sequence applied on that qubit, orNone(no DD for this qubit). Qubits not in the map use the default DD strategy, if any.context["DDStrategy"], describing the global default DD strategy.DDStrategybuilt from the individualDDStrategy_*parameters. These are initialized toSTANDARD_DD_STRATEGYin the settings tree, so the standard strategy is the default unless you change them.
Note
qubit_specific_ddandidling_specific_ddare compile-only settings: their values cannot be serialized (e.g. callables and dicts), so this pass removes them fromcontext["settings"]when it finishes.- Parameters:
schedules (list[Schedule]) – Schedules representing the compiled circuits.
builder (ScheduleBuilder) – The ScheduleBuilder.
dd_is_disabled (bool) – Set to
Falseto enable dynamical decoupling.qubit_specific_dd (dict[str, list[DDGateSequence] | None] | None) – Per-qubit DD map. Maps physical qubit name to the DD sequences applied to idle windows on that qubit, or
Noneto mean no DD sequence is applied on that qubit. Qubits not in the map use the default DD strategy.idling_specific_dd (dict[IdleWindowKey, list[DDGateSequence] | None] | IdleDDMapBuilder | None) – Per-idle-window DD. Either an
IdleDDMap(dict fromIdleWindowKeyto agate_sequenceslist orNone), or anIdleDDMapBuildercallablefn(idle_windows, schedules, builder) -> IdleDDMap | None(useful for automated decisions — see the module docstring ofiqm.cpc.compiler.dd).DDStrategy_merge_contiguous_waits (bool) – Whether to merge contiguous waits (see
DDStrategy).DDStrategy_target_qubits (list[str] | None) – The qubits to which DD is applied (
Nonemeans apply to every applicable qubit).DDStrategy_skip_leading_wait (bool) – Whether to skip leading waits (see
DDStrategy).DDStrategy_skip_trailing_wait (bool) – Whether to skip trailing waits (see
DDStrategy).DDStrategy_gate_sequences_ratio (list[int]) – Minimal durations for the Wait to be replaced with the DD sequence (in PRX gate durations) in the DD sequence. Defaults to the ratios of
STANDARD_DD_STRATEGY.DDStrategy_gate_sequences_gate_pattern_xy (list[str]) – XY Gate patterns in the DD sequence. If you want to provide custom PRX angles instead of XY patterns, you must provide the DDStrategy in the Compiler context. Defaults to the gate patterns of
STANDARD_DD_STRATEGY.DDStrategy_gate_sequences_align (list[str]) –
Alignments in the DD sequence (“asap”, “alap” or “center”). Defaults to the alignments of
STANDARD_DD_STRATEGY.These three parameters are parallel lists defining the default DD strategy, and must have the same length. Setting any of them to an empty list means there is no default DD strategy.
- Returns:
The schedules where applicable Waits are replaced with DD sequences.
- Return type: