symop.devices.models.detectors

Measurement device models.

This package contains semantic models of measurement devices used to extract classical information from quantum states.

Detector models define how measurement targets, resolutions, and readouts are constructed. They do not perform the measurement themselves; instead, they produce semantic measurement actions that are evaluated by backend-specific measurement kernels.

Supported measurement types include:

  • single-mode number detection,

  • joint (coincidence) measurements across multiple ports,

  • POVM-based detectors,

  • postselection and conditional measurements.

Notes

All detectors in this package are representation-independent and operate at the planning level. The numerical evaluation of measurement outcomes is delegated to measurement kernels.

Additional detector types that naturally fit here include:

  • threshold detectors,

  • time-resolved detectors,

  • homodyne and heterodyne detectors,

  • imperfect detectors (with loss, dark counts, jitter),

  • adaptive or feedback-based measurement devices.

class CoincidenceDetector(input_ports: tuple[str, ...]=<factory>, destructive: bool = True) None

Bases: MeasurementDeviceBase

Semantic joint-number coincidence detector.

This device performs a joint photon-number measurement across multiple logical detector ports.

Parameters:
  • input_ports (tuple[str, ...]) – Names of logical input ports participating in the joint measurement.

  • destructive (bool) – Whether selective measurements discard the measured subsystem.

_abc_impl = <_abc._abc_data object>
_build_spec(*, ports: Mapping[str, Path]) ProjectiveNumberMeasurementSpec

Construct the number-measurement specification.

Parameters:

ports (Mapping[str, Path]) – Mapping from device ports to paths.

Returns:

Measurement specification defining a number-resolving measurement.

Return type:

ProjectiveNumberMeasurementSpec

_build_target(*, ports: Mapping[str, Path]) MeasurementTarget

Construct the measurement target.

Parameters:

ports (Mapping[str, Path]) – Mapping from device ports to paths.

Returns:

Target describing the selected input modes.

Return type:

MeasurementTarget

destructive: bool = True
input_ports: tuple[str, ...]
property kind: DeviceKind

Return the device kind identifier.

plan_detect(*, state: State, ports: Mapping[str, Path], selection: object | None = None, ctx: ApplyContext | None = None) DetectAction

Plan a detection query.

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

  • ports (Mapping[str, Path]) – Mapping from device ports to paths.

  • selection (object | None) – Optional selection object (unused).

  • ctx (ApplyContext | None) – Optional apply context (unused).

Returns:

Semantic action requesting a sampled measurement outcome.

Return type:

DetectAction

plan_observe(*, state: State, ports: Mapping[str, Path], selection: object | None = None, ctx: ApplyContext | None = None) ObserveAction

Plan an observation query.

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

  • ports (Mapping[str, Path]) – Mapping from device ports to paths.

  • selection (object | None) – Optional selection object (unused).

  • ctx (ApplyContext | None) – Optional apply context (unused).

Returns:

Semantic action requesting outcome probabilities.

Return type:

ObserveAction

plan_postselect(*, state: State, outcome: MeasurementOutcome, ports: Mapping[str, Path], selection: object | None = None, ctx: ApplyContext | None = None) PostselectAction

Plan a postselection query.

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

  • outcome (MeasurementOutcome) – Measurement outcome to condition on.

  • ports (Mapping[str, Path]) – Mapping from device ports to paths.

  • selection (object | None) – Optional selection object (unused).

  • ctx (ApplyContext | None) – Optional apply context (unused).

Returns:

Semantic action conditioning the state on the selected outcome.

Return type:

PostselectAction

property port_specs: tuple[PortSpec, ...]

Return the declared port interface.

Returns:

Single input port named "in".

Return type:

tuple[PortSpec, …]

class NumberDetector(destructive: bool = True) None

Bases: MeasurementDeviceBase

Semantic number-measurement device.

This device performs projective number measurements on modes associated with its input port.

Parameters:

destructive (bool) – Whether the measurement should discard the measured subsystem after a selective update (for detection and postselection).

_abc_impl = <_abc._abc_data object>
_build_spec(*, ports: Mapping[str, Path]) ProjectiveNumberMeasurementSpec

Construct the number-measurement specification.

Parameters:

ports (Mapping[str, Path]) – Mapping from device ports to paths.

Returns:

Measurement specification defining a number-resolving measurement.

Return type:

ProjectiveNumberMeasurementSpec

_build_target(*, ports: Mapping[str, Path]) MeasurementTarget

Construct the measurement target.

Parameters:

ports (Mapping[str, Path]) – Mapping from device ports to paths.

Returns:

Target describing the selected input modes.

Return type:

MeasurementTarget

destructive: bool = True
property kind: DeviceKind

Return the device kind identifier.

plan_detect(*, state: State, ports: Mapping[str, Path], selection: object | None = None, ctx: ApplyContext | None = None) DetectAction

Plan a detection query.

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

  • ports (Mapping[str, Path]) – Mapping from device ports to paths.

  • selection (object | None) – Optional selection object (unused).

  • ctx (ApplyContext | None) – Optional apply context (unused).

Returns:

Semantic action requesting a sampled measurement outcome.

Return type:

DetectAction

plan_observe(*, state: State, ports: Mapping[str, Path], selection: object | None = None, ctx: ApplyContext | None = None) ObserveAction

Plan an observation query.

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

  • ports (Mapping[str, Path]) – Mapping from device ports to paths.

  • selection (object | None) – Optional selection object (unused).

  • ctx (ApplyContext | None) – Optional apply context (unused).

Returns:

Semantic action requesting outcome probabilities.

Return type:

ObserveAction

plan_postselect(*, state: State, outcome: MeasurementOutcome, ports: Mapping[str, Path], selection: object | None = None, ctx: ApplyContext | None = None) PostselectAction

Plan a postselection query.

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

  • outcome (MeasurementOutcome) – Measurement outcome to condition on.

  • ports (Mapping[str, Path]) – Mapping from device ports to paths.

  • selection (object | None) – Optional selection object (unused).

  • ctx (ApplyContext | None) – Optional apply context (unused).

Returns:

Semantic action conditioning the state on the selected outcome.

Return type:

PostselectAction

property port_specs: tuple[PortSpec, ...]

Return the declared port interface.

Returns:

Single input port named "in".

Return type:

tuple[PortSpec, …]

Modules

coincidence_detector

Number-resolving measurement device model.

number_detector

Number-resolving measurement device model.

povm_detector

POVM Detection is not implemented.