The PSF is specific to the optical instrument you are working with and depends on its aperture shape. You can use the numpy.fft library to compute the PSF from the aperture assuming the Fraunhofer propagation for instance. If you have an image from which you want to estimate the PSF, deconvolution (blind, myopic or marginal) techniques are needed. The MTF is then obtained from the absolute value of the Fourier transform of the PSF.