code: def spher2cart(rho, theta, phi):
      
      st = np.sin(theta)
      sp = np.sin(phi)
      ct = np.cos(theta)
      cp = np.cos(phi)
      rhost = rho * st
      x = rhost * cp
      y = rhost * sp
      z = rho * ct
      return np.array([x, y, z])
docs: Spherical to Cartesian coordinate conversion.