# Camera format for WFI/8k on the UH88

# How to recognise this type
RULE	METADATA
	ORIGIN		STR	UH 2.2m Telescope
	CCD		STR	8k
	DETECTOR	STR	8k
	INSTRUME	STR	8k/WFI
	IMAGESWV	STR	CFHT DetCom v3.41 (Jun 10 2008)
	NAXIS           S32     2
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.OBS		STR	EXPNUM	# A PHU keyword for unique identifier
	CONTENT		STR	EXTNAME	# Key to the CONTENTS menu
	CONTENT.RULE	STR	{CHIP.NAME} # How to derive the CONTENT when writing
END

# What's in the FITS file?
CONTENTS	METADATA
	# Content name, chipType
	chip00		STR	chip00:SingleAmp
	chip01		STR	chip01:SingleAmp
	chip02		STR	chip02:SingleAmp
	chip03		STR	chip03:SingleAmp
	chip04		STR	chip04:SingleAmp
	chip05		STR	chip05:SingleAmp
	chip06		STR	chip06:SingleAmp
	chip07		STR	chip07:SingleAmp
END

# Specify the chips
CHIPS		METADATA
	# Chip type, cellName:cellType
	SingleAmp	STR	Cell:amplifier
END


# Specify the cells
CELLS		METADATA
	# Cell type, concepts for this type
	amplifier	METADATA
		CELL.BIASSEC.SOURCE	STR	HEADER
		CELL.TRIMSEC.SOURCE	STR	HEADER
		CELL.BIASSEC		STR	BIASSEC
		CELL.TRIMSEC		STR	DATASEC
	END
END

# How to translate PS concepts into FITS headers
TRANSLATION	METADATA
	FPA.INSTRUMENT	STR	INSTRUME
	FPA.DETECTOR    STR	DETECTOR
        FPA.AIRMASS     STR     AIRMASS
        FPA.FILTER      STR     FILTER
        FPA.FILTERID    STR     FILTER
        FPA.RA          STR     RA
        FPA.DEC         STR     DEC
	FPA.OBSTYPE	STR	OBSTYPE
	FPA.OBJECT	STR	OBJECT
	FPA.FOCUS	STR	TELFOCUS
	FPA.TIME	STR	DATE-OBS TIME-OBS
	FPA.TIMESYS	STR	TIMESYS
	FPA.EXPOSURE	STR	EXPTIME
        CELL.EXPOSURE   STR     EXPTIME
        CELL.DARKTIME   STR     DARKTIME
	CELL.TIME	STR	DATE-OBS TIME-OBS
	CELL.TIMESYS	STR	TIMESYS
        CELL.XBIN       STR     CCDBIN1
        CELL.YBIN       STR     CCDBIN2
        CELL.SATURATION STR     MAXLIN
END

# Default PS concepts that may be specified by value
DEFAULTS        METADATA
        FPA.POSANGLE    	F32	0.0
        FPA.RADECSYS    	STR     ICRS
        CELL.READNOISE  	F32	10.0	# A guess
	CELL.GAIN		F32	1.0	# A guess

	FPA.TELESCOPE		STR	UH 88-inch
	CHIP.XSIZE		S32	2048
	CHIP.YSIZE		S32	4096
	CELL.XSIZE		S32	2048
	CELL.YSIZE		S32	4096
	CELL.XWINDOW		S32	0
	CELL.YWINDOW		S32	0
	CELL.READDIR		S32	1		# Cell is read in x direction
        CELL.BAD                F32     0
	CELL.XPARITY		S32	1
	CELL.YPARITY		S32	1
	CELL.Y0			S32	0
	CELL.X0			S32	0
	CHIP.X0.DEPEND		STR	CHIP.NAME
	CHIP.X0		METADATA
		chip00	S32	0
		chip01	S32	2048
		chip02	S32	4096
		chip03	S32	6144
		chip04	S32	0   
		chip05	S32	2048
		chip06	S32	4096
		chip07	S32	6144
	END
	CHIP.Y0.DEPEND		STR	CHIP.NAME
	CHIP.Y0		METADATA
		chip00	S32	8192
		chip01	S32	8192
		chip02	S32	8192
		chip03	S32	8192
		chip04	S32	0
		chip05	S32	0
		chip06	S32	0
		chip07	S32	0
	END
	CHIP.XPARITY.DEPEND	STR	CHIP.NAME
	CHIP.XPARITY	METADATA
		chip00	S32	-1
		chip01	S32	-1
		chip02	S32	-1
		chip03	S32	-1
		chip04	S32	1
		chip05	S32	1
		chip06	S32	1
		chip07	S32	1
	END
	CHIP.YPARITY.DEPEND	STR	CHIP.NAME
	CHIP.YPARITY	METADATA
		chip00	S32	-1
		chip01	S32	-1
		chip02	S32	-1
		chip03	S32	-1
		chip04	S32	1
		chip05	S32	1
		chip06	S32	1
		chip07	S32	1
	END
END


# How to translation PS concepts into database lookups
DATABASE	METADATA
END		


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