Still more DOF management

Started Jun 14, 2016 | Discussions thread
alanr0 Senior Member • Posts: 1,893
Re: Simulation software, quantisation & spatial resolution
1

Jack Hogan wrote:

Agreed about the need to work in floating point where complex Fourier stuff is concerned. I understand that was one of the main motivators to come up with a floating point version of ImageMagick.

I can see the benefits of having an optimized command line executable for the sake of speed and ease of use. Perhaps one suggestion could be to first have the basic engine working properly in Octave/Matlab - and then implement it in the faster language with a proper interface. This would also allow us to have a reference to verify the accuracy of the final product.

Just for fun, I think the following three lines in Octave/Matlab should produce the PSF and MTF of an aberrated lens. W is the 2D aberrated monochromatic wavefront (say W020*R.^2+W040*R.^4 for rotationally symmetric spherical+defocus, R normalized for wavelength and f-number):

P = exp(1i*2*pi*W) %2D Pupil Function Amplitude
psf = abs(fftshift(fft2(P))).^2 %2D Intensity PSF
MTF = abs(fft2(psf)) %2D Unnormalized MTF

Near enough. The following snipped directly from Octave code used for my figures - uploaded 20 minutes after your post (I was mid-edit when you hit the button).

phase = dz * NA2*a2a * pi / wlen + sphase;

amp = amask;
amp(yv,xv) = amp(yv,xv) .* exp(i*phase);

% Only calculate exp() over central range ( yv,xv) where field is non-zero

anf = fftshift(fft2(ifftshift(amp)))/amsum; % Near field diffracted field

psf = anf .* conj(anf); % Near field diffracted intensity

% amask is a circular mask, a2a is normalised radius squared (unity at aperture boundary), sphase includes higher order aberrations, wlen is wavelength, amsum normalises to the aperture area.

A.

-- hide signature --

Alan Robinson

Post (hide subjects) Posted by
Keyboard shortcuts:
FForum PPrevious NNext WNext unread UUpvote SSubscribe RReply QQuote BBookmark MMy threads
Color scheme? Blue / Yellow