mqt.ionshuttler.linear.dd.nearest_hahn

Nearest-feasible midpoint Hahn comparator for compiled Linear schedules.

Module Contents

NearestHahnStatus
NearestHahnSkipReason
class NearestHahnConfig[source]

Configure the schedule-preserving nearest-feasible Hahn comparator.

min_idle_timesteps: int = 2
label: str = 'NearestHahn'
__post_init__() → None[source]

Validate the comparator configuration.

Raises:
  • TypeError – If a configuration value has the wrong type.

  • ValueError – If a configuration value is outside its supported range.

class NearestHahnOpportunityRecord[source]

Describe the placement outcome for one eligible ion-local idle window.

ion: int
window: tuple[int, int]
ideal_midpoint: int
status: NearestHahnStatus
selected_timestep: int | None = None
processing_zone: str | None = None
signed_displacement: int | None = None
absolute_displacement: int | None = None
skip_reason: NearestHahnSkipReason | None = None
__post_init__() → None[source]

Validate one placement audit entry.

Raises:
  • TypeError – If a record value has the wrong type.

  • ValueError – If a record value is outside its supported range.

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

Return this record using JSON-compatible values.

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

Restore one placement record from JSON-compatible values.

Returns:

The restored record.

Raises:

ValueError – If the serialized record is malformed.

class NearestHahnReport[source]

Summarize nearest-Hahn placements and the windows it could not use.

report_type: ClassVar[str] = 'nearest_hahn'
sequences: tuple[LocalDDSequence, ...] = ()
opportunities: tuple[NearestHahnOpportunityRecord, ...] = ()
__post_init__() → None[source]

Freeze and validate the report collections.

Raises:

TypeError – If a collection contains an unexpected value.

property placed: int

The number of windows that received a pulse.

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

Return this report using JSON-compatible values.

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

Restore a nearest-Hahn report from JSON-compatible values.

Returns:

The restored report.

run_nearest_hahn(schedule: ActionSchedule, architecture: Architecture, config: NearestHahnConfig | None = None) → DDPassResult[NearestHahnReport][source]

Place one X pulse as near each eligible idle-window midpoint as the schedule allows.

The pass uses only processing-zone access the compiled trajectory already provides. It inserts no transport, never extends the makespan, and adds no physical recovery pulse, so the resulting Pauli frame persists and is discharged virtually by a consumer that corrects the terminal frame. Unlike apply_idealized_hahn(), every returned schedule is executable on the given architecture.

The pass is intended for a base schedule. Applying it to an already augmented schedule is permitted, but the returned report then owns only the pulses this call inserted.

Parameters:
  • schedule – Base schedule to augment.

  • architecture – Hardware model the schedule runs on.

  • config – Optional comparator settings.

Returns:

The augmented schedule and its complete eligible-window audit.