code: def angular_similarity(S, T):
      r"""Computes the cosine distance of the best match between
      points of two sets of vectors S and T
  
      Parameters
      ----------
      S : array, shape (m,d)
      T : array, shape (n,d)
  
      Returns
      -------
      max_cosine_distance:float
  
      Examples
      --------
      >>> import numpy as np
      >>> from dipy.core.sphere_stats import angular_similarity
      >>> S=np.array([[1,0,0],[0,1,0],[0,0,1]])
      >>> T=np.array([[1,0,0],[0,0,1]])
      >>> angular_similarity(S,T)
      2.0
      >>> T=np.array([[0,1,0],[1,0,0],[0,0,1]])
      >>> S=np.array([[1,0,0],[0,0,1]])
      >>> angular_similarity(S,T)
      2.0
      >>> S=np.array([[-1,0,0],[0,1,0],[0,0,1]])
      >>> T=np.array([[1,0,0],[0,0,-1]])
      >>> angular_similarity(S,T)
      2.0
      >>> T=np.array([[0,1,0],[1,0,0],[0,0,1]])
      >>> S=np.array([[1,0,0],[0,1,0],[0,0,1]])
      >>> angular_similarity(S,T)
      3.0
      >>> S=np.array([[0,1,0],[1,0,0],[0,0,1]])
      >>> T=np.array([[1,0,0],[0,np.sqrt(2)/2.,np.sqrt(2)/2.],[0,0,1]])
      >>> angular_similarity(S,T)
      2.7071067811865475
      >>> S=np.array([[0,1,0],[1,0,0],[0,0,1]])
      >>> T=np.array([[1,0,0]])
      >>> angular_similarity(S,T)
      1.0
      >>> S=np.array([[0,1,0],[1,0,0]])
      >>> T=np.array([[0,0,1]])
      >>> angular_similarity(S,T)
      0.0
      >>> S=np.array([[0,1,0],[1,0,0]])
      >>> T=np.array([[0,np.sqrt(2)/2.,np.sqrt(2)/2.]])
  
      Now we use ``print`` to reduce the precision of of the printed output
      (so the doctests don't detect unimportant differences)
  
      >>> print('%.12f' % angular_similarity(S,T))
      0.707106781187
      >>> S=np.array([[0,1,0]])
      >>> T=np.array([[0,np.sqrt(2)/2.,np.sqrt(2)/2.]])
      >>> print('%.12f' % angular_similarity(S,T))
      0.707106781187
      >>> S=np.array([[0,1,0],[0,0,1]])
      >>> T=np.array([[0,np.sqrt(2)/2.,np.sqrt(2)/2.]])
      >>> print('%.12f' % angular_similarity(S,T))
      0.707106781187
      """
      m = len(S)
      n = len(T)
      if m < n:
          A = S.copy()
          a = m
          S = T
          T = A
          n = a
  
      """
      v=[]
      for p in permutations(S,n):
          angles=[]
          for i in range(n):
              angles.append(np.abs(np.dot(p[i],T[i])))
          v.append(np.sum(angles))
      print(v)
      """
      v = [
          np.sum([np.abs(np.dot(p[i], T[i])) for i in range(n)])
          for p in permutations(S, n)
      ]
  
      return float(np.max(v))
  
imports: import numpy
  import dipy.core.geometry
  from itertools import permutations
label_desc: Use image node_id 4 for calling a global function with example usage: angular_similarity(S, T) and returns: float