Detailed API Reference

webbpsf Package

WebbPSF: Simulated Point Spread Functions for the James Webb Space Telescope

WebbPSF produces simulated PSFs for the James Webb Space Telescope, NASA’s next flagship infrared space telescope. WebbPSF can simulate images for any of the four science instruments plus the fine guidance sensor, including both direct imaging and coronagraphic modes.

Developed by Marshall Perrin and collaborators at STScI, 2010-2018.

Documentation can be found online at


display_ee([hdulist_or_filename, ext, ...])

Display Encircled Energy curve for a PSF

display_profiles([hdulist_or_filename, ext, ...])

Produce two plots of PSF radial profile and encircled energy

display_psf(hdulist_or_filename[, ext, ...])

Display nicely a PSF from a given hdulist or filename


Display nicely the difference of two PSFs from given files


Set up a WebbPSF instrument instance to have a modifiable OTE wavefront error OPD via an OTE linear optical model (LOM).


This is just a convenience function, allowing one to access instrument objects based on a string.

measure_centroid([HDUlist_or_filename, ext, ...])

Measure the center of an image via center-of-mass

measure_ee([hdulist_or_filename, ext, ...])

measure encircled energy vs radius and return as an interpolator

measure_fwhm(hdulist_or_filename[, ext, ...])

Improved version of measuring FWHM, without any binning of image data.

measure_radial([hdulist_or_filename, ext, ...])

measure azimuthally averaged radial profile of a PSF.

measure_sharpness([HDUlist_or_filename, ext])

Compute image sharpness, the sum of pixel squares.

measure_strehl([HDUlist_or_filename, ext, ...])

Estimate the Strehl ratio for a PSF.

radial_profile([hdulist_or_filename, ext, ...])

Compute a radial profile of the image.


Restart logging using the same settings as the last WebbPSF session, as stored in the configuration system.

setup_logging([level, filename])

Allows selection of logging detail and output locations (screen and/or file)


Setup a webbpsf Instrument instance matched to a given dataset

specFromSpectralType(sptype[, return_list, ...])

Get synphot Spectrum object from a user-friendly spectral type string.


return various helpful/informative information about the current system.



Configuration parameters for webbpsf.


A class modeling the optics of the FGS.

JWInstrument(*args, **kwargs)

Superclass for all JWST instruments


A class modeling the optics of MIRI, the Mid-InfraRed Instrument.


A class modeling the optics of NIRCam.


A class modeling the optics of the Near-IR Imager and Slit Spectrograph


A class modeling the optics of NIRSpec, in imaging mode.

RomanCoronagraph([mode, pixelscale, ...])

Roman Coronagraph Instrument

SpaceTelescopeInstrument([name, pixelscale])

A generic Space Telescope Instrument class.



WFI represents the Roman mission's Wide Field Imager.

Class Inheritance Diagram

Inheritance diagram of webbpsf.Conf, webbpsf.webbpsf_core.FGS, webbpsf.webbpsf_core.JWInstrument, webbpsf.webbpsf_core.MIRI, webbpsf.webbpsf_core.NIRCam, webbpsf.webbpsf_core.NIRISS, webbpsf.webbpsf_core.NIRSpec, webbpsf.roman.RomanCoronagraph, webbpsf.webbpsf_core.SpaceTelescopeInstrument, webbpsf.UnsupportedPythonError, webbpsf.roman.WFI