symop.devices.models.phase_shifters

Phase shifter device models.

This subpackage provides semantic device models for phase-shifting operations in optical systems.

Currently, it includes:

  • PhaseShifter: a single-path device that applies a constant phase rotation to all modes associated with a selected path.

Notes

Phase shifters are fundamental linear-optical components that implement single-mode unitary transformations. In this package, they are represented at the semantic level and rely on backend kernels to perform the actual operator-level transformation.

class PhaseShifter(phi: float) None

Bases: DeviceBase

Ideal path phase shifter.

A phase shifter applies a constant phase rotation to all modes on a selected path. The transformation is represented at the operator level and affects the phase of creation and annihilation operators associated with the path.

Parameters:

phi (float) – Phase angle (in radians) applied to the selected path.

Notes

  • The phase is applied uniformly across all modes on the path.

  • Planning does not inspect the state or enumerate modes.

  • The actual operator-level rewrite is performed by the backend kernel.

_abc_impl = <_abc._abc_data object>
apply(state: State, *, ports: Mapping[str, Path], selection: object | None = None, runtime: DeviceRuntime | None = None, ctx: ApplyContext | None = None, out_kind: Literal['ket', 'density'] | None = None) State

Apply the device to a state through a runtime.

Parameters:
  • state (State) – Input quantum state.

  • ports (Mapping[str, Path]) – Mapping from device port names to path labels. Must contain the key "path".

  • selection (object | None) – Optional device-specific selection object. Not used by this device.

  • runtime (DeviceRuntime | None) – Optional runtime instance. If not provided, the default runtime is used.

  • ctx (ApplyContext | None) – Optional apply context forwarded to the runtime.

  • out_kind (Optional[Literal['ket', 'density']]) – Optional requested output state kind.

Returns:

Output state after applying the phase shifter.

Return type:

StateProtocol

Notes

This method delegates execution to the device runtime. The actual phase transformation is performed by a representation-specific kernel.

property kind: DeviceKind

Return the device kind identifier.

phi: float
plan(*, state: State, ports: Mapping[str, Path], selection: object | None = None, ctx: ApplyContext | None = None) DeviceAction

Plan a phase shift on a selected path.

Parameters:
  • state (State) – Input state. Not inspected by this device.

  • ports (Mapping[str, Path]) – Mapping from device-port names to path labels. Must contain the key "path".

  • selection (object | None) – Optional selection object forwarded by the runtime. Not used.

  • ctx (ApplyContext | None) – Optional apply context forwarded by the runtime. Not used.

Returns:

Planned action containing:

  • params["path"]: target path label

  • params["phi"]: phase angle

  • edits: always empty

Return type:

DeviceAction

Notes

Planning is purely semantic and does not modify the state or labels. The backend kernel is responsible for applying the phase rotation to all modes associated with the selected path.

property port_specs: tuple[PortSpec, ...]

Return the port specification of the device.

Returns:

A single in-place port named "path" with direction "inout".

Return type:

tuple of PortSpec

Notes

The phase shifter acts on a single path and does not create or destroy paths.

Modules

phase_shifter

Path phase shifter device.