Hi mbelio,
As far as I know, PyZDDE isn’t developped (and therefore not supported) by Zemax. Assuming this is the most up-to-date repo for PyZDDE, the most recent commit was 5 years ago.
I’d advise to use the ZOS-API, which has been developped by Zemax, and recieves regular updates (notably with the .net connexion recently).
I cannot comment for the functionalities of PyZDDE, but most of the OpticStudio features have already been implemented in the ZOS-API. Perhaps this article can give some insights about the DDE extension itself.
What features in particular are you interested in?
Take care,
David
Hi,
Thank you very much for your answer,
I want to do a kind of WFE sensitivity analysis. I.e. perturb the elements of my system and get the change in the performance, in terms of Zernike residuals, RMS residual error, wavefront map etc
I know that it is possible to use both python libraries but I’m not sure if PyZDDE will support this.
Best wishes,
Marta
Hi Marta,
I really don’t know PyZDDE, so I cannot say. However, the ZOS-API fully supports the wavefront map. In fact, a year ago, I wrote a Python code snipet to display the wavefront map and print the RMS wavefront error for another user. The code is available as a Gist, and here’s the relevant part (you’d have to add this code to a template generated in OpticStudio by pressing: Programming..Python..Standalone Application/Interactive Extension, this template contains the reshape function defined below):
# Create a Wavefront Map analysis
MyWavefrontMap = TheSystem.Analyses.New_Analysis(ZOSAPI.Analysis.AnalysisIDM.WavefrontMap)
# Retrieve Wavefront Map settings
MyWavefrontMapSettings = MyWavefrontMap.GetSettings()
# Change to field number 2
MyWavefrontMapSettings.Field.SetFieldNumber(2)
# Apply new settings
MyWavefrontMap.ApplyAndWaitForCompletion()
# Retrieve Wavefront Map results
MyWavefrontMapResults = MyWavefrontMap.GetResults()
MyWavefrontMapGrid = MyWavefrontMapResults.GetDataGrid(0).Values
MyWavefrontMapArray = reshape(MyWavefrontMapGrid, MyWavefrontMapGrid.GetLength(0), MyWavefrontMapGrid.GetLength(1))
# Plot results
plt.figure()
plt.imshow(MyWavefrontMapArray)
plt.show()
# (additional) Retrieve RMS wavefront error from a Merit Function operand
RMS_WaveFront = TheSystem.MFE.GetOperandValue(ZOSAPI.Editors.MFE.MeritOperandType.ZERN, -4, 2, 2, 1, 0, 0, 0, 0)
print(RMS_WaveFront)
I hope this helps. Take care,
David