Skip to main content

Hey,

i want to retrieve data from POP with the API (in python). As far as i got i understand that the pop_analysis.GetResult() is delivering a matrix, like the one you get from the text tab in POP. So far so good. But I don’t know how to get the index for peak irradiance or any other certain value. So, can anybody help me to retrieve the peak irradiance value from that matrix? I’d really appreciate any help that would lead me to a solution. There seem to be some options like “IndexOf”, “FindIndex”, but I don’t know how to use them. My code for that section so far:

pop_analysis = TheSystem.Analyses.New_Analysis(ZOSAPI.Analysis.AnalysisIDM.PhysicalOpticsPropagation)
pop_analysis.ApplyAndWaitForCompletion()
pop_results = pop_analysis.GetResults()
matrixData = pop_results.GetDataGrid(0).Values

Thanks,

Mo

Hi @Mo. 

When you use GetResults(), an interface containing a few objects is returned. I have discussed this in more detail here: 

 

The Peak Irradiance is given as part of the POP HeaderData object. In Python, you can extract it with the following:

 

pop = TheSystem.Analyses.Get_AnalysisAtIndex(4)
results = pop.GetResults()
header = results.HeaderData
irradiance = header.Linesi6]

 

That is a quick way to get the Peak Irradiance value. If you want both the Peak Irradiance and its location within the data matrix, you can use the index and max commands that Python provides to parse through your matrixData object. In order to use those two commands, you will need to convert your matrixData object from a System.Doublee,] matrix to a Python array. You can do this with the list command. For example:

 

 

In my code, data was defined in the same way as your matrixData variable. Note: if you are using the Python boilerplate we provide, then the reshape function will perform the conversion for you. 


Thank you very much @Allie !


Reply