mqt.ionshuttler.linear.dd.result

Shared result and report values for Linear dynamical-decoupling passes.

Module Contents

class DDReport[source]

Bases: Protocol

Describe a method-specific report that supports JSON serialization.

report_type: ClassVar[str]
to_dict() → dict[str, object][source]

Return the report using JSON-compatible values.

classmethod from_dict(data: object) → DDReport[source]

Restore a report from JSON-compatible values.

class LocalDDSequence[source]

Describe one ion-local pulse sequence in a DD method report.

ion: int
window: tuple[int, int]
scheme_name: str
pulse_timesteps: tuple[int, ...]
action_ids: tuple[int, ...]
remaining_phase: float = 0.0
phase_reduction: float = 0.0
residual_phase_at_window_end_before: float | None = None
residual_phase_at_window_end_after: float | None = None
residual_phase_at_window_end_reduction: float | None = None
__post_init__() → None[source]

Validate pulse positions and their associated idle window.

Raises:
  • TypeError – If a sequence field has the wrong type.

  • ValueError – If the window or pulse positions are inconsistent.

to_dict() → dict[str, object][source]

Return this local sequence using JSON-compatible values.

classmethod from_dict(data: object) → LocalDDSequence[source]

Restore a local sequence from JSON-compatible values.

Returns:

The restored local DD sequence.

Raises:

ValueError – If the serialized sequence is malformed.

class DDPassResult[source]

Bases: Generic[ReportT]

Contain an augmented schedule and diagnostics from one DD pass.

schedule: ActionSchedule
architecture: Architecture
report: ReportT
unavailable_reason: str | None = None
__post_init__() → None[source]

Validate the schedule, report, and optional explanation.

Raises:
  • TypeError – If the schedule or report violates the pass-result protocol.

  • ValueError – If an unavailable reason is empty.

to_dict() → dict[str, object][source]

Return the DD-pass result using JSON-compatible values.

classmethod from_dict(data: object, report_class: type[ReportT], *, action_types: Sequence[type[Action]] | None = None, action_decoders: ActionDecoders | None = None) → DDPassResult[ReportT][source]

Restore a DD-pass result with an explicit report class.

Returns:

The restored DD-pass result.

Raises:

ValueError – If the serialized envelope or report type is malformed.

to_json() → str[source]

Serialize this DD-pass result as JSON text.

Returns:

The JSON document.

classmethod from_json(raw: str, report_class: type[ReportT], *, action_types: Sequence[type[Action]] | None = None, action_decoders: ActionDecoders | None = None) → DDPassResult[ReportT][source]

Restore a DD-pass result from JSON text.

Returns:

The restored DD-pass result.

save(filename: str | Path) → Path[source]

Write this DD-pass result to an explicit UTF-8 JSON file.

Returns:

The path written.