qiskit.ignis.mitigation.CompleteMeasFitter¶

class
CompleteMeasFitter
(results, state_labels, qubit_list=None, circlabel='')[source]¶ 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__
(results, state_labels, qubit_list=None, circlabel='')[source]¶ 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.
Methods
__init__
(results, state_labels[, …])Initialize a measurement calibration matrix from the results of running the circuits returned by measurement_calibration_circuits
add_data
(new_results[, rebuild_cal_matrix])Add measurement calibration data
plot_calibration
([ax, show_plot])Plot the calibration matrix (2D color grid plot)
readout_fidelity
([label_list])Based on the results, output the readout fidelity which is the normalized trace of the calibration matrix
subset_fitter
([qubit_sublist])Return a fitter object that is a subset of the qubits in the original list.
Attributes
Return cal_matrix.
Return a measurement filter using the cal matrix.
Return list of qubits.
Return state_labels.

add_data
(new_results, rebuild_cal_matrix=True)[source]¶ Add measurement calibration data
 Parameters
new_results (list or qiskit.result.Result) – a single result or list of result objects.
rebuild_cal_matrix (bool) – rebuild the calibration matrix

property
cal_matrix
¶ Return cal_matrix.

property
filter
¶ Return a measurement filter using the cal matrix.

plot_calibration
(ax=None, show_plot=True)[source]¶ 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

property
qubit_list
¶ Return list of qubits.

readout_fidelity
(label_list=None)[source]¶ 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 ondiagonal 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

property
state_labels
¶ Return state_labels.

subset_fitter
(qubit_sublist=None)[source]¶ 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
 Raises
QiskitError – If the calibration matrix is not initialized