sf.lab.PNRDetector¶
- class mrmustard.lab.PNRDetector(efficiency=1.0, dark_counts=0.0, efficiency_trainable=False, dark_counts_trainable=False, efficiency_bounds=(0.0, 1.0), dark_counts_bounds=(0.0, None), stochastic_channel=None, modes=None, cutoffs=None)[source]¶
Bases:
FockMeasurement
Photon Number Resolving detector.
If
len(modes) > 1
the detector is applied in parallel to all of the modes provided. If a parameter is a single float, the parallel instances of the detector share that parameter.To apply mode-specific parmeters use a list of floats. The number of modes is determined (in order of priority) by the modes parameter, the cutoffs parameter, or the length of the efficiency and dark counts parameters.
One can optionally set bounds for each parameter, which the optimizer will respect.
It can be supplied the full stochastic channel, or it will compute it from the quantum efficiency (binomial) and the dark count probability (possonian).
- Parameters:
efficiency (float or List[float]) – list of quantum efficiencies for each detector
efficiency_trainable (bool) – whether the efficiency is trainable
efficiency_bounds (Tuple[float, float]) – bounds for the efficiency
dark_counts (float or List[float]) – list of expected dark counts
dark_counts_trainable (bool) – whether the dark counts are trainable
dark_counts_bounds (Tuple[float, float]) – bounds for the dark counts
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
cutoffs (int or List[int]) – largest phton number measurement cutoff for each mode
Attributes
returns the modes being measured
returns the number of modes being measured
Returns outcome of the measurement.
The set of parameters for this transformation.
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
Methods
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
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
]