qiskit-documentation/docs/api/qiskit/0.26/qiskit.ignis.mitigation.Com...

154 lines
8.5 KiB
Plaintext
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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: CompleteMeasFitter (v0.26)
description: API reference for qiskit.ignis.mitigation.CompleteMeasFitter in qiskit v0.26
in_page_toc_min_heading_level: 1
python_api_type: class
python_api_name: qiskit.ignis.mitigation.CompleteMeasFitter
---
<span id="qiskit-ignis-mitigation-completemeasfitter" />
# qiskit.ignis.mitigation.CompleteMeasFitter
<Class id="qiskit.ignis.mitigation.CompleteMeasFitter" isDedicatedPage={true} github="https://github.com/qiskit-community/qiskit-ignis/tree/stable/0.6/qiskit/ignis/mitigation/measurement/fitters.py" signature="CompleteMeasFitter(results, state_labels, qubit_list=None, circlabel='')" modifiers="class">
Measurement correction fitter for a full calibration
Initialize a measurement calibration matrix from the results of running the circuits returned by measurement\_calibration\_circuits
A wrapper for the tensored fitter
**Parameters**
* **results** (`Union`\[`Result`, `List`\[`Result`]]) the results of running the measurement calibration circuits. If this is None the user will set a calibration matrix later.
* **state\_labels** (`List`\[`str`]) list of calibration state labels returned from measurement\_calibration\_circuits. The output matrix will obey this ordering.
* **qubit\_list** (`Optional`\[`List`\[`int`]]) List of the qubits (for reference and if the subset is needed). If None, the qubit\_list will be created according to the length of state\_labels\[0].
* **circlabel** (`str`) if the qubits were labeled.
### \_\_init\_\_
<Function id="qiskit.ignis.mitigation.CompleteMeasFitter.__init__" signature="__init__(results, state_labels, qubit_list=None, circlabel='')">
Initialize a measurement calibration matrix from the results of running the circuits returned by measurement\_calibration\_circuits
A wrapper for the tensored fitter
**Parameters**
* **results** (`Union`\[`Result`, `List`\[`Result`]]) the results of running the measurement calibration circuits. If this is None the user will set a calibration matrix later.
* **state\_labels** (`List`\[`str`]) list of calibration state labels returned from measurement\_calibration\_circuits. The output matrix will obey this ordering.
* **qubit\_list** (`Optional`\[`List`\[`int`]]) List of the qubits (for reference and if the subset is needed). If None, the qubit\_list will be created according to the length of state\_labels\[0].
* **circlabel** (`str`) if the qubits were labeled.
</Function>
## Methods
| | |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------- |
| [`__init__`](#qiskit.ignis.mitigation.CompleteMeasFitter.__init__ "qiskit.ignis.mitigation.CompleteMeasFitter.__init__")(results, state\_labels\[, …]) | Initialize a measurement calibration matrix from the results of running the circuits returned by measurement\_calibration\_circuits |
| [`add_data`](#qiskit.ignis.mitigation.CompleteMeasFitter.add_data "qiskit.ignis.mitigation.CompleteMeasFitter.add_data")(new\_results\[, rebuild\_cal\_matrix]) | Add measurement calibration data |
| [`plot_calibration`](#qiskit.ignis.mitigation.CompleteMeasFitter.plot_calibration "qiskit.ignis.mitigation.CompleteMeasFitter.plot_calibration")(\[ax, show\_plot]) | Plot the calibration matrix (2D color grid plot) |
| [`readout_fidelity`](#qiskit.ignis.mitigation.CompleteMeasFitter.readout_fidelity "qiskit.ignis.mitigation.CompleteMeasFitter.readout_fidelity")(\[label\_list]) | Based on the results, output the readout fidelity which is the normalized trace of the calibration matrix |
| [`subset_fitter`](#qiskit.ignis.mitigation.CompleteMeasFitter.subset_fitter "qiskit.ignis.mitigation.CompleteMeasFitter.subset_fitter")(\[qubit\_sublist]) | Return a fitter object that is a subset of the qubits in the original list. |
## Attributes
| | |
| ------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------- |
| [`cal_matrix`](#qiskit.ignis.mitigation.CompleteMeasFitter.cal_matrix "qiskit.ignis.mitigation.CompleteMeasFitter.cal_matrix") | Return cal\_matrix. |
| [`filter`](#qiskit.ignis.mitigation.CompleteMeasFitter.filter "qiskit.ignis.mitigation.CompleteMeasFitter.filter") | Return a measurement filter using the cal matrix. |
| [`qubit_list`](#qiskit.ignis.mitigation.CompleteMeasFitter.qubit_list "qiskit.ignis.mitigation.CompleteMeasFitter.qubit_list") | Return list of qubits. |
| [`state_labels`](#qiskit.ignis.mitigation.CompleteMeasFitter.state_labels "qiskit.ignis.mitigation.CompleteMeasFitter.state_labels") | Return state\_labels. |
### add\_data
<Function id="qiskit.ignis.mitigation.CompleteMeasFitter.add_data" signature="add_data(new_results, rebuild_cal_matrix=True)">
Add measurement calibration data
**Parameters**
* **new\_results** (*list or* [*qiskit.result.Result*](qiskit.result.Result "qiskit.result.Result")) a single result or list of result objects.
* **rebuild\_cal\_matrix** (*bool*) rebuild the calibration matrix
</Function>
### cal\_matrix
<Attribute id="qiskit.ignis.mitigation.CompleteMeasFitter.cal_matrix">
Return cal\_matrix.
</Attribute>
### filter
<Attribute id="qiskit.ignis.mitigation.CompleteMeasFitter.filter">
Return a measurement filter using the cal matrix.
</Attribute>
### plot\_calibration
<Function id="qiskit.ignis.mitigation.CompleteMeasFitter.plot_calibration" signature="plot_calibration(ax=None, show_plot=True)">
Plot the calibration matrix (2D color grid plot)
**Parameters**
* **show\_plot** (*bool*) call plt.show()
* **ax** (*matplotlib.axes.Axes*) An optional Axes object to use for the plot
</Function>
### qubit\_list
<Attribute id="qiskit.ignis.mitigation.CompleteMeasFitter.qubit_list">
Return list of qubits.
</Attribute>
### readout\_fidelity
<Function id="qiskit.ignis.mitigation.CompleteMeasFitter.readout_fidelity" signature="readout_fidelity(label_list=None)">
Based on the results, output the readout fidelity which is the normalized trace of the calibration matrix
**Parameters**
**label\_list** (*bool*) If None, returns the average assignment fidelity of a single state. Otherwise it returns the assignment fidelity to be in any one of these states averaged over the second index.
**Returns**
readout fidelity (assignment fidelity)
**Return type**
numpy.array
**Additional Information:**
The on-diagonal elements of the calibration matrix are the probabilities of measuring state x given preparation of state x and so the normalized trace is the average assignment fidelity
</Function>
### state\_labels
<Attribute id="qiskit.ignis.mitigation.CompleteMeasFitter.state_labels">
Return state\_labels.
</Attribute>
### subset\_fitter
<Function id="qiskit.ignis.mitigation.CompleteMeasFitter.subset_fitter" signature="subset_fitter(qubit_sublist=None)">
Return a fitter object that is a subset of the qubits in the original list.
**Parameters**
**qubit\_sublist** (*list*) must be a subset of qubit\_list
**Returns**
**A new fitter that has the calibration for a**
subset of qubits
**Return type**
[CompleteMeasFitter](#qiskit.ignis.mitigation.CompleteMeasFitter "qiskit.ignis.mitigation.CompleteMeasFitter")
**Raises**
**QiskitError** If the calibration matrix is not initialized
</Function>
</Class>