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
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.
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'
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:
Best,
Allie
My version is actually: 200121
Ill upgrade my optic studio version and get back here, when I have tested this again.
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?
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
Thank you. Everything works now.
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.
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
This is indeed a very helpful forum. Thank you very much and keep it up!