mqt.ionshuttler.linear.dd.schemes

Reusable pulse sequences for dynamical decoupling.

Module Contents

ARBITRARY_X_SCHEME_FAMILY = 'arbitrary_x'
class GateSpec[source]

Describe the rotation of one decoupling pulse.

gate_name names the rotation class, such as "Rx". A pulse applied to one ion becomes that gate; a global pulse becomes a GlobalGate with the same rotation.

gate_name: str
theta: float | None = None
class DDScheme[source]

Define pulse axes and their relative positions in an idle window.

name: str
relative_gate_times: tuple[float, ...]
gate_specs: tuple[GateSpec, ...]
allow_rounding: bool = False
__post_init__() → None[source]

Validate that every pulse has exactly one relative time.

Raises:

ValueError – If pulse times and specifications are empty or inconsistent.

property num_pulses: int

The number of pulses in this sequence.

gate_timesteps(window: tuple[int, int]) → tuple[int, ...][source]

Map relative pulse times to the nearest schedule boundaries.

Offsets are rounded to nearest with ties-to-even before adding the window start. A pulse at boundary t acts before phase accumulates over [t, t + 1).

Returns:

The schedule boundary for every pulse.

resolved_gate_timesteps(window: tuple[int, int]) → tuple[int, ...] | None[source]

Return distinct integral pulse boundaries, or None if infeasible.

With allow_rounding unset, a pulse time must already coincide with a schedule boundary within tolerance. With allow_rounding set, a pulse time is rounded to the nearest boundary and rejected only if that falls outside the window.

clamped_pulses(window: tuple[int, int]) → tuple[tuple[int, GateSpec], ...][source]

Return rounded, window-clamped, deduplicated pulse boundaries with their gate specs.

Unlike resolved_gate_timesteps(), a pulse time outside the window is clamped to the nearer boundary instead of making the sequence infeasible.

Returns:

The ordered, deduplicated (timestep, gate_spec) pairs to insert.

make_cpmg_scheme(num_pulses: int) → DDScheme[source]

Construct an evenly spaced Carr-Purcell-Meiboom-Gill sequence.

Returns:

The requested CPMG sequence.

Raises:

ValueError – If num_pulses is not an even integer of at least two.

make_arbitrary_x_scheme(num_pulses: int) → DDScheme[source]

Construct an evenly spaced sequence of X pulses.

Returns:

The requested X-pulse sequence.

Raises:

ValueError – If num_pulses is less than one.

make_xy4_scheme(k: int = 1) → DDScheme[source]

Construct an XY4 sequence repeated k times.

Returns:

The requested XY4 sequence.

make_xy8_scheme(k: int = 1) → DDScheme[source]

Construct an XY8 sequence repeated k times.

Returns:

The requested XY8 sequence.

make_xy16_scheme(k: int = 1) → DDScheme[source]

Construct an XY16 sequence repeated k times.

Returns:

The requested XY16 sequence.

make_cdd_scheme(level: int) → DDScheme[source]

Construct a recursively concatenated sequence up to level three.

Returns:

The requested concatenated sequence.

Raises:

ValueError – If level lies outside the supported range.

HAHN_ECHO
MIDPOINT_ONLY_HAHN
CPMG_2
CPMG_4
CPMG_6
CPMG_8
XY4
XY8
XY16
CDD_1
CDD_2
CDD_3
available_dd_schemes() → dict[str, DDScheme][source]

Return a copy of the registered named schemes.

dd_scheme(name: str) → DDScheme[source]

Resolve a registered scheme by name.

Returns:

The registered scheme.

Raises:

ValueError – If name is not registered.