class photutils.psf.EPSFBuilder(*, oversampling=4, shape=None, smoothing_kernel='quartic', recentering_func=<function centroid_com>, recentering_maxiters=20, fitter=<photutils.psf.epsf.EPSFFitter object>, maxiters=10, progress_bar=True, norm_radius=5.5, recentering_boxsize=(5, 5), center_accuracy=0.001, sigma_clip=SigmaClip(sigma=3, sigma_lower=3, sigma_upper=3, maxiters=10, cenfunc='median', stdfunc='std', grow=False))[source]

Bases: object

Class to build an effective PSF (ePSF).

See Anderson and King (2000; PASP 112, 1360) and Anderson (2016; WFC3 ISR 2016-12) for details.

oversamplingint or array_like (int)

The integer oversampling factor(s) of the ePSF relative to the input stars along each axis. If oversampling is a scalar then it will be used for both axes. If oversampling has two elements, they must be in (y, x) order.

shapefloat, tuple of two floats, or None, optional

The shape of the output ePSF. If the shape is not None, it will be derived from the sizes of the input stars and the ePSF oversampling factor. If the size is even along any axis, it will be made odd by adding one. The output ePSF will always have odd sizes along both axes to ensure a well-defined central pixel.

smoothing_kernel{‘quartic’, ‘quadratic’}, 2D ndarray, or None

The smoothing kernel to apply to the ePSF. The predefined 'quartic' and 'quadratic' kernels are derived from fourth and second degree polynomials, respectively. Alternatively, a custom 2D array can be input. If None then no smoothing will be performed.

recentering_funccallable, optional

A callable object (e.g., function or class) that is used to calculate the centroid of a 2D array. The callable must accept a 2D ndarray, have a mask keyword and optionally error and oversampling keywords. The callable object must return a tuple of two 1D ndarray variables, representing the x and y centroids.

recentering_maxitersint, optional

The maximum number of recentering iterations to perform during each ePSF build iteration.

fitterEPSFFitter object, optional

A EPSFFitter object use to fit the ePSF to stars. To set custom fitter options, input a new EPSFFitter object. See the EPSFFitter documentation for options.

maxitersint, optional

The maximum number of iterations to perform.

progress_barbool, option

Whether to print the progress bar during the build iterations. The progress bar requires that the tqdm optional dependency be installed. Note that the progress bar does not currently work in the Jupyter console due to limitations in tqdm.

norm_radiusfloat, optional

The pixel radius over which the ePSF is normalized.

recentering_boxsizefloat or tuple of two floats, optional

The size (in pixels) of the box used to calculate the centroid of the ePSF during each build iteration. If a single integer number is provided, then a square box will be used. If two values are provided, then they must be in (ny, nx) order. recentering_boxsize must have odd must have odd values and be greater than or equal to 3 for both axes.

center_accuracyfloat, optional

The desired accuracy for the centers of stars. The building iterations will stop if the centers of all the stars change by less than center_accuracy pixels between iterations. All stars must meet this condition for the loop to exit.

sigma_clipastropy.stats.SigmaClip instance, optional

A SigmaClip object that defines the sigma clipping parameters used to determine which pixels are ignored when stacking the ePSF residuals in each iteration step. If None then no sigma clipping will be performed.


If your image image contains NaN values, you may see better performance if you have the bottleneck package installed.

Methods Summary


Call self as a function.

build_epsf(stars, *[, init_epsf])

Build iteratively an ePSF from star cutouts.

Methods Documentation


Call self as a function.

build_epsf(stars, *, init_epsf=None)[source]

Build iteratively an ePSF from star cutouts.

starsEPSFStars object

The stars used to build the ePSF.

init_epsfEPSFModel object, optional

The initial ePSF model. If not input, then the ePSF will be built from scratch.

epsfEPSFModel object

The constructed ePSF.

fitted_starsEPSFStars object

The input stars with updated centers and fluxes derived from fitting the output epsf.