Hello,
A comment on ZOSPy. I did already spent countless hours on my own python wrapper and I am very happy to see a team of skilled programmers working on that. Just getting rid of tons of boilerplate code is worth the effort!
Getting connected to Zemax from my jupyter-lab to zemax as “Interactive Extension” works with ZOSPy or with the pasting several lines of boilerplate and directly acessing ZOS-API via pythonnet 3.x.
Via ZOSPy I can add lenses, changes become visible in zemax. So I assume there is no general problem with library loading, connecting, etc..
However, I cannot figure how to run a FFT MTF using ZOSPy.
With the bare pythonnet this looks like this (Boilerplat-part from example 04 skipped)
1# Create analysis2TheAnalyses = TheSystem.Analyses3newWin = TheAnalyses.New_FftMtf()4# Settings5newWin_Settings = newWin.GetSettings()6newWin_Settings.MaximumFrequency = 507newWin_Settings.SampleSize = ZOSAPI.Analysis.SampleSizes.S_256x256FFT MFT Window appears.
And afterwards
1# Run Analysis2newWin.ApplyAndWaitForCompletion()3# Get Analysis Results4newWin_Results = newWin.GetResults()5#! [e04s04_py]Results appear and the numbers go into newWin_Results. Still having to get them converted from .net-datatypes to python-data.
With ZOSPy I can successfully:
1oss = zos.connect(mode="extension")2fftmtf = zp.analyses.base.new_analysis(oss, analysis_type = zp.constants.Analysis.AnalysisIDM.FftMtf)3fftmtf = zp.analyses.base.new_analysis(oss, analysis_type = zp.constants.Analysis.AnalysisIDM.FftMtf)Which creates a new FFT MTF window.
1fftmtf.Settings.MaximumFrequency = 50.2fftmtf.Settings.SampleSize = zp.constants.Analysis.SampleSizes.S_256x2563print((fftmtf.Settings.MaximumFrequency, fftmtf.Settings.SampleSize))45output: (50.0, <SampleSizes.S_256x256: 4>)Settings somehow seem to work, but I cannot figure the equivalent of “AppyAndWaitForCompletion()” or just “Apply()”.
I did go thru https://zospy.readthedocs.io/en/latest/api/zospy.analyses.mtf.html
Is there an “emergency exit” from the ZOSPy world to the underlying pythonnet-objects and -methods?
Best regards,
Axel