# The LOT1m data is a single chip with single cell

# How to recognise this type
RULE	METADATA
	TELESCOP	STR	LOT1m
	INSTRUME	STR	Roper
	OBSERVAT	STR	NCU Lulin observatory, Taiwan
	CAMERA		STR	Princeton Instruments 1300B
	DETECTOR	STR	EEV 1340x1300 CCD36-4
	NAXIS           S32     2
	SWCREATE	STR	MaxIm DL Version 4.10
END

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

# What's in the FITS file?
CONTENTS	STR	Chip:Cell:Amplifier

# Specify the cells
CELLS		METADATA
	# Cell type, concepts to use
	Amplifier	METADATA
		CELL.BIASSEC.SOURCE	STR	NONE
		CELL.TRIMSEC.SOURCE	STR	VALUE
		CELL.TRIMSEC		STR	[0:0,0:0]
	END
END

# How to translate PS concepts into FITS headers
TRANSLATION	METADATA
	FPA.TELESCOPE	STR	TELESCOP
	FPA.INSTRUMENT	STR	INSTRUME
	FPA.DETECTOR	STR	DETECTOR
	FPA.OBSTYPE	STR	IMAGETYP
	FPA.TIME	STR	DATE-OBS TIME-OBS
	FPA.TIMESYS	STR	TIMESYS
        FPA.RA          STR     OBJCTRA
        FPA.DEC         STR     OBJCTDEC
	FPA.EXPOSURE	STR	EXPTIME
	FPA.TEMP	STR	CCD-TEMP
	CHIP.TEMP	STR	CCD-TEMP
        CELL.EXPOSURE   STR     EXPTIME
        CELL.DARKTIME   STR     EXPTIME
        CELL.READNOISE  STR     SLOWRN
	CELL.GAIN	STR	SLOWGAIN
	CELL.TIME	STR	DATE-OBS TIME-OBS
	CELL.TIMESYS	STR	TIMESYS
        CELL.XBIN       STR     XBINNING
        CELL.YBIN       STR     YBINNING
	CELL.XWINDOW	STR	XORGSUBF
	CELL.YWINDOW	STR	YORGSUBF
END

# Default PS concepts that may be specified by value
DEFAULTS        METADATA
        FPA.AIRMASS     	F32	0.0
        FPA.FILTERID    	STR     UNKNOWN
        FPA.FILTER      	STR     UNKNOWN
	FPA.OBJECT		STR	Unknown object
        FPA.RADECSYS    	STR     ICRS
        FPA.POSANGLE    	STR     0.0
	FPA.FOCUS		STR	0.0
	FPA.ALT			STR	0.0
	FPA.AZ			STR	0.0

	CHIP.XSIZE		S32	1340
	CHIP.YSIZE		S32	1300
	CELL.XSIZE		S32	1340
	CELL.YSIZE		S32	1300
	CELL.READDIR		S32	1		# Cell is read in x direction
        CELL.SATURATION		F32	50000.0
        CELL.BAD                F32     0
	CELL.XPARITY		S32	1
	CELL.YPARITY		S32	1
	CELL.X0			S32	0
	CELL.Y0			S32	0
	CHIP.X0			S32	0
	CHIP.Y0			S32	0
	CHIP.XPARITY		S32	1
	CHIP.YPARITY		S32	1
END


# How to translation PS concepts into database lookups
DATABASE	METADATA
#	CELL.GAIN	STR	SELECT gain FROM camera WHERE chip_id = '{CHIP.NAME}' AND cell_id = '{CELL.NAME}'
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
 
