| AHELP for CIAO 4.5 Sherpa v1 | get_psf |
Context: psfs |
Synopsis
Return PSF model data and plot, image, and contour preferences.
Syntax
get_psf( [id] ) get_psf_plot( [id] ) get_psf_image( [id] ) get_psf_contour( [id] )
Description
- id - the id of the data set to use; if not given, uses the default dataset id (id=1 by default, see "ahelp get_default_id")
What is the difference between the PSF and the kernel?
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 Sherpa must evaluate.
get_psf
The get_psf() function returns the parameter values and settings defining a PSF model assigned to a data set, by data set ID.
get_psf_plot
A Sherpa PSF model can contain data read from a file, or can be a function that calculates a PSF. If the PSF model has been assigned to a data set, then get_psf_plot() returns the data and preferences defining the PSF plot calculated from the PSF model and visualized with plot_psf().
get_psf_image
A Sherpa PSF model can be defined with data read from a 2-D image, or can be calculated from a model function. If either type of PSF model has been assigned to a 2-D data set, then the image_psf() function evaluates the model (that has been set as the PSF) over the source data array, and sends the PSF image to the imager (ds9) for display. The get_psf_image() function returns a variable containing the data and settings characterizing the image of the PSF visualized with image_psf().
get_psf_contour
The get_psf_contour() function returns a variable containing the data and preferences defining the contour plot of the PSF visualized with contour_psf()
Example 1
sherpa> get_psf() sherpa> get_psf(2)
When called with no arguments, the get_psf() function returns the parameter values and settings for the PSF model assigned to the default data set. If a data set ID is specified, the PSF model assigned to that data set will be returned.
sherpa> load_image(1, "center_box_0.25pix.fits")
sherpa> load_psf("psf", "psf_f1_norm_0.25pix.fits")
sherpa> notice2d_id(1, "BOX(88.16875,75.8625,70.416667,68.508334)")
sherpa> set_psf(psf)
sherpa> set_source(gauss2d.g1 + const2d.c1)
sherpa> psf.size=[72, 72]
sherpa> psf.center= [128, 129]
sherpa> print(get_psf())
psfmodel.psf
Param Type Value Min Max Units
----- ---- ----- --- --- -----
psf.size0 frozen 72 1 72
psf.size1 frozen 72 1 72
psf.center0 frozen 128 0 128
psf.center1 frozen 129 0 129
psf.radial frozen 0 0 1
psf.norm frozen 1 0 1
Example 2
sherpa> get_psf_plot()
sherpa> get_psf_plot("src")If a PSF model contains data read in from a PSF file, or calculated with a PSF function, the get_psf_plot() function returns the data and preferences defining a PSF plot which can be created with plot_psf(). If no argument is given, then the PSF model assigned to the default data set is assumed. If a data set ID is specified, then the plot data belonging to the PSF model assigned to that data set is returned.
sherpa> print(get_psf_plot())
PSF frac: 0.991270796001
x = [ 1.0000e+00 2.0000e+00 3.0000e+00 ..., 5.1820e+03 5.1830e+03
5.1840e+03]
y = [ 7.6365e-07 1.6777e-06 7.0964e-07 ..., 4.9221e-07 4.3923e-07
1.0823e-06]
yerr = None
xerr = None
xlabel = None
ylabel = PSF data
title = psf_f1_norm_0.25pix.fits
plot_prefs = {'errstyle': 'line', 'symbolfill': False, 'symbolstyle':
4, 'linestyle': 0, 'symbolsize': 3, 'yerrorbars': True}
sherpa> get_psf_plot().plot_prefs
PSF frac: 0.991270796001
{'errstyle': 'line',
'linestyle': 0,
'symbolfill': False,
'symbolsize': 3,
'symbolstyle': 4,
'yerrorbars': True}
sherpa> get_psf_plot().plot_prefs["linestyle"]=3
Example 3
sherpa> get_psf_image() sherpa> get_psf_image(2)
When called with no arguments, the get_psf_image() function returns the data and settings defining the PSF image produced with image_psf(), using the PSF model assigned to default dataset. If a data set ID is specified, the PSF image corresponding to that data set will be returned.
sherpa> image_psf()
sherpa> print(get_psf_image())
PSF frac: 0.991270796001
name = PSF_Data
y = [[ 7.6365e-07 1.6777e-06 7.0964e-07 ..., 3.6620e-07 4.2709e-07
1.2908e-06]
[ 5.0448e-07 1.1551e-06 6.6760e-07 ..., 3.5132e-07 5.2898e-07
1.0603e-06]
[ 1.5065e-06 1.9085e-06 1.6145e-07 ..., 6.0550e-07 1.0842e-06
1.6097e-06]
...,
[ 1.6771e-07 3.0185e-07 1.5670e-06 ..., 8.7316e-07 2.3804e-07
2.2776e-07]
[ 3.6587e-07 1.8109e-08 3.4516e-08 ..., 7.9327e-07 1.4121e-06
7.3247e-07]
[ 3.2451e-07 1.1731e-08 4.3682e-07 ..., 4.9221e-07 4.3923e-07
1.0823e-06]]
eqpos = world
crval = [ 248.6211 70.531 ]
crpix = [ 4096.5 4096.5]
cdelt = [-0.0001 0.0001]
crota = 0
epoch = 2000
equinox = 2000
sky = physical
crval = [ 4064.5 4026.5]
crpix = [ 0.5 0.5]
cdelt = [ 0.25 0.25]
Example 4
sherpa> get_psf_contour() sherpa> get_psf_contour(2)
When called with no arguments, the get_psf_contour() function returns the data and settings defining the PSF contour plot produced with contour_psf(), using the PSF model assigned to default dataset. If a data set ID is specified, the PSF contour plot corresponding to that data set will be returned.
sherpa> contour_psf()
sherpa> print(get_psf_contour())
PSF frac: 0.991270796001
x0 = [ 1. 2. 3. ..., 70. 71. 72.]
x1 = [ 1. 1. 1. ..., 72. 72. 72.]
y = [ 7.6365e-07 1.6777e-06 7.0964e-07 ..., 4.9221e-07 4.3923e-07
1.0823e-06]
xlabel = x0
ylabel = x1
title = PSF Data: psf_f1_norm_0.25pix.fits
levels = None
contour_prefs = {}
Bugs
See the bugs pages on the Sherpa website for an up-to-date listing of known bugs.
See Also
- confidence
- get_conf, get_covar, get_int_proj, get_int_unc, get_proj, get_reg_proj, get_reg_unc
- contrib
- get_chart_spectrum
- data
- get_areascal, get_arf, get_arf_plot, get_axes, get_backscal, get_bkg, get_bkg_plot, get_bkg_scale, get_coord, get_counts, get_data, get_data_plot, get_dep, get_dims, get_error, get_exposure, get_grouping, get_indep, get_quality, get_rmf, get_specresp, get_staterror, get_syserror
- filtering
- get_filter
- fitting
- calc_stat_info, get_fit, get_stat_info
- info
- get_default_id, list_stats
- methods
- get_draws, get_iter_method_name, get_iter_method_opt, get_method
- modeling
- get_model, get_model_component, get_model_component_image, get_model_component_plot, get_model_plot, get_num_par, get_order_plot, get_par, get_pileup_model, get_response, get_source, get_source_component_image, get_source_component_plot, image_source
- plotting
- get_split_plot
- psfs
- contour_kernel, contour_psf, delete_psf, get_kernel, image_kernel, image_psf, load_conv, load_psf, plot_kernel, plot_psf, set_psf, show_kernel, show_psf
- statistics
- get_chisqr_plot, get_delchi_plot, get_prior, get_sampler, get_stat
- utilities
- get_analysis, get_rate
- visualization
- get_ratio, get_resid, image_getregion

![[Sherpa Logo]](../imgs/sherpa_logo_navbar.gif)