
20100506:

  we may load RAW and/or CNV images.

  * options->convolve:
    * if only one of RAW or CNV exists, convolve it to match target PSF
    * if both exist, convolve desired one
    
    * if matching PSF exists, use it (unless told to re-measure)
    
    * output goes to OUT (which is then used by psphot analysis routines)

  * detect

    * if (RAW) ? RAW : OUT
    
  *   


20100503:

  psphotStack : outline

  * load N images
  * make chisq detection image
  * detect sources on all (N+1) images
  * convolve N input images (to match, to target)
  * measure source properties on convolved images

20100126:

  * watch out for psphotSetMomentsWindow & MOMENTS_SX_MAX,etc
  * watch out for psphotSignificanceImage.c:,psphotEfficiency using the FWHM_MAJ from psphotChoosePSF

20100120 : more stack processing mods:

  there are a number of data collections generated during psphotReadout:

  * detections (currently a structure containing multiple arrays)
  * sources (a psArray)
  * psf (the psf model structure)
  
  * new sources vs old sources:
    there is a sequence on the second pass in which we need to distinguish the sources
    from the first pass from those on the second pass:

    - add noise (old sources only)
    - find detections
    - subtract noise (old sources only)
    - generate sources (new detections only)
    - source classifications (new sources only)
    - guess models (new sources only)
    - replace sources (old sources only)
    - merge sources (new + old -> sources)

    currently we are distiguishing the old vs new based on different arrays.
    can we use the processing flags to distinguish the these cases and carry around 
    only a single source list?

    * detections->peaks holds the most recently detected set of peaks
      detections->oldPeaks holds the previous collection

      detections->footprints holds the full set of merged footprints,
      including assigned peaks from the old and new set.

20100107 : updates for stack processing

  I am building a new version of psphot that operates on a set of
  images (eg, multi-filter or multi-epoch).  The assumptions are:

  * each input image represents the same sky pixels : they are warped to a common frame.
  * each image has been previously processed, with the background
    subtracted (and the psf model determined?)
  * all planes are / can be loaded into memory at once (otherwise I
    need to add a lot of I/O layers)

  psphot currently expects the pmFPAfile of interest to be available in
  config->files with the name PSPHOT.INPUT.  To update the code for
  stacks, I am extending this concept with the pmFPAfileSelectSingle
  API: config->files may contain multiple PSPHOT.INPUT entries, and
  functions which access this file / these files need to specify
  *which* image they want.  The number of PSPHOT.INPUT entries is
  saved in config->arguments as PSPHOT.INPUT.NUM (this can be
  generated from the filerule PSPHOT.INPUT for extension).

  As a result, we need a number of wrapper functions which loop over
  all PSPHOT.INPUT.NUM entries and perform a particular operation on
  one of the entries.  Here are the functions which I have modified
  in this way (function -> child)

  * psphotAddPhotcode -> psphotAddPhotcodeReadout
    * note that the photcode is now saved on readout->analysis
  * psphotSetMaskAndVariance -> psphotSetMaskAndVarianceReadout
  * psphotModelBackground -> psphotModelBackgroundReadoutFileIndex
  * psphotSubtractBackground -> psphotSubtractBackgroundReadout

  side notes on 
  
  * psphotModelBackground vs psphotBackgroundModel : I've renamed
    psphotBackgroundModel (used only by ppStack for now) to
    psphotModelBackgroundReadoutNoFile.  I've also named the
    single-readout version used by psphotModelBackground to
    psphotModelBackgroundReadoutFileIndex.  These two functions do the
    same thing, but psphotModelBackgroundReadoutNoFile does not save
    a pmFPAfile on config->files


20090606 : design notes on the multi-image photometry analysis

  assumptions:
  
  * each input image represents the same sky pixels : they are warped to a common frame.

  * each image has been previously processed, with the background subtracted and the psf model determined

  basic outline:

  * load images, masks, variance : for now, we should load all images.  in the future, we might be able to split this into segments.  

  * option: model and subtract background for each image (should not be needed)

  * option: smooth each image with a psf or fraction (not needed if stack smooths too much?)

  * generate the significance (chisq) image: X_i = sum(f_i^2 / var_i)

  * perform the peak detection on X_i

  * for each of the input images:

    * generate the significance image S_i = f_i^2 / var_i 
    
    * perform the peak detection on S_i

  * merge the list of peaks

  * generate the footprints

  * linear fit to the peaks with the set of images (psf for each image)


  design issues:
  
  * pmSource represents the analysis for an object on a single image
  * extended pmSourceSet to group connected pmSources on multiple images?
