Index: trunk/ippToPsps/jython/detectionbatch.py
===================================================================
--- trunk/ippToPsps/jython/detectionbatch.py	(revision 32305)
+++ trunk/ippToPsps/jython/detectionbatch.py	(revision 32327)
@@ -538,52 +538,9 @@
         self.scratchDb.makeColumnPrimaryKey("Detection", "ippDetectID")
 
-    '''
-    Applies indexes to the IPP tables
-    '''
-    def indexIppTables(self):
-
-        self.logger.infoPair("Creating indexes on", "IPP tables")
-
-        for x in range(self.startX, self.endX):
-            for y in range(self.startY, self.endY):
-
-                # dodge the corners
-                if x==0 and y==0: continue
-                if x==0 and y==7: continue
-                if x==7 and y==0: continue
-                if x==7 and y==7: continue
-
-                extension = "XY%d%d_psf" % (x, y)
-                self.scratchDb.createIndex(extension, "IPP_IDET")
-
-    '''
-    Updates provided table with DVO IDs from DVO table
-    '''
-    def updateDvoIDs(self, table, sourceID, externID):
-
-        imageID = self.scratchDb.getImageIDFromExternID(sourceID, externID)
-        self.logger.debug("Updating table '" + table + "' with DVO IDs using imageID = %d" % imageID)
-        sql = "UPDATE IGNORE " + table + " AS a, " + self.scratchDb.dvoDetectionTable + " AS b SET \
-               a.ippObjID = b.ippObjID, \
-               a.detectID = b.detectID, \
-               a.objID = b.objID, \
-               a.infoFlag = b.flags << 32 | a.infoFlag \
-               WHERE a.ippDetectID = b.ippDetectID \
-               AND b.sourceID = " + str(sourceID) + " \
-               AND b.imageID = " + str(imageID)
-
-        self.scratchDb.execute(sql)
-
-
-    '''
-    Does the processing, i.e. pulling stuff from IPP tables into PSPS tables
-    '''
-    def populatePspsTables(self):
-
         self.populateFrameMeta()
      
         # dictionary objects to hold sourceIDs and imageIDs for later
-        sourceIDs = {}
-        imageIDs = {}
+        self.sourceIDs = {}
+        self.imageIDs = {}
 
         # loop through all OTAs and populate ImageMeta extensions
@@ -608,8 +565,6 @@
 
                 # check we have valid sourceID/imageID pair from the header
-                if self.safeDictionaryAccess(header, 'SOURCEID') == "NULL":
-                    continue
-                if self.safeDictionaryAccess(header, 'IMAGEID') == "NULL":
-                    continue
+                if self.safeDictionaryAccess(header, 'SOURCEID') == "NULL": continue
+                if self.safeDictionaryAccess(header, 'IMAGEID') == "NULL": continue
 
                 # store sourceID/imageID combo in Db so DVO can look up later
@@ -618,6 +573,6 @@
 
                 # store these for later
-                sourceIDs[ota] = header['SOURCEID']
-                imageIDs[ota] = header['IMAGEID']
+                self.sourceIDs[ota] = header['SOURCEID']
+                self.imageIDs[ota] = header['IMAGEID']
 
                 # populate ImageMeta
@@ -628,4 +583,50 @@
         if not self.useFullTables: 
             if not self.getIDsFromDVO(): return False
+
+        return True
+
+
+    '''
+    Applies indexes to the IPP tables
+    '''
+    def indexIppTables(self):
+
+        self.logger.infoPair("Creating indexes on", "IPP tables")
+
+        for x in range(self.startX, self.endX):
+            for y in range(self.startY, self.endY):
+
+                # dodge the corners
+                if x==0 and y==0: continue
+                if x==0 and y==7: continue
+                if x==7 and y==0: continue
+                if x==7 and y==7: continue
+
+                extension = "XY%d%d_psf" % (x, y)
+                self.scratchDb.createIndex(extension, "IPP_IDET")
+
+    '''
+    Updates provided table with DVO IDs from DVO table
+    '''
+    def updateDvoIDs(self, table, sourceID, externID):
+
+        imageID = self.scratchDb.getImageIDFromExternID(sourceID, externID)
+        self.logger.debug("Updating table '" + table + "' with DVO IDs using imageID = %d" % imageID)
+        sql = "UPDATE IGNORE " + table + " AS a, " + self.scratchDb.dvoDetectionTable + " AS b SET \
+               a.ippObjID = b.ippObjID, \
+               a.detectID = b.detectID, \
+               a.objID = b.objID, \
+               a.infoFlag = b.flags << 32 | a.infoFlag \
+               WHERE a.ippDetectID = b.ippDetectID \
+               AND b.sourceID = " + str(sourceID) + " \
+               AND b.imageID = " + str(imageID)
+
+        self.scratchDb.execute(sql)
+
+
+    '''
+    Does the processing, i.e. pulling stuff from IPP tables into PSPS tables
+    '''
+    def populatePspsTables(self):
 
         # loop through all OTAs again to update with DVO IDs
@@ -649,5 +650,5 @@
 
                 ota = "XY%d%d" % (x, y)
-                if ota not in sourceIDs: continue
+                if ota not in self.sourceIDs: continue
 
                 #self.logger.infoTitle("Processing " + ota)
@@ -660,5 +661,5 @@
 
                 # now add DVO IDs
-                self.updateDvoIDs("Detection_" + ota, sourceIDs[ota], imageIDs[ota])
+                self.updateDvoIDs("Detection_" + ota, self.sourceIDs[ota], self.imageIDs[ota])
                 results['NULLOBJID'] = self.scratchDb.reportAndDeleteRowsWithNULLS("Detection_" + ota, "objID")
                 self.updateImageID("Detection_" + ota, x, y) 
@@ -687,5 +688,5 @@
                 # update ImageMeta with count of detections for this OTA and photoCodeID
                 sql = "UPDATE ImageMeta_" + ota + " \
-                       SET nDetect = %d, photoCalID = %d" % (self.scratchDb.getRowCount("Detection_" + ota), self.scratchDb.getPhotoCalID(sourceIDs[ota], imageIDs[ota]))
+                       SET nDetect = %d, photoCalID = %d" % (self.scratchDb.getRowCount("Detection_" + ota), self.scratchDb.getPhotoCalID(self.sourceIDs[ota], self.imageIDs[ota]))
                 self.scratchDb.execute(sql)
 
