symop.devices.models.detectors.coincidence_detector

Number-resolving measurement device model.

This module defines NumberDetector, a semantic measurement device that performs projective number measurements on selected modes.

The device constructs a semantic measurement specification describing a number-resolving measurement over the input port. The resulting semantic actions are later evaluated by backend-specific measurement kernels.

Notes

The detector supports three types of measurement queries:

  • observation: returns outcome probabilities,

  • detection: samples an outcome and optionally applies a state update,

  • postselection: conditions the state on a chosen outcome.

The measurement is defined via ProjectiveNumberMeasurementSpec and operates on the selected input paths.

Classes

CoincidenceDetector(input_ports, ...] =, ...)

Semantic joint-number coincidence detector.

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, …]