TABLE diffRun, diffSkyfile
TITLE Diff Processed Skyfiles
FILE  diffProcessedSkyfile_Images.php
MENU  ipp.stack.dat

WHERE diffRun.diff_id             = diffSkyfile.diff_id
# WHERE diffRun.state = 'full'
# WHERE diffSkyfile.fault = 0

# define image names to be used below
# IMAGE VAR basename filerule camera class_id
IMAGE JPEG2 $diffSkyfile.path_base PPSUB.OUTPUT.JPEG2 GPC1 NONE

# XXX need to get camera from lookup
ARGS  ARG7 diffSkyfile.diff_id=$diffSkyfile.diff_id
ARGS  ARG7 diffSkyfile.skycell_id=$diffSkyfile.skycell_id
ARGS  ARG7 camera=GPC1
ARGS  ARG7 basename=$diffSkyfile.path_base

#     field                         size  format  name           show     link to         extras
FIELD diffSkyfile.diff_id,             5, %d,     Diff ID
FIELD diffSkyfile.skycell_id,          5, %s,     Skycell ID
FIELD diffRun.label,    	       5, %s,     Label
FIELD *,    	                       8, %s,     image,         image=JPEG2, diffProcessedSkyfile_Images.php,  ARG7
# FIELD diffRun.filter,    	       5, %s,     Filter
FIELD diffRun.tess_id,    	       5, %s,     Tess ID
FIELD diffRun.state,    	       7, %s,     State,         value,   diffProcessedSkyfile.php, ARG7
FIELD diffSkyfile.bg,                  5, %.2f,   backgnd
FIELD diffSkyfile.bg_stdev,            5, %.2f,   stdev    
FIELD diffSkyfile.dtime_diff,          5, %.2f,   t(diff)
FIELD diffSkyfile.dtime_match,         5, %.2f,   t(match)
FIELD diffSkyfile.dtime_phot,          5, %.2f,   t(phot)
FIELD diffSkyfile.dtime_script,        5, %.2f,   t(script)
FIELD diffSkyfile.stamps_num,          5, %d,     n(stamps)
FIELD diffSkyfile.stamps_mean,         5, %.2f,   mean(stamps)
FIELD diffSkyfile.stamps_rms,          5, %.2f,   rms(stamps)
FIELD diffSkyfile.sources,             5, %d,     n(sources)
FIELD diffSkyfile.path_base,           5, %s,     path_base,     none

TAIL PHP insert_image ('PPSUB.OUTPUT.JPEG1', 'width=90%');
TAIL PHP insert_log ('LOG.EXP');
