Skip to main content

The Ray Database Viewer reports quite a bit of data, but it doesn't seem to have angle of incidence. Is there an option to show that information? Or do I have to derive it myself?



OpticStudio 19.4 provides a lot of useful information in a Ray Database Viewer. All of this information is considered to be the “base” information and there is some useful information that a user might have to derive from this base information. The information reported is:





  • Segment identification and history (left 6 columns)


  • Interaction at a given surface (XRTSDGEFBZ columns)


  • XYZ ray intercept coordinates


  • LMN direction cosines


  • Nx/Ny/Nz surface normal at the ray intercept


  • Real & Imaginary E-field


  • Path & Phase information




To visualize the LMN and Normals in terms of Angle of Incidence rather than the provided vector representation, you will need to derive the values yourself. To do so, you will need to use the equation for the angle between 2 vectors:













Translating this to OpticStudio values, you get the angle to be:










In order to automate this process, you can create a ZPL macro that will loop through each row in an opened Ray Database Viewer (the RDV needs to be opened to ensure that the proper LMN and Normal values are displayed since these can be toggled on & off).  The ZPL attached in the next post will ask the user for the window number of the RDV, which is the number in the left part of the tab. The only 2 caveats for using this macro are:





  1. Both the LMN and Normal boxes must be checked


  2. Only 4 out of the bottom 5 boxes can be checked











The following will be the output.  Notice that the LMN and Normal components are printed out so you can verify that the inputs are correct.  The last column will be the AOI of the ray with respect to the surface normal.








The ZPL macro is attached here!


Hi, 



The attached zpl file cannot be opened! could you please attach it again? thanks.


Is this method works for sequential mode as well?



Cheers,



Sahar






Hi Sahar, 



Thanks for the message. I've gone ahead and reuploaded the file as a .zip folder. Can you try downloading it again? When you open the file, make sure to <right-click> and select Open With...Notepad (or another text editor). I found that my computer was defaulting to another program. 



That said, to answer your second question, out of box, this method will not work for Sequential Mode. This macro reads information from the Ray Database Viewer, which is only available in Non-Sequential Mode. However, you can report the angle of incidence for a given ray at a given surface in your sequential system using the optimization operand, RAID. With this, you could define a macro to loop over a given set of rays and report the RAID operand values for them. Check out this article on the Knowledgebase for some guidance on how to do this.



Cheers,



Nick




AOI macro seems to be working unexpectedly for my case,

Could you make comment on this ?


Hi @Önder.Sönmez - I don’t see anything right off the bat. Are you able to send the file you’re using as a Zemax Archive (ZAR) file? Or, at least provide the ZRD file?


 

  • Hi @Önder.Sönmez - I don’t see anything right off the bat. Are you able to send the file you’re using as a Zemax Archive (ZAR) file? Or, at least provide the ZRD file?

Thank you for your response Allie,

 

I attached the zipped version of my ZRD  file. I am not clear about how to read the correct angle values.

A comment on the sitiuation is welcomed.


@Önder.Sönmez - Thanks for sharing your file! Looking at this, I see that the L, M, and N values do not match up with what is shown in your screenshot. In fact, I now notice that your screenshot is reporting values greater than 1 for the direction cosines. This isn’t correct - is this also what you see in the Ray Database Viewer itself?

 

 

Based on the ZRD file you sent me, I think when you ran the macro, it somehow picked up the wrong values for L, M, and N which would result in the incorrect values for the AOI. I’m not sure how this would happen as it appears we have the same settings for the Ray Database Viewer. Here’s what I would suggest:

  1. Open a new Ray Database Viewer window
  2. Set up your settings to be the same as mine (shown in an image below)
  3. Click Save. This is not typically necessary, but I want to be sure the settings are properly applied
  4. When you run the macro, ensure you’re picking the correct window number as given by the title of the tab.
     

 

 

Ray Database Viewer window settings

 

For your reference, I am attaching the output I saw with the macro. Let me know if you still have trouble getting this to run after running through the steps I sent. In that case, maybe we can set up a screenshare so I can see what’s going on.


Reply