# The raw GPC data comes off the telescope with each of the chips stored in separate files

# How to identify this type
RULE	METADATA
#	TELESCOP	STR	PS1
#	DETECTOR	STR	GPC1
	EXTEND		BOOL	T
	NEXTEND		S32	64
	NAMPS		S32	64
END

# How to read this data
PHU		STR	CHIP	# The FITS file represents a single chip
EXTENSIONS	STR	CELL	# The extensions represent cells

# What's in the FITS file?
CONTENTS	METADATA
	# Extension name, type
	xy00	STR	pitch10u
	xy01	STR	pitch10u
	xy02	STR	pitch10u
	xy03	STR	pitch10u
	xy04	STR	pitch10u
	xy05	STR	pitch10u
	xy06	STR	pitch10u
	xy07	STR	pitch10u
	xy10	STR	pitch10u
	xy11	STR	pitch10u
	xy12	STR	pitch10u
	xy13	STR	pitch10u
	xy14	STR	pitch10u
	xy15	STR	pitch10u
	xy16	STR	pitch10u
	xy17	STR	pitch10u
	xy20	STR	pitch10u
	xy21	STR	pitch10u
	xy22	STR	pitch10u
	xy23	STR	pitch10u
	xy24	STR	pitch10u
	xy25	STR	pitch10u
	xy26	STR	pitch10u
	xy27	STR	pitch10u
	xy30	STR	pitch10u
	xy31	STR	pitch10u
	xy32	STR	pitch10u
	xy33	STR	pitch10u
	xy34	STR	pitch10u
	xy35	STR	pitch10u
	xy36	STR	pitch10u
	xy37	STR	pitch10u
	xy40	STR	pitch10u
	xy41	STR	pitch10u
	xy42	STR	pitch10u
	xy43	STR	pitch10u
	xy44	STR	pitch10u
	xy45	STR	pitch10u
	xy46	STR	pitch10u
	xy47	STR	pitch10u
	xy50	STR	pitch10u
	xy51	STR	pitch10u
	xy52	STR	pitch10u
	xy53	STR	pitch10u
	xy54	STR	pitch10u
	xy55	STR	pitch10u
	xy56	STR	pitch10u
	xy57	STR	pitch10u
	xy60	STR	pitch10u
	xy61	STR	pitch10u
	xy62	STR	pitch10u
	xy63	STR	pitch10u
	xy64	STR	pitch10u
	xy65	STR	pitch10u
	xy66	STR	pitch10u
	xy67	STR	pitch10u
	xy70	STR	pitch10u
	xy71	STR	pitch10u
	xy72	STR	pitch10u
	xy73	STR	pitch10u
	xy74	STR	pitch10u
	xy75	STR	pitch10u
	xy76	STR	pitch10u
	xy77	STR	pitch10u
END

# Specify the cell data
CELLS	METADATA
	pitch10u	METADATA
		CELL.BIASSEC.SOURCE	STR	VALUE
		CELL.TRIMSEC.SOURCE	STR	VALUE
		CELL.BIASSEC		STR	[575:606,1:594]
		CELL.TRIMSEC		STR	[1:574,1:594]
	#	CELL.BIASSEC		STR	BIASSEC
	#	CELL.TRIMSEC		STR	DATASEC
	END

	# This is just in here for fun
	pitch12u	METADATA
		CELL.BIASSEC.SOURCE	STR	VALUE
		CELL.TRIMSEC.SOURCE	STR	VALUE
		CELL.BIASSEC		STR	[1:10,1:512];[523:574,1:512]
		CELL.TRIMSEC		STR	[11:522,1:512]
	#	CELL.BIASSEC		STR	BIASSEC
	#	CELL.TRIMSEC		STR	TRIMSEC
	END
END


# How to translate PS concepts into FITS headers
TRANSLATION	METADATA
	CELL.XBIN	STR	CCDSUM
	CELL.YBIN	STR	CCDSUM
	CELL.X0		STR	IMNPIX1
	CELL.Y0		STR	IMNPIX2
	CELL.XPARITY	STR	LTM1_1
	CELL.YPARITY	STR	LTM2_2
	CELL.SATURATION	STR	SATURATE
END

# Default PS concepts that may be specified by value
DEFAULTS	METADATA
	FPA.AIRMASS	F32	0.0
	FPA.FILTER	STR	NONE
	FPA.POSANGLE	F32	0.0
	FPA.RA		STR	0:0:0
	FPA.DEC		STR	0:0:0
	FPA.RADECSYS	STR	ICRS
	FPA.NAME	S32	12345
	CELL.EXPOSURE	F32	0.0
	CELL.DARKTIME	F32	0.0
	CELL.GAIN	F32	1.0
	CELL.READNOISE	F32	0.0
	CELL.READDIR	S32	2
	CELL.BAD	S32	0
	CELL.TIMESYS	STR	UTC
	CELL.TIME	STR	2005-11-23T12:34:56.78
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,CELL
#	CELL.READNOISE	dbEntry		Camera		readNoise	chipId,cellId	CHIP,CELL

# 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
	CELL.TIME	STR	ISO
	CELL.BINNING	STR	TOGETHER
	CELL.X0		STR	FORTRAN
	CELl.Y0		STR	FORTRAN
END
 
# Recipe options
RECIPES		METADATA
	PHASE2		STR	phase2.config		# Phase 2 recipe details
END
 
# How to get the supplementary stuff: mask and weight
SUPPLEMENTARY	METADATA
	MASK.SOURCE	STR	FILE		# Source type for mask: EXT | FILE
	MASK.NAME	STR	%a_mask.fits	# Name for mask extension or filename
	WEIGHT.SOURCE	STR	FILE		# Source type for weight: EXT | FILE
	WEIGHT.NAME	STR	%a_weight.fits	# Name for weight extension or filename
END
