qilisdk.functionals.sampling_result
Classes
Store shot counts and derived probabilities for a sampling experiment. |
Module Contents
- class SamplingResult(nshots: int, samples: dict[str, int])[source]
Bases:
qilisdk.functionals.functional_result.FunctionalResultStore shot counts and derived probabilities for a sampling experiment.
- Parameters:
nshots (
int) – Total number of circuit evaluations.samples (
dict[str,int]) – Mapping from bitstring to observed counts.
- Raises:
ValueError – If
samplesis empty or contains bitstrings with different length.
- property nshots: int[source]
Total number of repetitions used to gather samples.
- property nqubits: int[source]
Number of qubits inferred from the sample bitstrings.
- property samples: dict[str, int][source]
Return a copy of the raw sample counts.
- property probabilities: dict[str, float][source]
Return a copy of the estimated probability distribution.
- get_probability(bitstring: str) float[source]
Return the probability associated with
bitstring(0.0 if unseen).
- get_probabilities(n: int | None = None) list[tuple[str, float]][source]
- Parameters:
n (
int | None) – Maximum number of items to return. Defaults to all outcomes.- Returns:
the
nmost probable bitstrings in descending probability order.- Return type:
list[tuple[str, float]]