original_docstring: 
      Constructs weight matrix from distance matrix + autocorrelation estimate
  
      Parameters
      ----------
      x : array_like
          Distance matrix
      d0 : float
          Estimate of spatial scale of autocorrelation
  
      Returns
      -------
      W : numpy.ndarray
          Weight matrix
      
docstring: Constructs weight matrix from distance matrix + autocorrelation estimate
  Parameters
  
  x : array_like
  Distance matrix
  d0 : float
  Estimate of spatial scale of autocorrelation
  
  Returns
  
  W : numpy.ndarray
  Weight matrix
docstring_tokens: Constructs weight matrix from distance matrix + autocorrelation estimate Parameters x : array_like Distance matrix d0 : float Estimate of spatial scale of autocorrelation Returns W : numpy . ndarray Weight matrix
code: def _make_weight_matrix(x, d0):
      """
      Constructs weight matrix from distance matrix + autocorrelation estimate
  
      Parameters
      ----------
      x : array_like
          Distance matrix
      d0 : float
          Estimate of spatial scale of autocorrelation
  
      Returns
      -------
      W : numpy.ndarray
          Weight matrix
      """
  
      # "W is the row-normalized weight matrix with zero diagonal and"
      # "off-diagonal elements proportional to W[ij] = z[i]^-1 exp(-D[ij]/d0),"
      # "where D[ij] is the surface-based geodesic distance between cortical"
      # "areas i and j, and z[i] is a row-wise normalization factor."
      # z[i] = row sum exp(-D[ij]/d0)
      with np.errstate(over='ignore'):
          weight = np.exp(-x / d0) * np.logical_not(np.eye(len(x), dtype=bool))
  
      # avoid divide-by-zero errors
      with np.errstate(invalid='ignore'):
          return weight / np.sum(weight, axis=1)
code_tokens: def _make_weight_matrix ( x , d0 ) : with np . errstate ( over = 'ignore' ) : weight = np . exp ( - x / d0 ) * np . logical_not ( np . eye ( len ( x ) , dtype = bool ) ) with np . errstate ( invalid = 'ignore' ) : return weight / np . sum ( weight , axis = 1 )
short_docstring: Constructs weight matrix from distance matrix + autocorrelation estimate
  Parameters
short_docstring_tokens: Constructs weight matrix from distance matrix + autocorrelation estimate Parameters
comment: """
      Constructs weight matrix from distance matrix + autocorrelation estimate
  
      Parameters
      ----------
      x : array_like
          Distance matrix
      d0 : float
          Estimate of spatial scale of autocorrelation
  
      Returns
      -------
      W : numpy.ndarray
          Weight matrix
      """$SEP$# "W is the row-normalized weight matrix with zero diagonal and"$SEP$# "off-diagonal elements proportional to W[ij] = z[i]^-1 exp(-D[ij]/d0),"$SEP$# "where D[ij] is the surface-based geodesic distance between cortical"$SEP$# "areas i and j, and z[i] is a row-wise normalization factor."$SEP$# z[i] = row sum exp(-D[ij]/d0)$SEP$# avoid divide-by-zero errors