dd

dd#

Full path: iqm.cpc.compiler.dd

Dynamical decoupling utilities.

We support three DD workflows, all accessible via the apply_dd_strategy() compilation pass (and hence controllable via settings):

  • Standard DD — one DDStrategy is applied to all eligible idle windows on all qubits.

  • Qubit-specific DD — different DD sequences for each qubit, defined using the qubit_specific_dd setting.

  • Idling-specific DD — individual DD sequences per idle window described using IdleWindowKey, defined using the idling_specific_dd setting. See the inspection helpers identify_idle_windows_for_settings() and display_idle_windows().

Idling-specific DD can be applied in three different ways:

Known map — provide an IdleDDMap:

settings = compiler.get_settings(circuits=circuits)
settings.stages.dynamical_decoupling.apply_dd_strategy.dd_is_disabled = False
settings.stages.dynamical_decoupling.apply_dd_strategy.idling_specific_dd = idle_dd_map
compiler.compile(circuits=circuits, settings=settings)

Inspect, then decide (for manual decisions) — run the compilation stages up to the DD stage, display the idle windows, set idling_specific_dd to the IdleDDMap you want, and then run the remaining stages:

settings = compiler.get_settings(circuits=circuits)
settings.stages.dynamical_decoupling.apply_dd_strategy.dd_is_disabled = False
stages = compiler.circuit_stages + compiler.pulse_stages
dd_idx = [stage.name for stage in stages].index("dynamical_decoupling")
context = compiler.compiler_context(components=None, settings=settings)

schedules, context = compiler.run_stages(circuits, context, stages=stages[:dd_idx])
display_idle_windows(identify_idle_windows_for_settings(schedules, context))

settings.stages.dynamical_decoupling.apply_dd_strategy.idling_specific_dd = idle_dd_map
schedules, context = compiler.run_stages(schedules, context, stages=stages[dd_idx:])
job_def, context = compiler.finalize(schedules, context)

Callable (for automated decisions) — assign a callable idling_specific_dd of the type IdleDDMapBuilder. In the DD pass it is called on all the eligible idling windows in the pre-DD schedules, and the IdleDDMap it returns is applied. Everything happens inside a single compiler.compile() call.

Module Attributes

STANDARD_DD_STRATEGY

The default DD strategy uses the following gate sequences:

IdleDDMap

Maps each eligible idle window in a schedule playlist to a DD strategy.

Functions

apply_dd_strategy(schedules, builder, context)

Insert dynamical decoupling sequences into the schedules iff dd_is_disabled is False.

display_idle_windows(idle_windows)

Pretty-print idle windows grouped by schedule index and qubit.

generate_phases_of_urn_sequence(n)

Generate PRX gate phases for the URn sequence.

identify_idle_windows_for_settings(...)

Enumerate the idle windows that the DD pass will see in the given pre-DD schedules.

insert_dd_sequences(builder, schedule, ...)

Insert dynamical decoupling sequences into the given schedule.

merge_wait_instructions_in_schedule(builder, ...)

Merge adjacent Wait instructions in the drive channels of the given schedule.

Classes

EligibleWait

One eligible Wait window enumerated by _enumerate_eligible_waits_by_qubit().

IdleDDMapBuilder

Callable form of the idling_specific_dd argument, used for automated per-window decisions.

IdleWindow

A single eligible idle (Wait) period on a specific qubit's drive channel.

IdleWindowKey

Key type for IdleDDMap: unique identifier for one eligible idle window.

Exceptions

DDError

Something was wrong in user input for dynamical decoupling.

Inheritance

Inheritance diagram of iqm.cpc.compiler.dd