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

RESTRICT_COUNT AND dateobs >= CURDATE()
UNRESTRICTED AND dateobs >= CURDATE()

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 chipRun.data_group,    	 7, %s,     data grp
FIELD chipRun.dist_group,    	 7, %s,     dist grp
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

