code: def ang2vec(theta, phi, lonlat=False):
      
      lon, lat = _healpy_to_lonlat(theta, phi, lonlat=lonlat)
      rep_sph = UnitSphericalRepresentation(lon, lat)
      rep_car = rep_sph.represent_as(CartesianRepresentation)
      return rep_car.xyz.value
docs: Drop-in replacement for healpy `~healpy.pixelfunc.ang2vec`.