Index: trunk/ippToPsps/jython/stackbatch.py
===================================================================
--- trunk/ippToPsps/jython/stackbatch.py	(revision 39072)
+++ trunk/ippToPsps/jython/stackbatch.py	(revision 39094)
@@ -275,5 +275,5 @@
             zpImage = zp
 
-        detectionThreshold = detectionThreshold + zpImage - 2.5 * math.log10(expTime)
+        detectionThreshold = detectionThreshold + zpImage + 2.5 * math.log10(expTime)
         
         # insert stack metadata into table
@@ -345,5 +345,5 @@
         self.scratchDb.addRowCountColumn("StackObjectThin", "row")
         self.logger.infoPair("Adding unique psps ids to", "StackObjectThin")
-        self.generateStackDetectRowIDsAndPspsUniqueIDs()
+        self.generatePspsUniqueIDs()
         self.logger.infoPair("Dropping row column from", "StackObjectThin table")
         self.scratchDb.dropColumn("StackObjectThin", "row")
@@ -553,11 +553,10 @@
         # self.scratchDb.createIndex(tablename, "objID") 
 
-        #objid
-        #uniquepsps id
+        # objid
+        # uniquepsps id
         # ippobjid
         # randomstackobjid
-        # stackdetectrowid
         # primarydetection
-        #bestdetection
+        # bestdetection
 
         #g / r / i /z / y
@@ -951,4 +950,9 @@
             maxRadius = 5
 
+        # XXX : by setting these to -999 here, the values are then
+        # modified downstream to apply exposure time and zero point
+        # factors (or platescale terms).  this means they will not
+        # have the correct -999 values in the end.
+
         # properly -999 these to start with.  the default should take
         # care of this, but does not?
@@ -1286,5 +1290,5 @@
         self.scratchDb.execute(sql)
 
-    def generateStackDetectRowIDsAndPspsUniqueIDs(self):
+    def generatePspsUniqueIDs(self):
         sql = "UPDATE StackObjectThin set uniquePspsSTid = (("+str(self.batchID)+"*1000000000 ) + row)"
         self.scratchDb.execute(sql)
@@ -1349,5 +1353,5 @@
             self.scratchDb.addColumn(table, filter + "haveData", "tinyint")
 
-        fields = "objID, ippObjID, randomStackObjID, primaryDetection, bestDetection, uniquePspsSTID, StackDetectRowID, "
+        fields = "objID, ippObjID, randomStackObjID, primaryDetection, bestDetection, uniquePspsSTID, "
 
         for i in range(len(self.filters)):
