Skip to main content

Change Input Polarization in Polarization Transmission using ZPL Macro


I am trying to create Mueller matrix for my polarimeter's optical design by finding the system's transmission for known states of input polarization. For this I have written a ZPL Macro to fetch a list of input polarization values from a .txt file and create corresponding polarization transmission files.

Problem:  For the whole macro run, it is unable to take in any input polarization from the .txt file containing the list of polarization values. Instead, it creates transmission files only for the polarization which is already loaded in the transmission tab when starting the macro(nominally Jx = 1, Jy = 0 ) .  I am attaching the ZPL macro below. Let me know how can I fix this problem.


"""
!macro to set the number of field points and get transmission data
!SETSYSTEMPROPERTY 101, 12
!polarization input data path
filename$="D:\Polarization_calibration\CalibrationInput.txt"
print, filename$
OPEN filename$
FOR j,1,5,1
FORMAT 1 INT
READ slno, jx, jy 
PRINT slno, jx, jy
SETSYSTEMPROPERTY 60, jx
SETSYSTEMPROPERTY 61, jy
SETSYSTEMPROPERTY 62, 0
SETSYSTEMPROPERTY 63, 0
UPDATE ALL
FORMAT 1.6
PRINT jx, jy
OPENANALYSISWINDOW "Tra"
name$ = "_" + $STR(j)
!path where the file has to be stored
main_name$ = "D:\Test\Config_1\transmission"
final_name$ = main_name$ + + name$ + ".txt"
GETTEXTFILE final_name$, "TRA"
CONVERTFILEFORMAT final_name$, 1
PRINT, "Transmission data Generated!!!"
NEXT
"""
Did this topic help you find an answer to your question?

3 replies

Mark.Nicholson
Luminary
Forum|alt.badge.img+3
Hi Siddharth,

If you are using the TRA analysis feature, it uses its own Settings dialog to define the polarization to use. You should use MODIFYSETTINGS instead of changing the system-level polarization.

Alternatively, you can use the POLDEFINE and POLTRACE keywords to set polarization, trace a ray and then get the transmission data from the answer vector returned.

Hi Mark. 

Thanks for your response.

We wanted to use MODIFYSETTINGS for TRA feature, but the operands(type) for defining Jx and Jy is not available in Zemax 14 version which I am using.  Do you have any suggestions how we can incorporate that in ZPL macro?

Regards,
Siddharth

Mark.Nicholson
Luminary
Forum|alt.badge.img+3

Sure, just use POLDEFINE and POLTRACE. This will give the transmission for a single ray, which may be all you need, but if you want to use a grid of rays you'll just need to put the POLTRACE inside a FOR/NEXT loop.


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings