Skip to main contentIBM Quantum Documentation
You are viewing the API reference for an old version of Qiskit SDK. Switch to latest version

MeasurementFilter

MeasurementFilter(cal_matrix, state_labels) GitHub(opens in a new tab)

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

Attributes

cal_matrix

Return cal_matrix.

state_labels

return the state label 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.

Was this page helpful?