ModelImageMixin#

class photutils.psf.ModelImageMixin[source]#

Bases: object

Mixin class to provide methods to calculate model images and residuals.

Methods Summary

make_model_image(shape[, psf_shape, ...])

Create a 2D image from the fit PSF models and optional local background.

make_residual_image(data[, psf_shape, ...])

Create a 2D residual image from the fit PSF models and local background.

Methods Documentation

make_model_image(shape, psf_shape=None, include_localbkg=False)[source]#

Create a 2D image from the fit PSF models and optional local background.

Parameters:
shape2 tuple of int

The shape of the output array.

psf_shape2 tuple of int, optional

The shape of the region around the center of the fit model to render in the output image. If psf_shape is a scalar integer, then a square shape of size psf_shape will be used. If None, then the bounding box of the model will be used. This keyword must be specified if the model does not have a bounding_box attribute.

include_localbkgbool, optional

Whether to include the local background in the rendered output image. Note that the local background level is included around each source over the region defined by psf_shape. Thus, regions where the psf_shape of sources overlap will have the local background added multiple times.

Returns:
array2D ndarray

The rendered image from the fit PSF models. This image will not have any units.

make_residual_image(data, psf_shape=None, include_localbkg=False)[source]#

Create a 2D residual image from the fit PSF models and local background.

Parameters:
data2D ndarray

The 2D array on which photometry was performed. This should be the same array input when calling the PSF-photometry class.

psf_shape2 tuple of int, optional

The shape of the region around the center of the fit model to subtract. If psf_shape is a scalar integer, then a square shape of size psf_shape will be used. If None, then the bounding box of the model will be used. This keyword must be specified if the model does not have a bounding_box attribute.

include_localbkgbool, optional

Whether to include the local background in the subtracted model. Note that the local background level is subtracted around each source over the region defined by psf_shape. Thus, regions where the psf_shape of sources overlap will have the local background subtracted multiple times.

Returns:
array2D ndarray

The residual image of the data minus the fit PSF models minus the optional``local_bkg``.