Index: trunk/ippToPsps/jython/objectbatch.py
===================================================================
--- trunk/ippToPsps/jython/objectbatch.py	(revision 34429)
+++ trunk/ippToPsps/jython/objectbatch.py	(revision 34441)
@@ -124,9 +124,10 @@
                    ," + filter[1] + "StackPSFFlux = FLUX_PSF \
                    ," + filter[1] + "StackPSFFluxErr = FLUX_PSF_ERR \
-                   ," + filter[1] + "StackKronMag = -2.5 * log10(FLUX_KRON) -8.9 \
+                   ," + filter[1] + "StackKronMag = -2.5 * log10(FLUX_KRON) + 8.9 \
                    ," + filter[1] + "StackKronMagErr = FLUX_KRON_ERR / FLUX_KRON \
                    ," + filter[1] + "20pct = MAG_20/1000 \
                    ," + filter[1] + "80pct = MAG_80/1000 \
-                   "
+                   ," + filter[1] + "Flags = FLAGS "  
+                   
             
             self.scratchDb.execute(sql)
@@ -141,4 +142,20 @@
                    WHERE " + filter[1] + "MeanPSFMagErr > " + str(cut)
             self.scratchDb.execute(sql)
+
+        self.logger.infoPair("Setting to NULL all x20pct =", "32.767" ) 
+        for filter in filters:
+            sql  = "UPDATE Object \
+                   SET " + filter[1] + "20pct = null \
+                   WHERE " + filter[1] + "20pct > 32.766"
+            self.scratchDb.execute(sql)
+        self.logger.infoPair("Setting to NULL all x80pct =", "32.767" )
+        for filter in filters:
+            sql  = "UPDATE Object \
+                    SET " + filter[1] + "80pct = null \
+                    WHERE " + filter[1] + "80pct > 32.766"
+            self.scratchDb.execute(sql)
+
+
+
 
     '''
@@ -187,4 +204,6 @@
                ,decErr \
                ,nDetections \
+               ,extra \
+               ,sgSep \
                ,dataRelease \
                ) \
@@ -200,4 +219,6 @@
                ,DEC_ERR \
                ,NMEASURE \
+               ,PSF_QF_PERF \
+               ,STARGAL_SEP \
                , " + str(self.config.dataRelease) + "\
                FROM " + cptTableName
Index: trunk/ippToPsps/jython/scratchdb.py
===================================================================
--- trunk/ippToPsps/jython/scratchdb.py	(revision 34429)
+++ trunk/ippToPsps/jython/scratchdb.py	(revision 34441)
@@ -391,5 +391,5 @@
         except: 
             self.logger.error("Unable to create DVO detection database table")
-
+        self.makeColumnUnique("dvoDetection", "objID") 
 
     '''
Index: trunk/ippToPsps/jython/stackbatch.py
===================================================================
--- trunk/ippToPsps/jython/stackbatch.py	(revision 34429)
+++ trunk/ippToPsps/jython/stackbatch.py	(revision 34441)
@@ -374,5 +374,5 @@
                ,PSF_THETA \
                ,psfLikelihood(EXT_NSIGMA) \
-               ,FLAGS << 32 | FLAGS2 \
+               ,FLAGS2 << 32 | FLAGS \
                ,PSF_QF \
                ,MOMENTS_XX \
@@ -389,5 +389,5 @@
                ,KRON_FLUX / " + str(self.expTime) + " \
                ,KRON_FLUX_ERR / " + str(self.expTime) + " \
-               , NULL \
+               , MOMENTS_R1 * 2.5 \
                , NULL \
                ,N_FRAMES \
@@ -395,6 +395,6 @@
                ," + self.historyModNum + " \
                FROM SkyChip_psf"
-
-        self.scratchDb.execute(sql)
+        self.scratchDb.execute(sql)
+        
         #it is possible to drop some detections from dvo (that are present in the cmf). when that happens we get a 0 for objid
         #we drop those...
@@ -402,14 +402,23 @@
         self.scratchDb.execute(sql)
         self.logger.infoPair("Deleting", "entries with StackDetection.objID = 0")
-
+        
         self.scratchDb.updateAllRows("StackDetection", "surveyID", str(self.surveyID))
+        
         self.scratchDb.updateFilterID("StackDetection", self.filter)
+        
         self.scratchDb.updateAllRows("StackDetection", "dataRelease", str(self.config.dataRelease))
+        
         self.scratchDb.updateAllRows("StackDetection", "primaryF", "0")
+        
         self.scratchDb.updateAllRows("StackDetection", "activeFlag", "0")
+        
         self.updateStackMetaID("StackDetection")
+        
         self.updateStackTypeID("StackDetection")
+        
         self.updateDvoIDs("StackDetection")
+        
         sql = "ALTER IGNORE TABLE StackDetection ADD PRIMARY KEY (objID)"
+        
         self.scratchDb.execute(sql)
   
@@ -422,12 +431,17 @@
                    AND a.ippDetectID = b.IPP_IDET  \
                    AND b.PSF_INST_FLUX_SIG IS NOT NULL"
+            
             self.scratchDb.execute(sql)
             
+        
         self.scratchDb.reportAndDeleteRowsWithNULLS("StackDetection", "instFlux")
+        
         self.scratchDb.reportAndDeleteRowsWithNULLS("StackDetection", "objID")
+        
         sql="DELETE FROM StackDetection where objID = 0"
-        self.scratchDb.execute(sql)
-        self.logger.infoPair("Deleting", "entries with StackDetection.objID = 0")
-
+        
+        self.scratchDb.execute(sql)
+        self.logger.infoPair("Delleting", "entries with StackDetection.objID = 0")
+        
 
     '''
@@ -600,4 +614,5 @@
 
         self.logger.debug("Altering PSPS tables")
+        # heather uncommented the unique line -- well that no worky
         #self.scratchDb.makeColumnUnique("StackDetection", "objID")
         self.scratchDb.createIndex("StackDetection", "ippDetectID")
@@ -624,6 +639,7 @@
     '''
     def updateDvoIDs(self, table):
-
+        self.logger.infoPair("getting","imageID")
         imageID = self.scratchDb.getImageIDFromExternID(self.header['IMAGEID'])
+        self.logger.infoPair("obtained","imageID")
         self.logger.debug("Updating table '" + table + "' with DVO IDs...")
         sql = "UPDATE " + table + " AS a, " + self.scratchDb.dvoDetectionTable + " AS b SET \
@@ -633,6 +649,7 @@
                WHERE a.ippDetectID = b.ippDetectID \
                AND b.imageID = " + str(imageID)
-        self.scratchDb.execute(sql)
-
+        
+        self.scratchDb.execute(sql)
+        
     '''
     Does the processing, i.e. pulling stuff from IPP tables into PSPS tables
