Name
       photfits - photometry measurement

Synopsis
       photfits [options] <cubes...>

Description
       photfits  computes the flux in ADU inside a specified disk
       in an image.  photfits can also  estimate  the  background
       inside  a ring cented on the same point, given an internal
       and external radius.

       photfits accepts jokers on the command-line, it will  com-
       pute  the  photometry at the indicated point in all planes
       of all given cubes.

       photfits can also try to detect by itself all bright peaks
       in  an  image,  by using the same algorithm implemented in
       detpeak.

Photometry Options
       -x x_center -y y_center
              specifies a center for the disk  within  which  the
              photometry  will be computed (can be floating point
              values). These options are useless when using auto-
              matic peak detection.

       -r radius
              specifies  a  radius in which the flux will be com-
              puted (can be a floating point value).

       -b `r_int r_ext'
              specifies the internal and external radii  for  the
              background estimation.  The center of the ring will
              be the same as the above disk center.

       -m     to require a background estimation  with  a  median
              filtering, default method uses a direct average.

Peak Detection Options
       -d     Activate automatic peak detection.

       -f r1 r2 r3
              Specify  3 radii for fine positioning after initial
              detection.  See the detpeak man page about  how  to
              set this option and the related algorithm.

       -l     Use  this option to smear out the image with a low-
              pass filter before launching peak detection.

       -s threshold
              Specify a threshold value for a sigma detection  of
              the peaks.

Algorithm
       For  the flux computation, The output is simply the sum of
       all pixel values found to be within  the  disk  (including
       the border). If a background had been estimated per pixel,
       it is then subtracted from each pixel before accumulation.

       For  background estimation, 2 methods are offered. In both
       cases, a list of all pixels found to be  in  the  ring  is
       first  constructed.   The  difference  between the average
       (default) and the median (-m option) is the following:

       In the case of an average estimation,  the  background  is
       simply  estimated as the average pixel value of the pixels
       found in the ring.

       In the case of the median estimation, the found pixel val-
       ues  are first sorted, the background is then estimated as
       an average of the 3 or 4  central  values  in  the  sorted
       array (whether the number of found pixels is odd or even).
       This method h.PPs getting rid  of  spurious  pixel  values
       that  can  occur  in  the ring.  Note that in this case, a
       minimum of 60 pixels has to be found to  perform  a  back-
       ground estimation.

Example
       photfits  -x  127.45  -y  131.65  -r 5.12 -b `5.2 20.4' -m
       *.fits
       would compute a flux  in  a  circle  centered  on  (127.45
       131.65),  of  radius  5.12, and estimate a background in a
       ring centered on the same  point  with  radii  (5.2  20.4)
       using a median method.

Files
       Files shall all comply with FITS format

See Also
       encircl, stcube, strehl, fwhm, detpeak

Bugs
       It  would be nice to have other means of defining the zone
       into which the background is estimated.

       To be added: the possibility to give a list  of  disks  in
       which the flux has to be estimated, with a list of associ-
       ated background definitions.