Skip to main content
Solved

Is an angle of incidence report available in the Ray Database Viewer?


Allie
Zemax Staff
Forum|alt.badge.img+2
  • Zemax Staff
  • 338 replies

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?

Best answer by Allie

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.

View original
Did this topic help you find an answer to your question?

8 replies

Allie
Zemax Staff
Forum|alt.badge.img+2
  • Author
  • Zemax Staff
  • 338 replies
  • Answer
  • April 24, 2019

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.


Allie
Zemax Staff
Forum|alt.badge.img+2
  • Author
  • Zemax Staff
  • 338 replies
  • April 24, 2019
The ZPL macro is attached here!

Forum|alt.badge.img+1

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


Nicholas Herringer
Zemax Staff
Forum|alt.badge.img+1

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


Forum|alt.badge.img

AOI macro seems to be working unexpectedly for my case,

Could you make comment on this ?


Allie
Zemax Staff
Forum|alt.badge.img+2
  • Author
  • Zemax Staff
  • 338 replies
  • November 12, 2021

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?


Forum|alt.badge.img

 

Allie wrote:
  • 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.


Allie
Zemax Staff
Forum|alt.badge.img+2
  • Author
  • Zemax Staff
  • 338 replies
  • November 19, 2021

@Ö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


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