Measuring the characteristics of individual optical pulses or of optical pulse trains