qiskit-documentation/docs/api/qiskit/1.2/qiskit.result.BaseReadoutMi...

64 lines
4.7 KiB
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
title: BaseReadoutMitigator (v1.2)
description: API reference for qiskit.result.BaseReadoutMitigator in qiskit v1.2
in_page_toc_min_heading_level: 1
python_api_type: class
python_api_name: qiskit.result.BaseReadoutMitigator
---
# BaseReadoutMitigator
<Class id="qiskit.result.BaseReadoutMitigator" isDedicatedPage={true} github="https://github.com/Qiskit/qiskit/tree/stable/1.2/qiskit/result/mitigation/base_readout_mitigator.py#L23-L79" signature="qiskit.result.BaseReadoutMitigator" modifiers="class">
Bases: [`ABC`](https://docs.python.org/3/library/abc.html#abc.ABC "(in Python v3.13)")
Base readout error mitigator class.
## Methods
### expectation\_value
<Function id="qiskit.result.BaseReadoutMitigator.expectation_value" github="https://github.com/Qiskit/qiskit/tree/stable/1.2/qiskit/result/mitigation/base_readout_mitigator.py#L52-L79" signature="expectation_value(data, diagonal, qubits=None, clbits=None, shots=None)" modifiers="abstract">
Calculate the expectation value of a diagonal Hermitian operator.
**Parameters**
* **data** ([*Counts*](qiskit.result.Counts "qiskit.result.counts.Counts")) Counts object to be mitigated.
* **diagonal** ([*Callable*](https://docs.python.org/3/library/typing.html#typing.Callable "(in Python v3.13)") *|*[*dict*](https://docs.python.org/3/library/stdtypes.html#dict "(in Python v3.13)") *|*[*str*](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.13)") *|*[*ndarray*](https://numpy.org/doc/stable/reference/generated/numpy.ndarray.html#numpy.ndarray "(in NumPy v2.1)")) the diagonal operator. This may either be specified as a string containing I,Z,0,1 characters, or as a real valued 1D array\_like object supplying the full diagonal, or as a dictionary, or as Callable.
* **qubits** ([*Iterable*](https://docs.python.org/3/library/typing.html#typing.Iterable "(in Python v3.13)")*\[*[*int*](https://docs.python.org/3/library/functions.html#int "(in Python v3.13)")*] | None*) the physical qubits measured to obtain the counts clbits. If None these are assumed to be qubits \[0, …, N-1] for N-bit counts.
* **clbits** ([*List*](https://docs.python.org/3/library/typing.html#typing.List "(in Python v3.13)")*\[*[*int*](https://docs.python.org/3/library/functions.html#int "(in Python v3.13)")*] | None*) Optional, marginalize counts to just these bits.
* **shots** ([*int*](https://docs.python.org/3/library/functions.html#int "(in Python v3.13)") *| None*) Optional, the total number of shots, if None shots will be calculated as the sum of all counts.
**Returns**
The mean and an upper bound of the standard deviation of operator expectation value calculated from the current counts.
**Return type**
[*Tuple*](https://docs.python.org/3/library/typing.html#typing.Tuple "(in Python v3.13)")\[[float](https://docs.python.org/3/library/functions.html#float "(in Python v3.13)"), [float](https://docs.python.org/3/library/functions.html#float "(in Python v3.13)")]
</Function>
### quasi\_probabilities
<Function id="qiskit.result.BaseReadoutMitigator.quasi_probabilities" github="https://github.com/Qiskit/qiskit/tree/stable/1.2/qiskit/result/mitigation/base_readout_mitigator.py#L26-L50" signature="quasi_probabilities(data, qubits=None, clbits=None, shots=None)" modifiers="abstract">
Convert counts to a dictionary of quasi-probabilities
**Parameters**
* **data** ([*Counts*](qiskit.result.Counts "qiskit.result.counts.Counts")) Counts to be mitigated.
* **qubits** ([*Iterable*](https://docs.python.org/3/library/typing.html#typing.Iterable "(in Python v3.13)")*\[*[*int*](https://docs.python.org/3/library/functions.html#int "(in Python v3.13)")*] | None*) the physical qubits measured to obtain the counts clbits. If None these are assumed to be qubits \[0, …, N-1] for N-bit counts.
* **clbits** ([*List*](https://docs.python.org/3/library/typing.html#typing.List "(in Python v3.13)")*\[*[*int*](https://docs.python.org/3/library/functions.html#int "(in Python v3.13)")*] | None*) Optional, marginalize counts to just these bits.
* **shots** ([*int*](https://docs.python.org/3/library/functions.html#int "(in Python v3.13)") *| None*) Optional, the total number of shots, if None shots will be calculated as the sum of all counts.
**Returns**
**A dictionary containing pairs of \[output, mean] where “output”**
is the key in the dictionaries, which is the length-N bitstring of a measured standard basis state, and “mean” is the mean of non-zero quasi-probability estimates.
**Return type**
[QuasiDistribution](qiskit.result.QuasiDistribution "qiskit.result.QuasiDistribution")
</Function>
</Class>