Skip to main content
Solved

How does OpticStudio determine the grid over which the FFT PSF is calculated?

  • June 2, 2025
  • 4 replies
  • 127 views

chaasjes
Forum|alt.badge.img

Hello,

I am currently trying to understand the sampling behavior of the FFT PSF analysis in OpticStudio. The analysis has two sampling parameters:

  1. ‘Sampling’, hereafter referred to as S, documented as “The size of the ray grid used to sample the pupil”.
  2. ‘Display’, hereafter referred to as D, documented as “The display size indicates what portion of the computed data will be drawn when a graphic display is generated. The display grid can be any size from 32 x 32 up to twice the sampling grid size. Smaller display sizes will show less data, but at higher magnification for better visibility”.

Based on implementations described in the literature and basic tests with OpticStudio, I assumed the PSF calculation works like this:

  1. Sample the wavefront at the pupil with a sampling S;
  2. Zero-pad the wavefront to the maximum possible display sampling Dmax;
  3. Crop the result to a size D. This last step was inferred from OpticStudio’s output.

Based on the properties of the Fourier transform, I assume the following behavior when changing the sampling parameters:

  1. Increasing the pupil sampling S increases the extent of the PSF. For example, if the extent of the PSF is 10 μm with S = 32x32, it will double to 20 μm when S is doubled to 64x64.
  2. Increasing the display sampling D while keeping S the same will increase the PSF resolution, i.e. the spacing dx between two adjacent points in the PSF will decrease.

In OpticStudio, the PSF resolution depends on the ratio D / S. D has to be in the range [S, 2S] and choosing D < 2S appears to crop or zoom the PSF, so OpticStudio does not allow to adjust the ratio D / S. As a result, assumption 2 cannot be tested by increasing D, but we can test assumption 1. I performed this test on the ‘Cooke 40 degree field’ sample.

Let’s start with S = 64x64, D = 128x128:

dx = 0.818 μm, data area is 104.759 μm wide.

Now decrease D to 64x64:

This indeed only crops the PSF. dx remains the same.

Now increase S to 128x128 and D to 256x256. D / S remains the same, so the extent should not change, but S is doubled, so dx should be halved. Result:

dx = 0.588 μm, data area is 150.541 μm wide. dx is not halved, so assumption 1 is not true; furthermore, the PSF extent changed, so assumption 2 is also not true.

I think this means I wrongly assumed D is the size of the grid over which the PSF is calculated. My question is: how, then, does OpticStudio choose the size of the grid over which the PSF is calculated, and (how) does this relate to the ‘Display’ sampling D?

I see a few options:

  1. OpticStudio has a hardcoded relation between the pupil sampling S and the PSF grid size D’. It then finds the bounds where the PSF becomes almost zero, crops it to these bounds, and resamples the result to the display grid size D.
  2. OpticStudio somehow calculates which PSF grid size D’ to use such that the PSF reaches 0 at a grid size of 2S. It then crops the PSF to the selected display grid size D, without resampling. I expect this to be inefficient because it may require multiple PSF calculations, but maybe there’s a smart way to predict the required value of D’ without calculating the PSF twice.

Curious to hear if anybody here knows how this works!

Best answer by Sean Turner

Have you checked the FFT PSF part of the manual? There is a large section about how sampling works. 

4 replies

chaasjes
Forum|alt.badge.img
  • Author
  • Visible
  • 38 replies
  • June 2, 2025

Sorry, the forums do not allow me to submit the actual question, without giving a (clear) error message. I am trying to still get it in the first post using the edit function.

Edit: for some reason, the screenshots were initially not accepted. The full post is available now.


Sean Turner
Fully Spectral
Forum|alt.badge.img+1
  • Fully Spectral
  • 106 replies
  • Answer
  • June 3, 2025

Have you checked the FFT PSF part of the manual? There is a large section about how sampling works. 


chaasjes
Forum|alt.badge.img
  • Author
  • Visible
  • 38 replies
  • June 4, 2025

Yes, I did check the FFT PSF page in the manual, but must have overlooked the sampling part. The manual indeed answers my question. Thanks!


jmcschmidt
  • Single Emitter
  • 1 reply
  • November 6, 2025

The FFT PSF part of the manual is pretty clear about how Zemax computes the grid spacing in the image plane.  When I compute the grid spacing using their equations, I get the same value they specify.  However, I am unclear on where the origin is on their grid.  For a standard 2-D FFT of an array with NxN samples, the origin is at (N/2+1,N/2+1).  This would be for both the pupil and image planes.  When I run a FFT PSF calculation in the Zemax GUI with Sampling = 128x128 and Display = 256x256, the text tab says “Center point is: row 129, column 128”.  This matches N/2+1 for the row, but not the column.  When I run this calculation using the ZOS-API in Matlab and extract the PSF, the peak value of the PSF (a case with azimuthally symmetric aberration) is at row 129, column 128, so that agrees with what the GUI says about the center point.  However, x = 0 at grid point 128, and y = 0 at grid point 128, which is inconsistent.  Further, I do not understand what grid is used in pupil plane to produce an image plane grid with its origin at (N/2+1,N/2+1).  Maybe I’m missing some subtlety about FFT grids, though.  If I understand the grid, I should be able to reproduce their PSF results to machine precision, but I cannot, yet.