uniqc.algorithms.workflows.readout_em_workflow module

High-level readout EM workflow.

Chip-agnostic: runs readout calibration and returns a ready-to-use ReadoutEM instance. For WK180-specific usage, see examples/wk180/readout_em.py.

uniqc.algorithms.workflows.readout_em_workflow.apply_readout_em(result, readout_em, measured_qubits)[source]

Apply readout EM to a UnifiedResult’s counts.

Parameters:
  • result (Any) – A UnifiedResult or result dict with a counts field.

  • readout_em (Any) – A ReadoutEM instance.

  • measured_qubits (list[int]) – List of qubit indices that were measured.

Returns:

Dict mapping outcome → corrected probability.

Return type:

dict[int, float]

uniqc.algorithms.workflows.readout_em_workflow.run_readout_em_workflow(backend='dummy:local:simulator', qubits=None, pairs=None, shots=1000, max_age_hours=24.0, chip_characterization=None)[source]

Run readout calibration and return a ready-to-use ReadoutEM instance.

This function: 1. Creates an adapter for the given backend 2. Runs 1q and/or 2q readout calibration 3. Returns a ReadoutEM instance ready for applying mitigation

Parameters:
  • backend (str) – Backend name (e.g. “dummy”, “originq:wuyuan:wk180”).

  • qubits (list[int] | None) – List of qubit indices for 1q calibration.

  • pairs (list[tuple[int, int]] | None) – List of (u, v) qubit pairs for 2q calibration.

  • shots (int) – Number of shots per calibration circuit.

  • max_age_hours (float) – Maximum acceptable age of existing calibration data.

  • chip_characterization (Any) – Optional ChipCharacterization.

Returns:

A ReadoutEM instance. Calibration results are saved to ~/.uniqc/calibration_cache/ and loaded automatically.

Return type:

Any