Last modified: December 2024

URL: https://cxc.cfa.harvard.edu/sherpa/ahelp/set_psf.html
Jump to: Description · Examples · PARAMETERS · Notes · Bugs · See Also


AHELP for CIAO 4.17 Sherpa

set_psf

Context: psfs

Synopsis

Add a PSF model to a data set.

Syntax

set_psf(id, psf=None)

Description

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).


Examples

Example 1

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)

Example 2

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')

Example 3

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)

PARAMETERS

The parameters for this function are:

Parameter Type information Definition
id int or str, optional The data set. If not given then the default identifier is used, as returned by `get_default_id` .
psf str or psfmodel instance The PSF model created by `load_psf` .

Notes

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 `psf` parameter. If given two un-named arguments, then they are interpreted as the `id` and `psf` parameters, respectively.

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_psf` command. 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:

Item Definition
kernel The data used for the convolution (file name or model instance).
size 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.
center 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.
radial Set to 1 to use a symmetric array. The default is 0 to reduce edge effects.
norm 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 size parameter). The default is 1 (yes).

Bugs

See the bugs pages on the Sherpa website for an up-to-date listing of known bugs.

See Also

modeling
set_full_model
psfs
contour_kernel, contour_psf, delete_psf, get_psf, get_psf_contour, get_psf_image, get_psf_plot, image_kernel, image_psf, load_conv, load_psf, plot_kernel, plot_psf, show_kernel, show_psf