
2008.12.11

I am running into a couple of problems with the M31 images and need to
consider what this means for the footprints and for the CR masking.

* The background modeling is not doing a great job of representing the
  surface brightness of M31 near the core.  I'm concerned that there
  is still a small offset between the grid model and the input image.

* The footprints are outlining some low-significance regions which are
  clearly instrumental

* The CR masking should not be going to the low-surface-brightness
  levels that the footprints need.  


pmFootprintCullPeaks is very expensive (15 - 30 msec per object) and
must be performed on every peak.  We need to improve the speed (even
at the cost of memory) and we need to thread it.

*** pmFootprints makes use of the mask image, but it does not use the
    master mask values.  this must be fixed!

-- here is the algorithm

** note: this is run once for each footprint...

* the incoming footprint peak list is already sorted by brightness

* loop over all peaks

  * choose a threshold which is the peak flux - nsigma_delta*stdev
    ? actually, the threshold is using the edge of the containing
    subimage?  I'm a little confused by this.

  * if the threshold is below a minimum threshold, we drop it
    - the code is calling psArrayRemoveIndex for each of these, then decrementing i.
      this is inefficient since psArray is not a psList.  two possible options here:
      
      * do not remove the dropped peaks from the array until the full
        processing is done, then re-build the array in a single pass.
        flag peaks to be dropped (either in the structure or with a
        parallel vector)

      * have the code build a separate 'bright peaks' array on the fly
        then swap the new peaks out under the pmFootprint.

  * psArrayRemoveIndex is used 3x in pmFootprints.c : review each case

  * the subImage is divided into footprints above threshold about the
    current peak.

    - EAM : Need to disect pmFindFootprintsAtPoint.  Is it expensive
        in this case?  Should we be calling the normal pmFootprints
        function?


  
