code: def set_markov_prior(self, beta, U=None):
      if U is not None:  # make sure it's C-contiguous
          self.U = np.asarray(U).copy()
      else:  # Potts model
          U = np.ones((self.nclasses, self.nclasses))
          U[_diag_indices(self.nclasses)] = 0
          self.U = U
      self.beta = float(beta)
  
file_path: nipy/nipy/algorithms/segmentation/segmentation.py
imports: import numpy
  from ._segmentation import _interaction_energy, _ve_step
label_desc: Use image node_id 2 for calling the Segmentation obj's underlying member method code with example usage: obj.set_markov_prior(beta, U) without return types