Skip to main content
Solved

PolarizationRayTrace in Matlab ZOSAPI?


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.

Best answer by Angel Morales

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!

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

2 replies

Angel Morales
En-Lightened
Forum|alt.badge.img+1
  • En-Lightened
  • 203 replies
  • Answer
  • August 10, 2022

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!


Hi,

 

Thank you for the answer.

I’ve done it and it works fine.

 

François.


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