GETMTFUSER1D

Calculates tangential and sagittal MTF data from a Huygens PSF text file and places the data in one of the vector arrays (either VEC1, VEC2, VEC3, or VEC4).

Syntax:

GETMTFUSER1D wave, pupil_samp, idelta, PSFFile$, vector

Discussion:

Wave is an integer corresponding to the wavelength number to use for the calculation. A value of zero indicates a polychromatic calculation. Pupil_samp may be 1 (32 x 32), 2 (64 x 64), 3 (128 x 128), etc... up to 2048 x 2048. Idelta is the distance in micrometers between points in the image grid. Use zero for the default grid spacing. PSFFile$ is a string containing the file name and path of the text file containing the Huygens PSF data to use. The vector argument must be an integer value between 1 and 4, and specifies which vector array the data should be placed in. If any of the arguments fall outside the valid ranges, then the nearest acceptable value is used instead. This calculation uses the Huygens MTF method.

Note that TXT File Encoding (set under OpticStudio Preferences > General) must be set to ANSI to use this keyword. To convert existing text files to the right format, use the keyword CONVERTFILEFORMAT.

Note that you should close any active Huygens PSF files created with the OUTPUT keyword by using OUTPUT SCREEN prior to calling GETMTFUSER1D.

Example:

PSFFile$ = "C:\Users\Name\Documents\Zemax\PSF.txt"

SettingsFile$ = "C:\Users\Name\Documents\Zemax\Configs\HPS.CFG"

wave = 3
pupil_samp = 4
idelta = 0.008366

MODIFYSETTINGS SettingsFile$, HPS_PUPILSAMP, pupil_samp
MODIFYSETTINGS SettingsFile$, HPS_IMAGEDELTA, idelta
MODIFYSETTINGS SettingsFile$, HPS_IMAGESAMP, 2
MODIFYSETTINGS SettingsFile$, HPS_WAVE, wave
MODIFYSETTINGS SettingsFile$, HPS_FIELD, 1
MODIFYSETTINGS SettingsFile$, HPS_CENTROID, 1

GETTEXTFILE PSFFile$, Hps

vector = 4

GETMTFUSER1D wave, pupil_samp, PSFFile$, vector
N_BINS = vec4(0)
OFFSET = vec4(1)

OUTPUT SCREEN

FORMAT 15.0
PRINT "Number of Bins = ", N_BINS
FORMAT 15.0
PRINT "Offset = ", OFFSET

OFF1 = OFFSET
OFF2 = OFF1 + N_BINS
OFF3 = OFF2 + N_BINS

MAXI = N_BINS-1
FORMAT 16.6
PRINT
PRINT "             X          Tan           Sag"
PRINT
 
FOR i, 0, MAXI, 1
PRINT vec4(OFF1 + i),
PRINT vec4(OFF2 + i),
PRINT vec4(OFF3 + i)
NEXT i

Next: