Question

PolarizationRayTrace in Matlab ZOSAPI?

  • 4 August 2022
  • 1 reply
  • 43 views

Hi,

 

Using Matlab with the ZOSAPI with the classical RayTrace, I have access to the Hx, Hy, Px and Py parameters of my ray in the settings.

When I try to analyse a polarized ray using PolarizationRayTrace, I don’t have access to thethese parameters neither the Jones vector parameters.

Does someone know how to do it?

Thank you,

François.


1 reply

Userlevel 4
Badge +1

Hi François,

Thanks for your post here!

It sounds like you are referring to the Polarization Ray Trace and Ray Trace Analysis windows -- am I correct in my understanding? The issue you’re running into is that not all of the OpticStudio analyses have been connected to have their settings directly modified with the API. We have an article here which discusses how you can see which analyses have modifiable settings and which do not: Generating a list of output data types for each analysis in the ZOS-API – Knowledgebase (zemax.com)

If you run the sample MATLAB code provided there, you can get an output table of data that demonstrates which analyses have analysis settings interfaces (IAS interface). These are shown under the Setting column of the output, and we confirm that Polarization Ray Trace can’t be modified in this manner, whereas Ray Trace can (I copied into Excel for better legibility):

 

 

So, you’ll need to take an alternate approach to tracing polarized rays. Actually, we do have ray trace interfaces until the Tools namespace, which allow you to define unpolarized and unpolarized rays in terms of normalized coordinates (Hx, Hy, etc.) or direct starting positions and direction cosine values:

 

 

We have some sample code for the IRayTraceNormUnpolData interface that you could use as a starting reference (it is saved under Example 22):

 

 

With that starting point, you could then change the code to use the IRayTraceNormPolData interface instead, which allows you to define rays with a particular electric field:

 

 

Let us know how these thoughts work out for you or if you have any more questions. Thanks!

Reply