Skip to main content

Possible to set Settings for "PhysicalOpticsPropagation" window via Matlab API?


Nils.Melchert

Hello,

I was wondering, if it is possible to define the Settings for a 'PhysicalOpticsPropagation' Window created in Matlab as follows:

 

window = TheSystem.Analyses.New_Analysis(ZOSAPI.Analysis.AnalysisIDM.PhysicalOpticsPropagation)

 

I am missing an option for "General", "Beam Definition", "Display", and so on.

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

11 replies

Csilla Timar-Fulep
Zemax Staff
Forum|alt.badge.img+2

Hi Nils,

Thanks for your question here!

 

My colleague Ali wrote a forum post about this very topic, please find the link below:

 

 

 

In this post, he discusses how to adjust the settings of POP from Matlab API.

 

 

If you have further questions, please let us know and we will be happy to help!

 

 

Best,

 

Csilla

 


Nils.Melchert
  • Author
  • Infrared
  • 14 replies
  • January 11, 2021

Thanks. That looks like a good source.

However, ' newPOP.HasAnalysisSpecificSettings ' is returning 0, meaning that there are no settings available? I am working with an existing instance, which I defined in OpticStudio directly.


Nils.Melchert
  • Author
  • Infrared
  • 14 replies
  • January 11, 2021

I just copy and pasted the code mentioned in your link, but it seems to fail when entering:

newPOP_Settings.Wavelength.SetWavelengthNumber(1);

'No appropriate method, property, or field 'Wavelength' for class 'ZemaxUI.ZOSAPI.Analysis.AS_Default'.'

EDIT: The only differences to the code provided are, that he has an instance with name 'AS_PhysicalOpticsPropagation' and not 'AS_Default'


Allie
Zemax Staff
Forum|alt.badge.img+2
  • Zemax Staff
  • 337 replies
  • January 11, 2021

Hi Nils,

You are correct that when HasAnalysisSpecificSettings returns '0' there is no settings interface available in the API for the analysis window you are investigating. The POP settings interface was introduced in our OpticStudio 20.3 release. It was not available before that. Which version are you using? You can check in your code with this line:

    val = TheApplication.OpticStudioVersion;

Let me know what you see for the value of val. It will need to be one of the following value for the POP settings interface to work:

  • 200914
  • 201013
  • 201130

Best,

Allie


Nils.Melchert
  • Author
  • Infrared
  • 14 replies
  • January 12, 2021

My version is actually: 200121

Ill upgrade my optic studio version and get back here, when I have tested this again.


Nils.Melchert
  • Author
  • Infrared
  • 14 replies
  • January 12, 2021

I have indeed the version 200121. However, since I am using an educational license as a lecturer, I am not able to update my license. Could you please help me with that?


Csilla Timar-Fulep
Zemax Staff
Forum|alt.badge.img+2

Hi Nils,

As your license is currently under support, you may use the latest release of OpticStudio. The keys are eligible to run any version of the software that pre-dates the support expiration date.

You may download the current version of OpticStudio from our website:

OpticStudio Downloads · MyZemax 

Best,

Csilla


Nils.Melchert
  • Author
  • Infrared
  • 14 replies
  • January 12, 2021

Thank you. Everything works now.


Nils.Melchert
  • Author
  • Infrared
  • 14 replies
  • January 12, 2021

One last Question:

The line 'newPOP_Results = newPOP.GetResults(); ' actually outputs the results which were saved to a .ZBF file in previous versions?

How am I able to access the results properly?

To put it in other words: I am not able to access the EField Data from the 'GetResults' method.


Csilla Timar-Fulep
Zemax Staff
Forum|alt.badge.img+2

Hi Nils,

Thanks for your your follow-up question!

The line:

newPOP_Results = newPOP.GetResults();

retrieves the matrix data provided in the Text tab of the analysis window:

You may use the following line to access the data:

matrixData = newPOP_Results.DataGrids(1).Values.double;

You may find more instructions about how to process and plot these data in this from thread from Allie:

How do I output the image of an analysis in ZOS-API? · MyZemax

Besides, more information on how to access the header and meta data from the analysis window can be found here:

How can I pull Peak Irradiance or Total Hits from the Detector Viewer analysis in the API? · MyZemax

I hope this helps!

Best,

Csilla


Nils.Melchert
  • Author
  • Infrared
  • 14 replies
  • January 12, 2021

This is indeed a very helpful forum. Thank you very much and keep it up!


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