Smelling chemicals with a photonic nose