Skip to main content

 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
INPUT "What window is the Huygens PSF Cross Section?",win

fwhm = 0.5

FOR a = 1, 100, 1
    x1 = GETL(win, a + 0, 2)
    x2 = GETL(win, a + 1, 2)
    
    y1 = GETL(win, a + 0, 3)
    y2 = GETL(win, a + 1, 3)
    
    IF (ABSO(x2 - x1) > 0) & (ABSO(y2 - y1) > 0) 
        IF (y2 > 0.5) & (y1 < 0.5)
            left = (fwhm - y1)/((y2 - y1) / (x2 - x1)) + x1
            PRINT "Left:     " , left
        ENDIF
        IF (y2 < 0.5) & (y1 > 0.5)
            right = (fwhm - y1)/((y2 - y1) / (x2 - x1)) + x1
            PRINT "Right:     " , right
        ENDIF
    ENDIF 
NEXT

PRINT "FWHM:      " , (right - left)

有一些假设和前置操作:

PSF只能有一次上升跟下降

窗口设置要勾选Normalize,选择text窗口

运行时要输入PSF窗口的序号

 


对于刚接触宏的工程师,参考一下:
How to write a ZPL macro: Computing Zonal Transverse Chromatic Aberration – Knowledgebase (zemax.com)
免费的ZPL学习路径:
ZPL – Knowledgebase (zemax.com)


Reply