Index: /trunk/ippconfig/recipes/psphot.config
===================================================================
--- /trunk/ippconfig/recipes/psphot.config	(revision 15554)
+++ /trunk/ippconfig/recipes/psphot.config	(revision 15555)
@@ -1,34 +1,34 @@
 
 # these options turn on different inputs and/or outputs
-SAVE.OUTPUT		BOOL 	TRUE
-SAVE.BACKMDL		BOOL 	FALSE
-SAVE.BACKMDL.STDEV	BOOL 	FALSE
-SAVE.BACKGND		BOOL 	FALSE
-SAVE.BACKSUB		BOOL 	FALSE
-SAVE.RESID		BOOL 	FALSE
-SAVE.PSF		BOOL 	FALSE
-LOAD.PSF		BOOL 	FALSE
-SAVE.PLOTS      	BOOL    FALSE
+SAVE.OUTPUT                         BOOL  TRUE
+SAVE.BACKMDL                        BOOL  FALSE
+SAVE.BACKMDL.STDEV                  BOOL  FALSE
+SAVE.BACKGND                        BOOL  FALSE
+SAVE.BACKSUB                        BOOL  FALSE
+SAVE.RESID                          BOOL  FALSE
+SAVE.PSF                            BOOL  FALSE
+LOAD.PSF                            BOOL  FALSE
+SAVE.PLOTS                          BOOL  FALSE
 
 # the zero point is used to set a basic scale for DVO
 # XXX it may not currently be read : double check this (EAM)
-ZERO_POINT          F32  25.000          # zero point used by DVO
-ZERO_PT             F32  25.000          # zero point used by DVO
-
-MASKVAL             STR  SAT,BAD,BLANK   # Mask these types of pixels
-
-OUTPUT.FORMAT       STR  SMPDATA
+ZERO_POINT                          F32   25.000          # zero point used by DVO
+ZERO_PT                             F32   25.000          # zero point used by DVO
+
+MASKVAL                             STR   SAT,BAD,BLANK   # Mask these types of pixels
+
+OUTPUT.FORMAT                       STR   SMPDATA
 
 # these parameter govern how the background is measured
-BACKGROUND.XBIN	    S32   128            # size of background superpixels
-BACKGROUND.YBIN	    S32   128            # size of background superpixels
-IMSTATS_NPIX        S32  10000    	 # number of pixels to use for sky estimate boxes:
-
-SKY_BIAS            F32  0.0             # offset applied to measured sky (FOR TESTING)
-SKY_FIT_ORDER       S32  0
-SKY_FIT_LINEAR      BOOL FALSE
-SKY_STAT            STR  FITTED_MEAN_V4  # statistic used to measure background
-SKY_CLIP_SIGMA      F32  2.0             # statistic used to measure background
-SKY_SIG             F32  1.0             # optional sky error for 
+BACKGROUND.XBIN                     S32   128             # size of background superpixels
+BACKGROUND.YBIN                     S32   128             # size of background superpixels
+IMSTATS_NPIX                        S32   10000           # number of pixels to use for sky estimate boxes:
+
+SKY_BIAS                            F32   0.0             # offset applied to measured sky (FOR TESTING)
+SKY_FIT_ORDER                       S32   0
+SKY_FIT_LINEAR                      BOOL  FALSE
+SKY_STAT                            STR   FITTED_MEAN_V4  # statistic used to measure background
+SKY_CLIP_SIGMA                      F32   2.0             # statistic used to measure background
+SKY_SIG                             F32   1.0             # optional sky error for 
 
 # allowed values for SKY_STAT: 
@@ -36,128 +36,130 @@
 
 # masking parameters (XXX EAM : rework this to use psRegion like ANALYSIS_REGION)
-XMIN                F32   0        	 # minimum valid x-coord
-XMAX                F32   0        	 # maximum valid x-coord
-YMIN                F32   0        	 # minimum valid y-coord
-YMAX                F32   0        	 # maximum valid y-coord
+XMIN                                F32   0               # minimum valid x-coord
+XMAX                                F32   0               # maximum valid x-coord
+YMIN                                F32   0               # minimum valid y-coord
+YMAX                                F32   0               # maximum valid y-coord
 
 # peak finding 
-PEAKS_SMOOTH_SIGMA  F32  1.0       	 # smoothing kernel sigma in pixels
-PEAKS_SMOOTH_NSIGMA F32  2.0   	   	 # smoothing kernel width in sigmas
-PEAKS_NSIGMA_LIMIT  F32  25.0 	   	 # peak significance threshold
-PEAKS_NSIGMA_LIMIT_2 F32  5.0 	   	 # peak significance threshold
-PEAKS_NMAX          S32   0              # on first pass, only keep NMAX peaks (0 == all)
+PEAKS_SMOOTH_SIGMA                  F32   1.0             # smoothing kernel sigma in pixels
+PEAKS_SMOOTH_NSIGMA                 F32   2.0             # smoothing kernel width in sigmas
+PEAKS_NSIGMA_LIMIT                  F32   25.0            # peak significance threshold
+PEAKS_NSIGMA_LIMIT_2                F32   5.0             # peak significance threshold
+PEAKS_NMAX                          S32   0               # on first pass, only keep NMAX peaks (0 == all)
 
 # parameters to control the selection of the peak in the Sx,Sy plane
-MOMENTS_SCALE       F32   0.1
-MOMENTS_SN_MIN      F32   100.0           # min S/N to measure moments
-MOMENTS_SX_MAX      F32   3.0
-MOMENTS_SY_MAX      F32   3.0
-MOMENTS_AR_MAX      F32   1.5		 # maximum axial ratio: 1 / AR < (sx / sy) < AR
+MOMENTS_SCALE                       F32   0.1       
+MOMENTS_SN_MIN                      F32   100.0           # min S/N to measure moments
+MOMENTS_SX_MAX                      F32   3.0
+MOMENTS_SY_MAX                      F32   3.0
+MOMENTS_AR_MAX                      F32   1.5             # maximum axial ratio: 1 / AR < (sx / sy) < AR
 
 # basic object statistics
-SKY_INNER_RADIUS    F32  15		 # square annulus for local sky measurement
-SKY_OUTER_RADIUS    F32  25		 # square annulus for local sky measurement
-PSF_MOMENTS_RADIUS  F32  3               # calculate initial source moments with this radius
-PSF_SN_LIM          F32  50              # minimum S/N for stars used for PSF model
-PSF_MAX_NSTARS      S32  200             # limit number of stars used for PSF model
-PSF_CLUMP_NSIGMA    F32  1.5             # region of Sx,Sy plane to use for selecting PSF stars
-PSF_MIN_DS          F32  0.01
-PSF_PARAM_WEIGHTS   BOOL FALSE
+SKY_INNER_RADIUS                    F32   15              # square annulus for local sky measurement
+SKY_OUTER_RADIUS                    F32   25              # square annulus for local sky measurement
+PSF_MOMENTS_RADIUS                  F32   3               # calculate initial source moments with this radius
+PSF_SN_LIM                          F32   50              # minimum S/N for stars used for PSF model
+PSF_MAX_NSTARS                      S32   200             # limit number of stars used for PSF model
+PSF_CLUMP_NSIGMA                    F32   1.5             # region of Sx,Sy plane to use for selecting PSF stars
+PSF_MIN_DS                          F32   0.01
+PSF_PARAM_WEIGHTS                   BOOL  FALSE
 
 # PSF model parameters : choose the PSF model
 # list as many PSF_MODEL options as desired
-# PSF_MODEL           MULTI
-PSF_MODEL           STR  PS_MODEL_GAUSS
-# PSF_MODEL           STR  PS_MODEL_PGAUSS
-# PSF_MODEL           STR  PS_MODEL_QGAUSS
-# PSF_MODEL           STR  PS_MODEL_TGAUSS  ## not well tested, not very successful
+# PSF_MODEL                         MULTI
+PSF_MODEL                           STR   PS_MODEL_GAUSS
+# PSF_MODEL                         STR   PS_MODEL_PGAUSS
+# PSF_MODEL                         STR   PS_MODEL_QGAUSS
+# PSF_MODEL                         STR   PS_MODEL_TGAUSS # not well tested, not very successful
 
 # PSF.TREND.MASK must be a 2D polynomial
 # the specified values are ignored but define the active components of the polynomial
-PSF.TREND.MASK  METADATA  
-   NORDER_X         S32       0                # number of x orders
-   NORDER_Y         S32       0                # number of y orders
-   VAL_X00_Y00      F64       1                # polynomial coefficient
-   NELEMENTS        S32       1                # number of unmasked components
+PSF.TREND.MASK                      METADATA  
+   NORDER_X                         S32   0               # number of x orders
+   NORDER_Y                         S32   0               # number of y orders
+   VAL_X00_Y00                      F64   1               # polynomial coefficient
+   NELEMENTS                        S32   1               # number of unmasked components
 END  # folder for 2D polynomial
 
-PSF.TREND.MODE STR POLY_ORD
-PSF.TREND.NX   S32 0
-PSF.TREND.NY   S32 0
-
-PSF_FIT_RADIUS      F32  15.0	         # fitting radius for test PSF model
-PSF_REF_RADIUS      F32  25.0            # aperture magnitudes are scaled via 
-					 # curve-of-growth to this radius
+PSF.TREND.MODE                      STR POLY_ORD         
+PSF.TREND.NX                        S32   0 
+PSF.TREND.NY                        S32   0
+
+PSF_FIT_RADIUS                      F32   15.0            # fitting radius for test PSF model
+PSF_REF_RADIUS                      F32   25.0            # aperture magnitudes are scaled via 
+                                         # curve-of-growth to this radius
 # PSF-like source model parameters
-PSF_FIT_NSIGMA       F32  1.0		 # significance for pixel included in fit
-PSF_FIT_PADDING      F32  2.0            # extra annulus to use for fit 
-PSF_SHAPE_NSIGMA     F32  3.0		 # max significance for shape variation
-PSF_MIN_SN           F32  2.0		 # reject objects below this significance
-PSF_MAX_CHI          F32  50.0		 # reject objects worse that this
-FULL_FIT_SN_LIM      F32  50.0
-
-PSF.RESIDUALS        BOOL TRUE
-PSF.RESIDUALS.XBIN   S32   1
-PSF.RESIDUALS.YBIN   S32   1
-PSF.RESIDUALS.NSIGMA F32   3.0	
-PSF.RESIDUALS.INTERPOLATION STR BILINEAR
-PSF.RESIDUALS.STATISTIC     STR ROBUST_MEDIAN
-PSF.RESIDUALS.SPATIAL_ORDER S32 0
+PSF_FIT_NSIGMA                      F32   1.0             # significance for pixel included in fit
+PSF_FIT_PADDING                     F32   2.0             # extra annulus to use for fit 
+PSF_SHAPE_NSIGMA                    F32   3.0             # max significance for shape variation
+PSF_MIN_SN                          F32   2.0             # reject objects below this significance
+PSF_MAX_CHI                         F32   50.0            # reject objects worse that this
+FULL_FIT_SN_LIM                     F32   50.0
+
+# the RESIDUALS are pixelized psf residual tables
+PSF.RESIDUALS                       BOOL  TRUE            # generate the residuals?
+PSF.RESIDUALS.XBIN                  S32   1               # Nx(residual) = Nx(input)*XBIN
+PSF.RESIDUALS.YBIN                  S32   1               # Ny(residual) = Ny(input)*YBIN
+PSF.RESIDUALS.NSIGMA                F32   3.0             # clip input stack of NSIGMA outliers
+PSF.RESIDUALS.INTERPOLATION         STR   BILINEAR        # interpolation to use when reconstructing residual
+PSF.RESIDUALS.STATISTIC             STR   ROBUST_MEDIAN   # statistic to use for generating the residual
+PSF.RESIDUALS.SPATIAL_ORDER         S32   0               # fit spatial variations of the residuals at this order (0,1)
+PSF.RESIDUALS.PIX.SN                F32   0.0             # keep this pixel if residual is more significant than this
  
 # EXTended source model parameters
-EXT_MODEL            STR  PS_MODEL_PGAUSS
-EXT_MIN_SN           F32  50.0           # fit galaxies above this S/N limit
-EXT_FIT_NSIGMA       F32  1		 # significance for pixel included in fit
-EXT_FIT_PADDING      F32  5              # extra annulus to use for fit 
-EXT_MOMENTS_RADIUS   F32  9
+EXT_MODEL                           STR   PS_MODEL_PGAUSS
+EXT_MIN_SN                          F32   50.0            # fit galaxies above this S/N limit
+EXT_FIT_NSIGMA                      F32   1               # significance for pixel included in fit
+EXT_FIT_PADDING                     F32   5               # extra annulus to use for fit 
+EXT_MOMENTS_RADIUS                  F32   9
 
 # Extended source fit parameters
-EXTENDED_SOURCE_FITS BOOL FALSE
-EXTENDED_SOURCE_SN_LIM F32 20.0
-EXTENDED_SOURCE_PSF_CONVOLVED BOOL FALSE
-
-FITMODE              STR  BLEND
-DEBLEND_PEAK_FRACTION   F32 0.1
-DEBLEND_SKY_NSIGMA      F32 10.0
-
-# APTREND 	     STR  NONE, CONSTANT, SKYBIAS, SKYSAT, XY_LIN, SKY_XY_LIN, SKYSAT_XY_LIN, ALL
-APTREND 	     STR  CONSTANT
-AP_MIN_SN            F32  25.0
-APTREND.NSTAR.MIN    S32  5
-APTREND.ORDER.MAX    S32  5
+EXTENDED_SOURCE_FITS                BOOL  FALSE
+EXTENDED_SOURCE_SN_LIM              F32   20.0
+EXTENDED_SOURCE_PSF_CONVOLVED       BOOL  FALSE
+
+FITMODE                             STR   BLEND  
+DEBLEND_PEAK_FRACTION               F32   0.1
+DEBLEND_SKY_NSIGMA                  F32   10.0
+
+# APTREND                           STR   NONE, CONSTANT, SKYBIAS, SKYSAT, XY_LIN, SKY_XY_LIN, SKYSAT_XY_LIN, ALL
+APTREND                             STR   CONSTANT
+AP_MIN_SN                           F32   25.0
+APTREND.NSTAR.MIN                   S32   5
+APTREND.ORDER.MAX                   S32   5
 
 # test options
 # BREAK_POINT may be one of (PEAKS, MOMENTS, PSFMODEL, ENSEMBLE)
-BREAK_POINT           STR  NONE
-# PEAKS_OUTPUT_FILE   STR  peaks.dat
-# MOMENTS_OUTPUT_FILE STR  moments.dat
-# ANALYSIS_REGION     STR  [1000:1600,2800:3400]
+BREAK_POINT                         STR   NONE     
+# PEAKS_OUTPUT_FILE                 STR   peaks.dat
+# MOMENTS_OUTPUT_FILE               STR   moments.dat
+# ANALYSIS_REGION                   STR   [1000:1600,2800:3400]
 
 # optional parameter to limit the actual analysis to a fraction of the image
 # do not uncomment this in the master psphot.config file
-# ANALYSIS_REGION     STR  [1000:1600,2800:3400]
-
-IGNORE_GROWTH BOOL FALSE
-CONSTANT_PHOTOMETRIC_WEIGHTS BOOL TRUE # Should the photometric code [currently only ensemblePSF] refuse to weight each pixel by it's significance?
-INTERPOLATE_AP BOOL TRUE
-
-POISSON.ERRORS.PHOT.LMM BOOL TRUE
-POISSON.ERRORS.PHOT.LIN BOOL FALSE
-POISSON.ERRORS.PARAMS   BOOL TRUE
-
-PCM_BOX_SIZE        S32 2
-
-OUTPUT.FORMAT       STR SMPDATA
-NOISE.FACTOR        F32 5.0
-NOISE.SIZE          F32 2.0
-
-USE_FOOTPRINTS			BOOL	F	# use new pmFootprint peak packaging
-FOOTPRINT_NPIXMIN		S32	5	# Minimum size of a pmFootprint
-FOOTPRINT_NSIGMA_LIMIT		F32	20	# threshold for bright pmFootprint detection
-FOOTPRINT_NSIGMA_LIMIT_2	F32	4	# threshold for faint pmFootprint detection
-FOOTPRINT_GROW_RADIUS		S32	3	# How much to grow bright footprints
-FOOTPRINT_GROW_RADIUS_2		S32	5	# How much to grow faint footprints
-FOOTPRINT_CULL_NSIGMA_DELTA	F32	4	# Cull peaks that aren't nsigma above coll to neighbour
-FOOTPRINT_CULL_NSIGMA_MIN	F32	1	# Minimum height of colls in units of skyStdev
+# ANALYSIS_REGION                   STR   [1000:1600,2800:3400]
+
+IGNORE_GROWTH                       BOOL  FALSE
+CONSTANT_PHOTOMETRIC_WEIGHTS        BOOL  TRUE 		  # Should the photometric code [currently only ensemblePSF] refuse to weight each pixel by it's significance?
+INTERPOLATE_AP                      BOOL  TRUE
+
+POISSON.ERRORS.PHOT.LMM             BOOL  TRUE   
+POISSON.ERRORS.PHOT.LIN             BOOL  FALSE
+POISSON.ERRORS.PARAMS               BOOL  TRUE
+
+PCM_BOX_SIZE                        S32   2
+
+OUTPUT.FORMAT                       STR   SMPDATA     
+NOISE.FACTOR                        F32   5.0
+NOISE.SIZE                          F32   2.0
+
+USE_FOOTPRINTS                      BOOL  F       	  # use new pmFootprint peak packaging
+FOOTPRINT_NPIXMIN                   S32   5       	  # Minimum size of a pmFootprint
+FOOTPRINT_NSIGMA_LIMIT              F32   20      	  # threshold for bright pmFootprint detection
+FOOTPRINT_NSIGMA_LIMIT_2            F32   4       	  # threshold for faint pmFootprint detection
+FOOTPRINT_GROW_RADIUS               S32   3       	  # How much to grow bright footprints
+FOOTPRINT_GROW_RADIUS_2             S32   5       	  # How much to grow faint footprints
+FOOTPRINT_CULL_NSIGMA_DELTA         F32   4       	  # Cull peaks that aren't nsigma above coll to neighbour
+FOOTPRINT_CULL_NSIGMA_MIN           F32   1       	  # Minimum height of colls in units of skyStdev
 
 # alternate PSPHOT-type recipes
@@ -173,31 +175,31 @@
 END
 
-TEST_FIT 			BOOL FALSE
-TEST_FIT_MODE			STR  DEFAULT
-TEST_FIT_MODEL			STR  DEFAULT
-TEST_FIT_INNER_RADIUS		F32  NAN
-TEST_FIT_OUTER_RADIUS		F32  NAN
-TEST_FIT_RADIUS			F32  NAN
-TEST_MOMENTS_RADIUS		F32  NAN
-TEST_FIT_X			F32  NAN
-TEST_FIT_Y			F32  NAN
-
-TEST_FIT_PAR0			F32  NAN
-TEST_FIT_PAR1			F32  NAN
-TEST_FIT_PAR2			F32  NAN
-TEST_FIT_PAR3			F32  NAN
-TEST_FIT_PAR4			F32  NAN
-TEST_FIT_PAR5			F32  NAN
-TEST_FIT_PAR6			F32  NAN
-TEST_FIT_PAR7			F32  NAN
-TEST_FIT_PAR8			F32  NAN
-TEST_FIT_PAR			F32  NAN
-
-DIAGNOSTIC.PLOTS		METADATA
-  IMAGE.BACKGROUND.CELL.HISTOGRAM   BOOL FALSE
-  IMAGE.BACKGROUND.CELL.HISTOGRAM.X S32 35
-  IMAGE.BACKGROUND.CELL.HISTOGRAM.Y S32 -1
-END
-
-PSF.FLUXSCALE.NX		S32 5 # number cells to measure flux scale variations
-PSF.FLUXSCALE.NY		S32 5 # number cells to measure flux scale variations
+TEST_FIT                            BOOL  FALSE
+TEST_FIT_MODE                       STR   DEFAULT
+TEST_FIT_MODEL                      STR   DEFAULT
+TEST_FIT_INNER_RADIUS               F32   NAN
+TEST_FIT_OUTER_RADIUS               F32   NAN
+TEST_FIT_RADIUS                     F32   NAN
+TEST_MOMENTS_RADIUS                 F32   NAN
+TEST_FIT_X                          F32   NAN
+TEST_FIT_Y                          F32   NAN
+
+TEST_FIT_PAR0                       F32   NAN
+TEST_FIT_PAR1                       F32   NAN
+TEST_FIT_PAR2                       F32   NAN
+TEST_FIT_PAR3                       F32   NAN
+TEST_FIT_PAR4                       F32   NAN
+TEST_FIT_PAR5                       F32   NAN
+TEST_FIT_PAR6                       F32   NAN
+TEST_FIT_PAR7                       F32   NAN
+TEST_FIT_PAR8                       F32   NAN
+TEST_FIT_PAR                        F32   NAN
+
+DIAGNOSTIC.PLOTS                    METADATA
+  IMAGE.BACKGROUND.CELL.HISTOGRAM   BOOL  FALSE
+  IMAGE.BACKGROUND.CELL.HISTOGRAM.X S32   35
+  IMAGE.BACKGROUND.CELL.HISTOGRAM.Y S32   -1
+END
+
+PSF.FLUXSCALE.NX                    S32   5 		  # number cells to measure flux scale variations
+PSF.FLUXSCALE.NY                    S32   5 		  # number cells to measure flux scale variations
