Optical analogues to NMR spectroscopy