Skip to main content
IBM Quantum Platform

TREX (qiskit_mitigation.trex)

TREX

class TREX

GitHub

Bases: object

Mitigates readout errors in expectation values using the Twirled Readout Error eXtinction (TREX) method.

The class enables adding a readout error calibration item to a QuantumProgram shared by one or more mitigation tasks, that can be executed on hardware using the Executor. The calibration results are post processed into a measurement noise model, which is used to calculate scale factors that correct the expectation values computed by the connected mitigation tasks.

Instantiate a TREX task.

Methods

prepare

prepare(num_randomizations, quantum_program, custom_boxing_options=None)

GitHub

Adds a TREX calibration item to the quantum program.

Parameters

  • num_randomizations (int) – Number of randomizations for the TREX calibration.
  • quantum_program (QuantumProgram) – The quantum program to add an item for.
  • custom_boxing_options (dict | None) – The custom boxing options that will be used by generate_boxing_pass_manager() function.

Returns

The input QuantumProgram instance with added TREX calibration item.

Return type

QuantumProgram

calculate_trex_factor

static calculate_trex_factor(noise_data, observable_term)

GitHub

Calculate TREX factor relevant for a given observable term based on noise model.

Parameters

  • noise_data (PauliLindbladMap |ndarray) – PauliLindbladMap containing measurement noise model or a result of TREX calibration execution.
  • observable_term (Pauli |QubitSparsePauli |str) – observable term to calculate TREX factor for.

Returns

TREX factor for the observable term.

Return type

float

trex_factors_each_term

static trex_factors_each_term(measurement_noise_map, observables)

GitHub

Calculates TREX mitigation algorithm’s expectation value scale factor for each Pauli term in each observable.

Calculates ⟨ZN⟩\langle Z^N \rangle for each non-identity Pauli term in each observable using learned measurement noise, where NN are the non-identity indices in the term.

Parameters

Returns

A dictionary mapping Pauli terms to their expectation values scale factors.

Return type

dict[str, float]

compute_noise_model

compute_noise_model(results)

GitHub

Compute noise model from program results.

Parameters

results (QuantumProgramResult) – QuantumProgramResult which contains the TREX calibration circuit results.

Returns

The learned readout noise model as a PauliLindbladMap.

Return type

PauliLindbladMap

has_calibration_result

has_calibration_result()

GitHub

Whether a TREX calibration task has been added to the quantum program.

Return type

bool

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