resize_psf#
- photutils.psf_matching.resize_psf(psf, input_pixel_scale, output_pixel_scale, *, order=3)[source]#
Resize a PSF using spline interpolation of the requested order.
The total flux of the PSF is conserved during the resizing.
- Parameters:
- psf2D
ndarray The 2D data array of the PSF. The PSF must have odd dimensions. It is assumed to be centered on the central pixel.
- input_pixel_scalefloat
The pixel scale of the input
psf. The units must matchoutput_pixel_scale.- output_pixel_scalefloat
The pixel scale of the output
psf. The units must matchinput_pixel_scale.- orderint, optional
The order of the spline interpolation (0-5). The default is 3.
- psf2D
- Returns:
- result2D
ndarray The resampled/interpolated 2D data array. The output always has odd dimensions. The natural resampled size is computed by taking the ceiling of
input_size * (input_pixel_scale / output_pixel_scale)for each axis, then adding 1 to any axis whose size is even. This guarantees the output is centered and usable for PSF matching. When the output size is adjusted, the effective pixel scale will be slightly smaller thanoutput_pixel_scale; the exact value per axis isinput_pixel_scale * input_size / output_size.
- result2D
- Raises:
- ValueError
If
psfis not a 2D array, has even dimensions, is not centered, or if the pixel scales are not positive.