docs: def cartesian_to_helicity(vector, numeric=False):
      r"""This function takes vectors from the cartesian basis to the helicity basis.
      For instance, we can check what are the vectors of the helicity basis.
  
      >>> from sympy import pi
      >>> em=polarization_vector(phi=0, theta= 0, alpha=0, beta=-pi/8,p= 1)
      >>> em
      Matrix([
      [   sqrt(2)/2],
      [-sqrt(2)*I/2],
      [           0]])
      >>> cartesian_to_helicity(em)
      Matrix([
      [ 0],
      [ 0],
      [-1]])
  
      >>> e0=polarization_vector(phi=pi/2, theta=pi/2, alpha=pi/2, beta=0,p=1)
      >>> e0
      Matrix([
      [0],
      [0],
      [1]])
      >>> cartesian_to_helicity(e0)
      Matrix([
      [0],
      [1],
      [0]])
  
      >>> ep=polarization_vector(phi=0, theta= 0, alpha=pi/2, beta= pi/8,p= 1)
      >>> ep
      Matrix([
      [  -sqrt(2)/2],
      [-sqrt(2)*I/2],
      [           0]])
      >>> cartesian_to_helicity(ep)
      Matrix([
      [-1],
      [ 0],
      [ 0]])
  
      Note that vectors in the helicity basis are built in a weird way by
      convention:
  
      .. math::
  
          \vec{a} = -a_{+1}\vec{e}_{-1} +a_0\vec{e}_0 -a_{-1}\vec{e}_{+1}
  
      >>> from sympy import symbols
      >>> am,a0,ap = symbols("am a0 ap")
      >>> a=-ap*em +a0*e0 -am*ep
      >>> a
      Matrix([
      [    sqrt(2)*am/2 - sqrt(2)*ap/2],
      [sqrt(2)*I*am/2 + sqrt(2)*I*ap/2],
      [                             a0]])
      >>> cartesian_to_helicity(a).expand()
      Matrix([
      [am],
      [a0],
      [ap]])
  
      We can also convert a numeric array
  
      >>> r =[[[0.0, 1.0],
      ...      [1.0, 0.0]],
      ...     [[0.0, -1j],
      ...      [ 1j, 0.0]],
      ...     [[1.0, 0.0],
      ...      [0.0,-1.0]]]
  
      >>> cartesian_to_helicity(r, numeric=True)
      array([[[ 0.    +0.j,  0.    +0.j],
              [ 1.4142+0.j,  0.    +0.j]],
      <BLANKLINE>
             [[ 1.    +0.j,  0.    +0.j],
              [ 0.    +0.j, -1.    +0.j]],
      <BLANKLINE>
             [[-0.    +0.j, -1.4142+0.j],
              [-0.    +0.j, -0.    +0.j]]])
  
      """
      if numeric:
          vector = list(vector)
          vector[0] = nparray(vector[0])
          vector[1] = nparray(vector[1])
          vector[2] = nparray(vector[2])
  
          v = [(vector[0]-1j*vector[1])/npsqrt(2),
               vector[2],
               -(vector[0]+1j*vector[1])/npsqrt(2)]
          v = nparray(v)
      else:
          v = [(vector[0]-I*vector[1])/sqrt(2),
               vector[2],
               -(vector[0]+I*vector[1])/sqrt(2)]
  
      if type(vector[0]) in [type(Matrix([1, 0])), type(nparray([1, 0]))]:
          return v
      else:
          return Matrix(v)