mqt.ionshuttler.linear.schedule

Executable schedules for the Linear hardware model.

Module Contents

ActionDecoder
ActionDecoders
class MachineState[source]

Describe hardware state without compiler circuit-progress fields.

positions: tuple[tuple[int, int], ...]
ions_busy_until: tuple[tuple[int, int], ...]
pzs_busy_until: tuple[tuple[str, int], ...]
time: int = 0
__post_init__() → None[source]

Normalize and validate machine-state values.

Raises:
  • TypeError – If the machine clock has the wrong type.

  • ValueError – If state mappings, occupancy, or timestamps are inconsistent.

classmethod from_compiler_state(state: State) → MachineState[source]

Copy only hardware fields from a compiler state.

Availability timestamps in a compiler state may refer to resources that became free before its current clock. The machine-only view canonicalizes those timestamps to the current clock.

Parameters:

state – Compiler state whose circuit progress is discarded.

Returns:

The canonical machine-only state.

to_replay_state() → State[source]

Return a state suitable for schedule replay.

Returns:

A compiler-state value with empty circuit-progress fields.

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

Return this machine state using JSON-compatible values.

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

Restore a machine state from JSON-compatible values.

Returns:

The restored machine-only state.

class ScheduledAction[source]

Pair one operation with an ID stable across schedule passes.

action_id: int
action: Action
__post_init__() → None[source]

Validate the action ID and value.

Raises:
class ActionSchedule[source]

Contain the immutable executable boundary shared by downstream stages.

Action IDs are unique within a schedule and remain attached to preserved actions when a transformation inserts or replaces operations. Compiler search status and dynamical-decoupling reports are intentionally absent.

scheduled_actions: tuple[ScheduledAction, ...]
num_timesteps: int
initial_state: MachineState
__post_init__() → None[source]

Freeze and validate the executable schedule.

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

  • ValueError – If identifiers or timing are inconsistent.

property path: tuple[Action, ...]

The ordered executable operations without their metadata.

property next_action_id: int

An unused identifier suitable for the next inserted action.

classmethod from_actions(actions: Sequence[Action], initial_state: State | MachineState) → ActionSchedule[source]

Create a schedule and assign deterministic action identifiers.

Parameters:
  • actions – Ordered executable operations.

  • initial_state – Initial hardware or compiler state. Compiler progress fields are deliberately discarded.

Returns:

The immutable action schedule.

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

Return the action schedule using JSON-compatible values.

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

Restore a schedule from its JSON-compatible representation.

Returns:

The restored action schedule.

Raises:

ValueError – If the action stream or metadata is malformed.

to_json() → str[source]

Serialize this schedule as JSON text.

Returns:

The JSON document.

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

Restore a schedule from JSON text.

Returns:

The restored action schedule.

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

Write this schedule to an explicit UTF-8 JSON file.

Returns:

The path written.

classmethod load(filename: str | Path, *, action_types: Sequence[type[Action]] | None = None, action_decoders: ActionDecoders | None = None) → ActionSchedule[source]

Load a schedule from an explicit UTF-8 JSON file.

Returns:

The restored action schedule.