fiqci.ems.mitigators.rem#

Functions related to Readout Error Mitigation (REM).

Classes

M3IQM(backend)

M3 readout mitigation class modified to work with IQM devices.

class M3IQM(backend)#

Bases: M3Mitigation

M3 readout mitigation class modified to work with IQM devices. Adapted from IQM Benchmarks which is adapted from M3 both of which are licensed under Apache 2.0

__init__(backend)#

Main M3 calibration class.

Parameters:
  • system (Backend) – Target backend.

  • iter_threshold (int) – Sets the bitstring count at which iterative mode is turned on (assuming reasonable error rates).

system#

The target system or execution manager.

Type:

Backend

system_info#

Information needed about the system

Type:

dict

cal_method#

Calibration method used

Type:

str

cal_timestamp#

Time at which cals were taken

Type:

str

single_qubit_cals#

1Q calibration matrices

Type:

list

cals_from_system(qubits=None, shots=None, method=None, initial_reset=False, rep_delay=None, cals_file=None, async_cal=True, runtime_mode=None, cal_id=None)#

Grab calibration data from system.

Overrides M3’s method to: 1. Default to ‘balanced’ calibration method for IQM 2. Support IQM’s calibration_set_id parameter 3. Use IQM-specific job thread for bit-string handling

Parameters:
  • qubits (array_like) – Qubits over which to correct calibration data. Default is all.

  • shots (int) – Number of shots per circuit. min(1e4, max_shots).

  • method (str) – Type of calibration, ‘balanced’ (default for IQM), ‘independent’, or ‘marginal’.

  • initial_reset (bool) – Use resets at beginning of calibration circuits, default=False.

  • rep_delay (float) – Delay between circuits on IBM Quantum backends.

  • cals_file (str) – Output path to write JSON calibration data to.

  • async_cal (bool) – Do calibration async in a separate thread, default is True.

  • runtime_mode – Mode to run jobs in if using IBM system, default=None

  • cal_id (str) – Optional calibration set ID for IQM backends.

Returns:

List of jobs submitted.

Return type:

list

Raises:

M3Error – Called while a calibration currently in progress.

cals_to_file(cals_file: str | None = None) None#

Save calibration data to JSON file with FiQCI-specific metadata.

Extends M3’s cals_to_file to include calibration_set_id and qubits.

Parameters:

cals_file – File in which to store calibrations.

Raises:
  • M3Error – Calibration filename missing.

  • M3Error – Mitigator is not calibrated.

cals_from_file(cals_file: str, validate_calibration_set: bool = True) None#

Load calibration data from JSON file with FiQCI-specific validation.

Extends M3’s cals_from_file to validate calibration_set_id matches backend.

Parameters:
  • cals_file – Path to the saved calibration file.

  • validate_calibration_set – Whether to validate calibration_set_id matches backend.

Raises:
  • M3Error – Calibration in progress.

  • M3Error – Calibration set ID mismatch.

  • M3Error – Invalid calibration file format.

  • FileNotFoundError – Calibration file not found.