measure_strehl

webbpsf.measure_strehl(HDUlist_or_filename=None, ext=0, slice=0, center=None, display=True, verbose=True, cache_perfect=False)[source]

Estimate the Strehl ratio for a PSF.

This requires computing a simulated PSF with the same properties as the one under analysis.

Note that this calculation will not be very accurate unless both PSFs are well sampled, preferably several times better than Nyquist. See Roberts et al. 2004 SPIE 5490 for a discussion of the various possible pitfalls when calculating Strehl ratios.

WARNING: This routine attempts to infer how to calculate a perfect reference PSF based on FITS header contents. It will likely work for simple direct imaging cases with WebbPSF but will not work (yet) for more complicated cases such as coronagraphy, anything with image or pupil masks, etc. Code contributions to add such cases are welcomed.

Parameters:
HDUlist_or_filenamestring

Either a fits.HDUList object or a filename of a FITS file on disk

extint

Extension in that FITS file

sliceint, optional

If that extension is a 3D datacube, which slice (plane) of that datacube to use

centertuple

center to compute around. Default is image center. If the center is on the crosshairs between four pixels, then the mean of those four pixels is used. Otherwise, if the center is in a single pixel, then that pixel is used.

verbose, displaybool

control whether to print the results or display plots on screen.

cache_perfectbool

use caching for perfect images? greatly speeds up multiple calcs w/ same config

Returns:
strehlfloat

Strehl ratio as a floating point number between 0.0 - 1.0