Narrow 2D Gaussians
Sherpa evaluates 2D models at the center of the pixel. If the model
changes rapidly within a pixel, it can lead to unexpected results.
This can happen if a Gaussian, or other 2D model, is given
a small FWHM (much less than a pixel). The example below
illustrates the problem
sherpa> dataspace2d(100,100)
sherpa> set_model(gauss2d.g1)
sherpa> g1.xpos = 50
sherpa> g1.ypos = 50
sherpa> g1.fwhm = 0.01
sherpa> g1.ampl = 1.0
sherpa> calc_model_sum2d()
1.0
sherpa> g1.xpos = 50.1
sherpa> calc_model_sum2d()
3.8725919148189143e-121
Here a 2D Gaussian with a FWHM=0.01 pixel is created. When the
Gaussian is center on the pixel center, the sum of the model is
1.0. However, shifting the narrow Gaussian by a small amount, 0.1 pixels
in the X direction, results in the model now essentially summing to 0.
This leads to very steep slopes in the error surface separated by large
areas where the fit statistic barely changes with positon. The error
surface looks like a stair case rather than say the classic parabolic shape.
sherpa> load_data("psf.fits")
sherpa> load_psf("p", "psf.fits")
sherpa> set_psf("p")
sherpa> set_model(gauss2d.g1)
sherpa> g1.fwhm=0.1
sherpa> freeze(g1.fwhm)
sherpa> set_method("neldermead")
sherpa> g1.xpos = 196/2.0
sherpa> g1.ypos = 138/2.0
sherpa> fit()
...
g1.xpos 97.9973
g1.ypos 68.9982
g1.ampl 1.00023
sherpa> int_unc( g1.xpos, min=96, max=100, nloop=400)
Here the same data are loaded as both the dataset and the PSF. A
2D Gaussian is used to approximate a delta function and the data are fit.
Trying to run conf will yeild tiny errors on the
xpos and ypos values. It is best to look at the
error surface using int_unc.
The stair-step error surface is a result of the Gaussian only being
evaluated at the pixel center. The large region between the pixels
is when the model evaluates to approximately zero.
This is not restricted just to Gaussians. All 2D models behave the
same way. It can also be a problem for 1D datasets which are evaluated
over each bin - such as with PHA data.