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


Instrument(name) This is just a convenience function, allowing one to access instrument objects based on a string.
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_psf_difference([…]) Display nicely the difference of two PSFs from given files
enable_adjustable_ote(instr[, jsc]) Set up a WebbPSF instrument instance to have a modifiable OTE wavefront error OPD via an OTE linear optical model (LOM).
gui([preferred]) Start the WebbPSF GUI with the selected interface
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([verbose]) 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)
show_notebook_interface(instrumentname) Show Jupyter notebook widget interface
specFromSpectralType(sptype[, return_list, …]) Get Pysynphot Spectrum object from a user-friendly spectral type string.
system_diagnostic() return various helpful/informative information about the current system.
test([package, test_path, args, plugins, …]) Run the tests using py.test.


CGI([mode, pixelscale, fov_arcsec, …]) WFIRST Coronagraph Instrument
Conf Configuration parameters for webbpsf.
FGS() A class modeling the optics of the FGS.
JWInstrument(*args, **kwargs) Superclass for all JWST instruments
MIRI() A class modeling the optics of MIRI, the Mid-InfraRed Instrument.
NIRCam() A class modeling the optics of NIRCam.
NIRISS([auto_pupil]) A class modeling the optics of the Near-IR Imager and Slit Spectrograph
NIRSpec() A class modeling the optics of NIRSpec, in imaging mode.
WFI([set_pupil_mask_on]) WFI represents to the to-be-named wide field imager for the WFIRST mission

Class Inheritance Diagram

Inheritance diagram of webbpsf.wfirst.CGI, 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.UnsupportedPythonError, webbpsf.wfirst.WFI