Spot centroid (CENX/CENY) vs Huygens PSF centroid (CEHX/CEHY) - why are they different?

  • 14 March 2023
  • 8 replies


I am getting about 100% difference when calculating the centroid using the two methods. 

  1. Why are they so different? I was expecting ~10% difference.
  2. Should they not be identical for a paraxial lens?

Thank you!


8 replies

Userlevel 7
Badge +3

Can you post your file?

I can’t share my file but I put together this one and the difference is still there.


Userlevel 7
Badge +3

Hi Anton,

Thanks for the file. Your intuition is correct, the two centroids (spot and Huygens) should be close but not exactly the same. The differences you are seeing are just rounding error however.

In your merit function, the centroid of the on-axis field using rays CENY is 2.2 10^-20, and using the Huygens CEHY is -5.5 10^-19. Both of these are effectively zero, which is the answer our intuition gives us for the on-axis spot of a rotationally symmetric system. But any calculation with a finite number of rays, with data held to finite accuracy, will have some sampling error and calculation noise that means that zero is never returned. Instead some vanishingly small but non-zero number is returned. If you take the difference and divide by one of the values, sure you’ll get a big percentage difference: but it’s still a percentage of a number O(10^-20).

Let’s also consider how the two calculations work and why they will never return the exact same number to 64-bit accuracy. CENY traces rays to the image surface and records the ray landing coordinates, and then computes the centroid of those coordinates. The Huygens version treats the rays as pieces of a plane wave, and intereferes these waves to produce a diffraction PSF. We then compute the centroid location of that PSF.

These calculations are very different, and so exact correspondence of the two values should not be expected. Both return O(10^-20)mm. I forget what comes after pico and femto, but if you think of the difference in terms of the wavelength it is still O(lambda/1,000,000,000,000)...pretty close 😀

If you have a sample file where the difference is physically significant, please post it. But don’t think of the difference as a fraction of the two locations...think of the difference as a fraction of the wavelength. 

  • Mark

Hi Mark!

Thank you for your answer!

I have no concerns over the on-axis calculation. Off-axis, however, the difference is much more than 1 wavelength - even for the Zemax sample file I posted. 

In the file I posted the difference between CEHY and CENY off-axis varies between 1 wavelength and 6 wavelengths across the image height. You can see the plot of this difference in the screenshot I attached  as well. I does not seem insignificant to me. 

I do not expect these two to be identical, but I am surprised by how far off they are. 


Userlevel 7
Badge +3

Hey Anton,

Well...’far off’ is relative 😁

At the edge of the field, using the operands in the merit function, the CENY is 18.1353 mm and CEHY is 18.1350 mm, so the difference is 0.3 microns at a wavelength of .5 microns, so around lambda/2 over a distance of 18 mm.

At the mid-field point the values are 12.419 and 12.421 for a difference of 1.9 micromns, say 3Lambda.

It all comes down to whether you think this difference is significant.

If you think it insignificant, choose CENY as it is much faster.

If you think it is significant, choose CEHY as the Huygens is the superior method. But I’d increase the image delta. If you look at the PSF configured the way you have configured the merit function, you’ll see

Note that we’re not capturing all the light in the sampling region. 

The only disadvantage to the Huygens method is speed. CENY will get to within a wavelength or two in a much shorter time.

  • Mark



I agree that the centroid difference should be compared in mm instead of wavelength since this is not OPD.

Hi Mark,

I ran a check on some of the the sample lens files in the ...\Zemax\Samples\Sequential\Objectives folder and a paraxial lens. The results I am getting are the opposite of what you are saying. At high sampling rates the Huygens PSF centroid (CEHY) is converging to the value of the spot centroid (CENY). Spot centroid calculated with 100x100 rays every time. Paraxial lens at high sampling does not have any CENY-CEHY difference.





Hi Mark,

I understand the difference between spot centroid and PSF centroid could be reduced by higher sampling #s.  Does it mean that there is no difference between these two centroids theoretically?  Then the next question is which centroid gives a more accurate result?