Characterizing and minimizing nonlinearities responsible for intermodulation distortion in high speed and high power photodiodes