Thank you for this very useful ImageJ macro!
In the reduction of x_psf and y_psf to x_psf_r and y_psf_r, you do:
// reduce to number of entries within the xmin, xmax range
x_psf_r = Array.slice(x_psf, 0, count2-1);
y_psf_r = Array.slice(y_psf, 0, count2-1);
Because of the -1, you omit the last value before the bunch of zeros. Is this intentional or is this wrong slicing? In my opinion, the -1 should be removed, so the x_psf_r has length count2.