Lucky spectroscopy, an equivalent technique to lucky imaging