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)
# Create analysis
TheAnalyses = TheSystem.Analyses
newWin = TheAnalyses.New_FftMtf()
# Settings
newWin_Settings = newWin.GetSettings()
newWin_Settings.MaximumFrequency = 50
newWin_Settings.SampleSize = ZOSAPI.Analysis.SampleSizes.S_256x256
FFT MFT Window appears.
And afterwards
# Run Analysis
newWin.ApplyAndWaitForCompletion()
# Get Analysis Results
newWin_Results = newWin.GetResults()
#! re04s04_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:
oss = zos.connect(mode="extension")
fftmtf = zp.analyses.base.new_analysis(oss, analysis_type = zp.constants.Analysis.AnalysisIDM.FftMtf)
fftmtf = zp.analyses.base.new_analysis(oss, analysis_type = zp.constants.Analysis.AnalysisIDM.FftMtf)
Which creates a new FFT MTF window.
fftmtf.Settings.MaximumFrequency = 50.
fftmtf.Settings.SampleSize = zp.constants.Analysis.SampleSizes.S_256x256
print((fftmtf.Settings.MaximumFrequency, fftmtf.Settings.SampleSize))
output: (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