### ppImage recipe configuration file

# Inherit everything from the top-level recipe file, except for what's below.

FRINGE.FILTERS  MULTI
FRINGE.FILTERS	STR z
FRINGE.FILTERS	STR y

# apply the following constraints when selecting a detrend image
DETREND.CONSTRAINTS  METADATA
  BIAS METADATA
  END
  DARK METADATA
  END
  SHUTTER METADATA
  END	
  FLAT METADATA
    FILTER  STR FPA.FILTERID
#   VERSION STR RAW
  END
  FRINGE METADATA
    FILTER   STR FPA.FILTERID
#   AIRMASS  STR FPA.AIRMASS
#   TWILIGHT STR TWILIGHT:FPA.TIME
  END
END

## these science-image analysis recipes are placed here set MASK = FALSE

# Standard chip processing
CHIP   METADATA
  BASE.FITS       BOOL    FALSE           # Save base detrended image?
  BASE.MASK.FITS   BOOL   FALSE           # Save base detrended image?
  BASE.VARIANCE.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.VARIANCE.FITS BOOL   TRUE            # Save chip-mosaic-ed image? 
  OVERSCAN        BOOL    TRUE            # Overscan subtraction
  BIAS            BOOL    FALSE           # Bias subtraction
  DARK            BOOL    TRUE            # Dark subtraction
  SHUTTER         BOOL    TRUE            # Shutter correction
  FLAT            BOOL    TRUE            # Flat-field normalisation
  MASK            BOOL    FALSE           # 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_DET_ONLY  METADATA
  BASE.FITS       BOOL    FALSE           # Save base detrended image?
  BASE.MASK.FITS   BOOL   FALSE           # Save base detrended image?
  BASE.VARIANCE.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.VARIANCE.FITS BOOL   TRUE            # Save chip-mosaic-ed image? 
  OVERSCAN        BOOL    TRUE            # Overscan subtraction
  BIAS            BOOL    FALSE           # Bias subtraction
  DARK            BOOL    TRUE            # Dark subtraction
  SHUTTER         BOOL    TRUE            # Shutter correction
  FLAT            BOOL    TRUE            # Flat-field normalisation
  MASK            BOOL    FALSE           # 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    FALSE           # 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
PPIMAGE_OBDSFRP   METADATA
  BASE.FITS       BOOL    FALSE           # Save base detrended image?
  BASE.MASK.FITS   BOOL   FALSE           # Save base detrended image?
  BASE.VARIANCE.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.VARIANCE.FITS BOOL   TRUE            # Save chip-mosaic-ed image? 
  OVERSCAN        BOOL    TRUE            # Overscan subtraction
  BIAS            BOOL    FALSE           # Bias subtraction
  DARK            BOOL    TRUE            # Dark subtraction
  SHUTTER         BOOL    TRUE            # Shutter correction
  FLAT            BOOL    TRUE            # Flat-field normalisation
  MASK            BOOL    FALSE           # 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.VARIANCE.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.VARIANCE.FITS BOOL   TRUE            # Save chip-mosaic-ed image? 
  OVERSCAN        BOOL    TRUE            # Overscan subtraction
  BIAS            BOOL    FALSE           # Bias subtraction
  DARK            BOOL    TRUE            # Dark subtraction
  SHUTTER         BOOL    TRUE            # Shutter correction
  FLAT            BOOL    TRUE            # Flat-field normalisation
  MASK            BOOL    FALSE           # 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, photometry, astrometry
PPIMAGE_OA   METADATA
  BASE.FITS       BOOL    FALSE           # Save base detrended image?
  BASE.MASK.FITS   BOOL   FALSE           # Save base detrended image?
  BASE.VARIANCE.FITS BOOL   FALSE           # Save base detrended image?
  CHIP.FITS       BOOL    TRUE            # Save chip-mosaic-ed image? 
  CHIP.MASK.FITS   BOOL   FALSE           # Save base detrended image?
  CHIP.VARIANCE.FITS BOOL   FALSE           # Save base detrended image?
  OVERSCAN        BOOL    TRUE            # Overscan subtraction
  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
  FRINGE          BOOL    FALSE           # Fringe subtraction
  BIN1.FITS       BOOL    FALSE           # Save 1st binned chip image?
  BIN2.FITS       BOOL    FALSE           # Save 2nd binned chip image?
  BIN1.JPEG       BOOL	  TRUE 		# Save 1st binned jpeg?
  BIN2.JPEG       BOOL	  TRUE 		# Save 2nd binned jpeg?
  PHOTOM          BOOL    TRUE		  # Source identification and photometry
  ASTROM.CHIP     BOOL    FALSE           # Astrometry per chip?
  ASTROM.MOSAIC   BOOL    FALSE		  # Astrometry for mosaic?
END

# No operation except rebinning and potential normalisation
PPIMAGE_N          METADATA
  BASE.FITS        BOOL    TRUE            # Save base detrended 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? 
  OVERSCAN         BOOL    FALSE           # Overscan subtraction
  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
  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 subtraction only
PPIMAGE_O            METADATA
  BASE.FITS          BOOL    TRUE            # Save base detrended image?
  BASE.MASK.FITS     BOOL    TRUE            # 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? 
  OVERSCAN           BOOL    TRUE            # Overscan subtraction
  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
  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

# Bias subtraction only
PPIMAGE_B          METADATA
  BASE.FITS        BOOL    TRUE            # Save base detrended 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? 
  OVERSCAN         BOOL    FALSE           # Overscan subtraction
  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
  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

# Dark subtraction only
PPIMAGE_D          METADATA
  BASE.FITS        BOOL    TRUE            # Save base detrended 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? 
  OVERSCAN         BOOL    FALSE           # Overscan subtraction
  BIAS             BOOL    FALSE           # 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

# Dark subtraction only
PPIMAGE_M          METADATA
  BASE.FITS        BOOL    TRUE            # Save base detrended 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? 
  OVERSCAN         BOOL    FALSE           # Overscan subtraction
  BIAS             BOOL    FALSE           # Bias subtraction
  DARK             BOOL    FALSE           # Dark subtraction
  SHUTTER          BOOL    FALSE           # Shutter correction
  FLAT             BOOL    FALSE           # Flat-field normalisation
  MASK             BOOL    TRUE            # 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

# Shutter correction only
PPIMAGE_S          METADATA
  BASE.FITS        BOOL    TRUE            # Save base detrended 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? 
  OVERSCAN         BOOL    FALSE           # Overscan subtraction
  BIAS             BOOL    FALSE           # Bias subtraction
  DARK             BOOL    FALSE           # Dark subtraction
  SHUTTER          BOOL    TRUE            # 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

# Flat-fielding only
PPIMAGE_F          METADATA
  BASE.FITS        BOOL    TRUE            # Save base detrended 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? 
  OVERSCAN         BOOL    FALSE           # Overscan subtraction
  BIAS             BOOL    FALSE           # Bias subtraction
  DARK             BOOL    FALSE           # 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

# Fringe correction only
PPIMAGE_R          METADATA
  BASE.FITS        BOOL    TRUE            # Save base detrended 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? 
  OVERSCAN         BOOL    FALSE           # Overscan subtraction
  BIAS             BOOL    FALSE           # Bias subtraction
  DARK             BOOL    FALSE           # Dark subtraction
  SHUTTER          BOOL    FALSE           # Shutter correction
  FLAT             BOOL    FALSE           # Flat-field normalisation
  MASK             BOOL    TRUE            # 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

# Photometry only
PPIMAGE_P          METADATA
  BASE.FITS        BOOL    FALSE           # Save base detrended image?
  BASE.MASK.FITS   BOOL    FALSE           # Save base detrended image?
  BASE.VARIANCE.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.VARIANCE.FITS BOOL    TRUE            # Save chip-mosaic-ed image? 
  OVERSCAN         BOOL    FALSE           # Overscan subtraction
  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
  FRINGE           BOOL    FALSE           # Fringe subtraction
  PHOTOM           BOOL    TRUE            # 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

# Photometry & Astrometry
PPIMAGE_A          METADATA
  BASE.FITS        BOOL    FALSE           # Save base detrended image?
  BASE.MASK.FITS   BOOL    FALSE           # Save base detrended image?
  BASE.VARIANCE.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.VARIANCE.FITS BOOL    TRUE            # Save chip-mosaic-ed image? 
  OVERSCAN         BOOL    FALSE           # Overscan subtraction
  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
  FRINGE           BOOL    FALSE           # Fringe subtraction
  PHOTOM           BOOL    TRUE            # Source identification and photometry
  ASTROM.CHIP      BOOL    FALSE           # Astromtery 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
PPIMAGE_OB         METADATA
  BASE.FITS        BOOL    TRUE            # Save base detrended image?
  BASE.MASK.FITS   BOOL    TRUE            # 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? 
  OVERSCAN         BOOL    TRUE            # Overscan subtraction
  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
  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
PPIMAGE_OBD        METADATA
  BASE.FITS        BOOL    TRUE            # Save base detrended image?
  BASE.MASK.FITS   BOOL    TRUE            # Save base detrended image?
  BASE.VARIANCE.FITS BOOL    TRUE            # 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? 
  OVERSCAN         BOOL    TRUE            # Overscan subtraction
  BIAS             BOOL    FALSE            # 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 -- search for DARK_PREMASK
PPIMAGE_DARKMASK_PROCESS METADATA
  BASE.FITS        BOOL    TRUE            # Save base detrended image?
  BASE.MASK.FITS   BOOL    TRUE            # Save base detrended image?
  BASE.VARIANCE.FITS BOOL    TRUE            # 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? 
  OVERSCAN         BOOL    TRUE            # Overscan subtraction
  BIAS             BOOL    FALSE            # 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?
DETREND.CONSTRAINTS  METADATA
    DARK METADATA
      DETTYPE STR DARK_PREMASK
      EXPTIME STR FPA.EXPOSURE
    END
  END 


END

# Overscan, bias, dark, shutter
PPIMAGE_OBDS       METADATA
  BASE.FITS          BOOL    TRUE            # Save base detrended image?
  BASE.MASK.FITS     BOOL    TRUE            # Save base detrended image?
  BASE.VARIANCE.FITS BOOL    TRUE            # 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? 
  OVERSCAN           BOOL    TRUE            # Overscan subtraction
  BIAS               BOOL    FALSE            # 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

# used for the pre-mask version of flat-field processing
PPIMAGE_FLATPROC_PREMASK     METADATA
  BASE.FITS          BOOL    TRUE            # Save base detrended image?
  BASE.MASK.FITS     BOOL    TRUE            # Save base detrended image?
  BASE.VARIANCE.FITS BOOL    TRUE            # 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? 
  OVERSCAN           BOOL    TRUE            # Overscan subtraction
  BIAS               BOOL    FALSE            # 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?
  MASK.SATURATED     BOOL    FALSE           # DO NOT Mask the saturated pixels

  DETREND.CONSTRAINTS  METADATA
    DARK METADATA
      DETTYPE STR DARK_PREMASK
    END
  END   
END

# Overscan, bias, dark, shutter, flat-field
PPIMAGE_OBDSF      METADATA
  BASE.FITS        BOOL    TRUE            # Save base detrended image?
  BASE.MASK.FITS   BOOL    TRUE            # Save base detrended image?
  BASE.VARIANCE.FITS BOOL  TRUE            # 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? 
  OVERSCAN         BOOL    TRUE            # Overscan subtraction
  BIAS             BOOL    FALSE            # 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 -- use FLAT_PREMASK
PPIMAGE_FLATMASK_PROCESS      METADATA
  BASE.FITS        BOOL    TRUE            # Save base detrended image?
  BASE.MASK.FITS   BOOL    TRUE            # Save base detrended image?
  BASE.VARIANCE.FITS BOOL  TRUE            # 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? 
  OVERSCAN         BOOL    TRUE            # Overscan subtraction
  BIAS             BOOL    FALSE            # 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?

  DETREND.CONSTRAINTS  METADATA
    DARK METADATA
      DETTYPE STR DARK_PREMASK
      EXPTIME STR FPA.EXPOSURE
    END
    FLAT METADATA
      DETTYPE STR FLAT_PREMASK
      FILTER  STR FPA.FILTERID
    END
  END   
END

# Overscan, bias, dark, shutter, flat-field, fringe
PPIMAGE_OBDSFR     METADATA
  BASE.FITS        BOOL    TRUE            # Save base detrended image?
  BASE.MASK.FITS   BOOL    TRUE            # Save base detrended image?
  BASE.VARIANCE.FITS BOOL    TRUE            # 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? 
  OVERSCAN         BOOL    TRUE            # Overscan subtraction
  BIAS             BOOL    FALSE            # 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_FLATCORR    METADATA
  BASE.FITS        BOOL    FALSE           # Save base detrended image?
  BASE.MASK.FITS   BOOL    FALSE           # Save base detrended image?
  BASE.VARIANCE.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.VARIANCE.FITS BOOL    TRUE            # Save chip-mosaic-ed image? 
  OVERSCAN         BOOL    TRUE            # Overscan subtraction
  BIAS             BOOL    FALSE            # 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?

  DETREND.CONSTRAINTS  METADATA
    FLAT METADATA
      DETTYPE STR FLAT_RAW
    END
  END   
END

# generate CTE map image
PPIMAGE_CTEMAP     METADATA
  BASE.FITS        BOOL    TRUE            # Save base image?
  BASE.MASK.FITS   BOOL    TRUE            # Save base detrended image?
  BASE.VARIANCE.FITS BOOL  TRUE            # 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? 
  OVERSCAN         BOOL    FALSE           # Overscan subtraction
  OVERSCAN         BOOL    TRUE            # Overscan subtraction
  BIAS             BOOL    FALSE            # 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?
  CHECK.CTE        BOOL    TRUE            # measure CTE errors?

  DETREND.CONSTRAINTS  METADATA
    DARK METADATA
      DETTYPE STR DARK_PREMASK
      EXPTIME STR FPA.EXPOSURE
    END
    FLAT METADATA
      DETTYPE STR FLAT_PREMASK
      FILTER  STR FPA.FILTERID
    END
  END   
END
