erado.models

Provides the underlying erasure simulation models.

Attributes

ShotCallback

Per-shot callback function type.

SNAPSHOT_GATES

Circuit instructions recognised as supported state snapshots.

EXEMPT_GATES

Circuit instructions which are never involved in erasure events.

Classes

CircuitState

Data structure representing the observed state of a quantum circuit.

ErasureModel

Protocol representing an erasure circuit simulation model.

ShotInfo

Data structure of per-shot information provided to callbacks.

ErasurePass

Transpiler pass implementing erasable qubits.

ErasurePassJob

Utility class to run ErasurePass-based simulations.

ErasureCircuitSampler

Custom simulation wrapper implementing erasure noise on arbitrary circuits.

Functions

postselect_counts(→ collections.Counter[str])

Filter a state counter to only non-erased states.

get_qubit_by_name(→ int)

Return the index of the sole/first qubit in a qreg of a given name.

add_erasure_noise(→ None)

Add an erasure noise model to an ErasurePass circuit.

Package Contents

erado.models.postselect_counts(counts: collections.Counter[CircuitState]) collections.Counter[str]

Filter a state counter to only non-erased states.

Parameters:

counts (collections.Counter[CircuitState]) – CircuitState counter.

Returns:

Counter of non-erased measurement states.

Return type:

collections.Counter[str]

type erado.models.ShotCallback = Callable[[ShotInfo], None]

Per-shot callback function type.

erado.models.SNAPSHOT_GATES = ['save_statevector', 'save_density_matrix']

Circuit instructions recognised as supported state snapshots.

erado.models.EXEMPT_GATES = ['barrier', 'measure', 'save_statevector', 'save_density_matrix']

Circuit instructions which are never involved in erasure events.

erado.models.get_qubit_by_name(qc: qiskit.circuit.QuantumCircuit, name: str) int

Return the index of the sole/first qubit in a qreg of a given name.

Parameters:
Raises:

ValueError – If no qreg could be found with the given name.

Returns:

Qubit index.

Return type:

int

erado.models.add_erasure_noise(noise_model: qiskit_aer.noise.NoiseModel, qc: qiskit.circuit.QuantumCircuit, erasure_rate: float) None

Add an erasure noise model to an ErasurePass circuit.

This model populates erasure events via Pauli noise on the ErasurePass.ERASER_QREG_NAME ancilla.

One should avoid using add_all_qubit_quantum_error() in other error modes in the model, so as not to introduce additional noise on this ancilla. Instead, prefer to use meth:add_quantum_error on explicit qubits, via a loop or otherwise.

See example_ErasurePass for example usage.

Parameters:
Return type:

None