# Camera configuration file for MegaCam: describes the camera

# File formats that we know about (these are relative to PATH)
FORMATS         METADATA
        RAW     STR     ucam/format_raw.config
END


# Description of camera --- all the chips and the cells that comprise them
FPA     METADATA
	chip	STR	xy00 xy10 xy20 xy30 xy40 xy50 xy60 xy70 xy01 xy11 xy21 xy31 xy41 xy51 xy61 xy71 xy02 xy12 xy22 xy32 xy42 xy52 xy62 xy72 xy03 xy13 xy23 xy33 xy43 xy53 xy63 xy73 xy04 xy14 xy24 xy34 xy44 xy54 xy64 xy74 xy05 xy15 xy25 xy35 xy45 xy55 xy65 xy75 xy06 xy16 xy26 xy36 xy46 xy56 xy66 xy76 xy07 xy17 xy27 xy37 xy47 xy57 xy67 xy77
END

# move this elsewhere?  we need a lookup table to go from filter ID to abstract name
FILTER.ID       METADATA
   g        STR   g
   r        STR   r
   i        STR   i
   z        STR   z
   y        STR   y
END

# Table of strings to use for the class identifier (see ippdb) according to the file level.
CLASSID		METADATA
	fpa	STR	fpa
	chip	STR	{CHIP.NAME}
	cell	STR	{CHIP.NAME}:{CELL.NAME}
END

# 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
	# Recipes for ppImage
        # PPIMAGE         STR     ucam/ppImage.config     # Default: all (normal) options on
END

FILERULES METADATA
   PPIMAGE.OUTPUT     STR PPIMAGE.OUTPUT
   PPIMAGE.BIN1       STR PPIMAGE.BIN1.OUTPUT
   PPIMAGE.BIN2	      STR PPIMAGE.BIN2.OUTPUT
   PPIMAGE.JPEG1      STR PPIMAGE.JPEG1.OUTPUT
   PPIMAGE.JPEG2      STR PPIMAGE.JPEG2.OUTPUT

   PSASTRO.INPUT      STR PSASTRO.INPUT.CMP
   PSASTRO.OUTPUT     STR PSASTRO.OUTPUT.CMP
   PSPHOT.OUTPUT      STR PSPHOT.OUTPUT.CMF

   ### input file definitions
   TYPE               INPUT FILENAME.RULE                 DATA.LEVEL FILE.TYPE 
   PPIMAGE.INPUT      INPUT @FILES                        CHIP       IMAGE
   PPARITH.INPUT      INPUT @FILES                        CHIP       IMAGE

   ### use these entries to get the detrend images from specific files
   PPIMAGE.MASK       INPUT mask.fits                     CHIP       IMAGE
   PPIMAGE.BIAS       INPUT bias.fit                      CHIP       IMAGE     
   PPIMAGE.DARK       INPUT dark.fits                     CHIP       IMAGE     
   PPIMAGE.FLAT       INPUT flat.fits                     CHIP       IMAGE     

   ### use these entries to get the detrend images from the database
   #PPIMAGE.MASK       INPUT @DETDB                       CHIP       IMAGE     
   #PPIMAGE.BIAS       INPUT @DETDB                       CHIP       IMAGE     
   #PPIMAGE.DARK       INPUT @DETDB                       CHIP       IMAGE     
   #PPIMAGE.FLAT       INPUT @DETDB                       CHIP       IMAGE     

   PSPHOT.INPUT       INPUT @FILES                        CHIP       IMAGE     

   PSASTRO.INPUT.CMP  INPUT @FILES                        CHIP       CMP       
   PSASTRO.INPUT.CMF  INPUT @FILES                        CHIP       CMF       

   ### output file definitions
   TYPE                OUTPUT FILENAME.RULE            FILE.TYPE FITS.TYPE DATA.LEVEL FILE.SAVE FILE.FORMAT
   PPIMAGE.OUTPUT      OUTPUT     {OUTPUT}.fit         IMAGE     NONE      CHIP       TRUE      NONE
   PPIMAGE.OUTPUT.CHIP OUTPUT     {OUTPUT}.chip.fit    IMAGE     NONE      FPA        TRUE      NONE
   PPIMAGE.OUTPUT.FPA1 OUTPUT     {OUTPUT}.fpa1.fit    IMAGE     NONE      FPA        TRUE      NONE
   PPIMAGE.OUTPUT.FPA2 OUTPUT     {OUTPUT}.fpa2.fit    IMAGE     NONE      FPA        TRUE      NONE

   PPIMAGE.BIN1.OUTPUT OUTPUT {OUTPUT}.b1.fit          IMAGE     NONE      FPA        TRUE      NONE
   PPIMAGE.BIN2.OUTPUT OUTPUT {OUTPUT}.b2.fit          IMAGE     NONE      FPA        TRUE      NONE
   PPIMAGE.JPEG1.OUTPUT OUTPUT {OUTPUT}.b1.jpg         JPEG      NONE      FPA        TRUE      NONE
   PPIMAGE.JPEG2.OUTPUT OUTPUT {OUTPUT}.b2.jpg         JPEG      NONE      FPA        TRUE      NONE

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

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

   PSASTRO.OUTPUT.CMP  OUTPUT {OUTPUT}.{CHIP.NAME}.smp CMP       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
