PointSourceFit
fit_point_source(Double x_hpbw, Double y_hpbw, listof PointSourceSample samples)
Fit for the offset position and flux of a point source.
Double x_hpbw
listof PointSourceSample samples
The beam profile is assumed to be reasonablly well approximated
be an elliptical gaussian of the dimensions specified by
the x_hpbw
and y_hpbw
arguments. Thus a
point source sampled by this beam, should look like a gaussian of
the same size, centered on the position of the source, scaled by
the flux of the source, and offset by the background flux level
of the sky. The fitting function thus has to fit for the flux of
the source, the 2D offset of the source from the expected
position, and the background flux level. It does this using the
Levenberg Marquardt non-linear least-squares algorithm.
offset
command, The
fitted position of the source is also returned in this form.
The chosen sample positions must provide good coverage in both X and Y, within a beam width of the source in all directions, in order that the X and Y offsets of the source can be determined. They must also include at least one sample that is a few beam-widths away from the expected position of the point source, to aid in fitting the background flux level.
In principle, since there are 4 free parameters to be fit, at least 4 distinct positions need to be sampled. However this small number of points is unlikely to give a reasonable fit, especially given the need for one background sample, far off source. At the other extreme, the use of a large number of samples may also result in a poor fit, because the sky background flux may vary significantly during the time needed to measure a large number of samples. The optimal number is probably between 10 and 20 samples, depending on the accuracy needed and the time available.
fit_point_source
function is
a PointSourceFit
group value. This contains the fitted X, Y offset of the source,
suitable for passing to the x
and y
arguments of the offset
command, the flux of the source, the background flux, the reduced
chi-squared of the fit, and a quantity that is refered to as the
normalized deviation of the fit (see below).
In practice, the reduced chi-squared of the fit is generally not useful, because it depends on the correct estimation of the uncertainties of the flux measurements in the input samples. These uncertainties are unknowable, since they depend on atmospheric variations, such as clouds passing in front of the telescope, and how well the telescope tracks the intended offset position. It also depends on the assumed gaussian being a good approximation of the actual beam profile.
A better measure of how well the measured fluxes fit the scaled
and offset guassian beam profile, is returned in the
ndev
member of the returned group value. This,
normalized deviation, is the RMS difference between the
measured and model fluxes, normalized by the fitted gaussian
flux. A maximum value of 0.2 appears to be a reasonable level
above which to reject poor fits, along with a lower flux cutoff
and a maximum correction cutoff. Note that the fitting algorithm
aborts the fitting procedure if the fitted X or Y offsets exceed
one beam width.
fit_point_source
function returns error
estimates along with each of the fitted parameters. They
are Asymptotic standard errors, meaning that they are
computed from the square root of the diagonal of the covariance
matrix of the fit, as though the fitted parameters were all
linear. In practice this turns out to be a good approximation for
the pointing fitting algorithm. To test this, confidence interval
searches were performed on the pointing samples of a number of
test sources, to determine more robust estimates of the errors,
and the results were essentially the same as the asymptotic
standard error estimates.
Since the error estimates of the input data tend to significantly
underestimate the errors of the sample fluxes, all of the
calculated uncertainties are scaled by the square root of the
reduced chi-squared. This is a commonly used trick, which works
reasonably well when there are large numbers of data points. For
the small number of samples that go into pointing fits, it should
work on average, but may produce large variations in individual
fits.
Occassionally, when there is a lot of noise, such as during bad weather, it isn't possible to compute the covariance matrix. In such cases, the returned uncertainties are set to zero.