Solved

How to change the PSF display size from Zemax API?

  • 21 December 2023
  • 2 replies
  • 80 views

Hello,

I am using the python API to generate and save FFT PSFs. I can change all the parameters using the python API (with the ModifySettings function) appart the display size. How can I do it? It is not listed in the documentation for the Zemax macro.

 

icon

Best answer by Pascal Gregoire 22 December 2023, 14:04

View original

2 replies

Userlevel 7
Badge +2

@Pascal Gregoire,

 

If the MODIFYSETTINGS doesn’t have the setting which you’d like, it is likely that it hasn’t been implemented.

However, the settings of the FFT PSF have been fully implemented in the ZOSAPI. This means you don’t need to rely on MODIFYSETTINGS anymore.

Here is a Python example:

from ZOSAPI.Analysis.Settings import Psf

# Open a new FFT PSF analysis
fftPsf = TheSystem.Analyses.New_FftPsf()

# Retrieve the settings
fftPsfSettings = fftPsf.GetSettings().__implementation__

# Change the sampling
fftPsfSettings.SampleSize = Psf.PsfSampling.PsfS_1024x1024 # Sampling
fftPsfSettings.OutputSize = Psf.PsfSampling.PsfS_1024x1024 # Display

# Apply settings and run analysis
fftPsf.ApplyAndWaitForCompletion()

Pay attention to the __implementation__ after calling GetSettings(), this relates to this issue:

The rest of the settings are found in the ZOS-API Syntax Help File:

And this is the list of available sampling sizes:

Next time you work with an analysis in the ZOS-API, you can use the property: 

HasAnalysisSpecificSettings 

to check whether said analysis has been fully implemented in the ZOS-API, i.e. it doesn’t need a settings file anymore.

For example:

# Open a new FFT PSF analysis
fftPsf = TheSystem.Analyses.New_FftPsf()

# Test is analysis has its settings implemented
print(fftPsf.HasAnalysisSpecificSettings)

which should print a True value.

Let me know if that answers your question and take care,


David

Many thanks! I could not find in your documentation the trick to make it work (using __implementation__), I’ll get rid of MODIFYSETTING.

Reply