Skip to main content
Solved

How to change the PSF display size from Zemax API?

  • December 21, 2023
  • 2 replies
  • 150 views

Pascal Gregoire

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.

 

Best answer by Pascal Gregoire

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

View original
Did this topic help you find an answer to your question?

2 replies

David.Nguyen
Luminary
Forum|alt.badge.img+2
  • Luminary
  • 1065 replies
  • December 22, 2023

@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


Pascal Gregoire
  • Author
  • Monochrome
  • 2 replies
  • Answer
  • December 22, 2023

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


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings