Optical measurement of temperature