Author: Mike Gutzwiller Date: 960412 Revision: #1 960412 Key Words: CCD, techniques, PSF, computation
Norman has asked about my use of a shifted PSF in my star detection algorithm and I thought that it would make a good topic for all. Be forewarned though, I'm going to use some calculus! If you bear with me though I'll explain at the end why using the shifted PSF works well for star detection.
The use of a shifted PSF (one which sums to zero and thus has negative components) comes about naturally if you try to get a least squares fit of the magnitude of a star candidate with an unknown background. A good star candidate should look like the PSF times the amplitude plus a constant background. Or near the star:
y(x) = A*psf(x - x0) + K
where y is the value at pixel x, A is the amplitude and K is the constant background.
Using least squares then we want to minimize:
E(A,K) = sum((y(x) - A*psf(x-x0) - K)^2)
To find the A and K which give the minimum value of E we take the partial derivatives and set them to zero to get:
dE/dK = 0 = sum(2*(y(x) - A*psf(x-x0) - K)*(-1))
dE/dA = 0 = sum(2*(y(x) - A*psf(x-x0) - K)*(-psf(x-x0)))
rearranging terms we get:
A*sum(psf(x-x0)) + K*sum(1) = sum(y(x))
A*sum(psf(x-x0)^2) + K*sum(psf(x-x0)) = sum(y(x)*psf(x-x0))
Remember that sum(psf(x-x0)) = 1 by definition and let N = the number of pixels we look at. Then the above equations become:
A + K*N = sum(y(x))
A*sum(psf(x-x0)^2) + K = sum(y(x)*psf(x-x0))
Solving the two equations we get for A:
A = (sum(y(x)*psf(x-x0)) - sum(y(x))/N) / (sum(psf(x-x0)^2) - 1/N)
which can be rewritten as:
A = sum(y(x)*(psf(x-x0)-1/N)) / constant
The psf(x-x0) - 1/N term is simply the psf shifted so that it sums to zero. It turns out that using this function works well for detecting stars since it weights the inner parts of the psf heavily (where the psf is above 1/N) and penalizes heavily any candidate which has signal away from the center (where the psf is below 1/N).
Using the shifted PSF has other advantages. The PSF I use is generated automatically from the actual image. Thus I look for objects that look like TASS stars. For example, in the image orion3.dat, an unsaturated star looks like a short, fuzzy line about 3 pixels long at about 45 degrees since the detector seems to be off true east-west by about 1/4 degree. A small error to be sure, but enough to make the stars definitely non-circular.