Index: /branches/eam_branches/ohana.20170822/src/libautocode/def/measure-ps1-v6.d
===================================================================
--- /branches/eam_branches/ohana.20170822/src/libautocode/def/measure-ps1-v6.d	(revision 40242)
+++ /branches/eam_branches/ohana.20170822/src/libautocode/def/measure-ps1-v6.d	(revision 40243)
@@ -13,5 +13,5 @@
 FIELD Mkron,          M_KRON,        float,          kron magnitude,               mag
 FIELD dMkron,         M_KRON_ERR,    float,          kron magnitude error,         mag
-FIELD Mcal,           M_CAL,         float,          image cal mag,                mag
+FIELD McalPSF,        MCAL_PSF,      float,          image cal mag,                mag
 FIELD dMcal,          MAG_CAL_ERR,   float,          systematic calibration error, mag
 FIELD dt,             M_TIME,        float,          exposure time,                2.5*log(exptime)
@@ -44,5 +44,5 @@
 
 FIELD Mflat,          M_FLAT,        float,          Static Flat-field offset,     mag
-FIELD dummy2,         PADDING,       int,            unused 4 bytes
+FIELD McalAPER,       MCAL_APER,     float,          image cal mag for apertures,  mag
 
 # could these be packed into fewer bits?
Index: /branches/eam_branches/ohana.20170822/src/libautocode/def/measure.d
===================================================================
--- /branches/eam_branches/ohana.20170822/src/libautocode/def/measure.d	(revision 40242)
+++ /branches/eam_branches/ohana.20170822/src/libautocode/def/measure.d	(revision 40243)
@@ -13,5 +13,5 @@
 FIELD Mkron,          M_KRON,        float,          kron magnitude,                 mag
 FIELD dMkron,         M_KRON_ERR,    float,          kron magnitude error,           mag
-FIELD Mcal,           M_CAL,         float,          image cal mag,                  mag
+FIELD McalPSF,        MCAL_PSF,      float,          image cal mag,                  mag
 FIELD dMcal,          MAG_CAL_ERR,   float,          systematic calibration error,   mag
 FIELD dt,             M_TIME,        float,          exposure time,                  2.5*log(exptime)
@@ -44,5 +44,5 @@
 
 FIELD Mflat,          M_FLAT,        float,          Static Flat-field offset,     mag
-FIELD dummy2,         PADDING,       int,            unused 4 bytes
+FIELD McalAPER,       MCAL_APER,     float,          image cal mag for apertures,  mag
 
 # could these be packed into fewer bits?
@@ -53,8 +53,10 @@
 FIELD averef,         AVE_REF,      unsigned int,   reference to average entry      
 
+# internally, this is an unsigned int; however, we do NOT convert with TZERO/TSCAL on output
 FIELD detID,          DET_ID,       unsigned int,   detection ID
 FIELD objID,          OBJ_ID,       unsigned int,   unique ID for object in table
 FIELD catID,          CAT_ID,       unsigned int,   unique ID for table in which object was first realized
 
+# extID needs to be on an 8-byte boundary
 # PSPS uses a 64-bit detection ID
 FIELD extID,          EXT_ID,       uint64_t,       external ID (eg PSPS detID)
@@ -91,4 +93,5 @@
 FIELD dRsys,          POS_SYS_ERR,  short,          systematic error from astrom,   1/100 of pixels
 
+# local astrometry scales
 FIELD posangle,       POSANGLE,     short,          position angle sky to chip,     (0xffff/360) deg
 FIELD pltscale,       PLTSCALE,     float,          plate scale,                    arcsec/pixel
Index: /branches/eam_branches/ohana.20170822/src/libdvo/include/dvo.h
===================================================================
--- /branches/eam_branches/ohana.20170822/src/libdvo/include/dvo.h	(revision 40242)
+++ /branches/eam_branches/ohana.20170822/src/libdvo/include/dvo.h	(revision 40243)
@@ -504,5 +504,6 @@
   float          M; // change to Mpsf eventually to disambiguate
   float          Mkron;
-  float          Mcal;
+  float          McalPSF;
+  float          McalAPER;
   float          Mflat;
   float          dM;
Index: /branches/eam_branches/ohana.20170822/src/libdvo/include/dvodb.h
===================================================================
--- /branches/eam_branches/ohana.20170822/src/libdvo/include/dvodb.h	(revision 40242)
+++ /branches/eam_branches/ohana.20170822/src/libdvo/include/dvodb.h	(revision 40243)
@@ -243,5 +243,6 @@
       MEAS_EXTERN_ID,
       MEAS_EXPNAME_AS_INT,
-      MEAS_MCAL_OFFSET, // make this a dvoMagOption?
+      MEAS_MCAL_OFFSET_PSF, // make this a dvoMagOption?
+      MEAS_MCAL_OFFSET_APER, // make this a dvoMagOption?
       MEAS_FLAT,
       MEAS_CENTER_OFFSET,
Index: /branches/eam_branches/ohana.20170822/src/libdvo/src/dbExtractMeasures.c
===================================================================
--- /branches/eam_branches/ohana.20170822/src/libdvo/src/dbExtractMeasures.c	(revision 40242)
+++ /branches/eam_branches/ohana.20170822/src/libdvo/src/dbExtractMeasures.c	(revision 40243)
@@ -740,5 +740,6 @@
       break;
 
-    case MEAS_MCAL_OFFSET: { value.Flt = measure[0].Mcal; break; }
+    case MEAS_MCAL_OFFSET_PSF:  { value.Flt = measure[0].McalPSF;  break; }
+    case MEAS_MCAL_OFFSET_APER: { value.Flt = measure[0].McalAPER; break; }
     case MEAS_FLAT: { value.Flt = measure[0].Mflat; break; }
 
Index: /branches/eam_branches/ohana.20170822/src/libdvo/src/dbFields.c
===================================================================
--- /branches/eam_branches/ohana.20170822/src/libdvo/src/dbFields.c	(revision 40242)
+++ /branches/eam_branches/ohana.20170822/src/libdvo/src/dbFields.c	(revision 40243)
@@ -609,5 +609,7 @@
   if (!strcasecmp (fieldName, "SKY"))        	 ESCAPE (MEAS_SKY,            OPIHI_FLT);
   if (!strcasecmp (fieldName, "SKY_ERR"))    	 ESCAPE (MEAS_dSKY,           OPIHI_FLT);
-  if (!strcasecmp (fieldName, "MCAL_OFFSET"))    ESCAPE (MEAS_MCAL_OFFSET,    OPIHI_FLT);
+  if (!strcasecmp (fieldName, "MCAL_OFFSET"))    ESCAPE (MEAS_MCAL_OFFSET_PSF,    OPIHI_FLT);
+  if (!strcasecmp (fieldName, "MCAL_OFFSET_PSF"))  ESCAPE (MEAS_MCAL_OFFSET_PSF,  OPIHI_FLT);
+  if (!strcasecmp (fieldName, "MCAL_OFFSET_APER")) ESCAPE (MEAS_MCAL_OFFSET_APER, OPIHI_FLT);
   if (!strcasecmp (fieldName, "FLAT"))    	 ESCAPE (MEAS_FLAT,           OPIHI_FLT);
   if (!strcasecmp (fieldName, "CENTER_OFFSET"))  ESCAPE (MEAS_CENTER_OFFSET,  OPIHI_FLT);
Index: /branches/eam_branches/ohana.20170822/src/libdvo/src/dvo_catalog.c
===================================================================
--- /branches/eam_branches/ohana.20170822/src/libdvo/src/dvo_catalog.c	(revision 40242)
+++ /branches/eam_branches/ohana.20170822/src/libdvo/src/dvo_catalog.c	(revision 40243)
@@ -317,5 +317,6 @@
  measure->Mkron     = NAN;
  measure->dMkron    = NAN;
- measure->Mcal      = NAN;
+ measure->McalPSF   = NAN;
+ measure->McalAPER  = NAN;
  measure->dMcal     = NAN;
  measure->dt        = NAN;
@@ -344,5 +345,4 @@
 
  measure->Mflat     = 0.0;
- measure->dummy2    = 0;
 
  measure->Sky       = NAN;
@@ -395,5 +395,6 @@
  measure->D         = NAN;
  measure->M         = NAN;
- measure->Mcal      = NAN;
+ measure->McalPSF   = NAN;
+ measure->McalAPER  = NAN;
  measure->dM        = NAN;
 
Index: /branches/eam_branches/ohana.20170822/src/libdvo/src/dvo_convert_PS1_DEV_1.c
===================================================================
--- /branches/eam_branches/ohana.20170822/src/libdvo/src/dvo_convert_PS1_DEV_1.c	(revision 40242)
+++ /branches/eam_branches/ohana.20170822/src/libdvo/src/dvo_convert_PS1_DEV_1.c	(revision 40243)
@@ -17,5 +17,6 @@
     out[i].D          = ave[averef].D - in[i].dD / 3600.0;
     out[i].M          = in[i].M;
-    out[i].Mcal       = in[i].Mcal;
+    out[i].McalPSF    = in[i].Mcal;
+    out[i].McalAPER   = in[i].Mcal;
     out[i].dM         = in[i].dM;
     out[i].dt         = in[i].dt;
@@ -64,5 +65,5 @@
     out[i].dD         = 3600.0*(ave[averef].D - in[i].D);
     out[i].M          = in[i].M;
-    out[i].Mcal       = in[i].Mcal;
+    out[i].Mcal       = in[i].McalPSF;
     out[i].dM         = in[i].dM;
     out[i].dt         = in[i].dt;
Index: /branches/eam_branches/ohana.20170822/src/libdvo/src/dvo_convert_PS1_DEV_2.c
===================================================================
--- /branches/eam_branches/ohana.20170822/src/libdvo/src/dvo_convert_PS1_DEV_2.c	(revision 40242)
+++ /branches/eam_branches/ohana.20170822/src/libdvo/src/dvo_convert_PS1_DEV_2.c	(revision 40243)
@@ -17,5 +17,6 @@
     out[i].D          = ave[averef].D - in[i].dD / 3600.0;
     out[i].M          = in[i].M;
-    out[i].Mcal       = in[i].Mcal;
+    out[i].McalPSF    = in[i].Mcal;
+    out[i].McalAPER   = in[i].Mcal;
     out[i].Map        = in[i].Map;
     out[i].dM         = in[i].dM;
@@ -62,5 +63,5 @@
     out[i].dD         = 3600.0*(ave[averef].D - in[i].D);
     out[i].M          = in[i].M;
-    out[i].Mcal       = in[i].Mcal;
+    out[i].Mcal       = in[i].McalPSF;
     out[i].Map        = in[i].Map;
     out[i].dM         = in[i].dM;
Index: /branches/eam_branches/ohana.20170822/src/libdvo/src/dvo_convert_PS1_SIM.c
===================================================================
--- /branches/eam_branches/ohana.20170822/src/libdvo/src/dvo_convert_PS1_SIM.c	(revision 40242)
+++ /branches/eam_branches/ohana.20170822/src/libdvo/src/dvo_convert_PS1_SIM.c	(revision 40243)
@@ -18,5 +18,6 @@
     out[i].M          = in[i].M;
     out[i].dM         = in[i].dM;
-    out[i].Mcal       = in[i].Mcal;
+    out[i].McalPSF    = in[i].Mcal;
+    out[i].McalAPER   = in[i].Mcal;
     out[i].dt         = in[i].dt;
     out[i].airmass    = in[i].airmass;
@@ -64,5 +65,5 @@
     out[i].M          = in[i].M;
     out[i].dM         = in[i].dM;
-    out[i].Mcal       = in[i].Mcal;
+    out[i].Mcal       = in[i].McalPSF;
     out[i].dt         = in[i].dt;
     out[i].airmass    = in[i].airmass;
Index: /branches/eam_branches/ohana.20170822/src/libdvo/src/dvo_convert_PS1_V1.c
===================================================================
--- /branches/eam_branches/ohana.20170822/src/libdvo/src/dvo_convert_PS1_V1.c	(revision 40242)
+++ /branches/eam_branches/ohana.20170822/src/libdvo/src/dvo_convert_PS1_V1.c	(revision 40243)
@@ -17,5 +17,6 @@
     out[i].D          = ave[averef].D - in[i].dD / 3600.0;
     out[i].M          = in[i].M;
-    out[i].Mcal       = in[i].Mcal;
+    out[i].McalPSF    = in[i].Mcal;
+    out[i].McalAPER   = in[i].Mcal;
     out[i].Map        = in[i].Map;
     out[i].dM         = in[i].dM;
@@ -71,5 +72,5 @@
     out[i].dD         = 3600.0*(ave[averef].D - in[i].D);
     out[i].M          = in[i].M;
-    out[i].Mcal       = in[i].Mcal;
+    out[i].Mcal       = in[i].McalPSF;
     out[i].Map        = in[i].Map;
     out[i].dM         = in[i].dM;
Index: /branches/eam_branches/ohana.20170822/src/libdvo/src/dvo_convert_PS1_V2.c
===================================================================
--- /branches/eam_branches/ohana.20170822/src/libdvo/src/dvo_convert_PS1_V2.c	(revision 40242)
+++ /branches/eam_branches/ohana.20170822/src/libdvo/src/dvo_convert_PS1_V2.c	(revision 40243)
@@ -17,5 +17,6 @@
     out[i].D          = ave[averef].D - in[i].dD / 3600.0;
     out[i].M          = in[i].M;
-    out[i].Mcal       = in[i].Mcal;
+    out[i].McalPSF    = in[i].Mcal;
+    out[i].McalAPER   = in[i].Mcal;
     out[i].Map        = in[i].Map;
     out[i].dM         = in[i].dM;
@@ -72,5 +73,5 @@
     out[i].dD         = 3600.0*(ave[averef].D - in[i].D);
     out[i].M          = in[i].M;
-    out[i].Mcal       = in[i].Mcal;
+    out[i].Mcal       = in[i].McalPSF;
     out[i].Map        = in[i].Map;
     out[i].dM         = in[i].dM;
Index: /branches/eam_branches/ohana.20170822/src/libdvo/src/dvo_convert_PS1_V3.c
===================================================================
--- /branches/eam_branches/ohana.20170822/src/libdvo/src/dvo_convert_PS1_V3.c	(revision 40242)
+++ /branches/eam_branches/ohana.20170822/src/libdvo/src/dvo_convert_PS1_V3.c	(revision 40243)
@@ -17,5 +17,6 @@
     out[i].D          = ave[averef].D - in[i].dD / 3600.0;
     out[i].M          = in[i].M;
-    out[i].Mcal       = in[i].Mcal;
+    out[i].McalPSF    = in[i].Mcal;
+    out[i].McalAPER   = in[i].Mcal;
     out[i].Map        = in[i].Map;
     out[i].dM         = in[i].dM;
@@ -72,5 +73,5 @@
     out[i].dD         = 3600.0*(ave[averef].D - in[i].D);
     out[i].M          = in[i].M;
-    out[i].Mcal       = in[i].Mcal;
+    out[i].Mcal       = in[i].McalPSF;
     out[i].Map        = in[i].Map;
     out[i].dM         = in[i].dM;
Index: /branches/eam_branches/ohana.20170822/src/libdvo/src/dvo_convert_PS1_V4.c
===================================================================
--- /branches/eam_branches/ohana.20170822/src/libdvo/src/dvo_convert_PS1_V4.c	(revision 40242)
+++ /branches/eam_branches/ohana.20170822/src/libdvo/src/dvo_convert_PS1_V4.c	(revision 40243)
@@ -17,5 +17,6 @@
     out[i].D          = ave[averef].D - in[i].dD / 3600.0;
     out[i].M          = in[i].M;
-    out[i].Mcal       = in[i].Mcal;
+    out[i].McalPSF    = in[i].Mcal;
+    out[i].McalAPER   = in[i].Mcal;
     out[i].Map        = in[i].Map;
     out[i].Mkron      = in[i].Mkron;
@@ -81,5 +82,5 @@
     out[i].dD         = 3600.0*(ave[averef].D - in[i].D);
     out[i].M          = in[i].M;
-    out[i].Mcal       = in[i].Mcal;
+    out[i].Mcal       = in[i].McalPSF;
     out[i].Map        = in[i].Map;
     out[i].Mkron      = in[i].Mkron;
@@ -518,5 +519,6 @@
     out[i].D          = ave[averef].D - in[i].dD / 3600.0;
     out[i].M          = in[i].M;
-    out[i].Mcal       = in[i].Mcal;
+    out[i].McalPSF    = in[i].Mcal;
+    out[i].McalAPER   = in[i].Mcal;
     out[i].Map        = in[i].Map;
     out[i].Mkron      = in[i].Mkron;
Index: /branches/eam_branches/ohana.20170822/src/libdvo/src/dvo_convert_PS1_V5.c
===================================================================
--- /branches/eam_branches/ohana.20170822/src/libdvo/src/dvo_convert_PS1_V5.c	(revision 40242)
+++ /branches/eam_branches/ohana.20170822/src/libdvo/src/dvo_convert_PS1_V5.c	(revision 40243)
@@ -22,5 +22,6 @@
     out[i].Mkron      = in[i].Mkron;
     out[i].dMkron     = in[i].dMkron;
-    out[i].Mcal       = in[i].Mcal;
+    out[i].McalPSF    = in[i].Mcal;
+    out[i].McalAPER   = in[i].Mcal;
     out[i].dMcal      = in[i].dMcal;
     out[i].dt         = in[i].dt;
@@ -96,5 +97,5 @@
     out[i].Mkron      = in[i].Mkron;
     out[i].dMkron     = in[i].dMkron;
-    out[i].Mcal       = in[i].Mcal;
+    out[i].Mcal       = in[i].McalPSF;
     out[i].dMcal      = in[i].dMcal;
     out[i].dt         = in[i].dt;
@@ -1674,5 +1675,6 @@
     out[i].Mkron      = in[i].Mkron;
     out[i].dMkron     = in[i].dMkron;
-    out[i].Mcal       = in[i].Mcal;
+    out[i].McalPSF    = in[i].Mcal;
+    out[i].McalAPER   = in[i].Mcal;
     out[i].dMcal      = in[i].dMcal;
     out[i].dt         = in[i].dt;
Index: /branches/eam_branches/ohana.20170822/src/libdvo/src/dvo_convert_PS1_V5_LOAD.c
===================================================================
--- /branches/eam_branches/ohana.20170822/src/libdvo/src/dvo_convert_PS1_V5_LOAD.c	(revision 40242)
+++ /branches/eam_branches/ohana.20170822/src/libdvo/src/dvo_convert_PS1_V5_LOAD.c	(revision 40243)
@@ -22,5 +22,6 @@
     out[i].Mkron      = in[i].Mkron;
     out[i].dMkron     = in[i].dMkron;
-    out[i].Mcal       = in[i].Mcal;
+    out[i].McalPSF    = in[i].Mcal;
+    out[i].McalAPER   = in[i].Mcal;
     out[i].dMcal      = in[i].dMcal;
     out[i].dt         = in[i].dt;
@@ -96,5 +97,5 @@
     out[i].Mkron      = in[i].Mkron;
     out[i].dMkron     = in[i].dMkron;
-    out[i].Mcal       = in[i].Mcal;
+    out[i].Mcal       = in[i].McalPSF;
     out[i].dMcal      = in[i].dMcal;
     out[i].dt         = in[i].dt;
Index: /branches/eam_branches/ohana.20170822/src/libdvo/src/dvo_convert_PS1_V6.c
===================================================================
--- /branches/eam_branches/ohana.20170822/src/libdvo/src/dvo_convert_PS1_V6.c	(revision 40242)
+++ /branches/eam_branches/ohana.20170822/src/libdvo/src/dvo_convert_PS1_V6.c	(revision 40243)
@@ -22,5 +22,6 @@
     out[i].Mkron      = in[i].Mkron;
     out[i].dMkron     = in[i].dMkron;
-    out[i].Mcal       = in[i].Mcal;
+    out[i].McalPSF    = in[i].McalPSF;
+    out[i].McalAPER   = in[i].McalAPER;
     out[i].dMcal      = in[i].dMcal;
     out[i].dt         = in[i].dt;
@@ -96,5 +97,6 @@
     out[i].Mkron      = in[i].Mkron;
     out[i].dMkron     = in[i].dMkron;
-    out[i].Mcal       = in[i].Mcal;
+    out[i].McalPSF    = in[i].McalPSF;
+    out[i].McalAPER   = in[i].McalAPER;
     out[i].dMcal      = in[i].dMcal;
     out[i].dt         = in[i].dt;
Index: /branches/eam_branches/ohana.20170822/src/libdvo/src/dvo_convert_elixir.c
===================================================================
--- /branches/eam_branches/ohana.20170822/src/libdvo/src/dvo_convert_elixir.c	(revision 40242)
+++ /branches/eam_branches/ohana.20170822/src/libdvo/src/dvo_convert_elixir.c	(revision 40243)
@@ -24,5 +24,6 @@
     out[i].dM       = (in[i].dM      == NAN_U_CHAR)  ? NAN : in[i].dM     * 0.001;
     out[i].dt       = (in[i].dt      == NAN_S_SHORT) ? NAN : in[i].dt     * 0.001;
-    out[i].Mcal     = (in[i].Mcal    == NAN_S_SHORT) ? NAN : in[i].Mcal   * 0.001;
+    out[i].McalPSF  = (in[i].Mcal    == NAN_S_SHORT) ? NAN : in[i].Mcal   * 0.001;
+    out[i].McalAPER = (in[i].Mcal    == NAN_S_SHORT) ? NAN : in[i].Mcal   * 0.001;
     out[i].Map      = (in[i].Mgal    == NAN_S_SHORT) ? NAN : in[i].Mgal   * 0.001;
     out[i].airmass  = (in[i].airmass == NAN_S_SHORT) ? NAN : in[i].airmass* 0.001;
@@ -72,5 +73,5 @@
     out[i].dM       = isnan(in[i].dM     ) ? NAN_U_CHAR  : in[i].dM      * 1000.0;
     out[i].dt       = isnan(in[i].dt     ) ? NAN_S_SHORT : in[i].dt      * 1000.0;
-    out[i].Mcal     = isnan(in[i].Mcal   ) ? NAN_S_SHORT : in[i].Mcal    * 1000.0;
+    out[i].Mcal     = isnan(in[i].McalPSF) ? NAN_S_SHORT : in[i].McalPSF * 1000.0;
     out[i].Mgal     = isnan(in[i].Map    ) ? NAN_S_SHORT : in[i].Map     * 1000.0;
     out[i].airmass  = isnan(in[i].airmass) ? NAN_S_SHORT : in[i].airmass * 1000.0;
Index: /branches/eam_branches/ohana.20170822/src/libdvo/src/dvo_convert_loneos.c
===================================================================
--- /branches/eam_branches/ohana.20170822/src/libdvo/src/dvo_convert_loneos.c	(revision 40242)
+++ /branches/eam_branches/ohana.20170822/src/libdvo/src/dvo_convert_loneos.c	(revision 40243)
@@ -26,5 +26,6 @@
     out[i].M        = (in[i].M       == NAN_S_SHORT) ? NAN : in[i].M      * 0.001;
     out[i].dM       = (in[i].dM      == NAN_U_CHAR)  ? NAN : in[i].dM     * 0.001;
-    out[i].Mcal     = (in[i].Mcal    == NAN_S_SHORT) ? NAN : in[i].Mcal   * 0.001;
+    out[i].McalPSF  = (in[i].Mcal    == NAN_S_SHORT) ? NAN : in[i].Mcal   * 0.001;
+    out[i].McalAPER = (in[i].Mcal    == NAN_S_SHORT) ? NAN : in[i].Mcal   * 0.001;
     out[i].Map      = (in[i].M       == NAN_S_SHORT) ? NAN : in[i].M      * 0.001;
     out[i].photcode = in[i].source;
@@ -59,5 +60,5 @@
     out[i].M      = isnan(in[i].M      ) ? NAN_S_SHORT : in[i].M       * 1000.0;
     out[i].dM     = isnan(in[i].dM     ) ? NAN_U_CHAR  : in[i].dM      * 1000.0;
-    out[i].Mcal   = isnan(in[i].Mcal   ) ? NAN_S_SHORT : in[i].Mcal    * 1000.0;
+    out[i].Mcal   = isnan(in[i].McalPSF) ? NAN_S_SHORT : in[i].McalPSF * 1000.0;
     out[i].source = in[i].photcode;
     out[i].t      = in[i].t;
Index: /branches/eam_branches/ohana.20170822/src/libdvo/src/dvo_convert_panstarrs_DEV_0.c
===================================================================
--- /branches/eam_branches/ohana.20170822/src/libdvo/src/dvo_convert_panstarrs_DEV_0.c	(revision 40242)
+++ /branches/eam_branches/ohana.20170822/src/libdvo/src/dvo_convert_panstarrs_DEV_0.c	(revision 40243)
@@ -17,5 +17,6 @@
     out[i].M          = in[i].M;
     out[i].dM         = in[i].dM;
-    out[i].Mcal       = in[i].Mcal;
+    out[i].McalPSF    = in[i].Mcal;
+    out[i].McalAPER   = in[i].Mcal;
 
     out[i].airmass    = in[i].airmass;
@@ -68,5 +69,5 @@
     out[i].M          = in[i].M;
     out[i].dM         = in[i].dM;
-    out[i].Mcal       = in[i].Mcal;
+    out[i].Mcal       = in[i].McalPSF;
     out[i].airmass    = in[i].airmass;
     out[i].az         = in[i].az;
Index: /branches/eam_branches/ohana.20170822/src/libdvo/src/dvo_convert_panstarrs_DEV_1.c
===================================================================
--- /branches/eam_branches/ohana.20170822/src/libdvo/src/dvo_convert_panstarrs_DEV_1.c	(revision 40242)
+++ /branches/eam_branches/ohana.20170822/src/libdvo/src/dvo_convert_panstarrs_DEV_1.c	(revision 40243)
@@ -17,5 +17,6 @@
     out[i].M          = in[i].M;
     out[i].dM         = in[i].dM;
-    out[i].Mcal       = in[i].Mcal;
+    out[i].McalPSF    = in[i].Mcal;
+    out[i].McalAPER   = in[i].Mcal;
 
     out[i].airmass    = in[i].airmass;
@@ -68,5 +69,5 @@
     out[i].M          = in[i].M;
     out[i].dM         = in[i].dM;
-    out[i].Mcal       = in[i].Mcal;
+    out[i].Mcal       = in[i].McalPSF;
     out[i].airmass    = in[i].airmass;
     out[i].az         = in[i].az;
Index: /branches/eam_branches/ohana.20170822/src/libdvo/src/dvo_photcode_ops.c
===================================================================
--- /branches/eam_branches/ohana.20170822/src/libdvo/src/dvo_photcode_ops.c	(revision 40242)
+++ /branches/eam_branches/ohana.20170822/src/libdvo/src/dvo_photcode_ops.c	(revision 40243)
@@ -381,13 +381,17 @@
 
   float Mraw = NAN;
+  float Mcal = NAN;
   switch (class) {
     case MAG_CLASS_PSF:
       Mraw = measure[0].M;
+      Mcal = measure[0].McalPSF;
       break;
     case MAG_CLASS_KRON:
       Mraw = measure[0].Mkron;
+      Mcal = measure[0].McalAPER;
       break;
     case MAG_CLASS_APER:
       Mraw = measure[0].Map;
+      Mcal = measure[0].McalAPER;
       break;
     default:
@@ -398,5 +402,5 @@
   }
   float Mflat = isfinite(measure[0].Mflat) ? measure[0].Mflat : 0.0;
-  float Mcat = Mraw - ZERO_POINT + code[0].K*(measure[0].airmass - 1.000) + SCALE*code[0].C - measure[0].Mcal - Mflat;
+  float Mcat = Mraw - ZERO_POINT + code[0].K*(measure[0].airmass - 1.000) + SCALE*code[0].C - Mcal - Mflat;
 
   /* for DEP, color must be made of PRI/SEC */
@@ -1130,7 +1134,7 @@
 
   // measure.M has the static ZERO_POINT (25.0) applied, but not measure.Flux
-  float Mcal = code[0].K*(measure[0].airmass - 1.000) + SCALE*code[0].C;
-  float Moff = Mcal - ZERO_POINT + 8.9;
-  float Foff = 3630.8 * MagToFlux(Mcal);
+  float Mzpt = code[0].K*(measure[0].airmass - 1.000) + SCALE*code[0].C;
+  float Moff = Mzpt - ZERO_POINT + 8.9;
+  float Foff = 3630.8 * MagToFlux(Mzpt);
   float Fcat = NAN;
   switch (class) {
@@ -1158,7 +1162,7 @@
 
   // measure.M has the static ZERO_POINT (25.0) applied, but not measure.Flux
-  float Mcal = code[0].K*(measure[0].airmass - 1.000) + SCALE*code[0].C;
-  float Moff = Mcal - ZERO_POINT + 8.9;
-  float Foff = 3630.8 * MagToFlux(Mcal);
+  float Mzpt = code[0].K*(measure[0].airmass - 1.000) + SCALE*code[0].C;
+  float Moff = Mzpt - ZERO_POINT + 8.9;
+  float Foff = 3630.8 * MagToFlux(Mzpt);
   float Fcat = NAN;
   switch (class) {
@@ -1203,8 +1207,12 @@
 
   // measure.M has the static ZERO_POINT (25.0) applied, but not measure.Flux
+
+  // use Mcal APER for aperture-like data
+  float Mcal = (class == MAG_CLASS_PSF) ? measure[0].McalPSF : measure[0].McalAPER;
   float Mflat = isfinite(measure[0].Mflat) ? measure[0].Mflat : 0.0;
-  float Mcal = code[0].K*(measure[0].airmass - 1.000) + SCALE*code[0].C - measure[0].Mcal - Mflat;
-  float Moff = Mcal - ZERO_POINT + 8.9;
-  float Foff = 3630.8 * MagToFlux(Mcal);
+
+  float Mzpt = code[0].K*(measure[0].airmass - 1.000) + SCALE*code[0].C - Mcal - Mflat;
+  float Moff = Mzpt - ZERO_POINT + 8.9;
+  float Foff = 3630.8 * MagToFlux(Mzpt);
   float Fcat = NAN;
   switch (class) {
@@ -1470,7 +1478,7 @@
 
   // measure.M has the static ZERO_POINT (25.0) applied, but not measure.Flux
-  float Mcal = code[0].K*(measure[0].airmass - 1.000) + SCALE*code[0].C;
-  float Moff = Mcal - ZERO_POINT + 8.9;
-  float Foff = 3630.8 * MagToFlux(Mcal);
+  float Mzpt = code[0].K*(measure[0].airmass - 1.000) + SCALE*code[0].C;
+  float Moff = Mzpt - ZERO_POINT + 8.9;
+  float Foff = 3630.8 * MagToFlux(Mzpt);
 
   // use dFlux if we can, but use dMag if we must:
@@ -1516,7 +1524,7 @@
 
   // measure.M has the static ZERO_POINT (25.0) applied, but not measure.Flux
-  float Mcal = code[0].K*(measure[0].airmass - 1.000) + SCALE*code[0].C;
-  float Moff = Mcal - ZERO_POINT + 8.9;
-  float Foff = 3630.8 * MagToFlux(Mcal);
+  float Mzpt = code[0].K*(measure[0].airmass - 1.000) + SCALE*code[0].C;
+  float Moff = Mzpt - ZERO_POINT + 8.9;
+  float Foff = 3630.8 * MagToFlux(Mzpt);
 
   // use dFlux if we can, but use dMag if we must:
@@ -1579,8 +1587,11 @@
 
   // measure.M has the static ZERO_POINT (25.0) applied, but not measure.Flux
+  // XXX fix this too:
   float Mflat = isfinite(measure[0].Mflat) ? measure[0].Mflat : 0.0;
-  float Mcal = code[0].K*(measure[0].airmass - 1.000) + SCALE*code[0].C - measure[0].Mcal - Mflat;
-  float Moff = Mcal - ZERO_POINT + 8.9;
-  float Foff = 3630.8 * MagToFlux(Mcal);
+  float Mcal = (class == MAG_CLASS_PSF) ? measure[0].McalPSF : measure[0].McalAPER;
+
+  float Mzpt = code[0].K*(measure[0].airmass - 1.000) + SCALE*code[0].C - Mcal - Mflat;
+  float Moff = Mzpt - ZERO_POINT + 8.9;
+  float Foff = 3630.8 * MagToFlux(Mzpt);
 
   // use dFlux if we can, but use dMag if we must:
@@ -1742,13 +1753,17 @@
 
   float Mraw = NAN;
+  float Mcal = NAN;
   switch (class) {
     case MAG_CLASS_PSF:
       Mraw = measure[0].M;
+      Mcal = measure[0].McalPSF;
       break;
     case MAG_CLASS_KRON:
       Mraw = measure[0].Mkron;
+      Mcal = measure[0].McalAPER;
       break;
     case MAG_CLASS_APER:
       // Mraw = measure[0].Map; // MeasureTiny does not have Map
+      // Mcal = measure[0].McalAPER;
       break;
     default:
@@ -1759,5 +1774,5 @@
   }
   float Mflat = isfinite(measure[0].Mflat) ? measure[0].Mflat : 0.0;
-  float Mcat = Mraw - ZERO_POINT + code[0].K*(measure[0].airmass - 1.000) + SCALE*code[0].C - measure[0].Mcal - Mflat;
+  float Mcat = Mraw - ZERO_POINT + code[0].K*(measure[0].airmass - 1.000) + SCALE*code[0].C - Mcal - Mflat;
 
   /* for DEP, color must be made of PRI/SEC */
Index: /branches/eam_branches/ohana.20170822/src/libdvo/src/dvo_tiny_values.c
===================================================================
--- /branches/eam_branches/ohana.20170822/src/libdvo/src/dvo_tiny_values.c	(revision 40242)
+++ /branches/eam_branches/ohana.20170822/src/libdvo/src/dvo_tiny_values.c	(revision 40243)
@@ -20,5 +20,6 @@
   measureT[0].M          = measure[0].M;
   measureT[0].Mkron      = measure[0].Mkron;
-  measureT[0].Mcal       = measure[0].Mcal;
+  measureT[0].McalPSF    = measure[0].McalPSF;
+  measureT[0].McalAPER   = measure[0].McalAPER;
   measureT[0].dM         = measure[0].dM;
   measureT[0].airmass    = measure[0].airmass;
