STDPSFGrid#

class photutils.psf.STDPSFGrid(filename)[source]#

Bases: object

Class to read and plot ePSF model grids stored in the STDPSF format.

STDPSF files are FITS files containing a 3D array of ePSF models. The FITS header specifies the fiducial detector coordinates associated with each ePSF in the grid.

For STDPSF files, the oversampling factor is assumed to be 4 along both axes.

Parameters:
filenamestr or path-like

The name or URL of a STDPSF FITS file.

Examples

>>> from photutils.psf import STDPSFGrid
>>> psfgrid = STDPSFGrid('STDPSF_ACSWFC_F814W.fits')
>>> fig = psfgrid.plot_grid()

Attributes Summary

data

The 3D array of ePSFs.

grid_shape

The (ny, nx) shape of the ePSF grid.

grid_xypos

The (x, y) positions of the ePSFs.

oversampling

The integer oversampling factor(s) of the input ePSF images.

Methods Summary

plot_grid(*[, ax, vmax_scale, peak_norm, ...])

Plot the grid of ePSF models.

Attributes Documentation

data#

The 3D array of ePSFs.

The shape is (N_psf, ePSF_ny, ePSF_nx).

grid_shape#

The (ny, nx) shape of the ePSF grid.

grid_xypos#

The (x, y) positions of the ePSFs.

The order of positions matches the first axis of the 3D ndarray of ePSFs. In other words, grid_xypos[i] is the (x, y) position of the reference ePSF defined in data[i].

oversampling#

The integer oversampling factor(s) of the input ePSF images.

Returns:
oversamplingndarray

The oversampling factors in (y, x) order.

Methods Documentation

plot_grid(*, ax=None, vmax_scale=None, peak_norm=False, deltas=False, cmap='viridis', dividers=True, divider_color='darkgray', divider_ls='-', figsize=None)[source]#

Plot the grid of ePSF models.

Parameters:
axmatplotlib.axes.Axes or None, optional

The matplotlib axes on which to plot. If None, then the current Axes instance is used.

vmax_scalefloat, optional

Scale factor to apply to the image stretch limits. This value is multiplied by the peak ePSF value to determine the plotting vmax. The defaults are 1.0 for plotting the ePSF data and 0.03 for plotting the ePSF difference data (deltas=True). If deltas=True, the vmin is set to -vmax. If deltas=False the vmin is set to vmax / 1e4.

peak_normbool, optional

Whether to normalize the ePSF data by the peak value. The default shows the ePSF flux per pixel.

deltasbool, optional

Set to True to show the differences between each ePSF and the average ePSF.

cmapstr or matplotlib.colors.Colormap, optional

The colormap to use. The default is ‘viridis’.

dividersbool, optional

Whether to show divider lines between the ePSFs.

divider_color, divider_lsstr, optional

Matplotlib color and linestyle options for the divider lines between ePSFs. These keywords have no effect unless dividers=True.

figsize(float, float), optional

The figure (width, height) in inches.

Returns:
figmatplotlib.figure.Figure

The matplotlib figure object. This will be the current figure if ax=None. Use fig.savefig() to save the figure to a file.

Notes

This method returns a figure object. If you are using this method in a script, you will need to call fig.show() to display the figure. If you are using this method in a Jupyter notebook, the figure will be displayed automatically.

When in a notebook, if you do not store the return value of this function, the figure will be displayed twice due to the REPL automatically displaying the return value of the last function call. Alternatively, you can append a semicolon to the end of the function call to suppress the display of the return value.