Index: branches/bills_081204/ippMonitor/def/camIQstats.d
===================================================================
--- branches/bills_081204/ippMonitor/def/camIQstats.d	(revision 20890)
+++ branches/bills_081204/ippMonitor/def/camIQstats.d	(revision 20890)
@@ -0,0 +1,40 @@
+TABLE camRun, chipRun, rawExp, camProcessedExp
+TITLE Per-Exposure Image Quality Stats
+FILE  camIQstats.php
+MENU  ipp.science.dat
+
+# limit this table to non-OBJECT types of images
+WHERE camRun.state = 'full'
+WHERE camRun.chip_id = chipRun.chip_id
+WHERE chipRun.exp_id = rawExp.exp_id
+WHERE camProcessedExp.cam_id  = camRun.cam_id
+WHERE camProcessedExp.fault = 0
+
+ARGS  ARG1  rawImfile.exp_id=$rawExp.exp_id
+ARGS  ARG2  chipRun.chip_id=$chipRun.chip_id
+
+OP   OP1  0.5*($camProcessedExp.fwhm_major_uq + $camProcessedExp.fwhm_minor_uq)
+OP   OP2  0.5*($camProcessedExp.fwhm_major_lq + $camProcessedExp.fwhm_minor_lq)
+
+#     field                   size  format  name         show    link to                  extras
+FIELD rawExp.exp_name,     	 5, %s,     Exp Name
+FIELD chipRun.label,    	 7, %s,     Label
+FIELD rawExp.dateobs,        	19, %T,     Date/Time
+FIELD rawExp.filter,         	10, %s,     FILTER
+FIELD rawExp.exp_time,       	 5, %.2f,     exp_time    
+FIELD rawExp.airmass,        	 5, %.4f,     airmass     
+
+FIELD camProcessedExp.fwhm_major, 5, %.2f, fwhm major psf
+FIELD camProcessedExp.fwhm_minor, 5, %.2f, fwhm minor psf
+FIELD camProcessedExp.fwhm_major_uq, 5, %.2f, fwhm UQ, op=OP1
+FIELD camProcessedExp.fwhm_major_lq, 5, %.2f, fwhm LQ, op=OP2
+FIELD camProcessedExp.fwhm_minor_uq, 5, %.2f, fwhm UQ, none
+FIELD camProcessedExp.fwhm_minor_lq, 5, %.2f, fwhm UQ, none
+
+FIELD camProcessedExp.iq_fwhm_major, 5, %.2f, fwhm major moments
+FIELD camProcessedExp.iq_fwhm_minor, 5, %.2f, fwhm minor moments
+
+FIELD camProcessedExp.iq_m2, 5, %.2f, m2 moment
+FIELD camProcessedExp.iq_m3, 5, %.2f, m3 moment
+FIELD camProcessedExp.iq_m4, 5, %.2f, m4 moment
+
Index: branches/bills_081204/ippMonitor/def/chipIQstats.d
===================================================================
--- branches/bills_081204/ippMonitor/def/chipIQstats.d	(revision 20890)
+++ branches/bills_081204/ippMonitor/def/chipIQstats.d	(revision 20890)
@@ -0,0 +1,45 @@
+TABLE chipRun, rawExp, chipProcessedImfile
+TITLE Per-Chip Image Quality Stats
+FILE  chipIQstats.php
+MENU  ipp.science.dat
+
+# limit this table to non-OBJECT types of images
+WHERE chipRun.state = 'full'
+WHERE chipRun.exp_id = rawExp.exp_id
+WHERE chipRun.chip_id = chipProcessedImfile.chip_id
+
+ARGS  ARG1  rawImfile.exp_id=$rawExp.exp_id
+ARGS  ARG2  chipRun.chip_id=$chipRun.chip_id
+
+OP   OP1  0.5*($chipProcessedImfile.fwhm_major_uq + $chipProcessedImfile.fwhm_minor_uq)
+OP   OP2  0.5*($chipProcessedImfile.fwhm_major_lq + $chipProcessedImfile.fwhm_minor_lq)
+
+#     field                   size  format  name         show    link to                  extras
+FIELD rawExp.exp_name,     	 5, %s,     Exp Name
+FIELD chipProcessedImfile.class_id, 5, %s,  chip
+FIELD chipRun.chip_id,    	 5, %d,     Ch ID,       value,  chipProcessedImfile.php, ARG2
+FIELD chipRun.label,    	 7, %s,     Label
+FIELD rawExp.dateobs,        	19, %T,     Date/Time
+FIELD rawExp.filter,         	10, %s,     FILTER
+FIELD rawExp.exp_time,       	 5, %.2f,     exp_time    
+FIELD rawExp.airmass,        	 5, %.4f,     airmass     
+
+FIELD 0.5*(chipProcessedImfile.fwhm_major + chipProcessedImfile.fwhm_minor) as fwhm, 5, %.2f, fwhm psf
+FIELD chipProcessedImfile.fwhm_major, 5, %.2f, fwhm major psf
+FIELD chipProcessedImfile.fwhm_minor, 5, %.2f, fwhm minor psf
+FIELD 0.5*(chipProcessedImfile.fwhm_major_uq + chipProcessedImfile.fwhm_minor_uq), 5, %.2f, fwhm UQ
+FIELD 0.5*(chipProcessedImfile.fwhm_major_lq + chipProcessedImfile.fwhm_minor_lq), 5, %.2f, fwhm LQ
+
+FIELD 0.5*(chipProcessedImfile.iq_fwhm_major + chipProcessedImfile.iq_fwhm_minor), 5, %.2f, fwhm moments
+FIELD chipProcessedImfile.iq_fwhm_major, 5, %.2f, fwhm major moments
+FIELD chipProcessedImfile.iq_fwhm_minor, 5, %.2f, fwhm minor moments
+
+#FIELD chipProcessedImfile.fwhm_major_uq, 5, %.2f, fwhm UQ, op=OP1
+#FIELD chipProcessedImfile.fwhm_major_lq, 5, %.2f, fwhm LQ, op=OP2
+#FIELD chipProcessedImfile.fwhm_minor_uq, 5, %.2f, fwhm UQ, none
+#FIELD chipProcessedImfile.fwhm_minor_lq, 5, %.2f, fwhm UQ, none
+
+FIELD chipProcessedImfile.iq_m2, 5, %.2f, m2 moment
+FIELD chipProcessedImfile.iq_m3, 5, %.2f, m3 moment
+FIELD chipProcessedImfile.iq_m4, 5, %.2f, m4 moment
+
Index: branches/bills_081204/ippMonitor/def/chipProcessedImfile_failure.d
===================================================================
--- trunk/ippMonitor/def/chipProcessedImfile_failure.d	(revision 19726)
+++ branches/bills_081204/ippMonitor/def/chipProcessedImfile_failure.d	(revision 20890)
@@ -10,5 +10,5 @@
 WHERE chipProcessedImfile.fault != 0
 
-ARGS  ARG1 rawImfile.exp_id=$chipRun.exp_id
+ARGS  ARG1 rawImfile.exp_id=$rawExp.exp_id
 
 ARGS  ARG2 chipRun.chip_id=$chipRun.chip_id
Index: branches/bills_081204/ippMonitor/def/detProcessedImfile.d
===================================================================
--- trunk/ippMonitor/def/detProcessedImfile.d	(revision 19726)
+++ branches/bills_081204/ippMonitor/def/detProcessedImfile.d	(revision 20890)
@@ -12,5 +12,5 @@
 FIELD rawExp.exp_name,                  5, %s,     Exp Name
 FIELD detProcessedImfile.class_id,      8, %s,     Chip ID
-FIELD detProcessedImfile.fault,         5, %d,     Chip ID
+FIELD detProcessedImfile.fault,         5, %d,     fault
 FIELD detProcessedImfile.bg, 	        8, %f,     backgnd
 FIELD detProcessedImfile.bg_stdev,      8, %s,     stdev
Index: branches/bills_081204/ippMonitor/def/detResidExp.d
===================================================================
--- trunk/ippMonitor/def/detResidExp.d	(revision 19726)
+++ branches/bills_081204/ippMonitor/def/detResidExp.d	(revision 20890)
@@ -6,4 +6,5 @@
 # the following WHERE clauses are added to all queries joined by AND
 WHERE detResidExp.exp_id = rawExp.exp_id
+WHERE detResidExp.det_id = detInputExp.det_id
 WHERE detResidExp.exp_id = detInputExp.exp_id
 WHERE detResidExp.iteration = detInputExp.iteration
@@ -26,5 +27,5 @@
 #     field                   size  format  name       show         link to              linkargs
 FIELD detResidExp.det_id,        7, %s,     Det ID,    value
-FIELD rawExp.camera,            10, %s,     camera,    value
+FIELD rawExp.camera,            10, %s,     camera,    none
 FIELD detResidExp.exp_id, 	 5, %s,     Exp ID,    value,       rawImfile.php,       ARG1
 FIELD rawExp.exp_name, 	         5, %s,     Exp Name,  value,       rawImfile.php,       ARG1
@@ -39,16 +40,23 @@
 FIELD detResidExp.bin_stdev,     8, %.3f,   bin stdev, value
 FIELD (detResidExp.bg/detResidExp.bin_stdev), 8, %.3f, S/N, value
+FIELD (detResidExp.bg/rawExp.exp_time), 8, %.3f, flux, value
 # FIELD *,                         8, %s,     S/N,       op=OP1
-FIELD detResidExp.fringe_0,      8, %.3f,   fringe,    value
-FIELD detResidExp.fringe_1,      8, %.3f,   fringe err, value
-FIELD detResidExp.fringe_2,      8, %.3f,   fringe stdev, value
-FIELD detResidExp.user_1,        8, %.3f,   dfringe,    value
-FIELD detResidExp.user_2,        8, %.3f,   dfringe err, value
-FIELD detResidExp.user_3,        8, %.3f,   dfringe stdev, value
+# FIELD detResidExp.fringe_0,      8, %.3f,   fringe,    value
+# FIELD detResidExp.fringe_1,      8, %.3f,   fringe err, value
+# FIELD detResidExp.fringe_2,      8, %.3f,   fringe stdev, value
+# FIELD detResidExp.user_1,        8, %.3f,   dfringe,    value
+# FIELD detResidExp.user_2,        8, %.3f,   dfringe err, value
+# FIELD detResidExp.user_3,        8, %.3f,   dfringe stdev, value
 FIELD rawExp.dateobs,           19, %T,     obs date,  value
 FIELD rawExp.filter,            10, %s,     filter,    value
+FIELD rawExp.pon_time,          10, %d,    pon_time,    value
 FIELD rawExp.exp_time,           8, %.2f,   exptime,   value
 FIELD rawExp.ccd_temp,           8, %.2f,   ccd temp,  value
 FIELD rawExp.airmass,            8, %.4f,   airmass,   value
+FIELD rawExp.sun_alt,            8, %.4f,   sun_alt,   value
+FIELD rawExp.sun_angle,          8, %.4f,   sun_angle, value
+FIELD rawExp.moon_alt,           8, %.4f,   moon_alt,  value
+FIELD rawExp.moon_angle,         8, %.4f,   moon_angle, value
+FIELD rawExp.moon_phase,         8, %.4f,   moon_phase, value
 FIELD detResidExp.path_base,    20, %s,     path_base, none
 
Index: branches/bills_081204/ippMonitor/def/detResidExp_noimage.d
===================================================================
--- trunk/ippMonitor/def/detResidExp_noimage.d	(revision 19726)
+++ branches/bills_081204/ippMonitor/def/detResidExp_noimage.d	(revision 20890)
@@ -51,4 +51,9 @@
 FIELD rawExp.ccd_temp,           8, %.2f,   ccd temp,  value
 FIELD rawExp.airmass,            8, %.4f,   airmass,   value
+FIELD rawExp.sun_alt,            8, %.4f,   sun_alt,   value
+FIELD rawExp.sun_angle,          8, %.4f,   sun_angle, value
+FIELD rawExp.moon_alt,           8, %.4f,   moon_alt,  value
+FIELD rawExp.moon_angle,         8, %.4f,   moon_angle, value
+FIELD rawExp.moon_phase,         8, %.4f,   moon_phase, value
 FIELD detResidExp.path_base,    20, %s,     path_base, none
 
Index: branches/bills_081204/ippMonitor/def/rawDetrendExp.d
===================================================================
--- trunk/ippMonitor/def/rawDetrendExp.d	(revision 19726)
+++ branches/bills_081204/ippMonitor/def/rawDetrendExp.d	(revision 20890)
@@ -5,5 +5,5 @@
 
 # limit this table to non-OBJECT types of images
-WHERE rawExp.exp_type != 'OBJECT'
+WHERE (rawExp.exp_type != 'OBJECT' and rawExp.exp_type != 'LIGHT')
 
 ARGS ARG1 exp_id=$exp_id
Index: branches/bills_081204/ippMonitor/def/rawExp.d
===================================================================
--- trunk/ippMonitor/def/rawExp.d	(revision 19726)
+++ branches/bills_081204/ippMonitor/def/rawExp.d	(revision 20890)
@@ -4,5 +4,5 @@
 MENU  ipp.load.dat
 
-ARGS ARG1 exp_id=$exp_id
+ARGS ARG1 rawImfile.exp_id=$exp_id
 
 OP   OP1  $ra * 57.295783
@@ -23,5 +23,8 @@
 FIELD    exp_time,     5,  %.2f,   exp_time    
 FIELD    ccd_temp,     5,  %.2f,   ccd_temp
+FIELD    pon_time,     5,  %.2f,   pon_time
+FIELD    sat_pixel_frac, 5,   %.4f,   f(sat pixels)
 FIELD    bg,	       8,  %.2f,   backgnd
 FIELD    bg_stdev,     8,  %.2f,   stdev
 FIELD    bg_mean_stdev, 8, %.2f,   [stdev]
+FIELD    comment,      65,  %s,     Comment
Index: branches/bills_081204/ippMonitor/def/rawScienceExp.d
===================================================================
--- trunk/ippMonitor/def/rawScienceExp.d	(revision 19726)
+++ branches/bills_081204/ippMonitor/def/rawScienceExp.d	(revision 20890)
@@ -5,7 +5,7 @@
 
 # limit this table to OBJECT types of images
-WHERE rawExp.exp_type = 'OBJECT'
+WHERE (rawExp.exp_type = 'OBJECT' or rawExp.exp_type = 'LIGHT')
 
-ARGS ARG1 exp_id=$exp_id
+ARGS ARG1 rawImfile.exp_id=$exp_id
 
 OP   OP1  $ra * 57.295783
@@ -26,6 +26,8 @@
 FIELD    exp_time,     5,  %.2f,   exp_time    
 FIELD    ccd_temp,     5,  %.2f,   ccd_temp
+FIELD    pon_time,     5,  %.2f,   pon_time
+FIELD    sat_pixel_frac, 5,   %.4f,   f(sat pixels)
 FIELD    bg,	       8,  %.2f,   backgnd
 FIELD    bg_stdev,     8,  %.2f,   stdev
 FIELD    bg_mean_stdev, 8, %.2f,   [stdev]
-FIELD    comment,      65,  %s,     Comment
+FIELD    comment,      80,  %s,     Comment
