"""Abstract interface for noise models.This module defines :class:`NoiseModel`, the base class used by:class:`graphix.simulator.PatternSimulator` when running noisysimulations. Child classes implement concrete noise processes byoverriding the abstract methods defined here."""from__future__importannotationsimportabcfromtypingimportTYPE_CHECKINGifTYPE_CHECKING:fromgraphix.channelsimportKrausChannelfromgraphix.measurementsimportOutcomefromgraphix.simulatorimportPatternSimulator
[docs]classNoiseModel(abc.ABC):"""Base class for all noise models."""data:PatternSimulator# shared by all objects of the child class.
[docs]defassign_simulator(self,simulator:PatternSimulator)->None:"""Assign the running simulator. Parameters ---------- simulator : :class:`~graphix.simulator.PatternSimulator` Simulator instance that will use this noise model. """self.simulator=simulator
[docs]@abc.abstractmethoddefprepare_qubit(self)->KrausChannel:"""Return the preparation channel. Returns ------- KrausChannel Channel applied after single-qubit preparation. """...
[docs]@abc.abstractmethoddefentangle(self)->KrausChannel:"""Return the channel applied after entanglement. Returns ------- KrausChannel Channel modeling noise during the CZ gate. """...
[docs]@abc.abstractmethoddefmeasure(self)->KrausChannel:"""Return the measurement channel. Returns ------- KrausChannel Channel applied immediately before measurement. """...
[docs]@abc.abstractmethoddefbyproduct_x(self)->KrausChannel:"""Return the channel for X by-product corrections. Returns ------- KrausChannel Channel applied after an X correction. """...
[docs]@abc.abstractmethoddefbyproduct_z(self)->KrausChannel:"""Return the channel for Z by-product corrections. Returns ------- KrausChannel Channel applied after a Z correction. """...
[docs]@abc.abstractmethoddefclifford(self)->KrausChannel:"""Return the channel for Clifford gates. Returns ------- KrausChannel Channel modeling the noise of Clifford operations. """# NOTE might be different depending on the gate....
[docs]@abc.abstractmethoddeftick_clock(self)->None:"""Advance the simulator clock. This accounts for idle errors such as :math:`T_1` and :math:`T_2`. All commands between consecutive ``T`` instructions are considered simultaneous. """...