Hi Armand,
There is not a built-in way to get the electric field. However, the real & imaginary components of the x & y e-field are saved in the ZBF file. You can either use the ZPL with the ZBFREAD
keyword or you can use the ZOS-API. The Help Files have a really good example for using ZBFREAD...I have modified it slightly to output a more readable format:
! modified from the Help Files
BROWSE "Select ZBF file", zbf$, 0
IF SLEN(zbf$) == 0 THEN END
! First get the beam size
ZBFPROPERTIES zbf$, 1
nx = vec1(1)
ny = vec1(2)
ip = vec1(14) # The "is polarized" flag
! Allocate enough memory to hold the beam
IF (ip == 1)
PRINT "this example only handles unpolarized beams"
END
ENDIF
DECLARE B, DOUBLE, 3, nx, ny, 2
DECLARE P, DOUBLE, 1, 20
ZBFREAD zbf$, B, P
real$ = $TEMPFILENAME()
imag$ = $TEMPFILENAME()
FORMAT 12.6
! print data to text files
OUTPUT real$
PRINT "Real Data - ", zbf$
FOR j, 1, ny, 1
FOR i, 1, nx, 1
PRINT B(i, j, 1),
NEXT
PRINT
NEXT
OUTPUT SCREEN
OUTPUT imag$
PRINT "Imaginary Data - " , zbf$
FOR j, 1, ny, 1
FOR i, 1, nx, 1
PRINT B(i, j, 2),
NEXT
PRINT
NEXT
OUTPUT SCREEN
! show the data
SHOWFILE real$
SHOWFILE imag$
Michael C also wrote some really good parsers if you want to use the ZOS-API.
Python Reading Writing Binary Files (ZRD, ZBF, DAT, SDF) | Zemax Community