Index: trunk/Ohana/src/addstar/include/addstar.h
===================================================================
--- trunk/Ohana/src/addstar/include/addstar.h	(revision 29123)
+++ trunk/Ohana/src/addstar/include/addstar.h	(revision 29132)
@@ -121,4 +121,7 @@
 char    ZERO_POINT_OPTION[64];
 float	ZERO_POINT_OFFSET;
+float	ZERO_POINT_ERROR;
+float   ZPT_OBS_PHU;
+float   ZPT_ERR_PHU;
 
 // carries the mosaic into gstars
Index: trunk/Ohana/src/addstar/src/GetZeroPointExposure.c
===================================================================
--- trunk/Ohana/src/addstar/src/GetZeroPointExposure.c	(revision 29123)
+++ trunk/Ohana/src/addstar/src/GetZeroPointExposure.c	(revision 29132)
@@ -17,7 +17,8 @@
 
 // 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
+// the PHU header is used to set the zero point offset for each chip.  
+// Here set ZPT_OBS_PHU and ZPT_ERR_PHU to the observed values from the header.
+// ZERO_POINT_OFFSET is calculated in ReadImageHeader based on the per-chip zero points in the
+// photcode database.
 
 int GetZeroPointExposure (Header **headers, HeaderSet *headerSets, off_t Nimages) {
@@ -26,4 +27,5 @@
     if (!strcasecmp(ZERO_POINT_OPTION, "NOMINAL")) {
 	ZERO_POINT_OFFSET = 0.0;
+	ZERO_POINT_ERROR = NAN;
 	return (TRUE);
     }
@@ -32,4 +34,5 @@
     if (!strcasecmp(ZERO_POINT_OPTION, "CHIP_HEADER")) {
 	ZERO_POINT_OFFSET = 0.0;
+	ZERO_POINT_ERROR = NAN;
 	return (TRUE);
     }
@@ -39,5 +42,5 @@
 
 	int i, Nzpt, Nmid, Nhead;
-	float *zpt, ZPT_OBS;
+	float *zpt, ZPT_OBS, ZPT_ERR;
 	PhotCode *photcode;
 	char photname[80];
@@ -53,4 +56,11 @@
 		fprintf (stderr, "zero point not supplied in header\n");
 		continue;
+	    }
+	    
+	    if (!gfits_scan (headers[Nhead], "ZPT_ERR", "%f", 1, &ZPT_ERR)) {
+//		XXX should we emit this message? We currently aren't using this value so no
+//		fprintf (stderr, "zero point not supplied in header\n");
+//		continue;
+	        ZPT_ERR = NAN;
 	    }
 	    
@@ -78,4 +88,5 @@
 	    fprintf (stderr, "WARNING: zero point is not measured, no valid entries in headers\n");
 	    ZERO_POINT_OFFSET = 0.0;
+	    ZERO_POINT_ERROR = NAN;
 	    free (zpt);
 	    return (FALSE);
@@ -86,4 +97,6 @@
 	ZERO_POINT_OFFSET = (Nzpt % 2) ? zpt[Nmid] : 0.5*(zpt[Nmid] + zpt[Nmid-1]);
 	free (zpt);
+        // XXX: TODO calculate someting for ZERO_POINT_ERROR
+	ZERO_POINT_ERROR = NAN;
 	return (TRUE);
     }
@@ -92,16 +105,24 @@
     if (!strcasecmp(ZERO_POINT_OPTION, "PHU_HEADER")) {
 	int i, Nhead;
-	float ZPT_OBS;
 
 	ZERO_POINT_OFFSET = 0.0;
+	ZERO_POINT_ERROR = NAN;
 	for (i = 0; i < Nimages; i++) {
 	    if (strcmp(headerSets[i].exthead, "PHU")) continue;
 	    Nhead = headerSets[i].extnum_head;
 	    
+            float ZPT_OBS, ZPT_ERR;
 	    if (!gfits_scan (headers[Nhead], "ZPT_OBS", "%f", 1, &ZPT_OBS)) {
 		fprintf (stderr, "WARNING: zero point is not measured, no valid entries in headers\n");
 		return (FALSE);
 	    }
-	    ZERO_POINT_OFFSET = ZPT_OBS;
+	    if (!gfits_scan (headers[Nhead], "ZPT_ERR", "%f", 1, &ZPT_ERR)) {
+		fprintf (stderr, "WARNING: zero point error is not measured\n");
+//		XXX: Do we want to require ZPT_ERR? for now just set it to zero and proceed.
+//		return (FALSE);
+		ZPT_ERR = NAN;
+	    }
+            ZPT_OBS_PHU = ZPT_OBS;
+            ZPT_ERR_PHU = ZPT_ERR;
 	    return (TRUE);
 	}
Index: trunk/Ohana/src/addstar/src/ReadImageHeader.c
===================================================================
--- trunk/Ohana/src/addstar/src/ReadImageHeader.c	(revision 29123)
+++ trunk/Ohana/src/addstar/src/ReadImageHeader.c	(revision 29132)
@@ -220,6 +220,14 @@
           fprintf (stderr, "zero point not supplied in header\n");
           ZERO_POINT_OFFSET = 0.0;
+          ZERO_POINT_ERROR = NAN;
       } else {
           ZERO_POINT_OFFSET = 0.001*photcodeData[0].C - ZPT_OBS;
+          float ZPT_ERR;
+          if (!gfits_scan (header, "ZPT_ERR", "%f", 1, &ZPT_ERR)) {
+              // XXX: do we want to print this message?
+              fprintf (stderr, "zero point error not supplied in header\n");
+              ZPT_ERR = NAN;
+          }
+          ZERO_POINT_ERROR = ZPT_ERR;
       }
   }
@@ -230,6 +238,8 @@
           fprintf (stderr, "photcode data not supplied for this chip\n");
           ZERO_POINT_OFFSET = 0.0;
+          ZERO_POINT_ERROR = NAN;
       } else {
-          ZERO_POINT_OFFSET = 0.001*photcodeData[0].C - ZERO_POINT_OFFSET;
+          ZERO_POINT_OFFSET = 0.001*photcodeData[0].C - ZPT_OBS_PHU;
+          ZERO_POINT_ERROR =  ZPT_ERR_PHU;
       }
   }
@@ -237,4 +247,5 @@
   /* secz is in units milli-airmass */
   image[0].Mcal = ZERO_POINT_OFFSET;
+  image[0].dMcal = ZERO_POINT_ERROR;
   image[0].Xm   = NAN_S_SHORT;
   image[0].flags = 0;
