An improved method of checking the linearity of a photodetector