Analyzer

class lightworks.Analyzer(circuit: PhotonicCircuit, inputs: State | list[State], expected: dict[State, State | list[State]] | None = None, post_selection: PostSelectionType | Callable[[State], bool] | None = None)

The analyzer class is built as an alternative to simulation, intended for cases where we want to look at the transformations between a specific subset of states. It is useful for the simulation of probabilities in cases where loss and circuit errors are likely to be a factor. As part of the process a performance and error rate metric are calculated.

Parameters:
  • circuit (PhotonicCircuit) – The circuit to simulate.

  • inputs (list) – A list of the input states to simulate. For multiple inputs this should be a list of States.

  • expected (dict) – A dictionary containing a mapping between the input state and expected output state(s). If there is multiple possible outputs, this can be specified as a list.

Attribute:

performanceThe total probabilities of mapping between the states

provided compared with all possible states.

error_rateGiven an expected mapping, the analyzer will determine the

extent to which this is achieved.

property circuit: PhotonicCircuit

Stores the circuit to be used for simulation, should be a PhotonicCircuit object.

property expected: dict[State, State | list[State]] | None

A dictionary of the expected mapping between inputs and outputs of the system.

property inputs: list[State]

Store list of target inputs to the system.

property post_selection: PostSelectionType | None

Stores post-selection criteria for analysis.