fit a 2D Gaussian to an image SCULIB_FIT_2D_GAUSSIAN
This routine fits a 2D Gaussian to an image of a source. It takes as input data a map made of the source with pixels on a square grid.
If status is good on entry, the routine will calculate the 0th () and 1st order (, ) moments of the image on the map. Map pixels with bad quality are ignored:
The 0th order is calculated as
(27) |
where i,j are the pixel indices. The 1st order moment in X is calculated as
(28) |
where x is the x position of pixel i,j; and the 1st order moment in Y is calculated as
(29) |
where y is the y position of pixel i,j.
If the 0th order moment of the image was 0, i.e. there is no image on the map, then a warning message will be output and all image parameters set to 0 or bad quality. Otherwise, the x,y centre of the image is calculated from:-