# "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	MegaCam
END

FILE	METADATA
	# How to read this data
	PHU		STR	CHIP	# The FITS file represents an entire FPA
	EXTENSIONS	STR	NONE	# The extensions represent chips
	FPA.NAME	STR	EXPNUM	# A PHU keyword for unique identifier
	CONTENT		STR	EXTNAME	# Key to the CONTENTS menu
END

# What's in the FITS file?
CONTENTS	METADATA
	# Extension name, chip name:component cell
#	ccd00		STR	ccd00:CCD42-90
#	ccd01		STR	ccd01:CCD42-90
#	ccd02		STR	ccd02:CCD42-90
#	ccd03		STR	ccd03:CCD42-90
#	ccd04		STR	ccd04:CCD42-90
#	ccd05		STR	ccd05:CCD42-90
#	ccd06		STR	ccd06:CCD42-90
#	ccd07		STR	ccd07:CCD42-90
#	ccd08		STR	ccd08:CCD42-90
#	ccd09		STR	ccd09:CCD42-90
#	ccd10		STR	ccd10:CCD42-90
#	ccd11		STR	ccd11:CCD42-90
	ccd12		STR	ccd12:CCD42-90
	ccd13		STR	ccd13:CCD42-90
	ccd14		STR	ccd14:CCD42-90
#	ccd15		STR	ccd15:CCD42-90
#	ccd16		STR	ccd16:CCD42-90
#	ccd17		STR	ccd17:CCD42-90
#	ccd18		STR	ccd18:CCD42-90
#	ccd19		STR	ccd19:CCD42-90
#	ccd20		STR	ccd20:CCD42-90
	ccd21		STR	ccd21:CCD42-90
	ccd22		STR	ccd22:CCD42-90
	ccd23		STR	ccd23:CCD42-90
#	ccd24		STR	ccd24:CCD42-90
#	ccd25		STR	ccd25:CCD42-90
#	ccd26		STR	ccd26:CCD42-90
#	ccd27		STR	ccd27:CCD42-90
#	ccd28		STR	ccd28:CCD42-90
#	ccd29		STR	ccd29:CCD42-90
#	ccd30		STR	ccd30:CCD42-90
#	ccd31		STR	ccd31:CCD42-90
#	ccd32		STR	ccd32:CCD42-90
#	ccd33		STR	ccd33:CCD42-90
#	ccd34		STR	ccd34:CCD42-90
#	ccd35		STR	ccd35:CCD42-90
END

# Specify the chips
CHIPS		METADATA
	# Chip type, cellName:cellType
	CCD42-90	STR	LeftAmp:left RightAmp:right
END

# Specify the cells
CELLS		METADATA
	left		METADATA
		CELL.BIASSEC.SOURCE	STR	HEADER
		CELL.TRIMSEC.SOURCE	STR	HEADER
		CELL.BIASSEC		STR	BSECA
		CELL.TRIMSEC		STR	TSECA
		CELL.X0			S32	0
		CELL.GAIN.SOURCE	STR	HEADER
		CELL.GAIN		STR	GAINA
	END

	right		METADATA
		CELL.BIASSEC.SOURCE	STR	HEADER
		CELL.TRIMSEC.SOURCE	STR	HEADER
		CELL.BIASSEC		STR	BSECB
		CELL.TRIMSEC		STR	TSECB
		CELL.X0			S32	1024
		CELL.GAIN.SOURCE	STR	HEADER
		CELL.GAIN		STR	GAINB
	END
END

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

# Default PS concepts that may be specified by value
DEFAULTS        METADATA
	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
#	PPMERGE.SCALE		F32	1.0
#	PPMERGE.ZERO		F32	0.0
	CHIP.X0.DEPEND		STR	CHIP.NAME
	CHIP.X0		METADATA
#		ccd00	S32	
#		ccd01	S32
#		ccd02	S32
#		ccd03	S32
#		ccd04	S32
#		ccd05	S32
#		ccd06	S32
#		ccd07	S32
#		ccd08	S32
#		ccd09	S32
#		ccd10	S32
#		ccd11	S32
		ccd12	S32	0
		ccd13	S32	2048
		ccd14	S32	4096
#		ccd15	S32
#		ccd16	S32
#		ccd17	S32
#		ccd18	S32
#		ccd19	S32
#		ccd20	S32
		ccd21	S32	0
		ccd22	S32	2048
		ccd23	S32	4096
#		ccd24	S32
#		ccd25	S32
#		ccd26	S32
#		ccd27	S32
#		ccd28	S32
#		ccd29	S32
#		ccd30	S32
#		ccd31	S32
#		ccd32	S32
#		ccd33	S32
#		ccd34	S32
#		ccd35	S32
	END
	CHIP.Y0.DEPEND		STR	CHIP.NAME
	CHIP.Y0		METADATA
#		ccd00	S32	
#		ccd01	S32
#		ccd02	S32
#		ccd03	S32
#		ccd04	S32
#		ccd05	S32
#		ccd06	S32
#		ccd07	S32
#		ccd08	S32
#		ccd09	S32
#		ccd10	S32
#		ccd11	S32
		ccd12	S32	9223
		ccd13	S32	9223
		ccd14	S32	9223
#		ccd15	S32
#		ccd16	S32
#		ccd17	S32
#		ccd18	S32
#		ccd19	S32
#		ccd20	S32
		ccd21	S32	0
		ccd22	S32	0
		ccd23	S32	0
#		ccd24	S32
#		ccd25	S32
#		ccd26	S32
#		ccd27	S32
#		ccd28	S32
#		ccd29	S32
#		ccd30	S32
#		ccd31	S32
#		ccd32	S32
#		ccd33	S32
#		ccd34	S32
#		ccd35	S32
	END
	CHIP.XPARITY.DEPEND	STR	CHIP.NAME
	CHIP.XPARITY	METADATA
#		ccd00	S32	
#		ccd01	S32
#		ccd02	S32
#		ccd03	S32
#		ccd04	S32
#		ccd05	S32
#		ccd06	S32
#		ccd07	S32
#		ccd08	S32
#		ccd09	S32
#		ccd10	S32
#		ccd11	S32
		ccd12	S32	1
		ccd13	S32	1
		ccd14	S32	1
#		ccd15	S32
#		ccd16	S32
#		ccd17	S32
#		ccd18	S32
#		ccd19	S32
#		ccd20	S32
		ccd21	S32	1
		ccd22	S32	1
		ccd23	S32	1
#		ccd24	S32
#		ccd25	S32
#		ccd26	S32
#		ccd27	S32
#		ccd28	S32
#		ccd29	S32
#		ccd30	S32
#		ccd31	S32
#		ccd32	S32
#		ccd33	S32
#		ccd34	S32
#		ccd35	S32
	END
	CHIP.YPARITY.DEPEND	STR	CHIP.NAME
	CHIP.YPARITY	METADATA
#		ccd00	S32	
#		ccd01	S32
#		ccd02	S32
#		ccd03	S32
#		ccd04	S32
#		ccd05	S32
#		ccd06	S32
#		ccd07	S32
#		ccd08	S32
#		ccd09	S32
#		ccd10	S32
#		ccd11	S32
		ccd12	S32	-1
		ccd13	S32	-1
		ccd14	S32	-1
#		ccd15	S32
#		ccd16	S32
#		ccd17	S32
#		ccd18	S32
#		ccd19	S32
#		ccd20	S32
		ccd21	S32	1
		ccd22	S32	1
		ccd23	S32	1
#		ccd24	S32
#		ccd25	S32
#		ccd26	S32
#		ccd27	S32
#		ccd28	S32
#		ccd29	S32
#		ccd30	S32
#		ccd31	S32
#		ccd32	S32
#		ccd33	S32
#		ccd34	S32
#		ccd35	S32
	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
 
