code: def avg_gate_fidelity(self, reference_unitary):
          
          process_fidelity = self.process_fidelity(reference_unitary)
          dimension = self.pauli_basis.ops[0].shape[0]
          return (dimension * process_fidelity + 1.0) / (dimension + 1.0)
docs: Compute the average gate fidelity of the estimated process with respect to a unitary
           process. See `Chow et al., 2012, <https://doi.org/10.1103/PhysRevLett.109.060501>`_
  
          :param (qutip.Qobj|matrix-like) reference_unitary: A unitary operator that induces a process
           as `rho -> other*rho*other.dag()`, alternatively a superoperator or Pauli-transfer matrix.
          :return: The average gate fidelity, a real number between 1/(d+1) and 1, where d is the
          Hilbert space dimension.
          :rtype: float