Skip to main contentIBM Quantum Documentation
This page is from an old version of Qiskit SDK and does not exist in the latest version. We recommend you migrate to the latest version. See the release notes for more information.

MeasurementFilter

class MeasurementFilter(cal_matrix, state_labels)

GitHub

Bases: object

Measurement error mitigation filter.

Produced from a measurement calibration fitter and can be applied to data.

Initialize a measurement error mitigation filter using the cal_matrix from a measurement calibration fitter.

Parameters

  • cal_matrix (matrix) – the calibration matrix for applying the correction
  • state_labels (list) – the states for the ordering of the cal matrix

Methods

apply

MeasurementFilter.apply(raw_data, method='least_squares')

Apply the calibration matrix to results.

Parameters

  • raw_data (dict or list) –

    The data to be corrected. Can be in a number of forms:

    Form 1: a counts dictionary from results.get_counts

    Form 2: a list of counts of length==len(state_labels)

    Form 3: a list of counts of length==M*len(state_labels) where M is an integer (e.g. for use with the tomography data)

    Form 4: a qiskit Result

  • method (str) –

    fitting method. If None, then least_squares is used.

    pseudo_inverse: direct inversion of the A matrix

    least_squares: constrained to have physical probabilities

Returns

The corrected data in the same form as raw_data

Return type

dict or list

Raises

QiskitError – if raw_data is not an integer multiple of the number of calibrated states.


Attributes

cal_matrix

Return cal_matrix.

state_labels

return the state label ordering of the cal matrix

Was this page helpful?
Report a bug or request content on GitHub.