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

# We have no choice but to hard-code the various regions, because Keck
# only stores them as:
# WINDOW  = '1,0,0,2048,4096'
# PREPIX  =                   51
# 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	LRISBLUE
	AMPLIST		STR	1,4,0,0
	WINDOW		STR	1,0,0,2048,4096
	PREPIX		S32	51
	POSTPIX		S32	80
	BINNING		STR	1,1
	AMPPSIZE	STR	[1:1024,1:4096]
	NAXIS1		S32	4620
	NAXIS2		S32	4096
END

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

# What's in the FITS file?
CONTENTS	STR	LeftChip:LeftAmp:amp1 LeftChip:RightAmp:amp2 RightChip:LeftAmp:amp3 RightChip:RightAmp:amp4

# Specify the cell data
CELLS	METADATA
	amp1		METADATA
		CELL.BIASSEC.SOURCE	STR	VALUE
		CELL.TRIMSEC.SOURCE	STR	VALUE
		CELL.BIASSEC		STR	[1:51,1:4096];[4301:4380,1:4096]
		CELL.TRIMSEC		STR	[205:1228,1:4096]
		CELL.GAIN		F32	1.542
		CELL.X0			S32	0
	END

	amp2	METADATA
		CELL.BIASSEC.SOURCE	STR	VALUE
		CELL.TRIMSEC.SOURCE	STR	VALUE
		CELL.BIASSEC		STR	[52:102,1:4096];[4381:4460,1:4096]
		CELL.TRIMSEC		STR	[1229:2252,1:4096]
		CELL.GAIN		F32	1.546
		CELL.X0			S32	1024
	END

	amp3		METADATA
		CELL.BIASSEC.SOURCE	STR	VALUE
		CELL.TRIMSEC.SOURCE	STR	VALUE
		CELL.BIASSEC		STR	[103:153,1:4096];[4461:4540,1:4096]
		CELL.TRIMSEC		STR	[2253:3276,1:4096]
		CELL.GAIN		F32	1.632
		CELL.X0			S32	0
	END

	amp4	METADATA
		CELL.BIASSEC.SOURCE	STR	VALUE
		CELL.TRIMSEC.SOURCE	STR	VALUE
		CELL.BIASSEC		STR	[154:204,1:4096];[4541:4620,1:4096]
		CELL.TRIMSEC		STR	[3277:4300,1:4096]
		CELL.GAIN		F32	1.633
		CELL.X0			S32	1024
	END
END

# How to translate PS concepts into FITS headers
TRANSLATION	METADATA
	FPA.AIRMASS		STR	AIRMASS
	FPA.FILTER		STR	BLUFILT
	FPA.POSANGLE		STR	ROTPOSN
	FPA.RA			STR	RA
	FPA.DEC			STR	DEC
	CELL.EXPOSURE		STR	EXPOSURE
	CELL.DARKTIME		STR	EXPOSURE	# No special darktime header; use exposure time
	CELL.TIME		STR	MJD-OBS
	CELL.XBIN		STR	CCDSUM
	CELL.YBIN		STR	CCDSUM
END

# Default PS concepts that may be specified by value
DEFAULTS	METADATA
	FPA.RADECSYS		STR	ICRS
	CELL.TIMESYS		STR	UTC
	CELL.READDIR		S32	1
	CELL.XPARITY		S32	1
	CELL.YPARITY		S32	1
	CELL.Y0			S32	0
	CELL.READNOISE		F32	2.5
	CELL.SATURATION		F32	65536
	CELL.BAD		F32	0
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
