Skip to main content

I am using zos api at python

The api is very good interface to expand my works.

But, there are some questions.

I want general information of the lens from prescriptionReport.

I find a way to get the data from the code below.

 

prescriptionReport = TheSystem.Analyses.New_Analysis(ZOSAPI.Analysis.AnalysisIDM.PrescriptionDataSettings)

    prescriptionReport.ApplyAndWaitForCompletion()

    prescriptionResults = prescriptionReport.GetResults()

 

However, i cannot find extract data from the “prescriptionResults.”

The only way i know is export the prescriptionResults to a text file and read it.

i want some way to access the results of prescriptionResults .

 

I am calculating Hygens PSF. It was not difficult to caluculate PSF map form zos-api

There are important data in header to utilze the PSF.

I used “headdata=result.get_HeaderData()”, but headdata does not have any data.

I want headerdata of PSF.

 

Thank you all

 

 

Hi,

please check out this topic concerning the header data of the PSF: How do I get center coordinates from Huygens PSF in the ZOS-API? | Zemax Community

I don’t know whether it is possible to extract the text from the prescirption data directly. I had a similar issue once with the Zernike coefficients analyses. Eventually, I saved a temporary text file, loaded its contents, and extracted the required data with regex pattern matching.

Best regards
Benjamin


Hi, that is indeed also how we do it in ZOSPy for the analyses where the API doesn’t give the results directly. 

You can find an example in:

https://github.com/MREYE-LUMC/ZOSPy/blob/main/zospy/analyses/polarization.py

 

But when you are looking at this code, you might also be interested in some of the other analyses included in ZOSPy, as it already has a nice wrapper to get the Huygens PSF you are interested in (analyses.psf.huygens_psf), but also methods to extract other system data in analyses.reports.


To add to that, the general lens data seems to be present in both System Data and Prescription Data. The Prescription Data analysis is not yet available in ZOSPy, but the System Data analysis is. If you are only interested in the general lens data, you can use zospy.analyses.reports.system_data. That will save you the hassle of writing a parser yourself.


You can also just use operands to return the specific values you are interested in, or a merit function that lists everything you want and that you just read out. It might be easier than a text file parser.


Reply