fiqci.ems#

FiQCI Error Mitigation Service (EMS).

class FiQCISampler(backend, mitigation_level=1, calibration_shots=1000, calibration_file=None)#

Bases: object

FiQCISampler provides a simple interface for running circuits and obtaining mitigated measurement counts without needing to configure the backend directly. It applies readout error mitigation based on the chosen mitigation level and chosen settings, so users get improved sampling results with minimal setup.

Mitigation levels:
  • 0: No error mitigation (raw results)

  • 1: Readout error mitigation using M3 (default)

Parameters:
  • backend – An IQMBackendBase instance to wrap.

  • mitigation_level – Level of error mitigation to apply (default: 1).

  • calibration_shots – Number of shots to use for calibration circuits (default: 1000).

  • calibration_file – Optional calibration file to use for readout error mitigation.

__init__(backend, mitigation_level=1, calibration_shots=1000, calibration_file=None)#
property mitigator_options: dict[str, Any]#

Get current mitigator settings.

run(circuits: QuantumCircuit | list[QuantumCircuit], shots: int = 2048, **options) JobV1 | MitigatedJob#

Execute the given circuits on the backend and return mitigated measurement counts.

Parameters:
  • circuits – A QuantumCircuit or list of QuantumCircuits to execute.

  • shots – Number of shots to execute each circuit (default: 2048).

  • **options – Additional options to pass to the backend’s run method.

Returns:

A JobV1 or MitigatedJob instance containing the results of the execution.

rem(enabled: bool, calibration_shots: int = 1000, calibration_file: str | None = None) None#

Set readout error mitigation settings for the sampler. This will configure the underlying backend’s readout error mitigation accordingly.

Parameters:
  • enabled – Whether to enable readout error mitigation.

  • calibration_shots – Number of shots to use for calibration circuits (default: 1000).

  • calibration_file – Optional calibration file to use for readout error mitigation.

class FiQCIEstimator(backend, mitigation_level=1, calibration_shots=1000, calibration_file=None)#

Bases: object

FiQCIEstimator wraps a backend with built-in error mitigation (readout error mitigation via M3, zero-noise extrapolation) and computes expectation values of observables directly from circuits, eliminating the need for manual post-processing of measurement counts.

Mitigation levels:
  • 0: No error mitigation (raw results)

  • 1: Readout error mitigation using M3 (default)

  • 2: Level 1 + TBD

  • 3: Level 2 + zero-noise extrapolation (ZNE) with local folding and exponential extrapolation

Parameters:
  • backend – An IQMBackendBase instance to wrap.

  • mitigation_level – Level of error mitigation to apply (default: 1).

  • calibration_shots – Number of shots to use for calibration circuits (default: 1000).

  • calibration_file – Optional calibration file to use for readout error mitigation.

__init__(backend, mitigation_level=1, calibration_shots=1000, calibration_file=None)#
property mitigator_options: dict[str, Any]#

Get current mitigator settings.

run(circuits: QuantumCircuit | list[QuantumCircuit], observables: SparsePauliOp | list[SparsePauliOp], shots: int = 2048, **options) FiQCIEstimatorJobCollection#

Execute the given circuits on the backend and calculate expectation values for the provided observables.

Parameters:
  • circuits – A QuantumCircuit or list of QuantumCircuits to execute.

  • observables – A SparsePauliOp or list of SparsePauliOps representing the observables for which to calculate expectation values.

  • shots – Number of shots to execute each circuit (default: 2048).

  • **options – Additional options to pass to the backend’s run method.

Returns:

A FiQCIEstimatorJobCollection containing the jobs and calculated expectation values.

rem(enabled: bool, calibration_shots: int = 1000, calibration_file: str | None = None) None#

Set readout error mitigation settings for the estimator. This will configure the underlying backend’s readout error mitigation accordingly.

Parameters:
  • enabled – Whether to enable readout error mitigation.

  • calibration_shots – Number of shots to use for calibration circuits (default: 1000).

  • calibration_file – Optional calibration file to use for readout error mitigation.

zne(enabled: bool, fold_gates: list | None = None, scale_factors: list[int] = [1, 3, 5], folding_method: str = 'local', extrapolation_method: str = 'exponential', extrapolation_degree: int | None = None)#

Configure zero-noise extrapolation settings.

class FiQCIBackend(backend: IQMBackendBase, mitigation_level: int = 1, calibration_shots: int = 1000, calibration_file: str | None = None)#

Bases: object

FiQCI backend wrapper that applies error mitigation automatically.

Mitigation levels:
  • 0: No error mitigation (raw results)

  • 1: Readout error mitigation using M3 (default)

Parameters:
  • backend – An IQMBackendBase instance to wrap.

  • mitigation_level – Error mitigation level (0-3). Default is 1.

  • calibration_shots – Number of shots for calibration circuits. Default is 1000.

  • calibration_file – Optional path to save/load M3 calibration data.

__init__(backend: IQMBackendBase, mitigation_level: int = 1, calibration_shots: int = 1000, calibration_file: str | None = None) None#

Initialize the FiQCI backend wrapper.

Parameters:
  • backend – An IQMBackendBase instance to wrap.

  • mitigation_level – Error mitigation level (0-3). Default is 1.

  • calibration_shots – Number of shots for calibration circuits. Default is 1000.

  • calibration_file – Optional path to save/load M3 calibration data.

Raises:

ValueError – If mitigation_level is not in range 0-3.

property backend: IQMBackendBase#

Get the underlying backend.

property mitigation_level: int#

Get the current mitigation level.

property raw_counts: list[dict[str, int]] | None#

Get the raw (unmitigated) counts from the most recent run.

Returns:

List of raw count dictionaries, or None if no run has been performed yet.

property mitigator_options: dict[str, Any]#

Get current mitigator settings.

Returns:

A dictionary of current mitigator settings and their values.

rem(enabled: bool = True, calibration_shots: int = 1000, calibration_file: str | None = None) None#

Set readout error mitigation settings for the backend.

Parameters:
  • enabled – Whether to enable readout error mitigation.

  • calibration_shots – Number of shots to use for calibration circuits (default: 1000).

  • calibration_file – Optional calibration file to use for readout error mitigation.

run(circuits: QuantumCircuit | list[QuantumCircuit], shots: int = 1024, **kwargs: Any) JobV1 | MitigatedJob#

Run quantum circuits with error mitigation.

This method runs the specified quantum circuit(s) on the backend and applies error mitigation based on the configured mitigation level.

Parameters:
  • circuits – Single quantum circuit or list of circuits to execute.

  • shots – Number of shots. Default is 1024.

  • **kwargs – Additional keyword arguments passed to backend.run().

Returns:

A JobV1 instance (level 0) or MitigatedJob instance (level 1+) with mitigated results.

Raises:

ValueError – If circuits is empty or invalid.

Modules

fiqci_backend

FiQCI backend wrapper for seamless error mitigation.

mitigators

Mitigators for FiQCI EMS

primitives

Primitives for FiQCI EMS

transpiler_passes

Transpiler passes for FiQCI EMS

utils

Utility functions