# Camera configuration file for co-adding reduced SDSS images of stripe82
# Copied from ISP config files
# Sebastian Jester jester at mpia.de August 7, 2007

# File formats that we know about
FORMATS         METADATA
        SDSS     STR     sdss/format.config
END
 
# Description of camera --- all the chips and the cells that comprise them
FPA     METADATA
        Chip            STR     Cell
END

# valid filter names and corresponding IDs
FILTER.ID       METADATA
        g       STR     g
        r       STR     r
        i       STR     i
        z       STR     z
	u       STR     u
END

# Table of strings to use for the class identifier (see ippdb) according to the file level.
CLASSID		METADATA
	FPA	STR	fpa
END

DVO.CAMERADIR	STR	sdss		# Camera directory for DVO

# convert supplied FPA.OBSTYPE values to abstract exptype names
OBSTYPE.TABLE METADATA
  bias 	   STR BIAS
  zero 	   STR BIAS
  dark 	   STR DARK
  flat 	   STR SKYFLAT
  skyflat  STR SKYFLAT
  domeflat STR DOMEFLAT
  object   STR OBJECT
  science  STR OBJECT
END

# Recipe options
RECIPES         METADATA
        PSPHOT          STR     sdss/psphot.config               # psphot details
        PSASTRO         STR     sdss/psastro.config              # psastro details
        PPIMAGE         STR     sdss/ppImage.config              # Recipes for ppImage
        PPMERGE         STR     sdss/ppMerge.config              # Recipes for ppMerge
	PSWARP		STR	sdss/pswarp.config		# Recipes for pswarp
	REJECTIONS	STR     sdss/rejections.config
END

# reduction classes (recipes which are grouped together)
REDUCTION	STR	recipes/reductionClasses.mdc

FITSTYPES       STR     recipes/fitstypes.mdc

## XXX replace with appropriate common filerules?
FILERULES METADATA
   PSASTRO.INPUT       STR PSASTRO.INPUT.CMF
   PSASTRO.OUTPUT      STR PSASTRO.OUTPUT.CMF
   PSPHOT.OUTPUT       STR PSPHOT.OUTPUT.CMF

   ### input file definitions
   ### use @DETDB entries to get the detrend images from the database
   ### replace @DETDB with @FILES if you want to require it from the 
   ### command line, or with an explicit name to require a specific file
   TYPE               INPUT FILENAME.RULE DATA.LEVEL FILE.TYPE 

   ## files used by ppImage
   PPIMAGE.INPUT      INPUT @FILES        FPA        IMAGE     
   PPIMAGE.MASK       INPUT @FILES        FPA        IMAGE     
   PPIMAGE.BIAS       INPUT @DETDB        FPA        IMAGE     
   PPIMAGE.DARK       INPUT @DETDB        FPA        DARK
   PPIMAGE.FLAT       INPUT @DETDB        FPA        IMAGE     
   PPIMAGE.FRINGE     INPUT @DETDB        FPA        FRINGE
   PPIMAGE.SHUTTER    INPUT @DETDB        FPA        IMAGE     

   ## files used to build and apply the flat-field correction images
   DVOCORR.INPUT      INPUT @FILES        FPA        IMAGE
   DVOCORR.REFHEAD    INPUT @FILES        FPA        HEADER
   DVOFLAT.INPUT      INPUT @FILES        FPA        IMAGE
   DVOFLAT.CORR       INPUT @DETDB        FPA        IMAGE

   ## files used by psphot 
   PSPHOT.LOAD        INPUT @FILES        FPA        IMAGE
   PSPHOT.INPUT       INPUT @FILES        FPA        IMAGE     
   PSPHOT.MASK        INPUT @FILES        FPA        MASK     
   PSPHOT.WEIGHT      INPUT @FILES        FPA        WEIGHT     
   PSPHOT.PSF.LOAD    INPUT @FILES        FPA        PSF       

   ## files used by psastro 
   PSASTRO.INPUT.CMP  INPUT @FILES        FPA        CMP       
   PSASTRO.INPUT.CMF  INPUT @FILES        FPA        CMF       

   ## files used by pswarp
   PSWARP.INPUT       INPUT @FILES        FPA        IMAGE
   PSWARP.WEIGHT      INPUT @FILES        FPA        WEIGHT
   PSWARP.MASK        INPUT @FILES        FPA        MASK
   PSWARP.SKYCELL     INPUT @FILES        FPA        IMAGE
   PSWARP.ASTROM      INPUT @FILES        FPA        CMF

   PPSUB.INPUT        INPUT @FILES        FPA	     IMAGE
   PPSUB.INPUT.MASK   INPUT @FILES        FPA	     MASK
   PPSUB.INPUT.WEIGHT INPUT @FILES        FPA	     WEIGHT
   PPSUB.REF          INPUT @FILES        FPA	     IMAGE
   PPSUB.REF.MASK     INPUT @FILES        FPA	     MASK
   PPSUB.REF.WEIGHT   INPUT @FILES        FPA	     WEIGHT

   PPSTACK.INPUT      INPUT @FILES        FPA	     IMAGE
   PPSTACK.INPUT.MASK INPUT @FILES        FPA	     MASK
   PPSTACK.INPUT.WEIGHT INPUT @FILES      FPA	     WEIGHT

   PPARITH.INPUT.IMAGE INPUT @FILES        CHIP       IMAGE
   PPARITH.INPUT.MASK  INPUT @FILES        CHIP       MASK

   ### output file definitions
   TYPE                  OUTPUT  FILENAME.RULE        FILE.TYPE FITS.TYPE DATA.LEVEL FILE.SAVE FILE.FORMAT
   PPIMAGE.OUTPUT      	 OUTPUT  {OUTPUT}.sdss.fits   IMAGE     NONE      FPA        TRUE      NONE
   PPIMAGE.OUTPUT.MASK 	 OUTPUT  {OUTPUT}.mask.fits   MASK      NONE      FPA        TRUE      NONE
   PPIMAGE.OUTPUT.WEIGHT OUTPUT  {OUTPUT}.wt.fits     WEIGHT    NONE      FPA        TRUE      NONE
   PPIMAGE.CHIP 	 OUTPUT  {OUTPUT}.chip.fits   IMAGE     NONE      FPA        TRUE      NONE
   PPIMAGE.CHIP.MASK 	 OUTPUT  {OUTPUT}.chip.mask.fits MASK   NONE      FPA        TRUE      NONE
   PPIMAGE.CHIP.WEIGHT 	 OUTPUT  {OUTPUT}.chip.wt.fits WEIGHT   NONE      FPA        TRUE      NONE
   PPIMAGE.OUTPUT.FPA1 	 OUTPUT  {OUTPUT}.b1.fits     IMAGE     NONE      FPA        TRUE      NONE
   PPIMAGE.OUTPUT.FPA2 	 OUTPUT  {OUTPUT}.b2.fits     IMAGE     NONE      FPA        TRUE      NONE
   PPIMAGE.STATS 	 OUTPUT  {OUTPUT}.stats       STATS     NONE      FPA        TRUE      NONE

   PPIMAGE.BIN1        	 OUTPUT  {OUTPUT}.b1c.fits    IMAGE     NONE      FPA        TRUE      NONE
   PPIMAGE.BIN2        	 OUTPUT  {OUTPUT}.b2c.fits    IMAGE     NONE      FPA        TRUE      NONE

   PPIMAGE.JPEG1       	 OUTPUT  {OUTPUT}.b1.jpg      JPEG      NONE      FPA        TRUE      NONE
   PPIMAGE.JPEG2       	 OUTPUT  {OUTPUT}.b2.jpg      JPEG      NONE      FPA        TRUE      NONE

   PPMERGE.OUTPUT        OUTPUT   {OUTPUT}.fits       IMAGE     NONE      FPA        TRUE      NONE

   DVOCORR.OUTPUT    	 OUTPUT  {OUTPUT}.fc.fits     IMAGE     NONE      FPA        TRUE      NONE
   DVOFLAT.OUTPUT    	 OUTPUT  {OUTPUT}.co.fits     IMAGE     NONE      FPA        TRUE      NONE

   PSPHOT.RESID        	 OUTPUT  {OUTPUT}.res.fits    IMAGE     NONE      FPA        TRUE      NONE
   PSPHOT.BACKGND      	 OUTPUT  {OUTPUT}.bck.fits    IMAGE     NONE      FPA        TRUE      NONE
   PSPHOT.BACKSUB      	 OUTPUT  {OUTPUT}.sub.fits    IMAGE     NONE      FPA        TRUE      NONE
   PSPHOT.BACKMDL      	 OUTPUT  {OUTPUT}.mdl.fits    IMAGE     NONE      FPA        TRUE      NONE

   PSPHOT.OUTPUT.RAW   	 OUTPUT  {OUTPUT}             RAW       NONE      FPA        TRUE      NONE
   PSPHOT.OUTPUT.SX    	 OUTPUT  {OUTPUT}.sx          SX        NONE      FPA        TRUE      NONE
   PSPHOT.OUTPUT.OBJ   	 OUTPUT  {OUTPUT}.obj         OBJ       NONE      FPA        TRUE      NONE
   PSPHOT.OUTPUT.CMP   	 OUTPUT  {OUTPUT}.cmp         CMP       NONE      FPA        TRUE      NONE
   PSPHOT.OUTPUT.CMF   	 OUTPUT  {OUTPUT}.cmf         CMF       NONE      FPA        TRUE      NONE

   PSPHOT.PSF.SAVE     	 OUTPUT  {OUTPUT}.psf         PSF       NONE      FPA        TRUE      NONE

   SOURCE.PLOT.MOMENTS   OUTPUT  {OUTPUT}.mnt.png     KAPA      NONE      FPA        TRUE      NONE
   SOURCE.PLOT.PSFMODEL  OUTPUT  {OUTPUT}.psf.png     KAPA      NONE      FPA        TRUE      NONE
   SOURCE.PLOT.APRESID   OUTPUT  {OUTPUT}.dap.png     KAPA      NONE      FPA        TRUE      NONE

   PSASTRO.OUTPUT.CMP    OUTPUT  {OUTPUT}.smp         CMP       NONE      FPA        TRUE      NONE
   PSASTRO.OUTPUT.CMF    OUTPUT  {OUTPUT}.smf         CMF       NONE      FPA        TRUE      NONE

   PSWARP.OUTPUT         OUTPUT {OUTPUT}.fits         IMAGE     NONE      FPA        TRUE      NONE
   PSWARP.OUTPUT.MASK    OUTPUT {OUTPUT}.mask.fits    MASK      NONE      FPA        TRUE      NONE
   PSWARP.OUTPUT.WEIGHT  OUTPUT {OUTPUT}.wt.fits      WEIGHT    NONE      FPA        TRUE      NONE
   PSWARP.BIN1           OUTPUT {OUTPUT}.b1.fits      IMAGE     NONE      FPA        TRUE      NONE
   PSWARP.BIN2           OUTPUT {OUTPUT}.b2.fits      IMAGE     NONE      FPA        TRUE      NONE

   SKYCELL.STATS         OUTPUT {OUTPUT}.stats        STATS     NONE      FPA        TRUE      NONE
   SKYCELL.TEMPLATE      OUTPUT {OUTPUT}.skycell      SKYCELL   NONE      FPA        TRUE      NONE

   PPSUB.OUTPUT          OUTPUT {OUTPUT}.fits         IMAGE     NONE      FPA        TRUE      NONE
   PPSUB.OUTPUT.MASK     OUTPUT {OUTPUT}.mask.fits    MASK      NONE      FPA        TRUE      NONE
   PPSUB.OUTPUT.WEIGHT   OUTPUT {OUTPUT}.wt.fits      WEIGHT    NONE      FPA        TRUE      NONE

   PPSTACK.OUTPUT        OUTPUT {OUTPUT}.fits         IMAGE     NONE      FPA        TRUE      NONE
   PPSTACK.OUTPUT.MASK   OUTPUT {OUTPUT}.mask.fits    MASK      NONE      FPA        TRUE      NONE
   PPSTACK.OUTPUT.WEIGHT OUTPUT {OUTPUT}.weight.fits  WEIGHT    NONE      FPA        TRUE      NONE

   PPSIM.OUTPUT          OUTPUT {OUTPUT}.fits         IMAGE     NONE      FPA        TRUE      NONE

   PPARITH.OUTPUT.IMAGE  OUTPUT {OUTPUT}.fits         IMAGE     NONE      CHIP       TRUE      NONE
   PPARITH.OUTPUT.MASK   OUTPUT {OUTPUT}.fits         MASK      NONE      CHIP       TRUE      NONE

   LOG.IMFILE            OUTPUT {OUTPUT}.{CHIP.NAME}.log TEXT   NONE      CHIP       TRUE      NONE
   LOG.EXP               OUTPUT {OUTPUT}.log          TEXT      NONE      FPA        TRUE      NONE
END

EXTNAME.RULES METADATA
  CMF.HEAD STR cmf.hdr
  CMF.DATA STR cmf.psf # use .PSF and .EXT?
  CMF.XSRC STR xsrc # use .PSF and .EXT?
  CMF.XFIT STR xfit # use .PSF and .EXT?

  PSF.HEAD  STR	hdr
  PSF.TABLE STR psf_model
  PSF.RESID STR psf_resid
END

BLANK.HEADERS	METADATA
	FPA.TIME	STR	TAI
	FPA.EXPOSURE	STR	EXPTIME
	FPA.AIRMASS	STR	AIRMASS
END

