detectors module

class detectors.BSMDetector(name, p_dark=0.0, det_eff=1.0, visibility=1.0, num_resolving=False, dead_time=0.0, allow_multiple_successful_modes=False)[source]

Bases: TwinDetector

Component that performs a photon-based probabilistic Bell-state measurement (BSM) using linear optics. Supports single-rail (presence-absence) and dual-rail encoding for single-qubit states and multiplexing.

Schematic of setup:

        --------------------
        |   /|             |
cout0 : > A( |===     =====< : qin0
        |   \|   \\ //     |
        |       ------ BS  |
        |   /|   // \\     |
cout1 : > B( |===     =====< : qin1
        |   \|             |
        --------------------

Contains a single beam splitter (BS), which interferes incoming photons, and two photon detectors A and B. Two input ports qin0 and qin1 handle register incoming qubits, after which a (possibly noisy) measurement is done. The measurement outcome, successful mode (if any) and optional additional information are transmitted using output ports cout0 and cout1. Measurements are only possible for single-qubit states in either presence-absence or dual-rail encoding, and only performed when the two messages arrive simultaneously. The is_number_state property of the received qubits is used to determine whether single-rail encoding or dual-rail encoding is used. The number of multiplexing modes is automatically identified by the number of qubits in the received messages.

Parameters:
  • name (str) – Name of detector.

  • p_dark (float, optional) – Dark-count probability, i.e. probability of measuring a photon while no photon was present, per detector.

  • det_eff (float, optional) – Efficiency per detector, i.e. the probability of detecting an incoming photon.

  • visibility (float, optional) – Visibility of the Hong-Ou-Mandel dip, also referred to as the photon indistinguishability.

  • num_resolving (bool, optional) – If set to True, photon-number-resolving detectors will be used, otherwise threshold detectors.

  • dead_time (float, optional) – Time after the measurement in which the detectors can’t be triggered. It is possible for qubits to propagate through the system during the dead time. Qubits that would arrive at the detectors during their dead_time are discarded when they enter the system.

  • allow_multiple_successful_modes (bool, optional) – If set to True, multiple modes can be successful otherwise the detector stops measuring after the first successful mode.

measure()[source]

Perform a measurement on the received qubits.

Applies preprocessing to the qubits before the measurement, and applies postprocessing to the measured classical outcomes. After the measurement all qubits are discarded.

Override of superclass method to support multiplexed measurements and dual-rail encoded qubit measurements. If some of the parameters have changed, the measurement operators are reset. First the correct qubit-pair per mode is selected. If the qubits are in presence-absence encoding, we can measure the qubits directly, but for dual-rail encoding we first transform the qubits to two single-mode qubits and perform the double-click scheme. The qubit encoding is determined from the is_number_state property. All the raw measurement outcomes (int) are transformed to a BSMOutcome. Additionally, the successful mode (if any) is transmitted as the meta information of the classical output message.

Raises:

QuantumDetectorError – If the is_number_state property is not the same for the pair of qubits.

postprocess_outputs(dict_port_outcomes)[source]

Functionality incorporated in measure()

preprocess_inputs()[source]

Functionality incorporated in measure()

class detectors.BSMOutcome(success: bool, bell_index: BellIndex = -1)[source]

Bases: object

Possible outcomes of a photon-based Bell state measurement (BSM), caused by either a successful single-photon measurement, or a combination of photon losses and dark counts (see BSMDetector._set_meas_operators()).

success

Denotes whether the measurement was a success. It has value True if exactly one photon was detected in one of the detectors, while zero photons were detected at the other one. In case of dual-rail encoding, this must occur twice in each mode. In all other cases, the BSM is not successful.

Type:

bool

bell_index

Denotes the Bell index of the state, which is only relevant in case the BSM is successful. Must be either BellIndex.PSI_PLUS or BellIndex.PSI_MINUS. Default value set to -1 to force a user to set the correct BellIndex.

Type:

BellIndex

exception detectors.ModeError[source]

Bases: Exception

Different numbers of modes coming from sources.

class detectors.QKDDetector(name, measurement_basis='Z', p_dark=0.0, det_eff=1.0, visibility=1.0, num_resolving=False, dead_time=0.0)[source]

Bases: TwinDetector

Detector able to perform photon-based qubit measurements in three bases (X, Y and Z).

Outcomes can be used to extract a secret key from entangled states used for quantum key distribution (QKD).

Schematic of setup:

Without beam splitter (Z basis)   With beam splitter (BS) and phase shifter (PS)(X and Y bases)
        ----------------                      -----------------------
        |   /|         |                      |   /|           PS   |
        | A( |=========< : qin0               | A( |===     ==|xx|==< : qin0
        |   \|         |                      |   \|   \\ //        |
cout0 : >              |              cout0 : >       ------ BS     |
        |   /|         |                      |   /|   // \\        |
        | B( |=========< : qin1               | B( |===     ========< : qin1
        |   \|         |                      |   \|                |
        ----------------                      -----------------------

Able to perform measurements in both single and dual-rail encodings. If a list of qubits is received simultaneously on both input ports, single-rail encoding is assumed to be used. If a list of qubits is only received on the qin0 port, dual-rail encoding is assumed to be used. The qubits are then converted into two single-rail qubits each. Depending on the measurement basis, a different setup is used. Measurements in the Z basis are performed by directly measuring the incoming qubits. For measurements in the X basis, the incoming qubits are first interfered on a beam splitter. For measurements in the Y basis, a phase shift is additionally applied to one of the two qubits. The measurement outcome is transmitted using a single classical output port cout0.

Parameters:
  • name (str) – Name of detector.

  • measurement_basis (str in ['X', 'Y', 'Z']) – Measurement basis in which the incoming qubits are measured.

  • p_dark (float, optional) – Dark-count probability, i.e. probability of measuring a photon while no photon was present, per detector.

  • det_eff (float, optional) – Efficiency per detector, i.e. the probability of detecting an incoming photon.

  • visibility (float, optional) – Visibility of the Hong-Ou-Mandel dip, also referred to as the photon indistinguishability.

  • num_resolving (bool, optional) – If set to True, photon-number-resolving detectors will be used, otherwise threshold detectors.

  • dead_time (float, optional) – Time after the measurement in which the detectors can’t be triggered. It is possible for qubits to propagate through the system during the dead time. Qubits that would arrive at the detectors during their dead_time are discarded when they enter the system.

measure()[source]

Perform a measurement on the received qubits.

Applies preprocessing to the qubits before the measurement, and applies postprocessing to the measured classical outcomes. After the measurement all qubits are discarded.

Override of superclass method to support multiplexed measurements and dual-rail encoded qubit measurements. If some of the parameters have changed, the measurement operators are reset. First the correct qubit-pair per mode is selected. If the qubits are in presence-absence encoding, we can measure the qubits directly, but for dual-rail encoding we first transform the qubits to two single-mode qubits and perform the double-click scheme. The qubit encoding is determined from the is_number_state property. All the raw measurement outcomes (int) are transformed to a BSMOutcome. Additionally, the successful mode (if any) is transmitted as the meta information of the classical output message.

Raises:

QuantumDetectorError – If the is_number_state property is not the same for the pair of qubits.

class detectors.QKDOutcome(success: bool, measurement_basis: str, outcome: int)[source]

Bases: object

Possible outcomes of a photon measurement that can be used for quantum-key distribution (QKD). A measurement can be performed in three bases (X, Y or Z), and the measurement outcome can be either 0 or 1.

success

Denotes whether the measurement was a success. It has value True if exactly one photon was detected in one of the detectors, while zero photons were detected at the other one.

Type:

bool

outcome

Denotes the measurement outcome, which is only relevant in case the measurement is successful. Must be either 0 or 1. Note that these values are in principle interchangable and completely rely on convention.

Type:

int in [0, 1]

measurement_basis

Measurement basis that is used during the measurement. In the Z basis two photons are measured independently, while for the X and Y basis the two incoming photons are interfered using a beam splitter, where for the Y basis an additional phase shift is applied to one of the two photons.

Type:

str in [‘X’, ‘Y’, ‘Z’]

class detectors.TwinDetector(name: str, p_dark: float, det_eff: float, visibility: float, num_resolving: bool, num_input_ports: int, num_output_ports: int, meas_operators: list, output_meta: dict, dead_time: float)[source]

Bases: QuantumDetector

Component that contains two detectors which serves as a base class for the BSM and QKD detectors. Contains the POVMs for setups with and without a beam splitter that interferes the incoming qubits.

Schematic of setup:

      Without beam splitter                  With beam splitter (BS)
        ----------------                      --------------------
        |   /|         |                      |   /|             |
cout0 : > A( |=========< : qin0       cout0 : > A( |===     =====< : qin0
        |   \|         |                      |   \|   \\ //     |
        |              |                      |       ------ BS  |
        |   /|         |                      |   /|   // \\     |
cout1 : > B( |=========< : qin1       cout1 : > B( |===     =====< : qin1
        |   \|         |                      |   \|             |
        ----------------                      --------------------

The two detectors are labeled A and B and for the input and output ports the default names qin0, qin1, cout0 and cout1 are used. Can represent a setup with or without a single beam splitter, based on which measurement operators are set. The Hong-Ou-Mandel interference visibility of the beam splitter can be tuned to represent for example a delay between the arrival times of two incoming photons. The detectors can perform noisy measurements based on the values of the dark count probability and (quantum) detection efficiency parameters. The two input ports qin0 and qin1 handle register incoming qubits, after which a (possibly noisy) measurement is done. The measurement outcome and any additional information are transmitted using output ports cout0 and cout1. Measurements are only possible for single-qubit states in either presence-absence or dual-rail encoding, and only performed when the two messages arrive simultaneously. The is_number_state property of the received qubits is used to determine whether single-rail encoding or dual-rail encoding is used. The number of multiplexing modes is automatically identified by the number of qubits in the received messages.

Parameters:
  • name (str) – Name of detector.

  • p_dark (float, optional) – Dark-count probability, i.e. probability of measuring a photon while no photon was present, per detector.

  • det_eff (float, optional) – Efficiency per detector, i.e. the probability of detecting an incoming photon.

  • visibility (float, optional) – Visibility of the Hong-Ou-Mandel dip, also referred to as the photon indistinguishability. A visibility of 1 implies perfectly indistinguishable photons arrive at the beam splitter, while a visibility of 0 represents completely (classical) distinguishable photons, such that there will be no interference.

  • num_resolving (bool, optional) – If set to True, photon-number-resolving detectors will be used, otherwise threshold detectors.

  • num_input_ports (int, optional) – Number of ports available for qubit input. Must be at least one. Default 1.

  • num_output_ports (int, optional) – Number of ports available for measurement outcome output. Must be at least one. Default 1.

  • meas_operators (list or tuple of Operator or None, optional) – Operators used for general single or multi qubit measurements. If the number of qubits which has arrived doesn’t match the POVM the measurement will fail. This means a fail event will be scheduled and the returned message is an empty list. If set overrides the observable, otherwise ignored.

  • output_meta (dict or None, optional) – Metadata which is added to the output message

  • dead_time (float, optional) – Time after the measurement in which the detectors can’t be triggered. It is possible for qubits to propagate through the system during the dead time. Qubits that would arrive at the detectors during their dead_time are discarded when they enter the system.

property dead_time

dead-time of the detector.

Type:

float

property det_eff

detection efficiency.

Type:

float

property num_resolving

indicates whether photon-number-resolving detectors are used.

Type:

bool

property p_dark

dark-count probability.

Type:

float

postprocess_outputs(self, dict port_outcomes)[source]

Processes the classical outcomes of the measurement before the message is send.

Applies a classical noise model if specified.

Override this method to change the preprocessing behaviour.

Parameters:

port_outcomes (dict) – A dictionary with the port names as keys and a copy of the measurement outcomes as values

preprocess_inputs(self)[source]

Apply operations to qubits before they are measured.

Applies a quantum noise model per input port if specified. The model is given the elapsed time since the qubit arrived at the detector.

Override this method to change the preprocessing behaviour.

property visibility

Hong-Ou-Mandel interference visibility, which is a measure of the photon indistinguishability.

Type:

float