[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Focus indication



On Wed, 1 Aug 2001 17:40:09 -0400, you wrote:

>
>  Rob asked:
>
>> I have the centroid, but am unsure on the interpolation from the centroid to
>> calculate the FWHM.  Theoretically, I believe I should fit a gaussian to the
>> marginal sums (x and y, from star pixels only).  Is this the only way, the
>> wrong way, or is there a simpler way?  Strongly looking for the simpler
>> way...
>
>  Simple way:
>
>         - round centroid to integer (row, col)
>         - define "peak value" as the value of pixel at (row, col)
>                     (after subtracting background)
>         - walk down rows in the negative direction until you reach
>                     a pixel with half the peak.
>                     Call this distance in pixels "d1"
>         - walk up rows in the positive direction until you reach
>                     a pixel with half the peak
>                     Call this distance in pixels "d2"
>         - walk down cols in the negative direction until you reach
>                     a pixel with half the peak.
>                     Call this distance in pixels "d3"
>         - walk up cols in the positive direction until you reach
>                     a pixel with half the peak
>                     Call this distance in pixels "d4"
>
>         - calculate
>                     FWHM = (d1 + d2 + d3 + d4) / 2
This can be done to fractional pixels by interpolating ...
the FWHM is now so small that one is tempted to use
high order interpolation: I used 4th order splines.
This is a very dangerous process! I eventually scared
myself and gave it up!!

>
>  Complicated way:
>
>         - form the marginal sums in the row and column direction
>         - fit a gaussian to the 1-D marginal sum in row direction
>                     Set "d1" = 2.35*sigma of gaussian
>         - fit a gaussian to the 1-D marginal sum in col direction
>                     Set "d2" = 2.35*sigma of gaussian
> 
>         - calculate
>                     FWHM = (d1 + d2) / 2
>
>
>  The first way is really easy and really fast.  Don't forget to 
>subtract the background from all pixels before starting, though.

And the gaussian fit is horribly sensitive to background
subtraction too.

That's doubled in spades if there are background gradients.

Always compute a "goodness of fit" parameter ... and know
what it means. Then you have a fighting chance of spotting
when the background tail is wagging the star-dog.

Andrew Bennett, Avondale Vineyard