Index: /trunk/ippToPsps/jython/detectionbatch.py
===================================================================
--- /trunk/ippToPsps/jython/detectionbatch.py	(revision 32139)
+++ /trunk/ippToPsps/jython/detectionbatch.py	(revision 32140)
@@ -101,4 +101,5 @@
 
        self.filter = self.header['FILTERID'][0:1]
+       self.filterID = self.scratchDb.getFilterID(self.filter) 
 
        # insert what we know about this stack batch into the stack table
@@ -367,5 +368,8 @@
         pspsTableName = "Detection_" + ota
         ippTableName = ota + "_psf"
-        
+       
+        results['ORIGINALTOTAL'] = self.scratchDb.getRowCount(ippTableName)
+
+
         # drop then re-create table
         self.scratchDb.dropTable(pspsTableName)
@@ -385,4 +389,7 @@
         sql = "INSERT IGNORE INTO " + pspsTableName + " ( \
                ippDetectID \
+               ,filterID \
+               ,surveyID \
+               ,obsTime \
                ,xPos \
                ,yPos \
@@ -406,7 +413,14 @@
                ,skyErr \
                ,sgSep \
+               ,activeFlag \
+               ,assocDate \
+               ,historyModNum \
+               ,dataRelease \
                ) \
                SELECT \
                IPP_IDET \
+               , " + str(self.filterID) + "\
+               , " + str(self.surveyID) + " \
+               ," + str(self.obsTime) + " \
                ,X_PSF \
                ,Y_PSF \
@@ -430,15 +444,10 @@
                ,SKY_SIGMA \
                ,EXT_NSIGMA \
+               , 0 \
+               , '" + self.dateStr + "' \
+               , 0 \
+               , " + str(self.dataRelease) + "\
                FROM " + ippTableName
         self.scratchDb.execute(sql)
-
-        # set obsTime
-        sql = "UPDATE " + pspsTableName + " SET obsTime = %f, assocDate = '%s', activeFlag = 0" % (self.obsTime, self.dateStr)
-        self.scratchDb.execute(sql)
-        self.scratchDb.updateAllRows(pspsTableName, "dataRelease", str(self.dataRelease))
-        self.scratchDb.updateAllRows(pspsTableName, "historyModNum", "0")
-
-        self.scratchDb.updateAllRows(pspsTableName, "surveyID", str(self.surveyID))
-        self.scratchDb.updateFilterID(pspsTableName, self.filter)
 
         # now delete bad flux and bad chip positions
@@ -640,7 +649,8 @@
         otaCount = 0
         results = {}
-        self.logger.info("+-------+---------------+---------------+---------------+---------------+---------------+")
-        self.logger.info("|  OTA  |   Sat Det     | NULL instFlux | NULL peak ADU | NULL obj ID   |  Remainder    |")
-        self.logger.info("+-------+---------------+---------------+---------------+---------------+---------------+")
+        totalOriginal = totalSatDet = totalNulIInstFlux = totalNullPeakFlux = totalNullObjID = totalDetections = 0
+        self.logger.info("+-------+---------------+---------------+---------------+---------------+---------------+---------------+")
+        self.logger.info("|  OTA  | Initial total |   Sat Det     | NULL instFlux | NULL peak ADU | NULL obj ID   |  Remainder    |")
+        self.logger.info("+-------+---------------+---------------+---------------+---------------+---------------+---------------+")
         for x in range(self.startX, self.endX):
             for y in range(self.startY, self.endY):
@@ -666,6 +676,7 @@
                 self.populateLikelihoods("Detection_" + ota)
                 rowCount = self.scratchDb.getRowCount("Detection_" + ota) 
-                self.logger.info("| %5s | %13d | %13d | %13d | %13d | %13d |", 
+                self.logger.info("| %5s | %13d | %13d | %13d | %13d | %13d | %13d |", 
                         ota, 
+                        results['ORIGINALTOTAL'], 
                         results['SATDET'], 
                         results['NULLINSTFLUX'], 
@@ -673,4 +684,11 @@
                         results['NULLOBJID'],
                         rowCount)
+
+                totalOriginal = totalOriginal + results['ORIGINALTOTAL']
+                totalSatDet = totalSatDet + results['SATDET']
+                totalNulIInstFlux = totalNulIInstFlux + results['NULLINSTFLUX']
+                totalNullPeakFlux = totalNullPeakFlux + results['NULLPEAKADU']
+                totalNullObjID = totalNullObjID + results['NULLOBJID']
+                totalDetections = totalDetections + rowCount
 
                 # check we have something in this Detection table TODO add this to table above
@@ -696,6 +714,14 @@
                 otaCount = otaCount + 1
 
-        # TODO print totals here
-        self.logger.info("+-------+---------------+---------------+---------------+---------------+---------------+")
+        # print totals
+        self.logger.info("+-------+---------------+---------------+---------------+---------------+---------------+---------------+")
+        self.logger.info("| Total | %13d | %13d | %13d | %13d | %13d | %13d |", 
+                totalOriginal, 
+                totalSatDet, 
+                totalNulIInstFlux, 
+                totalNullPeakFlux, 
+                totalNullObjID,
+                totalDetections)
+        self.logger.info("+-------+---------------+---------------+---------------+---------------+---------------+---------------+")
 
         # if we only have one table export, i.e. FrameMeta, then get out of here
