Index: branches/eam_branches/ipp-20121219/ippconfig/gpc1/psastro.config
===================================================================
--- branches/eam_branches/ipp-20121219/ippconfig/gpc1/psastro.config	(revision 34903)
+++ branches/eam_branches/ipp-20121219/ippconfig/gpc1/psastro.config	(revision 35096)
@@ -382,4 +382,5 @@
    PSASTRO.USE.MODEL           BOOL FALSE
    PSASTRO.MOSAIC.MODE         BOOL FALSE
+   DVO.GETSTAR.FIXED.ZEROPT    F32   25.0
 
    PSASTRO.CATDIR               	STR     PS1.REF.20120524
@@ -394,25 +395,98 @@
 END
 
-# initial setup for MD@100 inputs, should work for 50-500 input
+STATICSKY_CAL   METADATA
+    REFSTAR_MASK                BOOL FALSE
+    PSASTRO.SAVE.REFMATCH       BOOL FALSE
+    PSASTRO.FIX.CHIPS           BOOL FALSE
+    PSASTRO.USE.MODEL           BOOL FALSE
+    PSASTRO.MOSAIC.MODE         BOOL FALSE
+    DVO.GETSTAR.FIXED.ZEROPT    F32   25.0
+
+    PSASTRO.CATDIR                       STR     PS1.REF.20120524
+    ZERO.POINT.USE.MEAN                  BOOL    TRUE
+
+    ## for skycell, radius shouldn't need to be as large as 90 pixel default. deeper stacks, crowded fields can be problems
+    PSASTRO.MATCH.RADIUS.N0 F32    15
+    PSASTRO.MATCH.RADIUS.N1 F32    10
+    PSASTRO.MATCH.RADIUS.N2 F32    5
+    PSASTRO.MATCH.RADIUS.N3 F32    1
+    PSASTRO.MATCH.RADIUS.N4 F32    0.5
+    PSASTRO.MATCH.FIT.NITER S32    5
+
+    PSASTRO.MAX.ERROR      F32      0.2  # in arcsec units, if larger than 0.2" on skycell then a problem..
+
+END
+
+
+# revised setup for MD nightly stack inputs, should work for case of N~2-30
+# - similar to DEEPCAL except for MIN.NSTAR 5 to attemp more edge skycells if poorer
+STATICSKY_NIGHTCAL   METADATA
+   PSASTRO.CATDIR                  STR   PS1.REF.20120524  # reset here to ensure same catalog is used when reprocessing set uniformly
+   REFSTAR_MASK                    BOOL  FALSE
+   PSASTRO.SAVE.REFMATCH           BOOL  FALSE
+   PSASTRO.FIX.CHIPS               BOOL  FALSE
+   PSASTRO.USE.MODEL               BOOL  FALSE
+   PSASTRO.MOSAIC.MODE             BOOL  FALSE
+   ZERO.POINT.USE.MEAN             BOOL  TRUE
+   PSASTRO.FIELD.PADDING           F32   0.01   # skycells are well defined, don't need large padding. 1% of 6400 is 64 pixels
+   PSASTRO.MAX.NRAW                S32   1000   # include more than MAX.NREF to account for extras like false-positives
+   PSASTRO.MAX.NREF            	   S32   500   # if edge skycell ~5% then want >50 to match (hit ~40% in normal field matches)
+   PSASTRO.MIN.INST.MAG.RAW        F32   -25.0  # 
+   PSASTRO.MAX.INST.MAG.RAW        F32   -5.0
+   PSASTRO.GRID.SEARCH 		   BOOL  FALSE  # skycell/stack and astrom well known, when used could cause problems and not help
+   #PSASTRO.GRID.NRAW.MAX           S32   2000
+   #PSASTRO.GRID.NREF.MAX 	    S32   2000
+   #PSASTRO.GRID.MIN.INST.MAG.RAW   F32   -21.0
+   #PSASTRO.GRID.MAX.INST.MAG.RAW   F32   -14.0
+   DVO.GETSTAR.MAX.RHO		   F32	 6000.0  # slightly larger than MAX.NREF 
+   DVO.GETSTAR.MIN.MAG.INST        F32   -25.0   # set absurd range to cover large range of exptime, then clamp...
+   DVO.GETSTAR.MIN.MAG		   F32	 15.0    # only used if keyword problem
+   REFSTAR_CLAMP_MAG_MIN 	   F32	 15.0    # saturation in MD ~14 even in y-band, so toss out brighter in the list
+   DVO.GETSTAR.FIXED.ZEROPT        F32   0.0     # not really needed, exptime overly dominates
+  
+   ## for skycell/stack astrom well known, radius shouldn't need to be as large as 90 pixel default. in deeper stacks can be problems
+   PSASTRO.MATCH.RADIUS.N0         F32   5 
+   PSASTRO.MATCH.RADIUS.N1 	   F32   3 
+   PSASTRO.MATCH.RADIUS.N2 	   F32   1
+   PSASTRO.MATCH.RADIUS.N3 	   F32   0.5
+   PSASTRO.MATCH.FIT.NITER 	   S32   4 
+   PSASTRO.MAX.ERROR       	   F32   0.2  # in arcsec units, still liberal limit for well known astrometry for skycells
+   PSASTRO.MIN.NSTAR       	   S32   5    # edges may not have many and require special treatment 
+END
+
+
+# revised setup for DEEP/MDS stacks with range of inputs, should work for N~2(edges)--500 inputs with large MIN/MAX.INST.MAG.RAW
 STATICSKY_DEEPCAL   METADATA
-   REFSTAR_MASK                BOOL FALSE
-   PSASTRO.SAVE.REFMATCH       BOOL FALSE
-   PSASTRO.FIX.CHIPS           BOOL FALSE
-   PSASTRO.USE.MODEL           BOOL FALSE
-   PSASTRO.MOSAIC.MODE         BOOL FALSE
-
-   PSASTRO.CATDIR                       STR     PS1.REF.20120524
-   ZERO.POINT.USE.MEAN                  BOOL    TRUE
-   PSASTRO.MAX.NRAW                     S32     0
-   PSASTRO.MAX.NREF            		S32     10000
-   PSASTRO.GRID.NRAW.MAX                S32     2000
-   PSASTRO.GRID.NREF.MAX  		S32     2000
-   PSASTRO.MIN.INST.MAG.RAW             F32     -19.0
-   PSASTRO.MAX.INST.MAG.RAW             F32     -14.0
-   PSASTRO.GRID.MIN.INST.MAG.RAW        F32     -19.0
-   PSASTRO.GRID.MAX.INST.MAG.RAW        F32     -15.0
-   DVO.GETSTAR.MIN.MAG.INST             F32     -19.0
-   DVO.GETSTAR.MIN.MAG			F32	16.0
-
-END
-
+   PSASTRO.CATDIR                  STR   PS1.REF.20120524  # reset here to ensure same catalog is used when reprocessing set uniformly
+   REFSTAR_MASK                    BOOL  FALSE
+   PSASTRO.SAVE.REFMATCH           BOOL  FALSE
+   PSASTRO.FIX.CHIPS               BOOL  FALSE
+   PSASTRO.USE.MODEL               BOOL  FALSE
+   PSASTRO.MOSAIC.MODE             BOOL  FALSE
+   ZERO.POINT.USE.MEAN             BOOL  TRUE
+   PSASTRO.FIELD.PADDING           F32   0.01   # skycells are well defined, don't need large padding. 1% of 6400 is 64 pixels
+   PSASTRO.MAX.NRAW                S32   1000   # include more than MAX.NREF to account for extras like false-positives
+   PSASTRO.MAX.NREF            	   S32    500   # if edge skycell ~10% then try ~50 to match 
+   PSASTRO.MIN.INST.MAG.RAW        F32   -25.0  # 
+   PSASTRO.MAX.INST.MAG.RAW        F32   -5.0
+   PSASTRO.GRID.SEARCH 		   BOOL  FALSE  # skycell/stack and astrom well known, when used could cause problems and not help
+   #PSASTRO.GRID.NRAW.MAX           S32   2000
+   #PSASTRO.GRID.NREF.MAX 	    S32   2000
+   #PSASTRO.GRID.MIN.INST.MAG.RAW   F32   -21.0
+   #PSASTRO.GRID.MAX.INST.MAG.RAW   F32   -14.0
+   DVO.GETSTAR.MAX.RHO		   F32	 6000.0  # N/sqdeg, slightly larger than MAX.NREF 
+   DVO.GETSTAR.MIN.MAG.INST        F32   -25.0   # set absurd range to cover large range of exptime, then clamp...
+   DVO.GETSTAR.MIN.MAG		   F32	 15.0    # only used if keyword problem so also using CLAMP_MAG_MIN
+   REFSTAR_CLAMP_MAG_MIN 	   F32	 15.0    # saturation in MD ~14 even in y-band, so toss out brighter in the list
+   DVO.GETSTAR.FIXED.ZEROPT        F32   0.0     # not really needed, exptime overly dominates
+  
+   ## for skycell/stack astrom well known, radius shouldn't need to be as large as 90 pixel default. in deeper stacks can be problems
+   PSASTRO.MATCH.RADIUS.N0         F32   5 
+   PSASTRO.MATCH.RADIUS.N1 	   F32   3 
+   PSASTRO.MATCH.RADIUS.N2 	   F32   1
+   PSASTRO.MATCH.RADIUS.N3 	   F32   0.5
+   PSASTRO.MATCH.FIT.NITER 	   S32   4 
+   PSASTRO.MAX.ERROR       	   F32   0.2  # in arcsec units, still liberal limit for well known astrometry for skycells
+   PSASTRO.MIN.NSTAR       	   S32   10   # edges may not have many and require special treatment 
+END
+
Index: branches/eam_branches/ipp-20121219/ippconfig/gpc1/psphot.config
===================================================================
--- branches/eam_branches/ipp-20121219/ippconfig/gpc1/psphot.config	(revision 34903)
+++ branches/eam_branches/ipp-20121219/ippconfig/gpc1/psphot.config	(revision 35096)
@@ -53,4 +53,7 @@
   PSPHOT.EXT.DIFF.ALTERNATE	    BOOL TRUE
   PSPHOT.EXT.DIFF.ALTERNATE.THRESH  F32	 1.25
+
+  PSPHOT.EXT.FIT.ALL.SOURCES	    BOOL TRUE
+  PSPHOT.EXT.FIT.ALL.THRESH	    F32	 1000
 END
 
@@ -59,4 +62,7 @@
   PSPHOT.EXT.DIFF.ALTERNATE	    BOOL TRUE
   PSPHOT.EXT.DIFF.ALTERNATE.THRESH  F32	 1.25
+
+  PSPHOT.EXT.FIT.ALL.SOURCES	    BOOL TRUE
+  PSPHOT.EXT.FIT.ALL.THRESH	    F32	 1000
 END
 
Index: branches/eam_branches/ipp-20121219/ippconfig/recipes/filerules-mef.mdc
===================================================================
--- branches/eam_branches/ipp-20121219/ippconfig/recipes/filerules-mef.mdc	(revision 34903)
+++ branches/eam_branches/ipp-20121219/ippconfig/recipes/filerules-mef.mdc	(revision 35096)
@@ -214,5 +214,5 @@
 PPIMAGE.PATTERN         OUTPUT {OUTPUT}.ptn                      PATTERN   NONE       CHIP       TRUE      MEF
 PPIMAGE.STATS           OUTPUT {OUTPUT}.stats                    STATS     NONE       FPA        TRUE      MEF
-
+PPIMAGE.BACKMDL              OUTPUT {OUTPUT}.{CHIP.NAME}.mdl.fits     IMAGE           NONE       CHIP       TRUE      NONE
 
 ## note: these use the same output naming convention since they are used for different ppMerge runs
Index: branches/eam_branches/ipp-20121219/ippconfig/recipes/filerules-simple.mdc
===================================================================
--- branches/eam_branches/ipp-20121219/ippconfig/recipes/filerules-simple.mdc	(revision 34903)
+++ branches/eam_branches/ipp-20121219/ippconfig/recipes/filerules-simple.mdc	(revision 35096)
@@ -178,5 +178,5 @@
 PPIMAGE.PATTERN              OUTPUT {OUTPUT}.ptn                  PATTERN         NONE       FPA        TRUE      NONE
 PPIMAGE.STATS                OUTPUT {OUTPUT}.stats                STATS           NONE       FPA        TRUE      NONE
-
+PPIMAGE.BACKMDL              OUTPUT {OUTPUT}.{CHIP.NAME}.mdl.fits     IMAGE           NONE       CHIP       TRUE      NONE
 
 ## note: these use the  same output naming convention since they are used for different ppMerge runs
Index: branches/eam_branches/ipp-20121219/ippconfig/recipes/filerules-split.mdc
===================================================================
--- branches/eam_branches/ipp-20121219/ippconfig/recipes/filerules-split.mdc	(revision 34903)
+++ branches/eam_branches/ipp-20121219/ippconfig/recipes/filerules-split.mdc	(revision 35096)
@@ -198,4 +198,5 @@
 PPIMAGE.PATTERN              OUTPUT {OUTPUT}.{CHIP.NAME}.ptn          PATTERN         NONE       CHIP       TRUE      NONE
 PPIMAGE.STATS                OUTPUT {OUTPUT}.{CHIP.NAME}.stats        STATS           NONE       CHIP       TRUE      NONE
+PPIMAGE.BACKMDL              OUTPUT {OUTPUT}.{CHIP.NAME}.mdl.fits     IMAGE           NONE       CHIP       TRUE      NONE
 
 ## note: these use the  same output naming convention since they are used for different ppMerge runs
Index: branches/eam_branches/ipp-20121219/ippconfig/recipes/ppImage.config
===================================================================
--- branches/eam_branches/ipp-20121219/ippconfig/recipes/ppImage.config	(revision 34903)
+++ branches/eam_branches/ipp-20121219/ippconfig/recipes/ppImage.config	(revision 35096)
@@ -42,5 +42,5 @@
 MASK.STATS         BOOL    FALSE           # calculate mask statistics.
 GAIN.OVERRIDE		BOOL	TRUE		# Override a non-finite gain?
-
+BACKGROUND.CONTINUITY BOOL FALSE           # Apply continuity correction to background models for an FPA.
 TILTYSTREAK.BY.CLASS METADATA              # apply the 'tiltystreak' tool
 END
@@ -1147,4 +1147,38 @@
   MASK.SATURATED   BOOL    FALSE           # DO NOT Mask the saturated pixels
   MASK.LOW         BOOL    FALSE           # DO NOT Mask the saturated pixels
+END
+
+# Calculate new background models with continuity correction applied
+PPIMAGE_BKGCONT    METADATA
+  OVERSCAN         BOOL    FALSE           # Overscan subtraction
+  NONLIN           BOOL    FALSE           # Non-linearity correction; not implemented
+  BIAS             BOOL    FALSE           # Bias subtraction
+  DARK             BOOL    FALSE           # Dark subtraction
+  SHUTTER          BOOL    FALSE           # Shutter correction
+  FLAT             BOOL    FALSE           # Flat-field normalisation
+  MASK             BOOL    FALSE           # Mask bad pixels
+  MASK.BUILD       BOOL    FALSE 	   # Build internal mask?
+  FRINGE           BOOL    FALSE           # Fringe subtraction
+  PHOTOM           BOOL    FALSE           # Source identification and photometry
+  ASTROM.CHIP      BOOL    FALSE           # Astrometry per chip?
+  ASTROM.MOSAIC    BOOL    FALSE           # Astrometry for mosaic?
+  BASE.FITS        BOOL    FALSE           # Save base image?
+  BASE.MASK.FITS   BOOL    FALSE           # Save base detrended image?
+  BASE.VARIANCE.FITS BOOL    FALSE           # Save base detrended image?
+  CHIP.FITS        BOOL    FALSE           # Save chip-mosaic-ed image? 
+  CHIP.MASK.FITS   BOOL    FALSE           # Save chip-mosaic-ed image? 
+  CHIP.VARIANCE.FITS BOOL    FALSE           # Save chip-mosaic-ed image? 
+  BIN1.FITS        BOOL    FALSE           # Save 1st binned chip image?
+  BIN2.FITS        BOOL    FALSE           # Save 2nd binned chip image?
+  BIN1.JPEG        BOOL    FALSE           # Save 1st binned jpeg?
+  BIN2.JPEG        BOOL    FALSE           # Save 2nd binned jpeg?
+  BIN1.XBIN        S32     1               # Image is already binned
+  BIN1.YBIN        S32     1               # Image is already binned
+  BIN2.XBIN        S32     1               # Image is already binned
+  BIN2.YBIN        S32     1               # Image is already binned
+  MASK.SATURATED   BOOL    FALSE           # DO NOT Mask the saturated pixels
+  MASK.LOW         BOOL    FALSE           # DO NOT Mask the saturated pixels
+  BACKGROUND.CONTINUITY BOOL TRUE
+  PATTERN.CONTINUITY.WIDTH S32 2
 END
 
Index: branches/eam_branches/ipp-20121219/ippconfig/recipes/psastro.config
===================================================================
--- branches/eam_branches/ipp-20121219/ippconfig/recipes/psastro.config	(revision 34903)
+++ branches/eam_branches/ipp-20121219/ippconfig/recipes/psastro.config	(revision 35096)
@@ -190,4 +190,8 @@
 DVO.GETSTAR.MIN.MAG.INST      F32     -15.0
 
+# if non-zero use as the zero point for computing magnitude limits for getstar
+# by default use the ZEROPT in the PHOTCODE.DATA
+DVO.GETSTAR.FIXED.ZEROPT      F32       0.0     
+
 ZERO.POINT.BY.EXPOSURE	      	BOOL     TRUE
 ZERO.POINT.USE.MEAN	      	BOOL     TRUE
@@ -268,9 +272,4 @@
 
 STATICSKY_CAL   METADATA
-    REFSTAR_MASK                BOOL FALSE
-    PSASTRO.SAVE.REFMATCH       BOOL FALSE
-    PSASTRO.FIX.CHIPS           BOOL FALSE
-    PSASTRO.USE.MODEL           BOOL FALSE
-    PSASTRO.MOSAIC.MODE         BOOL FALSE
 END
 
@@ -278,4 +277,7 @@
 END
 
+STATICSKY_NIGHTCAL   METADATA
+END
+
 STATICSKY_DEEPCAL   METADATA
 END
Index: branches/eam_branches/ipp-20121219/ippconfig/recipes/psphot.config
===================================================================
--- branches/eam_branches/ipp-20121219/ippconfig/recipes/psphot.config	(revision 34903)
+++ branches/eam_branches/ipp-20121219/ippconfig/recipes/psphot.config	(revision 35096)
@@ -347,4 +347,6 @@
 PSPHOT.EXT.DIFF.ALTERNATE	    BOOL  FALSE           # use alternate extended source calculation; designed for diff trails
 PSPHOT.EXT.DIFF.ALTERNATE.THRESH    F32	  1.5		  # threshold for alternate extended source calculations
+PSPHOT.EXT.FIT.ALL.SOURCES	    BOOL  FALSE           # Apply extended object fits to all sources
+PSPHOT.EXT.FIT.ALL.THRESH	    F32	  1000		  # Set density threshold above which to not fit all sources
 PSPHOT.CR.GROW                      S32   1               # Number of pixels to grow CR mask
 PSPHOT.CR.NSIGMA.SOFTEN             F32   0.0025          # Softening parameter for weights
Index: branches/eam_branches/ipp-20121219/ippconfig/recipes/pswarp.config
===================================================================
--- branches/eam_branches/ipp-20121219/ippconfig/recipes/pswarp.config	(revision 34903)
+++ branches/eam_branches/ipp-20121219/ippconfig/recipes/pswarp.config	(revision 35096)
@@ -34,5 +34,6 @@
 # Background restoration
 BACKGROUND	METADATA
-	SOURCES		BOOL	FALSE		# Write source list for warped image?
-	PSF		BOOL	FALSE		# Measure PSF for warped image?
+	SOURCES		    BOOL	FALSE		# Write source list for warped image?
+	PSF		    BOOL	FALSE		# Measure PSF for warped image?
+        BACKGROUND.MODEL    BOOL        FALSE           # do not model background
 END
Index: branches/eam_branches/ipp-20121219/ippconfig/recipes/reductionClasses.mdc
===================================================================
--- branches/eam_branches/ipp-20121219/ippconfig/recipes/reductionClasses.mdc	(revision 34903)
+++ branches/eam_branches/ipp-20121219/ippconfig/recipes/reductionClasses.mdc	(revision 35096)
@@ -518,4 +518,6 @@
       STACK_PPSUB     STR      STACK
       STACK_PSPHOT    STR      STACK
+      STACKPHOT_PSPHOT        STR     STACKPHOT
+      STATICSKY_CALIBRATION   STR     STATICSKY_NIGHTCAL
 END
 
