Solved

Only positive values for Chief Ray Coordinates with Merit Function Operands

  • 22 November 2022
  • 2 replies
  • 276 views

Hey Everyone!

 

I am currently trying to figure out a way to get the coordinates of the Chief Ray from a Monte Carlo Run so that I get a dataset of Chief Ray coordinates correlating to different lens displacements.  I am using the the Merit Function Criterion for the Monte Carlo Run in the Tolerancing tab. My Merit Funtion consists only of the Headers and one operand ( REAY or REAX).  The results only give out positive values for the Merit Function but I need it to also show me negative displacements.

I am new to ZOS so any help is very appreciated! 

icon

Best answer by Ethan 20 December 2022, 22:27

View original

2 replies

Userlevel 3
Badge +2

Hi @Ineedhelpformy hesis,

The merit function will always be positive. The value of the merit function is computed based on how close the operand values are to their target. In other words, the calculation of the merit function is related to the value of your REAY or REAX operand, but it does not give those numbers directly. The merit function is defined by the following equation in OpticStudio:

where W is the weight, V is the value, and T is the target of each operand. Therefore, to get the value of REAX or REAY, you will need to view them in the Merit Function Editor directly and save the data from Values column.

With the ZOS-API, you can collect these values directly instead of retrieving the value of the Merit Function. Here is a snippet of MATLAB code that retrieves the REAX operand value:

MFE = TheSystem.MFE;

RayX = MFE.GetOperandValue(ZOSAPI.Editors.MFE.MeritOperandType.REAX, 

     surface

     wave,

     Hx,

     Hy,

     Px,

     Py,

     0, (not used)

     0, (not used)

     );

 

Best,
Ethan

Userlevel 6
Badge +2

You can also use a Tolerance Script to get these values. Have a look at that article: https://support.zemax.com/hc/en-us/articles/1500005575382-How-to-get-any-optimization-operand-value-in-the-tolerance-report

Reply