- sherpa.astro.ui.set_psf(id, psf=None)
Add a PSF model to a data set.
After this call, the model that is fit to the data (as set by
set_model) will be convolved by the given PSF model. The term “psf” is used in functions to refer to the data sent to this function whereas the term “kernel” refers to the data that is used in the actual convolution (this can be re-normalized and a sub-set of the PSF data).
id (int or str, optional) – The data set. If not given then the default identifier is used, as returned by
psf (str or
sherpa.instrument.PSFModelinstance) – The PSF model created by
Delete the PSF model for a data set.
Return the PSF model defined for a data set.
Display the 2D PSF model for a data set in the image viewer.
Create a PSF model.
Plot the 1D PSF model applied to a data set.
Define the convolved model expression for a data set.
Set the source model expression for a data set.
The function does not follow the normal Python standards for parameter use, since it is designed for easy interactive use. When called with a single un-named argument, it is taken to be the
psfparameter. If given two un-named arguments, then they are interpreted as the
A PSF component should only be applied to a single data set. This is not enforced by the system, and incorrect results can occur if this condition is not true.
The point spread function (PSF) is defined by the full (unfiltered) PSF image loaded into Sherpa or the PSF model expression evaluated over the full range of the dataset; both types of PSFs are established with the
load_psfcommand. The kernel is the subsection of the PSF image or model which is used to convolve the data. This subsection is created from the PSF when the size and center of the kernel are defined by the command
set_psf. While the kernel and PSF might be congruent, defining a smaller kernel helps speed the convolution process by restricting the number of points within the PSF that must be evaluated.
In a 1-D PSF model, a radial profile or 1-D model array is used to convolve (fold) the given source model using the Fast Fourier Transform (FFT) technique. In a 2-D PSF model, an image or 2-D model array is used.
The parameters of a PSF model include:
The data used for the convolution (file name or model instance).
The number of pixels used in the convolution (this can be a subset of the full PSF). This is a scalar (1D) or a sequence (2D, width then height) value.
The center of the kernel. This is a scalar (1D) or a sequence (2D, width then height) value. The kernel centroid must always be at the center of the extracted sub-image, otherwise, systematic shifts will occur in the best-fit positions.
1to use a symmetric array. The default is
0to reduce edge effects.
Should the kernel be normalized so that it sums to 1? This summation is done over the full data set (not the subset defined by the
sizeparameter). The default is
Use the data in the ASCII file ‘line_profile.dat’ as the PSF for the default data set:
>>> load_psf('psf1', 'line_profile.dat') >>> set_psf(psf1)
Use the same PSF for different data sets:
>>> load_psf('p1', 'psf.img') >>> load_psf('p2', 'psf.img') >>> set_psf(1, 'p1') >>> set_psf(2, 'p2')
Restrict the convolution to a sub-set of the PSF data and compare the two:
>>> set_psf(psf1) >>> psf1.size = (41,41) >>> image_psf() >>> image_kernel(newframe=True, tile=True)