GETPSF
Calculates the diffraction point spread function (PSF) using the FFT algorithm and places the data in one of the vector arrays (either VEC1, VEC2, VEC3, or VEC4).
Syntax:
GETPSF wave, field, sampling, vector, unnormalized, phaseflag, imagedelta
Discussion:
- Wave is an integer corresponding to the wavelength number to use for the calculation. A value of zero indicates a polychromatic calculation.
- Field must be an integer between 1 and the maximum number of fields. The value indicates which field position to use.
- Sampling may be 1 (32 x 32), 2 (64 x 64), 3 (128 x 128), etc... up to 2048 x 2048.
- The vector argument must be an integer value between 1 and 4, and specifies which vector array the data should be placed in.
- The unnormalized flag is zero if the data should be normalized to a peak of 1.0, if the unnormalized value is 1, then the data is returned unnormalized.
- If phase flag is zero, the data returned is intensity.If phase flag is 1, then the phase in degrees is returned.If phase flag is 2, the data returned is the real part of the PSF.If phase flag is 3, the data returned is the imaginary part of the PSF.
- The imagedelta value is the spacing between PSF points in micrometers; use zero for the default spacing. The wavelength must be monochromatic to compute phase data. If any of the arguments fall outside the valid ranges, then the nearest acceptable value is used instead.
The data is returned in one of the vector arrays with the following format:
Vector position 0: the total number of PSF data points in the vector array. Usually, this number will be 4*n*n where n is the sampling size (32, 64, etc.). For example, if the sampling density is 2, the pupil sampling will be 64 x 64, and there will be 128 x 128 or 16,384 values in the array. This will require 8 bytes per number, or a total of 131 kb. A sampling density of 1024 will require at least 8 Mb just for the array; another 64 Mb or more to compute the PSF. Position 0 also returns other values as error codes. If position 0 is zero, then the computation was aborted. If -1, then the vector array is not large enough to hold all the data. Use SETVECSIZE to make the array bigger. If -2, then there is not enough system RAM to compute the PSF data. If -3, a general error occurred while computing the PSF.
Vector position 1 through 4*n*n holds the PSF data intensity. The first 2n values are the first row, going left to right from -x to +x, then each subsequent block of 2n values is another row, going from -y to +y. Vector position 4*n*n+1 holds the spacing between data values in micrometers.
Example:
! This macro computes the PSF ! for the currently loaded lens, polychromatic, ! at the first field, ! and a 32x32 grid density (sampling = 1), ! data will be placed in vector 1, ! normalized to 1, ! no phase data, ! default image delta. SETVECSIZE 4500 GETPSF 0, 1, 1, 1, 0, 0, 0 np = vec1(0) IF (np == 0) PRINT "PSF Computation aborted." GOTO 1 ENDIF IF (np == -1) PRINT "SETVECSIZE too small for PSF data." GOTO 1 ENDIF IF (np == -2) PRINT "Not enough system RAM for PSF data." GOTO 1 ENDIF PRINT "There are ", np, " data points, spaced ", vec1(np+1), " micrometers apart". LABEL 1
Next: