
    {	i                         S r SSKrSS jrg)z
Noise model inserter module
The goal of this module is to add QuantumError gates (Kraus gates) to a circuit
based on a given noise model.
    Nc                   ^ [        U [        [        45      nU(       a  U OU /n / nUR                  nUR                  nU  GHy  nU(       a(  [
        R                  R                  XqR                  S9nOUn[        UR                  5       V	V
s0 s H  u  pX_M	     sn
n	mUR                  UR                  S-   S9n/ Ul        UR                   H  nUR                  R                  U5        [        U4S jUR                   5       5      nUR                  R                  nX;   a;  XU   ;   a3  X^   U   nUR                  UR!                  5       UR                  5        M  XR#                  5       ;   d  M  Xn   nUR                  UR!                  5       UR                  5        M     UR                  U5        GM|     U(       a  U$ US   $ s  sn
n	f )a  Return a noisy version of a QuantumCircuit.

Args:
    circuits (QuantumCircuit or list[QuantumCircuit]): Input noise-free circuits.
    noise_model (NoiseModel):  The noise model containing the errors to add
    transpile (Boolean): Should the circuit be transpiled into the noise model basis gates

Returns:
    QuantumCircuit: The new circuit with the Kraus noise instructions inserted.

Additional Information:
    The noisy circuit return by this function will consist of the
    original circuit with ``Kraus`` instructions inserted after all
    instructions referenced in the ``noise_model``. The resulting circuit
    cannot be ran on a quantum computer but can be executed on the
    :class:`~qiskit_aer.QasmSimulator`.
)basis_gates_with_noise)namec              3   .   >#    U  H
  nTU   v   M     g 7f)N ).0qqubit_indicess     _/home/james-whalen/.local/lib/python3.13/site-packages/qiskit_aer/utils/noise_model_inserter.py	<genexpr>insert_noise.<locals>.<genexpr>7   s     A[=+[s   r   )
isinstancelisttuple_local_quantum_errors_default_quantum_errorsqiskitcompiler	transpiler   	enumeratequbitscopyr   dataappend	operationto_instructionkeys)circuitsnoise_modelr   is_circuits_listresult_circuitslocal_errorsdefault_errorscircuittranspiled_circuitindexbitresult_circuitinstr   r   errorr   s                   @r   insert_noiser,      s   $ "(T5M:+x(HO44L 88N!'!:!:%<%< "; " ")6?@R@Y@Y6Z[6Z
6Z[+006H6M6MP]6]0^ &++D&&t,AT[[AAF >>&&D#t2D(D$*62%%e&:&:&<dkkJ,,..&,%%e&:&:&<dkkJ , 	~.- . /?FOA4FF! \s   G)F)__doc__qiskit.compilerr   r,   r       r   <module>r0      s   
 .Gr/   