### ppImage recipe configuration file for Megacam

# Overscan subtraction
OVERSCAN.SINGLE		BOOL	FALSE		# Reduce overscan to a single value?
OVERSCAN.FIT		STR	NONE		# NONE | POLYNOMIAL | SPLINE
OVERSCAN.ORDER		S32	0		# Order of polynomial fit
OVERSCAN.STAT		STR	MEAN		# MEAN | MEDIAN

# for a test, turn off selected detrend types
OVERSCAN	BOOL	FALSE		# Overscan subtraction
BIAS		BOOL	TRUE		# Bias subtraction
DARK		BOOL	FALSE		# Dark subtraction
FLAT		BOOL	TRUE		# Flat-field normalisation

# binned output image options
BIN1.XBIN               S32     18
BIN1.YBIN               S32     18
BIN2.XBIN               S32     144
BIN2.YBIN               S32     144

# LBCred  needs fringe subtraction (?)
FRINGE		BOOL	TRUE		# Fringe subtraction

# this table lists extra constraints which should be applied when
# selecting the detrend images.
# note: camera and time are always applied

DETREND.CONSTRAINTS  METADATA
  BIAS METADATA
  END
  DARK METADATA
#   EXPTIME STR FPA.EXPOSURE
  END
  FLAT METADATA
    FILTER  STR FPA.FILTERID
#   DETTYPE STR DOMEFLAT.RAW
#   VERSION STR SKYFLAT.RAW
#   VERSION STR DOMEFLAT.CORR.XX
#   VERSION STR SKYFLAT.CORR
  END
  FLAT_CORRECTION METADATA
    FILTER   STR FPA.FILTER
  END
  FRINGE METADATA
    FILTER   STR FPA.FILTER
#   AIRMASS  STR FPA.AIRMASS
#   TWILIGHT STR FPA.TWILIGHT
  END
  SHUTTER METADATA
  END
  MASK METADATA
  END	
END

# only apply the fringe for these filters
FRINGE.FILTERS  MULTI
FRINGE.FILTERS	STR i
FRINGE.FILTERS	STR z
FRINGE.FILTERS	STR y

PHOTCODE.RULE		STR	{DETECTOR}.{FILTER.ID}.{CHIP.N}



# Overscan, bias, dark, shutter
PPIMAGE_OBDS       METADATA
  BASE.FITS        BOOL    TRUE            # Save base detrended image?
  BASE.MASK.FITS   BOOL    FALSE           # Save base detrended image?
  BASE.WEIGHT.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.WEIGHT.FITS BOOL    FALSE           # Save chip-mosaic-ed image? 
  OVERSCAN         BOOL    TRUE            # Overscan subtraction
  BIAS             BOOL    TRUE            # Bias subtraction
  DARK             BOOL    TRUE            # Dark subtraction
  SHUTTER          BOOL    FALSE           # Shutter correction
  FLAT             BOOL    FALSE           # Flat-field normalisation
  MASK             BOOL    FALSE           # Mask bad pixels
  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?
  BIN1.FITS        BOOL    TRUE            # Save 1st binned chip image?
  BIN2.FITS        BOOL    TRUE            # Save 2nd binned chip image?
END

# Overscan, bias, dark, shutter, flat-field
PPIMAGE_OBDSF      METADATA
  BASE.FITS        BOOL    TRUE            # Save base detrended image?
  BASE.MASK.FITS   BOOL    FALSE           # Save base detrended image?
  BASE.WEIGHT.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.WEIGHT.FITS BOOL    FALSE           # Save chip-mosaic-ed image? 
  OVERSCAN         BOOL    TRUE            # Overscan subtraction
  BIAS             BOOL    TRUE            # Bias subtraction
  DARK             BOOL    TRUE            # Dark subtraction
  SHUTTER          BOOL    FALSE           # Shutter correction
  FLAT             BOOL    TRUE            # Flat-field normalisation
  MASK             BOOL    FALSE           # Mask bad pixels
  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?
  BIN1.FITS        BOOL    TRUE            # Save 1st binned chip image?
  BIN2.FITS        BOOL    TRUE            # Save 2nd binned chip image?
END

# Overscan, bias, dark, shutter, flat-field, fringe
PPIMAGE_OBDSFR     METADATA
  BASE.FITS        BOOL    TRUE            # Save base detrended image?
  BASE.MASK.FITS   BOOL    FALSE           # Save base detrended image?
  BASE.WEIGHT.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.WEIGHT.FITS BOOL    FALSE           # Save chip-mosaic-ed image? 
  OVERSCAN         BOOL    TRUE            # Overscan subtraction
  BIAS             BOOL    TRUE            # Bias subtraction
  DARK             BOOL    TRUE            # Dark subtraction
  SHUTTER          BOOL    FALSE           # Shutter correction
  FLAT             BOOL    TRUE            # Flat-field normalisation
  MASK             BOOL    FALSE           # Mask bad pixels
  FRINGE           BOOL    TRUE            # Fringe subtraction
  PHOTOM           BOOL    FALSE           # Source identification and photometry
  ASTROM.CHIP      BOOL    FALSE           # Astrometry per chip?
  ASTROM.MOSAIC    BOOL    FALSE           # Astrometry for mosaic?
  BIN1.FITS        BOOL    TRUE            # Save 1st binned chip image?
  BIN2.FITS        BOOL    TRUE            # Save 2nd binned chip image?
END

# Overscan, bias, dark, shutter, flat-field, fringe, photom
PPIMAGE_OBDSFRP    METADATA
  BASE.FITS        BOOL    FALSE           # Save base detrended image?
  BASE.MASK.FITS   BOOL    FALSE           # Save base detrended image?
  BASE.WEIGHT.FITS BOOL    FALSE           # Save base detrended image?
  CHIP.FITS        BOOL    TRUE            # Save chip-mosaic-ed image? 
  CHIP.MASK.FITS   BOOL    TRUE            # Save chip-mosaic-ed image? 
  CHIP.WEIGHT.FITS BOOL    TRUE            # Save chip-mosaic-ed image? 
  OVERSCAN         BOOL    TRUE            # Overscan subtraction
  BIAS             BOOL    TRUE            # Bias subtraction
  DARK             BOOL    TRUE            # Dark subtraction
  SHUTTER          BOOL    FALSE           # Shutter correction
  FLAT             BOOL    TRUE            # Flat-field normalisation
  MASK             BOOL    TRUE            # Mask bad pixels
  FRINGE           BOOL    TRUE            # Fringe subtraction
  BIN1.FITS        BOOL    TRUE            # Save 1st binned chip image?
  BIN2.FITS        BOOL    TRUE            # Save 2nd binned chip image?
  PHOTOM           BOOL    TRUE            # Source identification and photometry
  ASTROM.CHIP      BOOL    FALSE           # Astrometry per chip?
  ASTROM.MOSAIC    BOOL    FALSE           # Astrometry for mosaic?
END

# Overscan, bias, dark, shutter, flat-field, fringe, photom, astrom
PPIMAGE_OBDSFRA    METADATA
  BASE.FITS        BOOL    FALSE           # Save base detrended image?
  BASE.MASK.FITS   BOOL    FALSE           # Save base detrended image?
  BASE.WEIGHT.FITS BOOL    FALSE           # Save base detrended image?
  CHIP.FITS        BOOL    TRUE            # Save chip-mosaic-ed image? 
  CHIP.MASK.FITS   BOOL    TRUE            # Save chip-mosaic-ed image? 
  CHIP.WEIGHT.FITS BOOL    TRUE            # Save chip-mosaic-ed image? 
  OVERSCAN         BOOL    TRUE            # Overscan subtraction
  BIAS             BOOL    TRUE            # Bias subtraction
  DARK             BOOL    TRUE            # Dark subtraction
  SHUTTER          BOOL    FALSE           # Shutter correction
  FLAT             BOOL    TRUE            # Flat-field normalisation
  MASK             BOOL    TRUE            # Mask bad pixels
  FRINGE           BOOL    TRUE            # Fringe subtraction
  BIN1.FITS        BOOL    TRUE            # Save 1st binned chip image?
  BIN2.FITS        BOOL    TRUE            # Save 2nd binned chip image?
  PHOTOM           BOOL    TRUE            # Source identification and photometry
  ASTROM.CHIP      BOOL    FALSE           # Astrometry per chip?
  ASTROM.MOSAIC    BOOL    FALSE           # Astrometry for mosaic?
END 
