mm.lab.ThresholdDetector

class mrmustard.lab.ThresholdDetector(efficiency=1.0, dark_count_prob=0.0, efficiency_trainable=False, dark_count_prob_trainable=False, efficiency_bounds=(0.0, 1.0), dark_count_prob_bounds=(0.0, None), stochastic_channel=None, modes=None)[source]

Bases: FockMeasurement

Threshold detector: any Fock component other than vacuum counts toward a click in the detector.

If len(modes) > 1 the detector is applied in parallel to all of the modes provided.

If a parameter is a single float, its value is applied to all of the parallel instances of the detector.

To apply mode-specific values use a list of floats.

It can be supplied the full conditional detection probabilities, or it will compute them from the quantum efficiency (binomial) and the dark count probability (bernoulli).

Parameters:
  • efficiency (float or List[float]) – list of quantum efficiencies for each detector

  • dark_count_prob (float or List[float]) – list of dark count probabilities for each detector

  • efficiency_trainable (bool) – whether the efficiency is trainable

  • dark_count_prob_trainable (bool) – whether the dark count probabilities are trainable

  • efficiency_bounds (Tuple[float, float]) – bounds for the efficiency

  • dark_count_prob_bounds (Tuple[float, float]) – bounds for the dark count probabilities

  • stochastic_channel (Optional 2d array) – if supplied, this stochastic_channel will be used for belief propagation

  • modes (Optional List[int]) – list of modes to apply the detector to

modes

returns the modes being measured

num_modes

returns the number of modes being measured

outcome

Returns outcome of the measurement.

parameter_set

The set of parameters for this transformation.

postselected

returns whether the measurement is postselected, i.e, a outcome has been provided

modes

returns the modes being measured

num_modes

returns the number of modes being measured

outcome
parameter_set

The set of parameters for this transformation.

postselected

returns whether the measurement is postselected, i.e, a outcome has been provided

primal(other)

performs the measurement procedure according to the representation of the incoming state

recompute_stochastic_channel([cutoffs])

recompute belief using the defined stochastic channel

should_recompute_stochastic_channel()

Returns True if the stochastic channel has to be recomputed.

primal(other)

performs the measurement procedure according to the representation of the incoming state

Return type:

Union[State, float]

recompute_stochastic_channel(cutoffs=None)[source]

recompute belief using the defined stochastic channel

should_recompute_stochastic_channel()[source]

Returns True if the stochastic channel has to be recomputed.

This method should be overriden by subclasses as needed.