# "mcshort" is a MegaCam camera with only the central six chips --- it's faster than the entire FPA.
# The spliced MecaCam data is stored in single extensions for each chip

# How to recognise this type
RULE	METADATA
	TELESCOP	STR	CFHT 3.6m
	DETECTOR	STR	CFH12K
	INSTRUME	STR	CFH12K Mosaic
	EXTEND		BOOL	T
        IMAGESWV        MULTI
	IMAGESWV	STR     CFHT DetCom v3.25 (Jun 13 2001)    
	IMAGESWV	STR     CFHT DetCom v3.28 (Jul 11 2001)    
	IMAGESWV	STR     CFHT DetCom v3.35 (May 01 2002)
END

FILE	METADATA
	# How to read this data
	PHU		STR	FPA	# The FITS file represents an entire FPA
	EXTENSIONS	STR	CHIP	# The extensions represent chips
	FPA.NAME	STR	EXPNUM	# A PHU keyword for unique identifier
	CHIP.NAME	STR	IMAGEID	# An extension keyword for unique identifie
	EXTWORD         STR     IMAGEID
END

# What's in the FITS file?
CONTENTS	METADATA
	# Extension name, chip name:component cell
	 0		STR	ccd00:MIT-LL
	 1		STR	ccd01:MIT-LL
	 2		STR	ccd02:MIT-LL
	 3		STR	ccd03:MIT-LL
	 4		STR	ccd04:MIT-LL
	 5		STR	ccd05:MIT-LL
	 6		STR	ccd06:MIT-LL
	 7		STR	ccd07:MIT-LL
	 8		STR	ccd08:MIT-LL
	 9		STR	ccd09:MIT-LL
	10		STR	ccd10:MIT-LL
	11		STR	ccd11:MIT-LL
END

# Specify the chips
CHIPS		METADATA
	# Chip type, cellName:cellType
	MIT-LL	STR	Amp:cell
END

# Specify the cells
CELLS		METADATA
	cell		METADATA
		CELL.BIASSEC.SOURCE	STR	HEADER
		CELL.TRIMSEC.SOURCE	STR	HEADER
		CELL.BIASSEC		STR	BIASSEC
		CELL.TRIMSEC		STR	DATASEC
		CELL.X0			S32	0
	END
END

# How to translate PS concepts into FITS headers
TRANSLATION	METADATA
        FPA.AIRMASS     STR     AIRMASS
	FPA.OBSTYPE	STR	OBSTYPE
	FPA.OBJECT	STR	OBJECT
        FPA.FILTERID    STR     FILTER
        FPA.FILTER      STR     FILTER
        FPA.POSANGLE    STR     ROTANGLE
        FPA.RA          STR     RA
        FPA.DEC         STR     DEC
        FPA.RADECSYS    STR     RADECSYS
	FPA.FOCUS	STR	TELFOCUS
	FPA.TIME	STR	MJD-OBS
	FPA.TIMESYS	STR	TIMESYS
	FPA.ALT		STR	TELALT
	FPA.AZ		STR	TELAZ
	FPA.TEMP	STR	DETTEM
	FPA.EXPOSURE	STR	EXPTIME
	CHIP.TEMP	STR	DETTEM
        CELL.EXPOSURE   STR     EXPTIME
        CELL.DARKTIME   STR     DARKTIME
	CELL.TIME	STR	MJD-OBS
        CELL.GAIN       STR     GAIN
        CELL.SATURATION STR     SATURATE
	CELL.TIMESYS	STR	TIMESYS
        CELL.XBIN       STR     CCDBIN1
        CELL.YBIN       STR     CCDBIN2
END

# Default PS concepts that may be specified by value
DEFAULTS        METADATA
	FPA.TELESCOPE		STR	CFHT
	FPA.INSTRUMENT		STR	CFH12K		# this value is used in ipprc.config to find the recipes
	FPA.DETECTOR	        STR	CFH12K
	CHIP.XSIZE		S32	2048
	CHIP.YSIZE		S32	4096
	CELL.XSIZE		S32	2048
	CELL.YSIZE		S32	4096
	CELL.READNOISE          F32     10.0
	CELL.READDIR		S32	1		# Cell is read in x direction
        CELL.BAD                S32     0
	CELL.XPARITY		S32	1
	CELL.YPARITY		S32	1
	CELL.Y0			S32	0
	CHIP.X0.DEPEND		STR	CHIP.NAME
	CHIP.X0		METADATA
		ccd00	S32	10
		ccd01	S32	2048
		ccd02	S32	4096
		ccd03	S32	6144
		ccd04	S32	8192
		ccd05	S32	10240
		ccd06	S32	0    
		ccd07	S32	2048 
		ccd08	S32	4096 
		ccd09	S32	6144 
		ccd10	S32	8192 
		ccd11	S32	10240
	END
	CHIP.Y0.DEPEND		STR	CHIP.NAME
	CHIP.Y0		METADATA
		ccd00	S32	10
		ccd01	S32	10
		ccd02	S32	10
		ccd03	S32	10
		ccd04	S32	10
		ccd05	S32	10
		ccd06	S32	4128
		ccd07	S32	4128
		ccd08	S32	4128
		ccd09	S32	4128
		ccd10	S32	4128
		ccd11	S32	4128
	END
	CHIP.XPARITY		S32	1
	CHIP.YPARITY.DEPEND	STR	CHIP.NAME
	CHIP.YPARITY	METADATA
		ccd00	S32	+1
		ccd01	S32	+1
		ccd02	S32	+1
		ccd03	S32	+1
		ccd04	S32	+1
		ccd05	S32	+1
		ccd06	S32	-1
		ccd07	S32	-1
		ccd08	S32	-1
		ccd09	S32	-1
		ccd10	S32	-1
		ccd11	S32	-1
	END
END

# How to translation PS concepts into database lookups
DATABASE	METADATA
	TYPE		dbEntry		TABLE		COLUMN		GIVENDBCOL	GIVENPS
#	CELL.GAIN	dbEntry		Camera		gain		chipId,cellId	CHIP.NAME,CELL.NAME
#	CELL.READNOISE	dbEntry		Camera		readNoise	chipId,cellId	CHIP.NAME,CELL.NAME

# A database entry refers to a particular column (COLUMN) in a
# particular table (TABLE), given certain PS concepts (GIVENPS) that
# match certain database columns (GIVENDBCOL).
END		


# Where there might be some ambiguity, specify the format
FORMATS		METADATA
	FPA.RA		STR	HOURS
	FPA.DEC		STR	DEGREES
	FPA.TIME	STR	MJD
	CELL.TIME	STR	MJD
END
 
