### ppImage recipe configuration file
### Here we have turned on our 'best guess' defaults for a simple camera
### Camera-specific options may be turned on by recipes in the camera configuration

# List of tasks to perform
NONLIN           BOOL    FALSE           # Non-linearity correction; not implemented
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
MASK.VALUE       STR     SAT,BAD         # Mask pixels with these attributes
MASK.BUILD       BOOL    FALSE           # Build internal mask image
WEIGHT.BUILD     BOOL    FALSE           # Build internal weight image
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?

# output data formats to save
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    FALSE           # Save chip-mosaic-ed image? 
CHIP.WEIGHT.FITS BOOL    FALSE           # Save chip-mosaic-ed image? 
FPA1.FITS        BOOL    FALSE           # Save 1st binned fpa image? 
FPA2.FITS        BOOL    FALSE           # Save 2nd binned fpa image? 
BIN1.FITS        BOOL    FALSE           # Save 1st binned chip image?
BIN2.FITS        BOOL    FALSE           # Save 2nd binned chip image?
BIN1.JPEG        BOOL    FALSE           # Save 1st binned jpeg?
BIN2.JPEG        BOOL    FALSE           # Save 2nd binned jpeg?

# Non-linearity correction
NONLIN.SOURCE           STR     CHIP.NAME       # How to determine the source
NONLIN.DATA             STR     nonlin.dat      # Filename for lookup table

# examples of other possible non-linearity correction representations
#@NONLIN.DATA           F32     0.0 1.001 0.001 # A polynomial
#NONLIN.DATA            METADATA                # Source of non-linearity data
#       ccd00           STR     nonlin00.dat    # A lookup table 
#       @ccd01          F32     0.0 1.001 0.001 # A polynomial
#END

# Overscan subtraction
OVERSCAN.SINGLE         BOOL    TRUE            # Reduce overscan to a single value?
OVERSCAN.FIT            STR     NONE            # NONE | POLYNOMIAL | SPLINE
OVERSCAN.ORDER          S32     5               # Order of polynomial fit
OVERSCAN.STAT           STR     MEAN            # MEAN | MEDIAN
OVERSCAN.BOXCAR		S32	0		# Boxcar smoothing radius
OVERSCAN.GAUSS		F32	0.0		# Gaussian smoothing sigma
OVERSCAN.CONSTANT	BOOL	FALSE		# Apply a known, fixed value?
OVERSCAN.VALUE	        F32	0.0		# value to apply, if requested

# Fringe subtraction options
FRINGE.ITER     S32     10              # Number of rejection iterations for fringe solution
FRINGE.REJ      F32     2.0             # Rejection threshold for fringe solution
FRINGE.KEEP     F32     0.5             # Minimum fraction to keep in fringe solution

# binned output image options
BIN1.XBIN               S32      4
BIN1.YBIN               S32      4
BIN2.XBIN               S32     16
BIN2.YBIN               S32     16

PPIMAGE.JPEG1  METADATA
  COLORMAP      STR     -greyscale
  SCALE.MODE    STR     RANGE
  SCALE.MIN     F32      -5.0
  SCALE.MAX     F32     +10.0
END

PPIMAGE.JPEG2  METADATA
  COLORMAP      STR     -greyscale
  SCALE.MODE    STR     RANGE
  SCALE.MIN     STR      -5.0
  SCALE.MAX     STR     +10.0
END

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

FRINGE.FILTERS  MULTI
FRINGE.FILTERS  STR UNDEF

DETREND.CONSTRAINTS  METADATA
END

################################################################################
# Diffferent processing options, which may be loaded symbolically
################################################################################

# No operation except potential normalisation
PPIMAGE_N          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    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    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    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.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    FALSE           # Overscan subtraction
  BIAS             BOOL    TRUE            # 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.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    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

# Shutter correction only
PPIMAGE_S          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    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.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    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.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    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    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.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    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?
END

# Photometry & Astrometry
PPIMAGE_A          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    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    TRUE            # Astromtery per chip?
  ASTROM.MOSAIC    BOOL    FALSE           # Astrometry for mosaic?
END

# Overscan, bias
PPIMAGE_OB         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    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    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
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    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

# 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    TRUE            # 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    TRUE            # 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, astrom
PPIMAGE_DET_ONLY   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    TRUE            # 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    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.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    TRUE            # 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    TRUE            # 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    TRUE            # Astrometry per chip?
  ASTROM.MOSAIC    BOOL    FALSE           # Astrometry for mosaic?
END

# Save JPEG from BIN1
PPIMAGE_JPEG       METADATA
  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?
  BASE.FITS        BOOL    FALSE           # Save base 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? 
  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?
END

# Save JPEG from BIN1
PPIMAGE_J1         METADATA
  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?
  BASE.FITS        BOOL    FALSE           # Save base 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? 
  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    FALSE           # Save 2nd binned jpeg?
  BIN1.XBIN        S32     1               # Image is already binned
  BIN1.YBIN        S32     1               # Image is already binned
  BIN2.XBIN        S32     1               # Image is already binned
  BIN2.YBIN        S32     1               # Image is already binned
END

# Save JPEG from BIN2
PPIMAGE_J2         METADATA
  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?
  BASE.FITS        BOOL    FALSE           # Save base 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? 
  BIN1.FITS        BOOL    FALSE           # Save 1st binned chip image?
  BIN2.FITS        BOOL    FALSE           # Save 2nd binned chip image?
  BIN1.JPEG        BOOL    FALSE           # Save 1st binned jpeg?
  BIN2.JPEG        BOOL    TRUE            # Save 2nd binned jpeg?
  BIN1.XBIN        S32     1               # Image is already binned
  BIN1.YBIN        S32     1               # Image is already binned
  BIN2.XBIN        S32     1               # Image is already binned
  BIN2.YBIN        S32     1               # Image is already binned
END

# Overscan, bias, photometry, astrometry (for, eg, summit ISP analysis)
PPIMAGE_OA         METADATA
  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    TRUE            # Astrometry per chip?
  ASTROM.MOSAIC    BOOL    FALSE           # Astrometry for mosaic?
END

# Overscan, bias, photometry (for quick analysis)
PPIMAGE_OP         METADATA
  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

# Photometry and astrometry only (for pre-reduced data)
PPIMAGE_PA         METADATA
  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
  BIN1.FITS        BOOL    TRUE            # Save 1st binned chip image?
  BIN2.FITS        BOOL    TRUE            # 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    TRUE            # Astrometry per chip?
  ASTROM.MOSAIC    BOOL    FALSE           # Astrometry for mosaic?
END

# JPEG images for different types of residual images
# Save JPEG from BIN1 for bias
PPIMAGE_J1_RESID_B      METADATA
  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?
  BASE.FITS        BOOL    FALSE           # Save base 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? 
  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    FALSE           # Save 2nd binned jpeg?
  BIN1.XBIN        S32     1               # Image is already binned
  BIN1.YBIN        S32     1               # Image is already binned
  BIN2.XBIN        S32     1               # Image is already binned
  BIN2.YBIN        S32     1               # Image is already binned

  PPIMAGE.JPEG1    METADATA
    COLORMAP       STR     -greyscale
    SCALE.MODE     STR     VALUE
    SCALE.MIN      F32     -5.0
    SCALE.MAX      F32     +5.0
  END
END

# Save JPEG from BIN2 for bias
PPIMAGE_J2_RESID_B        METADATA
  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?
  BASE.FITS        BOOL    FALSE           # Save base 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? 
  BIN1.FITS        BOOL    FALSE           # Save 1st binned chip image?
  BIN2.FITS        BOOL    FALSE           # Save 2nd binned chip image?
  BIN1.JPEG        BOOL    FALSE           # Save 1st binned jpeg?
  BIN2.JPEG        BOOL    TRUE            # Save 2nd binned jpeg?
  BIN1.XBIN        S32     1               # Image is already binned
  BIN1.YBIN        S32     1               # Image is already binned
  BIN2.XBIN        S32     1               # Image is already binned
  BIN2.YBIN        S32     1               # Image is already binned

  PPIMAGE.JPEG2    METADATA
    COLORMAP       STR     -greyscale
    SCALE.MODE     STR     VALUE
    SCALE.MIN      F32     -5.0
    SCALE.MAX      F32     +5.0
  END
END

# Save JPEG from BIN1 for flat
PPIMAGE_J1_RESID_F      METADATA
  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?
  BASE.FITS        BOOL    FALSE           # Save base 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? 
  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    FALSE           # Save 2nd binned jpeg?
  BIN1.XBIN        S32     1               # Image is already binned
  BIN1.YBIN        S32     1               # Image is already binned
  BIN2.XBIN        S32     1               # Image is already binned
  BIN2.YBIN        S32     1               # Image is already binned

  PPIMAGE.JPEG1    METADATA
    COLORMAP       STR     -greyscale
    SCALE.MODE     STR     FRACTION
    SCALE.MIN      F32     0.95
    SCALE.MAX      F32     1.05
  END
END

# Save JPEG from BIN2 for flat
PPIMAGE_J2_RESID_F        METADATA
  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?
  BASE.FITS        BOOL    FALSE           # Save base 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? 
  BIN1.FITS        BOOL    FALSE           # Save 1st binned chip image?
  BIN2.FITS        BOOL    FALSE           # Save 2nd binned chip image?
  BIN1.JPEG        BOOL    FALSE           # Save 1st binned jpeg?
  BIN2.JPEG        BOOL    TRUE            # Save 2nd binned jpeg?
  BIN1.XBIN        S32     1               # Image is already binned
  BIN1.YBIN        S32     1               # Image is already binned
  BIN2.XBIN        S32     1               # Image is already binned
  BIN2.YBIN        S32     1               # Image is already binned
		   
  PPIMAGE.JPEG2    METADATA
    COLORMAP       STR     -greyscale
    SCALE.MODE     STR     FRACTION
    SCALE.MIN      F32     0.95
    SCALE.MAX      F32     1.05
  END
END

# Save JPEG from BIN1 for flat
PPIMAGE_J1_RESID_R      METADATA
  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?
  BASE.FITS        BOOL    FALSE           # Save base 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? 
  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    FALSE           # Save 2nd binned jpeg?
  BIN1.XBIN        S32     1               # Image is already binned
  BIN1.YBIN        S32     1               # Image is already binned
  BIN2.XBIN        S32     1               # Image is already binned
  BIN2.YBIN        S32     1               # Image is already binned
		   
  PPIMAGE.JPEG1    METADATA
    COLORMAP       STR     -greyscale
    SCALE.MODE     STR     RANGE
    SCALE.MIN      F32     -2.0
    SCALE.MAX      F32     +3.0
  END
END

# Save JPEG from BIN2 for flat
PPIMAGE_J2_RESID_R        METADATA
  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?
  BASE.FITS        BOOL    FALSE           # Save base 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? 
  BIN1.FITS        BOOL    FALSE           # Save 1st binned chip image?
  BIN2.FITS        BOOL    FALSE           # Save 2nd binned chip image?
  BIN1.JPEG        BOOL    FALSE           # Save 1st binned jpeg?
  BIN2.JPEG        BOOL    TRUE            # Save 2nd binned jpeg?
  BIN1.XBIN        S32     1               # Image is already binned
  BIN1.YBIN        S32     1               # Image is already binned
  BIN2.XBIN        S32     1               # Image is already binned
  BIN2.YBIN        S32     1               # Image is already binned
		   
  PPIMAGE.JPEG2    METADATA
    COLORMAP       STR     -greyscale
    SCALE.MODE     STR     RANGE
    SCALE.MIN      F32     -2.0
    SCALE.MAX      F32     +3.0
  END
END

# JPEG images for different types of positive images
# Save JPEG from BIN1 for bias
PPIMAGE_J1_IMAGE_B      METADATA
  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?
  BASE.FITS        BOOL    FALSE           # Save base 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? 
  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    FALSE           # Save 2nd binned jpeg?
  BIN1.XBIN        S32     1               # Image is already binned
  BIN1.YBIN        S32     1               # Image is already binned
  BIN2.XBIN        S32     1               # Image is already binned
  BIN2.YBIN        S32     1               # Image is already binned
		   
  PPIMAGE.JPEG1    METADATA
    COLORMAP       STR     -greyscale
    SCALE.MODE     STR     RANGE
    SCALE.MIN      F32     -5.0
    SCALE.MAX      F32     +5.0
  END
END

# Save JPEG from BIN2 for bias
PPIMAGE_J2_IMAGE_B        METADATA
  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?
  BASE.FITS       BOOL    FALSE           # Save base 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? 
  BIN1.FITS       BOOL    FALSE           # Save 1st binned chip image?
  BIN2.FITS       BOOL    FALSE           # Save 2nd binned chip image?
  BIN1.JPEG       BOOL    FALSE           # Save 1st binned jpeg?
  BIN2.JPEG       BOOL    TRUE            # Save 2nd binned jpeg?
  BIN1.XBIN       S32     1               # Image is already binned
  BIN1.YBIN       S32     1               # Image is already binned
  BIN2.XBIN       S32     1               # Image is already binned
  BIN2.YBIN       S32     1               # Image is already binned

  PPIMAGE.JPEG2  METADATA
    COLORMAP      STR     -greyscale
    SCALE.MODE    STR     RANGE
    SCALE.MIN     F32     -5.0
    SCALE.MAX     F32     +5.0
  END
END

# Save JPEG from BIN1 for flat
PPIMAGE_J1_IMAGE_F      METADATA
  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?
  BASE.FITS       BOOL    FALSE           # Save base 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? 
  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    FALSE           # Save 2nd binned jpeg?
  BIN1.XBIN       S32     1               # Image is already binned
  BIN1.YBIN       S32     1               # Image is already binned
  BIN2.XBIN       S32     1               # Image is already binned
  BIN2.YBIN       S32     1               # Image is already binned

  PPIMAGE.JPEG1  METADATA
    COLORMAP      STR     -greyscale
    SCALE.MODE    STR     RANGE
    SCALE.MIN     F32     -5.0
    SCALE.MAX     F32     +5.0
  END
END

# Save JPEG from BIN2 for flat
PPIMAGE_J2_IMAGE_F        METADATA
  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?
  BASE.FITS       BOOL    FALSE           # Save base 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? 
  BIN1.FITS       BOOL    FALSE           # Save 1st binned chip image?
  BIN2.FITS       BOOL    FALSE           # Save 2nd binned chip image?
  BIN1.JPEG       BOOL    FALSE           # Save 1st binned jpeg?
  BIN2.JPEG       BOOL    TRUE            # Save 2nd binned jpeg?
  BIN1.XBIN       S32     1               # Image is already binned
  BIN1.YBIN       S32     1               # Image is already binned
  BIN2.XBIN       S32     1               # Image is already binned
  BIN2.YBIN       S32     1               # Image is already binned

  PPIMAGE.JPEG2  METADATA
    COLORMAP      STR     -greyscale
    SCALE.MODE    STR     RANGE
    SCALE.MIN     F32     -5.0
    SCALE.MAX     F32     +5.0
  END
END

# Save JPEG from BIN1 for flat
PPIMAGE_J1_IMAGE_R      METADATA
  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?
  BASE.FITS       BOOL    FALSE           # Save base 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? 
  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    FALSE           # Save 2nd binned jpeg?
  BIN1.XBIN       S32     1               # Image is already binned
  BIN1.YBIN       S32     1               # Image is already binned
  BIN2.XBIN       S32     1               # Image is already binned
  BIN2.YBIN       S32     1               # Image is already binned

  PPIMAGE.JPEG1  METADATA
    COLORMAP      STR     -greyscale
    SCALE.MODE    STR     RANGE
    SCALE.MIN     F32     -2.0
    SCALE.MAX     F32     +3.0
  END
END

# Save JPEG from BIN2 for flat
PPIMAGE_J2_IMAGE_R        METADATA
  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?
  BASE.FITS       BOOL    FALSE           # Save base 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? 
  BIN1.FITS       BOOL    FALSE           # Save 1st binned chip image?
  BIN2.FITS       BOOL    FALSE           # Save 2nd binned chip image?
  BIN1.JPEG       BOOL    FALSE           # Save 1st binned jpeg?
  BIN2.JPEG       BOOL    TRUE            # Save 2nd binned jpeg?
  BIN1.XBIN       S32     1               # Image is already binned
  BIN1.YBIN       S32     1               # Image is already binned
  BIN2.XBIN       S32     1               # Image is already binned
  BIN2.YBIN       S32     1               # Image is already binned

  PPIMAGE.JPEG2  METADATA
    COLORMAP      STR     -greyscale
    SCALE.MODE    STR     RANGE
    SCALE.MIN     F32     -2.0
    SCALE.MAX     F32     +3.0
  END
END

