# The Low Resolution Imager and Spectrograph (LRIS) red side

# We have no choice but to hard-code the various regions, because Keck
# only stores them as:
# WINDOW  = '0,0,0,2048,2048'
# PREPIX  =                   20
# POSTPIX =                   80
# BINNING = '1,1     '
# AMPPSIZE= '[1:1024,1:4096]'

# I don't know how we would get the IPP to react to changes in the
# windowing on the fly --- we have no mechanism for setting the region
# sizes on the basis of the above keywords.  Therefore, we hard-code
# the regions and assert on our assumptions in the RULE.


# How to identify this type
RULE	METADATA
	TELESCOP	STR	Keck I
	INSTRUME	STR	LRIS
	AMPLIST		STR	2,1,0,0
	WINDOW		STR	0,0,0,2048,2048
	PREPIX		S32	20
	POSTPIX		S32	80
	BINNING		STR	1, 1
	CCDPSIZE	STR	[1:2048,1:2048]
	NAXIS1		S32	2248
	NAXIS2		S32	2048
	IMTYPE		STR	TWOAMPTOP
END

# How to read this data
FILE	METADATA
	PHU		STR	FPA	# The FITS file represents a single chip
	EXTENSIONS	STR	NONE	# There are no extensions
	FPA.NAME	STR	OBSNUM	# A PHU keyword for unique identifier within the hierarchy level
END

# What's in the FITS file?
CONTENTS	STR	RedChip:LeftSide:left RedChip:RightSide:right

# Specify the cell data
CELLS	METADATA
	left	METADATA
		CELL.BIASSEC.SOURCE	STR	VALUE
		CELL.TRIMSEC.SOURCE	STR	VALUE
		CELL.BIASSEC		STR	[1:20,1:2048];[2089:2168,1:2048]
		CELL.TRIMSEC		STR	[41:1064,1:2048]
		CELL.GAIN		F32	1.98
		CELL.READNOISE		F32	6.1
		CELL.X0			S32	0
	END

	right	METADATA
		CELL.BIASSEC.SOURCE	STR	VALUE
		CELL.TRIMSEC.SOURCE	STR	VALUE
		CELL.BIASSEC		STR	[21:40,1:2048];[2169:2248,1:2048]
		CELL.TRIMSEC		STR	[1065:2088,1:2048]
		CELL.GAIN		F32	2.17
		CELL.READNOISE		F32	6.3
		CELL.X0			S32	1023
	END
END

# How to translate PS concepts into FITS headers
TRANSLATION	METADATA
	FPA.AIRMASS	STR	AIRMASS
	FPA.FILTER	STR	FILTER
	FPA.POSANGLE	STR	POSANG
	FPA.RA		STR	OBJ-RA
	FPA.DEC		STR	OBJ-DEC
	CELL.EXPOSURE	STR	EXPTIME
	CELL.DARKTIME	STR	DARKTIME
	CELL.TIME	STR	MJD-OBS
END

# Default PS concepts that may be specified by value
DEFAULTS	METADATA
	FPA.RADECSYS	STR	ICRS
	CELL.XPARITY	S32	1
	CELL.YPARITY	S32	1
	CELL.SATURATION	F32	65535
	CELL.BAD	F32	0
	CELL.XBIN	S32	1
	CELL.YBIN	S32	1
	CELL.READDIR	S32	1
	CELL.TIMESYS	STR	UTC
END

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