# Camera configuration file for MegaCam: describes the camera

# File formats that we know about
FORMATS         METADATA
        RAW     STR     megacam/format_raw.config
        MEF 	STR     megacam/format_mef.config
        SPLIT   STR     megacam/format_split.config
END

# Description of camera --- all the chips and the cells that comprise them
FPA     METADATA
        ccd00   STR     LeftAmp RightAmp
        ccd01   STR     LeftAmp RightAmp
        ccd02   STR     LeftAmp RightAmp
        ccd03   STR     LeftAmp RightAmp
        ccd04   STR     LeftAmp RightAmp
        ccd05   STR     LeftAmp RightAmp
        ccd06   STR     LeftAmp RightAmp
        ccd07   STR     LeftAmp RightAmp
        ccd08   STR     LeftAmp RightAmp
        ccd09   STR     LeftAmp RightAmp
        ccd10   STR     LeftAmp RightAmp
        ccd11   STR     LeftAmp RightAmp
        ccd12   STR     LeftAmp RightAmp
        ccd13   STR     LeftAmp RightAmp
        ccd14   STR     LeftAmp RightAmp
        ccd15   STR     LeftAmp RightAmp
        ccd16   STR     LeftAmp RightAmp
        ccd17   STR     LeftAmp RightAmp
        ccd18   STR     LeftAmp RightAmp
        ccd19   STR     LeftAmp RightAmp
        ccd20   STR     LeftAmp RightAmp
        ccd21   STR     LeftAmp RightAmp
        ccd22   STR     LeftAmp RightAmp
        ccd23   STR     LeftAmp RightAmp
        ccd24   STR     LeftAmp RightAmp
        ccd25   STR     LeftAmp RightAmp
        ccd26   STR     LeftAmp RightAmp
        ccd27   STR     LeftAmp RightAmp
        ccd28   STR     LeftAmp RightAmp
        ccd29   STR     LeftAmp RightAmp
        ccd30   STR     LeftAmp RightAmp
        ccd31   STR     LeftAmp RightAmp
        ccd32   STR     LeftAmp RightAmp
        ccd33   STR     LeftAmp RightAmp
        ccd34   STR     LeftAmp RightAmp
        ccd35   STR     LeftAmp RightAmp
END

# move this elsewhere?  we need a lookup table to go from filter ID to abstract name
FILTER.ID       METADATA
   u        STR   u.MP9301     
   g        STR   g.MP9401     
   r        STR   r.MP9601     
   i        STR   i.MP9701     
   z        MULTI
   z        STR   z.MP9801     
   z        STR   Zp           
   z        STR   Zprime       

   Ha       MULTI
   Ha       STR   Ha.MP7605    
   Ha       STR   Halpha       
   Ha       STR   Haalpha.on   
   HaOff    STR   HaOFF.MP7604 
   	              		
   CN       MULTI
   CN       STR   CN.MP780     
   CN       STR   cn.MP7803    
   CN       STR   CN.MP7803    
   	              		
   TiO      MULTI
   TiO      STR   TiO.MP77     
   TiO      STR   tio.MP7701   
   TiO      STR   TiO.MP7701   
   NB920    STR   NB920        
   	              		
   B2F      STR   B2F          
   Bj       STR   Bj           
   Vj       STR   Vj           
   Rj       STR   Rj           
   Ij       STR   Ij           
   Hb       STR   Hb           
   HbOff    STR   HbOff        
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

DVO.CAMERADIR	STR	isp		# 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
        # Other recipes
        PSPHOT          STR     megacam/psphot.config           # psphot details
        PSASTRO         STR     megacam/psastro.config          # psastro details
        PPIMAGE         STR     megacam/ppImage.config          # ppImage recipe
	REJECTIONS      STR     megacam/rejections.config       # rejection recipe
END

REDUCTION	METADATA
	DETREND		METADATA
		BIAS_PROCESS	STR	PPIMAGE_O
		BIAS_RESID	STR	PPIMAGE_B
		BIAS_VERIFY	STR	PPIMAGE_OB
		DARK_PROCESS	STR	PPIMAGE_OB
		DARK_RESID	STR	PPIMAGE_D
		DARK_VERIFY	STR	PPIMAGE_OBD
		SHUTTER_PROCESS	STR	PPIMAGE_OBD
		SHUTTER_RESID	STR	PPIMAGE_S
		SHUTTER_VERIFY	STR	PPIMAGE_OBDS
		FLAT_PROCESS	STR	PPIMAGE_OBDS
		FLAT_RESID	STR	PPIMAGE_F
		FLAT_VERIFY	STR	PPIMAGE_OBDSF
		FRINGE_PROCESS	STR	PPIMAGE_OBDSF
		FRINGE_RESID	STR	PPIMAGE_R
		FRINGE_VERIFY	STR	PPIMAGE_OBDSFR

 		JPEG_BIN1_IMAGE_BIAS     STR  PPIMAGE_J1_IMAGE_B
		JPEG_BIN1_IMAGE_DARK     STR  PPIMAGE_J1_IMAGE_B
		JPEG_BIN1_IMAGE_SHUTTER  STR  PPIMAGE_J1_IMAGE_F
		JPEG_BIN1_IMAGE_FLAT     STR  PPIMAGE_J1_IMAGE_F
		JPEG_BIN1_IMAGE_DOMEFLAT STR  PPIMAGE_J1_IMAGE_F
		JPEG_BIN1_IMAGE_SKYFLAT  STR  PPIMAGE_J1_IMAGE_F
		JPEG_BIN1_IMAGE_FRINGE   STR  PPIMAGE_J1_IMAGE_R
 		JPEG_BIN2_IMAGE_BIAS     STR  PPIMAGE_J2_IMAGE_B
		JPEG_BIN2_IMAGE_DARK     STR  PPIMAGE_J2_IMAGE_B
		JPEG_BIN2_IMAGE_SHUTTER  STR  PPIMAGE_J2_IMAGE_F
		JPEG_BIN2_IMAGE_FLAT     STR  PPIMAGE_J2_IMAGE_F
		JPEG_BIN2_IMAGE_DOMEFLAT STR  PPIMAGE_J2_IMAGE_F
		JPEG_BIN2_IMAGE_SKYFLAT  STR  PPIMAGE_J2_IMAGE_F
		JPEG_BIN2_IMAGE_FRINGE   STR  PPIMAGE_J2_IMAGE_R

 		JPEG_BIN1_RESID_BIAS     STR  PPIMAGE_J1_RESID_B
		JPEG_BIN1_RESID_DARK     STR  PPIMAGE_J1_RESID_B
		JPEG_BIN1_RESID_SHUTTER  STR  PPIMAGE_J1_RESID_F
		JPEG_BIN1_RESID_FLAT     STR  PPIMAGE_J1_RESID_F
		JPEG_BIN1_RESID_DOMEFLAT STR  PPIMAGE_J1_RESID_F
		JPEG_BIN1_RESID_SKYFLAT  STR  PPIMAGE_J1_RESID_F
		JPEG_BIN1_RESID_FRINGE   STR  PPIMAGE_J1_RESID_R
 		JPEG_BIN2_RESID_BIAS     STR  PPIMAGE_J2_RESID_B
		JPEG_BIN2_RESID_DARK     STR  PPIMAGE_J2_RESID_B
		JPEG_BIN2_RESID_SHUTTER  STR  PPIMAGE_J2_RESID_F
		JPEG_BIN2_RESID_FLAT     STR  PPIMAGE_J2_RESID_F
		JPEG_BIN2_RESID_DOMEFLAT STR  PPIMAGE_J2_RESID_F
		JPEG_BIN2_RESID_SKYFLAT  STR  PPIMAGE_J2_RESID_F
		JPEG_BIN2_RESID_FRINGE   STR  PPIMAGE_J2_RESID_R
	END

	# basic science analysis
	DEFAULT		METADATA
		CHIP		STR	PPIMAGE_OBDSFRA
 		JPEG_BIN1       STR     PPIMAGE_J1
 		JPEG_BIN2       STR     PPIMAGE_J2
	END

        # photometry & astrometry for pre-detrended images
	PROCESSED	METADATA
		CHIP		STR	PPIMAGE_PA
 		JPEG_BIN1       STR     PPIMAGE_J1
 		JPEG_BIN2       STR     PPIMAGE_J2

	END

	# Detrend Processing only for raw data
	DETREND_ONLY		METADATA
		CHIP		STR	PPIMAGE_DET_ONLY
 		JPEG_BIN1       STR     PPIMAGE_J1
 		JPEG_BIN2       STR     PPIMAGE_J2
	END
END

FITS    METADATA
# BITPIX is the bits per pixel for writing the output data
# COMPRESSION = NONE|RICE|GZIP|HCOMPRESS|PLIO is the compression algorithm
# TILE.[XYZ] are the tile sizes.  0 means entire the dimension, so (0,1,1) forms tiles from rows
# NOISE [0..16] is the number of "noise bits" to preserve when quantising floating point data; 16 for no loss
# HSCALE is the scale factor for lossy compression with HCOMPRESS; 0 or 1 for none; 2*RMS --> 10x compression
# HSMOOTH is the smoothing to apply to HCOMPRESSed data when decompressing; 0 for none
        TYPE            FITS    BITPIX  COMPRESSION     TILE.X  TILE.Y  TILE.Z  NOISE   HSCALE  HSMOOTH
        DET_IMAGE       FITS    -32     RICE            0       1       1       16      0       0
        DET_MASK        FITS    8       PLIO            0       1       1       0       0       0
        DET_WEIGHT      FITS    -32     RICE            0       1       1       16      0       0
        SKY_IMAGE       FITS    -32     RICE            0       1       1       16      0       0
        SKY_MASK        FITS    8       PLIO            0       1       1       0       0       0
        SKY_WEIGHT      FITS    -32     RICE            0       1       1       16      0       0
END

FILERULES	STR	megacam/filerules-mef.mdc		# File rules appropriate for MEF format

EXTNAME.RULES METADATA
  CMF.HEAD STR {CHIP.NAME}.hdr
  CMF.DATA STR {CHIP.NAME}.psf # use .PSF and .EXT?

  PSF.HEAD  STR	{CHIP.NAME}.hdr
  PSF.TABLE STR {CHIP.NAME}.psf_model
  PSF.RESID STR {CHIP.NAME}.psf_resid
END

TESSELLATIONS	METADATA
	MOPS		STR	path://MOPS/skycells/
END
