TABLE fakeRun, fakeProcessedImfile, camRun, chipRun, rawExp
TITLE fake Processed Imfile
FILE  fakeProcessedImfile_failure.php
MENU  ipp.science.dat

# limit this table to non-OBJECT types of images
WHERE fakeRun.cam_id = camRun.cam_id
WHERE camRun.chip_id = chipRun.chip_id
WHERE chipRun.exp_id = rawExp.exp_id
WHERE fakeProcessedImfile.fake_id = fakeRun.fake_id
WHERE fakeProcessedImfile.fault != 0

ARGS  ARG1  rawImfile.exp_id=$rawExp.exp_id
ARGS  ARG2  chipRun.chip_id=$chipRun.chip_id
ARGS  ARG3  camRun.cam_id=$camRun.cam_id
ARGS  ARG4  fakeRun.fake_id=$fakeRun.fake_id

ARGS  ARG5 fakeRun.fake_id=fakeRun.fake_id
ARGS  ARG5 fakeProcessedImfile.class_id=$fakeProcessedImfile.class_id
ARGS  ARG5 camera=$rawExp.camera
ARGS  ARG5 basename=$fakeProcessedImfile.path_base
ARGS  ARG5 class=$fakeProcessedImfile.class_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 fakeProcessedImfile.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 camRun.cam_id,                   7, %d,     Cam ID,       value,  camProcessedExp.php,     ARG3
FIELD fakeRun.fake_id,                 7, %d,     Fake ID,      value,  fakeProcessedImfile_failure.php, ARG4
FIELD fakeRun.state,                   7, %s,     State,       value,  fakeProcessedImfile_failure.php, ARG5
FIELD fakeRun.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, %10.6f, RA,           op=OP1      
FIELD rawExp.decl,                     8, %10.6f, 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.comment,                 65, %s,     Comment

FIELD fakeProcessedImfile.path_base,      5, %s,     path_base, none

TAIL PHP insert_log ('LOG.IMFILE');

# FIELD chipProcessedImfile.bg,          5, %.2f,   backgnd
# FIELD chipProcessedImfile.bg_stdev,    5, %.2f,   stdev    
# FIELD chipProcessedImfile.n_stars,     5, %d,     Nstars
# FIELD chipProcessedImfile.fwhm_major,  5, %.2f,   FHWM
