Index: /trunk/ippToPsps/jython/ipptopspsdb.py
===================================================================
--- /trunk/ippToPsps/jython/ipptopspsdb.py	(revision 34660)
+++ /trunk/ippToPsps/jython/ipptopspsdb.py	(revision 34661)
@@ -638,4 +638,6 @@
             and not self.processingNow(batchType, stageID) \
             and not self.consistentlyFailed(batchType, stageID)): 
+            
+            self.logger.infoPair("heather:","passed logic")
 
             sql = "INSERT INTO batch ( \
@@ -652,4 +654,5 @@
                        '" + self.config.datastoreProduct + "' \
                        )"
+            self.logger.infoPair("heather:","sql")
 
             self.execute(sql)
Index: /trunk/ippToPsps/jython/loader.py
===================================================================
--- /trunk/ippToPsps/jython/loader.py	(revision 34660)
+++ /trunk/ippToPsps/jython/loader.py	(revision 34661)
@@ -123,13 +123,13 @@
 
                 self.logger.infoPair("Boxes with unprocessed data", "%d" % len(boxIds))
-    
+                self.logger.infoPair("numAttempts", str(numAttempts))
                 if len(boxIds) > 0: numAttempts = 0
 
                 for boxId in boxIds:
-          
+                    self.logger.infoPair("Check","client status")
                     if not self.checkClientStatus():
                         abort = True
                         break
-    
+                    self.logger.infoPair("client status", "ok")
                     # get box info. if boxes have changed, break and start again
                     try:
@@ -138,5 +138,5 @@
                         self.logger.infoPair("Can't get details for this box", "%d" % boxId)
                         break
-     
+                    self.logger.infoPair("client status", "ok")
                     ids = self.ippToPspsDb.getPendingIdsForThisBox(boxId, batchType)
                 
@@ -150,5 +150,5 @@
                     self.logger.infoPair(batchType + " items found in this box", "%d" % len(ids))
                     boxSizeWithBorder = boxDim['SIDE'] + (self.config.BORDER * 2)
-     
+                    self.logger.infoPair("got here", "ok")
                     useFullTables = 0
                     if batchType != "OB":
@@ -174,5 +174,5 @@
                         abort = True
                         break
-
+                    self.logger.infoPair("processed","ok")
             if abort or not self.checkClientStatus(): abort = True
             elif numAttempts > 1 and not self.waitForPollTime():  break
@@ -188,15 +188,20 @@
         # loop round IDs of all items to be processed
         self.ippToPspsDb.lockBatchTable()
+        self.logger.infoPair("heather:","lockbatchtable")
         unattemptedCount = 0
         for id in ids:
-    
+            self.logger.infoPair("heather:","in ids")
+            self.logger.infoPair("heather:id",str(id))
             batchID = self.ippToPspsDb.createNewBatch(batchType, id)
-            
+            self.logger.infoPair("heather:","creatednewbatch")
+            self.logger.infoPair("heather:batchId", str(batchID))
             if batchID < 0: 
                 unattemptedCount += 1
                 continue
-    
+            self.logger.infoPair("heather:","passed logic")
             self.ippToPspsDb.unlockTables()
+            self.logger.infoPair("heather:","unlock table")
             self.ippToPspsDb.deletePendingItem(batchType, id)
+            self.logger.infoPair("heather:","deleted pending item")
 
             # catch any raised exceptions in batch constructors
@@ -234,12 +239,14 @@
    
             # if batch fails, ignore and move on to the next one
-            except: 
+            except Exception, e: 
+                self.logger.error("EXCEPTION: " + str(e))
                 self.logger.errorPair("Problem with this %s batch (%d)" % (batchType, id), "skipping")
                 pass
 
             if not self.checkClientStatus(): return False
-    
+            self.logger.infoPair("checkclient status", "ok")
+
             self.ippToPspsDb.lockBatchTable()
-    
+            self.logger.infoPair("lockbatchtable", "ok")
             self.logger.infoSeparator()
     
Index: /trunk/ippToPsps/jython/objectbatch.py
===================================================================
--- /trunk/ippToPsps/jython/objectbatch.py	(revision 34660)
+++ /trunk/ippToPsps/jython/objectbatch.py	(revision 34661)
@@ -206,5 +206,27 @@
         cpsTableName = self.scratchDb.getDbFriendlyTableName(self.region + ".cps")
 
-        self.logger.infoPair("Populating", "Object")
+        self.logger.infoPair("setting to null  > 1e-38 and < 1e-38 in", "cps FLUX_KRON_ERR")
+        sql = "UPDATE " + cpsTableName + " set FLUX_KRON_ERR = NULL where FLUX_KRON_ERR < 1e-37 AND FLUX_KRON_ERR > -1e-37 "
+      
+        try:
+            self.scratchDb.execute(sql)
+        except:
+            self.logger.errorPair("Couldn't squash out of range stuff", sql)
+            return False
+
+        self.logger.infoPair("setting to null  > 1e-38 and < 1e-38 in", "cps FLUX_KRON")
+        sql = "UPDATE " + cpsTableName + " set FLUX_KRON = NULL where FLUX_KRON < 1e-37 AND FLUX_KRON > -1e-37 "
+      
+        try:
+            self.scratchDb.execute(sql)
+        except:
+            self.logger.errorPair("Couldn't squash out of range stuff", sql)
+            return False
+
+
+
+
+        
+        self.logger.infoPair("Populating", "Object s")
         self.logger.infoPair("Inserting objects from", "cpt file")
 
Index: /trunk/ippToPsps/jython/stackbatch.py
===================================================================
--- /trunk/ippToPsps/jython/stackbatch.py	(revision 34660)
+++ /trunk/ippToPsps/jython/stackbatch.py	(revision 34661)
@@ -75,4 +75,8 @@
        self.skycell = self.skycell[8:12]
        self.projectioncell = self.skycell
+
+       # proposed new values. Need to coordinate with the SkyCell table
+       # this fits in 32 bits for 0 < tessID < 214
+       # self.skycell = str( (tessID * (10000 * 1000)) + (int(self.projectioncell) * 1000) + cellID )
 
        self.analysisVer = meta[2];
@@ -611,5 +615,4 @@
                ,surveyID \
                FROM StackDetection"
-        self.logger.info(sql)
         self.scratchDb.execute(sql)
         # insert calibration information from dvoDetections into the Table
@@ -623,7 +626,5 @@
             a.expTime = b.expTime, \
             a.airMass = b.airMass   \
-            WHERE a.objID = b.objID AND a.ippDetectID = b.ippDetectID"
-	# XXXX: this qualifier assumes that there is only one stack being processed at a time
-        self.logger.info(sql)
+            WHERE a.stackDetectID = b.detectID"
         self.scratchDb.execute(sql)
         self.scratchDb.updateAllRows(tableName, "dataRelease", str(self.config.dataRelease))
@@ -669,6 +670,4 @@
         self.scratchDb.execute("ALTER TABLE StackDetectionCalib CHANGE dec_ `dec` double")
 
-
-
         return True
 
@@ -696,5 +695,5 @@
         sql = "UPDATE " + table + " AS a, " + self.scratchDb.dvoDetectionTable + " AS b SET \
                a.ippObjID = b.ippObjID, \
-               a.stackDetectID = 10 * b.detectID + " + str(self.filterID) + ", \
+               a.stackDetectID = b.detectID, \
                a.objID = b.objID \
                WHERE a.ippDetectID = b.ippDetectID \
@@ -712,5 +711,5 @@
         sql = "UPDATE " + table + " AS a, " + self.scratchDb.dvoDetectionTable + " AS b SET \
                a.ippObjID = b.ippObjID, \
-               a.stackDetectID = 10 * b.detectID + " + str(self.filterID) + ", \
+               a.stackDetectID = b.detectID, \
                a.objID = b.objID, \
                a.infoFlag = b.flags << 45 | a.infoFlag \
