class photutils.psf.EPSFBuilder(oversampling=4.0, 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, shift_val=0.5, recentering_boxsize=(5, 5), center_accuracy=0.001, flux_residual_sigclip=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), ISR WFC3 2016-12 for details.

oversamplingint or tuple of two int, optional

The oversampling factor(s) of the ePSF relative to the input stars along the x and y axes. The oversampling can either be a single float or a tuple of two floats of the form (x_oversamp, y_oversamp). If oversampling is a scalar then the oversampling will be the same for both the x and y axes.

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 fitter options, a new object with specific options should be passed in - the default uses simply the default options. To see more of these options, see the EPSFFitter documentation.

maxitersint, optional

The maximum number of iterations to perform.

progress_barbool, option

Whether to print the progress bar during the build iterations.

norm_radiusfloat, optional

The pixel radius over which the ePSF is normalized.

shift_valfloat, optional

The undersampled value at which to compute the shifts. It must be a strictly positive number.

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 should be in (ny, nx) order.

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.

flux_residual_sigclipSigmaClip object, optional

A SigmaClip object used to determine which pixels are ignored based on the star sampling flux residuals, when computing the average residual of ePSF grid points in each iteration step.


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.