TABLE chipRun, rawExp, rawImfile
TITLE Chip Pending Imfiles
FILE  chipPendingImfile.php
MENU  ipp.science.dat

# XXX this query does not exclude imfiles already processed (unless the exp is done)
# I need to join against chipProcessedImfile and exclude ones where chipProcessedImfile.class_id is not NULL

# limit this table to OBJECT types of images
WHERE chipRun.state = 'new'
WHERE chipRun.exp_id = rawExp.exp_id
WHERE rawImfile.exp_id = rawExp.exp_id

ARGS  ARG1 rawImfile.exp_id=$rawExp.exp_id
ARGS  ARG2 chipRun.chip_id=$chipRun.chip_id

OP   OP1  $rawExp.ra * 57.295783
OP   OP2  $rawExp.decl * 57.295783

#     field                   size  format  name         show    link to                  extras
FIELD rawExp.exp_name,     	10, %s,     Exp Name
FIELD rawImfile.class_id,     	 8, %s,     Class ID
FIELD rawExp.exp_id,     	 5, %d,     Exp ID,      value,  rawImfile.php,           ARG1
FIELD chipRun.chip_id,    	 7, %d,     Chip ID,     value,  chipProcessedImfile.php, ARG2
FIELD chipRun.state,    	 7, %s,     State
FIELD chipRun.label,    	 7, %s,     Label
FIELD rawExp.telescope,      	10, %s,     Telescope
FIELD rawExp.camera,         	10, %s,     Camera
FIELD rawExp.dateobs,        	19, %T,     Date/Time
FIELD rawExp.ra,       	         8, %C, RA,          op=OP1    
FIELD rawExp.decl,       	 8, %C, DEC,         op=OP2
FIELD rawExp.object,         	 8, %s,     Object
FIELD rawExp.filter,         	10, %s,     FILTER
FIELD rawExp.exp_time,       	 5, %.2f,   exp_time    
FIELD rawExp.airmass,        	 5, %.4f,   airmass     
FIELD rawExp.bg,             	 5, %.2f,   backgnd
FIELD rawExp.bg_stdev,       	 5, %.2f,   stdev    
FIELD *,                         5, %d,     Nstars,      value=0
FIELD *, 	                 5, %.2f,   FHWM,        value=0.0
FIELD rawExp.comment,  	        65, %s,     Comment
