Rather than do that, which would be limited by the step size in the transfocal calculation, I wrote a routine to search for it, using Newton's method. The answer for the aberration set in the last post is 4.1 um for lamda = 550 nm. Less than I'd guessed.What about also marking the minimum rms spot size?
The high road would be to compute the rms spot size by weighted combination of all wavelengths, but that seems like gilding the lily.
Update: I tried that, and got the same answer, but it takes a lot longer.
There is something wrong with this calculation in the presence of aberrations. Used with defocus alone, and the other aberrations zeroed, the rms minimum spot size agrees with the visual results, but in the presence of aberrations, it doesn't. I'm using the centroid to find the location of the center of the spot, and I suspect that's a source of a error.
ChatGPT has some alternate suggestions:
1. Encircled Energy Radius (EEr)
Measure the radius within which a fixed percentage (e.g., 80%) of the total PSF energy falls. You can compute this around the geometric center or the intensity peak.
- Pros: Robust against asymmetry; less sensitive to centroid shifts.
- Cons: Sensitive to sampling resolution; may need smoothing.
Track the maximum value of the PSF over defocus. At best focus, the energy is most concentrated.
- Pros: Simple and intuitive; very sensitive to focus.
- Cons: Sensitive to pixel sampling, noise, and diffraction rings.
Compute contrast metrics in the frequency domain—e.g., OTF-based MTF50, or energy in mid-to-high spatial frequencies.
- Pros: Reflects perceptual sharpness.
- Cons: Requires consistent PSF size and zero-padding to avoid aliasing.
Instead of computing RMS about the centroid, compute RMS about the geometric center of the PSF array.
- Pros: Removes centroid shift bias.
- Cons: May overestimate size for asymmetric PSFs.
Define a 2D second moment matrix of the PSF and take the determinant or trace. This is robust and captures elongation and orientation.
- Pros: Generalizes RMS to 2D shapes.
- Cons: Requires matrix computation; less intuitive.
Compute the Zernike coefficients from the PSF or wavefront and look for a minimum of certain modes (like Z4 – defocus). Or optimize fit residuals.
- Pros: Ties directly into your simulation model.
- Cons: Computationally involved; assumes a valid fit.
Last edited:





