sf.apps.qchem.dynamics.prob

prob(samples, excited_state)[source]

Estimate probability of observing an excited state.

The probability is estimated by calculating the relative frequency of the excited state among the samples.

Example usage:

>>> excited_state = [0, 2]
>>> samples = [[0, 2], [1, 1], [0, 2], [2, 0], [1, 1], [0, 2], [1, 1], [1, 1], [1, 1]]
>>> prob(samples, excited_state)
0.3333333333333333
Parameters
  • list[list[int]] (samples) – a list of samples

  • excited_state (list) – a Fock state

Returns

probability of observing a Fock state in the given samples

Return type

float