Index: /branches/eam_branches/ohana.20170822/src/libdvo/include/dvo.h
===================================================================
--- /branches/eam_branches/ohana.20170822/src/libdvo/include/dvo.h	(revision 40246)
+++ /branches/eam_branches/ohana.20170822/src/libdvo/include/dvo.h	(revision 40247)
@@ -221,31 +221,32 @@
 /* Secfilt.flags values -- these values are 32 bit (as of PS1_V1) */
 typedef enum {
-  ID_SECF_STAR_FEW    	= 0x00000001, // used within relphot: skip star
-  ID_SECF_STAR_POOR   	= 0x00000002, // used within relphot: skip star
-  ID_SECF_USE_SYNTH   	= 0x00000004, // synthetic photometry used in average measurement
-  ID_SECF_USE_UBERCAL 	= 0x00000008, // ubercal photometry used in average measurement
-  ID_SECF_HAS_PS1     	= 0x00000010, // PS1 photometry used in average measurement
-  ID_SECF_HAS_PS1_STACK = 0x00000020, // PS1 stack photometry exists
-  ID_SECF_HAS_TYCHO   	= 0x00000040, // Tycho photometry used for synth mags
-  ID_SECF_FIX_SYNTH   	= 0x00000080, // synth mags repaired with zpt map
-  ID_SECF_RANK_0    	= 0x00000100, // average magnitude uses rank 0 values
-  ID_SECF_RANK_1    	= 0x00000200, // average magnitude uses rank 1 values
-  ID_SECF_RANK_2    	= 0x00000400, // average magnitude uses rank 2 values
-  ID_SECF_RANK_3    	= 0x00000800, // average magnitude uses rank 3 values
-  ID_SECF_RANK_4    	= 0x00001000, // average magnitude uses rank 4 values
-  ID_SECF_OBJ_EXT_PSPS  = 0x00002000, // In PSPS ID_SECF_OBJ_EXT is moved here so it fits within 16 bits 
-  ID_SECF_STACK_PRIMARY = 0x00004000, // PS1 stack photometry comes from primary skycell
-  ID_SECF_STACK_BESTDET = 0x00008000, // PS1 stack best measurement is a detection (not forced)
-  ID_SECF_STACK_PRIMDET = 0x00010000, // PS1 stack primary measurement is a detection (not forced)
-
-  ID_SECF_HAS_SDSS      = 0x00100000, // this photcode has SDSS photometry
-  ID_SECF_HAS_HSC       = 0x00200000, // this photcode has HSC  photometry
-  ID_SECF_HAS_CFH       = 0x00400000, // this photcode has CFH  photometry (mostly Megacam)
-  ID_SECF_HAS_DES       = 0x00800000, // this photcode has DES  photometry
-
-  ID_SECF_OBJ_EXT       = 0x01000000, // extended in this band
-
-  ID_SECF_CHIP_FLAGS    = 0x01003f1f, // all chip-related bits (used to reset the correct bits only)
-  ID_SECF_STACK_FLAGS   = 0x00004020, // all stack-related bits (
+  ID_SECF_STAR_FEW    		 = 0x00000001, // used within relphot: skip star
+  ID_SECF_STAR_POOR   		 = 0x00000002, // used within relphot: skip star
+  ID_SECF_USE_SYNTH   		 = 0x00000004, // synthetic photometry used in average measurement
+  ID_SECF_USE_UBERCAL 		 = 0x00000008, // ubercal photometry used in average measurement
+  ID_SECF_HAS_PS1     		 = 0x00000010, // PS1 photometry used in average measurement
+  ID_SECF_HAS_PS1_STACK 	 = 0x00000020, // PS1 stack photometry exists
+  ID_SECF_HAS_TYCHO   		 = 0x00000040, // Tycho photometry used for synth mags
+  ID_SECF_FIX_SYNTH   		 = 0x00000080, // synth mags repaired with zpt map
+  ID_SECF_RANK_0    		 = 0x00000100, // average magnitude uses rank 0 values
+  ID_SECF_RANK_1    		 = 0x00000200, // average magnitude uses rank 1 values
+  ID_SECF_RANK_2    		 = 0x00000400, // average magnitude uses rank 2 values
+  ID_SECF_RANK_3    		 = 0x00000800, // average magnitude uses rank 3 values
+  ID_SECF_RANK_4    		 = 0x00001000, // average magnitude uses rank 4 values
+  ID_SECF_OBJ_EXT_PSPS  	 = 0x00002000, // In PSPS ID_SECF_OBJ_EXT is moved here so it fits within 16 bits 
+  ID_SECF_STACK_PRIMARY 	 = 0x00004000, // PS1 stack photometry comes from primary skycell
+  ID_SECF_STACK_BESTDET 	 = 0x00008000, // PS1 stack best measurement is a detection (not forced)
+  ID_SECF_STACK_PRIMDET 	 = 0x00010000, // PS1 stack primary measurement is a detection (not forced)
+  ID_SECF_STACK_PRIMARY_MULTIPLE = 0x00020000, // PS1 stack object has multiple primary measurements
+
+  ID_SECF_HAS_SDSS      	 = 0x00100000, // this photcode has SDSS photometry
+  ID_SECF_HAS_HSC       	 = 0x00200000, // this photcode has HSC  photometry
+  ID_SECF_HAS_CFH       	 = 0x00400000, // this photcode has CFH  photometry (mostly Megacam)
+  ID_SECF_HAS_DES       	 = 0x00800000, // this photcode has DES  photometry
+
+  ID_SECF_OBJ_EXT       	 = 0x01000000, // extended in this band
+
+  ID_SECF_CHIP_FLAGS    	 = 0x01003f1f, // all chip-related bits (used to reset the correct bits only)
+  ID_SECF_STACK_FLAGS   	 = 0x00004020, // all stack-related bits (
 } DVOSecfiltFlags;
 
Index: /branches/eam_branches/ohana.20170822/src/libdvo/src/dbFields.c
===================================================================
--- /branches/eam_branches/ohana.20170822/src/libdvo/src/dbFields.c	(revision 40246)
+++ /branches/eam_branches/ohana.20170822/src/libdvo/src/dbFields.c	(revision 40247)
@@ -847,14 +847,14 @@
   if (!strcasecmp (fieldName, "dapresid" )) ESCAPE (IMAGE_DAPRESID,  OPIHI_FLT);
 
-  if (!strcasecmp (fieldName, "Mcal"     )) ESCAPE (IMAGE_MCAL_PSF,     OPIHI_FLT);
-  if (!strcasecmp (fieldName, "McalPSF"  )) ESCAPE (IMAGE_MCAL_APER,    OPIHI_FLT);
-  if (!strcasecmp (fieldName, "McalAPER" )) ESCAPE (IMAGE_MCAL_APER,    OPIHI_FLT);
-  if (!strcasecmp (fieldName, "McalAPERTURE")) ESCAPE (IMAGE_MCAL_APER, OPIHI_FLT);
-  if (!strcasecmp (fieldName, "dMcal"    )) ESCAPE (IMAGE_dMCAL,        OPIHI_FLT);
-  if (!strcasecmp (fieldName, "Xm"       )) ESCAPE (IMAGE_XM,           OPIHI_FLT);
-  if (!strcasecmp (fieldName, "photcode" )) ESCAPE (IMAGE_PHOTCODE,     OPIHI_INT);
-  if (!strcasecmp (fieldName, "exptime"  )) ESCAPE (IMAGE_EXPTIME,      OPIHI_FLT);
-  if (!strcasecmp (fieldName, "expname"  )) ESCAPE (IMAGE_EXPNAME_AS_INT, OPIHI_INT);
-  if (!strcasecmp (fieldName, "sidtime"  )) ESCAPE (IMAGE_SIDTIME,   OPIHI_FLT);
+  if (!strcasecmp (fieldName, "Mcal"        )) ESCAPE (IMAGE_MCAL_PSF,       OPIHI_FLT);
+  if (!strcasecmp (fieldName, "McalPSF"     )) ESCAPE (IMAGE_MCAL_PSF,       OPIHI_FLT);
+  if (!strcasecmp (fieldName, "McalAPER"    )) ESCAPE (IMAGE_MCAL_APER,      OPIHI_FLT);
+  if (!strcasecmp (fieldName, "McalAPERTURE")) ESCAPE (IMAGE_MCAL_APER,      OPIHI_FLT);
+  if (!strcasecmp (fieldName, "dMcal"       )) ESCAPE (IMAGE_dMCAL,          OPIHI_FLT);
+  if (!strcasecmp (fieldName, "Xm"          )) ESCAPE (IMAGE_XM,             OPIHI_FLT);
+  if (!strcasecmp (fieldName, "photcode"    )) ESCAPE (IMAGE_PHOTCODE,       OPIHI_INT);
+  if (!strcasecmp (fieldName, "exptime"     )) ESCAPE (IMAGE_EXPTIME,        OPIHI_FLT);
+  if (!strcasecmp (fieldName, "expname"     )) ESCAPE (IMAGE_EXPNAME_AS_INT, OPIHI_INT);
+  if (!strcasecmp (fieldName, "sidtime"     )) ESCAPE (IMAGE_SIDTIME,        OPIHI_FLT);
 
   if (!strcasecmp (fieldName, "latitude" )) ESCAPE (IMAGE_LATITUDE,  OPIHI_FLT);
