I am getting about 100% difference when calculating the centroid using the two methods.
Can you post your file?
I can’t share my file but I put together this one and the difference is still there.
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.
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.
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.
I agree that the centroid difference should be compared in mm instead of wavelength since this is not OPD.
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.
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?
Already have an account? Login
Enter your username or e-mail address. We'll send you an e-mail with instructions to reset your password.
Sorry, we're still checking this file's contents to make sure it's safe to download. Please try again in a few minutes.
Sorry, our virus scanner detected that this file isn't safe to download.
Do not provide any information or data that is restricted by applicable law, including by the People’s Republic of China’s Cybersecurity and Data Security Laws (
e.g., Important Data, National Core Data, etc.).