[docs]classM(Command):""" Measurement command. By default the plane is set to 'XY', the angle to 0, empty domains and identity vop. """kind:CommandKind=CommandKind.Mnode:Nodeplane:Plane=Plane.XYangle:float=0.0s_domain:set[Node]=set()t_domain:set[Node]=set()defclifford(self,clifford:Clifford)->M:s_domain=self.s_domaint_domain=self.t_domainforgateinclifford.hsz:ifgate==graphix.clifford.I:passelifgate==graphix.clifford.H:t_domain,s_domain=s_domain,t_domainelifgate==graphix.clifford.S:t_domain^=s_domainelifgate==graphix.clifford.Z:passelse:raiseRuntimeError(f"{gate} should be either I, H, S or Z.")update=graphix.pauli.MeasureUpdate.compute(self.plane,False,False,clifford)returnM(node=self.node,plane=update.new_plane,angle=self.angle*update.coeff+update.add_term/np.pi,s_domain=s_domain,t_domain=t_domain,)
classCorrection(Command):""" Correction command. Either X or Z. """node:Nodedomain:set[Node]=set()
[docs]classX(Correction):""" X correction command. """kind:CommandKind=CommandKind.X
[docs]classZ(Correction):""" Z correction command. """kind:CommandKind=CommandKind.Z
classS(Command):""" S command """kind:CommandKind=CommandKind.Snode:Nodedomain:set[Node]=set()classT(Command):""" T command """kind:CommandKind=CommandKind.T