Detector

enum perceval.components.detector.DetectionType(value)

Type of photon detection.

Valid values are as follows:

PNR = <DetectionType.PNR: 0>

Photon Number Resolving (perfect detection)

Threshold = <DetectionType.Threshold: 1>

Threshold detection (detects 1 photon at most)

PPNR = <DetectionType.PPNR: 2>

Pseudo PNR

Mixed = <DetectionType.Mixed: 3>

Multiple DetectionType

class perceval.components.detector.Detector(n_wires=None, max_detections=None)

Interleaved detector model

Such a detector is made of one or multiple wires, each able to simultaneously detect a photon. Each photon hitting the detector is absorbed randomly by one of the wires. When photons hit the same wire, only one is detected. When they hit different wires, all are detected.

The detect method takes the number of wires into account to simulate the detection probability for each case. Having 1 wire makes the detector threshold, whereas having an infinity of them makes the detector perfectly PNR.

type n_wires:

Optional[int]

param n_wires:

Number of detecting wires in the interleaved detector. (defaults to infinity)

type max_detections:

Optional[int]

param max_detections:

Max number of photons the user is willing to read. The |max_detection> state would then mean “max_detection or more photons were detected”. (defaults to None)

See pnr(), threshold() and ppnr(n_wires, max_detections) static methods for easy detector initialization.

Example:

>>> from perceval.components import Detector
>>> ppnr_detector = Detector.ppnr(5, 2)  # Create a 5-wires interleaved detector, able to detect 1 or 2+ photons
>>> print(ppnr_detector.detect(3))       # and simulate the outcome of 3 photons hitting it at once
{
  |1>: 0.04
  |2>: 0.96
}
detect(theoretical_photons)

Returns a one mode Fock state or distribution out of a theoretical photon count hitting the detector.

Parameters:

theoretical_photons (int) – Number of photons hitting the detector simultaneously.

Return type:

BSDistribution | BasicState

Returns:

The resulting measured state or distribution of all possible measurements.

property max_detections: int

Maximum number of detected photons (None for infinity)

property name: str

Returns component name

static pnr()

Builds a perfect photon number resolving (PNR) detector.

Return type:

Detector

static ppnr(n_wires, max_detections=None)

Builds an interleaved pseudo-PNR detector.

Return type:

Detector

static threshold()

Builds a threshold detector.

Return type:

Detector

property type: DetectionType

Returns the detector type.

class perceval.components.detector.BSLayeredPPNR(bs_layers, reflectivity=0.5)

BSLayeredPPNR implements Pseudo Photon Number Resolving detection using layers of beam splitter plugged on \(2^{(number\ of\ layers)}\) threshold detectors.

Parameters:
  • bs_layers (int) – Number of beam splitter layers. Adding more layers improves the probability to detect multiple photons.

  • reflectivity (float) – Reflectivity of the beam splitters used to split photons. (defaults to 0.5)

clear_cache()

Detector simulation results are cached in each instance and may consume memory. Call this method to empty the cache.

create_circuit()

Creates the beam splitter layered circuit to simulate PPNR with threshold detectors.

Return type:

Circuit

detect(theoretical_photons)

Returns a one mode Fock state or distribution out of a theoretical photon count hitting the detector.

Parameters:

theoretical_photons (int) – Number of photons hitting the detector simultaneously.

Return type:

BSDistribution | BasicState

Returns:

The resulting measured state or distribution of all possible measurements.

property max_detections: int

Maximum number of detected photons

property name: str

Returns component name

property type: DetectionType

Returns the detector type.

perceval.components.detector.get_detection_type(detectors)

Computes a global detection type from a given list of detectors.

Parameters:

detectors (list[IDetector]) – List of detectors (None is treated as PNR).

Return type:

DetectionType

Returns:

  • DetectionType.PNR if all detectors are PNR or not set.

  • DetectionType.Threshold if all detectors are threshold.

  • DetectionType.PPNR if all detectors are PPNR.

  • else DetectionType.Mixed.