Index: trunk/Ohana/src/addstar/src/GetZeroPointExposure.c
===================================================================
--- trunk/Ohana/src/addstar/src/GetZeroPointExposure.c	(revision 25872)
+++ trunk/Ohana/src/addstar/src/GetZeroPointExposure.c	(revision 25908)
@@ -1,7 +1,27 @@
 # include "addstar.h"
 
-// XXX this needs to handle the nominal zero point for the photcode(s) and the airmass term
+// this function evaluates the collection of image headers for keywords of the form ZPT_OBS.
+// Downstream, we will set the zero point offset for the image (image[0].Mcal) based on the
+// value calculated here and the nominal zero point for the chip photcode. Four possible modes
+// are defined: 
+
+// NOMINAL: in this case, the database value for the nominal zero point is used and
+// image[0].Mcal is set to zero.
+
+// CHIP_HEADER: in this case, the zero point offset measured for each chip is applied
+// independently to image[0].Mcal
+
+// CHIP_AVERAGE: in this case, the per-chip measured zero points are converted to offsets from
+// the nominal zero points, and the median zero point offset is calculate, and later applied to
+// image[0].Mcal
+
+// PHU_HEADER: in this case, the zero point measured for the entire exposure and reported in
+// the PHU header is used to set the zero point offset for each chip.  Note that in this case,
+// ZERO_POINT_OFFSET in this funciton is actually set to the zero point, and adjusted to an
+// offset in ReadImageHeader based on the per-chip zero points in the photcode database
+
 int GetZeroPointExposure (Header **headers, HeaderSet *headerSets, int Nimages) {
 
+    // the zero point correction is not applied
     if (!strcasecmp(ZERO_POINT_OPTION, "NOMINAL")) {
 	ZERO_POINT_OFFSET = 0.0;
@@ -9,4 +29,5 @@
     }
 
+    // the zero point correction is applied in ReadImageHeader
     if (!strcasecmp(ZERO_POINT_OPTION, "CHIP_HEADER")) {
 	ZERO_POINT_OFFSET = 0.0;
@@ -14,4 +35,5 @@
     }
 
+    // the zero point correction is measured here and applied in ReadImageHeader
     if (!strcasecmp(ZERO_POINT_OPTION, "CHIP_AVERAGE")) {
 	int i, Nzpt, Nmid, Nhead;
@@ -66,5 +88,5 @@
     }
     
-    // this option is not consistent with the options for photcodes
+    // the zero point (NOT the correction) is measured here and applied in ReadImageHeader
     if (!strcasecmp(ZERO_POINT_OPTION, "PHU_HEADER")) {
 	int i, Nhead;
Index: trunk/Ohana/src/addstar/src/ReadImageHeader.c
===================================================================
--- trunk/Ohana/src/addstar/src/ReadImageHeader.c	(revision 25872)
+++ trunk/Ohana/src/addstar/src/ReadImageHeader.c	(revision 25908)
@@ -203,5 +203,5 @@
   }
 
-  // if it exists, find the 
+  // in this case, lookup and apply the zero point measured for this chip
   if (!strcasecmp(ZERO_POINT_OPTION, "CHIP_HEADER")) {
       float ZPT_OBS;
@@ -214,4 +214,14 @@
   }
 
+  // in this case, lookup and apply the zero point measured for the exposure
+  if (!strcasecmp(ZERO_POINT_OPTION, "PHU_HEADER")) {
+      if (!photcodeData) {
+	  fprintf (stderr, "photcode data not supplied for this chip\n");
+	  ZERO_POINT_OFFSET = 0.0;
+      } else {
+	  ZERO_POINT_OFFSET = 0.001*photcodeData[0].C - ZERO_POINT_OFFSET;
+      }	  
+  }
+
   /* secz is in units milli-airmass */
   image[0].Mcal = ZERO_POINT_OFFSET;
