POVMPubResult

class POVMPubResult(data: DataBin, metadata: POVMMetadata)[source]

Bases: PubResult

The result of a POVMSamplerJob.

Initialize the result object.

Parameters:
  • data (DataBin) – The raw data bin object that contains raw measurement bitstrings.

  • metadata (POVMMetadata) – The metadata object that stores the POVM used and all necessary data to interpret the raw measurement bitstring. For example, for randomized POVMs, each bitstring has to be associated with the corresponding pvm_keys to produce a meaningful POVM outcome.

Attributes

metadata

The metadata of this result object.

Warning

The object returned by instances of this subclass have a different type than dictated by the PubResult interface.

Inherited Attributes

data

Result data for the pub.

Methods

get_counts(*, loc: int | tuple[int, ...] | None = None) ndarray | Counter[source]

Get the histogram data of the result.

This method will leverage get_povm_counts_from_raw() from the POVMImplementation instance stored inside the metadata to construct a histogram of POVM outcomes.

Parameters:

loc (int | tuple[int, ...] | None) – Which entry of the BitArray to return a histogram for. If the Pub that was submitted to POVMSampler.run() contained circuit parameters, loc can be used to indicate the set of parameter values for which to compute the histogram. If loc is None, the histogram will be computed for all parameter values at once.

Returns:

Either a single or an array of histograms of the POVM outcomes. The shape depends on the value of loc and the number of parameters that were submitted in the Pub to POVMSampler.run().

Return type:

ndarray | Counter

get_samples(*, loc: int | tuple[int, ...] | None = None) ndarray | list[tuple[int, ...]][source]

Get the individual POVM outcomes of the result.

This method will leverage get_povm_outcomes_from_raw() from the POVMImplementation instance stored inside the metadata to recover the sampled POVM outcomes.

Parameters:

loc (int | tuple[int, ...] | None) – Which entry of the BitArray to return the samples for. If the Pub that was submitted to POVMSampler.run() contained circuit parameters, loc can be used to indicate the set of parameter values for which to obtain the samples. If loc is None, the samples will be obtained for all parameter values at once.

Returns:

Either a single or an array of POVM outcomes. The shape depends on the value of loc and the number of parameters that were submitted in the Pub to POVMSampler.run().

Return type:

ndarray | list[tuple[int, …]]