# 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
	EXTEND		BOOL	T
	NEXTEND		S32	36
END

# How to read this data
PHU		STR	FPA	# The FITS file represents an entire FPA
EXTENSIONS	STR	CHIP	# The extensions represent chips

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

# Specify the cells
CELLS		METADATA
	left		METADATA
		CELL.BIASSEC	STR	HEADER:BSECA
		CELL.TRIMSEC	STR	HEADER:TSECA
	END

	right		METADATA
		CELL.BIASSEC	STR	HEADER:BSECB
		CELL.TRIMSEC	STR	HEADER:TSECB
	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.MJD         STR     MJD-OBS
        CELL.EXPOSURE   STR     EXPTIME
        CELL.DARKTIME   STR     DARKTIME
        CELL.XBIN       STR     CCDBIN1
        CELL.YBIN       STR     CCDBIN2
        CELL.GAIN       STR     GAIN
        CELL.READNOISE  STR     RDNOISE
        CELL.SATURATION STR     SATURATE
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
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		
