WebbPSF Tutorials

This article provides information on where to find Jupyter Notebooks and narrative documentation that demonstrate usage of the Roman functionality of WebbPSF




The GitHub repository for WebbPSF offers many tutorials, including one specific to Roman, to help users get started with its functionality. The foremost example is a Jupyter Notebook with a general demonstration of how to simulate, visualize, analyze, and export a point spread function (PSF) for the Roman Wide Field Instrument (WFI). To run the tutorials on your system, please follow the installation instructions from the readthedocs documentation

The readthedocs documentation's dedicated page on the Roman Instrument Model contains several more detailed usage examples alongside narrative text explaining how all of the functionality comes together. Readers with previous experience using the JWST modes of WebbPSF should note the differences highlighted there for Roman purposes.


While the GitHub repository for WebbPSF also offers a Jupyter Notebook that demonstrates usage of its class for the Roman Coronagraph Instrument, be aware that WebbPSF's Coronagraph model has not been updated since 2017, so the PSFs it generates may not reflect the Coronagraph Instrument's current capabilities.




Example 1: PSF with Default Parameters 


from matplotlib import pyplot as plt
import matplotlib
import webbpsf

matplotlib.rcParams['figure.figsize'] = (16, 7)  # make the default figure size larger
matplotlib.rcParams['image.interpolation'] = 'nearest'  # don't blur/smooth image plots
 
wfi = webbpsf.roman.WFI()

plt.figure(figsize=(8,10))
default_psf = wfi.calc_psf(display=True)

Figure of WFI F062 PSF from WebbPSF 

WebbPSF for Roman: PSF with default parameters.

The simulated PSF on detector pixel scale can be displayed and saved using the following calls:

webbpsf.display_psf(default_psf, ext='DET_SAMP')

default_psf.writeto('./test_PSF.fits', overwrite=True)

Figure of WFI PSF in Detector Pixels 

WebbPSF for Roman: Displaying the PSF in detector pixels.





Example 2: PSF with various specified parameters 


from matplotlib import pyplot as plt
import matplotlib
import webbpsf

matplotlib.rcParams['figure.figsize'] = (16, 7)  # make the default figure size larger
matplotlib.rcParams['image.interpolation'] = 'nearest'  # don't blur/smooth image plots

wfi = webbpsf.roman.WFI()

wfi.filter = 'GRISM1'
wfi.detector = 'SCA14'
wfi.detector_position = (1024, 1024)
src = webbpsf.specFromSpectralType('G0V', catalog='phoenix')

plt.figure(figsize=(8,10))
poly_psf =  wfi.calc_psf(source=src, nlambda=10, display=True)

Figure of WFI Grism PSF from WebbPSF

WebbPSF for Roman: Specifying a few parameters.



Example 3: PSF Profile & Encircled Energy 

WebbPSF also includes functions for measuring encircled energy, profiles, and centroids (described in the WebbPSF documentation and the POPPY documentation). Below, we measure the radial profile and encircled energy curve for the polychromatic PSF. Note that the FWHM is also computed and labeled on the radial profile plot.

from matplotlib import pyplot as plt
import matplotlib
import webbpsf
  
wfi = webbpsf.roman.WFI()
wfi.filter = 'GRISM1'
wfi.detector = 'SCA14'
wfi.detector_position = (1024, 1024)
src = webbpsf.specFromSpectralType('G0V', catalog='phoenix')

poly_psf =  wfi.calc_psf(source=src, nlambda=10, display=False)

plt.figure(figsize=(8,6)) 
webbpsf.display_profiles(poly_psf)

Figure of PSF Profile and Encircled Energy Plots 

WebbPSF for Roman: PSF Profile (top) and Encircled Energy (bottom)






For additional questions not answered in this article, please contact the Roman Help Desk at STScI.

You may also open an issue at the GitHub repository.




Latest Update

 

Updated for version 1.2.1.
Publication

 

Initial publication of the article.