Index: trunk/ippToPsps/jython/detectionbatch.py
===================================================================
--- trunk/ippToPsps/jython/detectionbatch.py	(revision 31357)
+++ trunk/ippToPsps/jython/detectionbatch.py	(revision 31365)
@@ -50,4 +50,9 @@
            self.startY = 0
            self.endY = 8
+
+       #self.startX = 6
+       #self.endX = 7
+       #self.startY = 7
+       #self.endY = 8
 
        self.obsTime = float(self.header['MJD-OBS']) + (float(self.header['EXPTIME']) / 172800.0)
@@ -556,4 +561,7 @@
                 self.updateDvoIDs("Detection_" + ota, sourceIDs[ota], imageIDs[ota])
 
+                self.scratchDb.reportAndDeleteRowsWithNULLS("Detection_" + ota, "objID")
+                self.updateImageID("Detection_" + ota, x, y) 
+                
                 # check we have something in this Detection table
                 if self.scratchDb.getRowCount("Detection_" + ota) < 1:
@@ -561,7 +569,4 @@
                     continue;
 
-                self.scratchDb.reportAndDeleteRowsWithNULLS("Detection_" + ota, "objID")
-                self.updateImageID("Detection_" + ota, x, y) 
-                
                 # 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(header['SOURCEID'], header['IMAGEID']))
@@ -580,4 +585,10 @@
                 otaCount = otaCount + 1
 
+        # if we only have one table export, i.e. FrameMeta, then get out of here
+        if len(self.tablesToExport) == 1:
+            
+            self.logger.error("No tables to export")
+            return False
+
         self.setMinMaxObjID(tables)
 
@@ -630,7 +641,7 @@
     file = gpc1Db.getCameraStageSmf(camID)
     #file = "detdemo.fits" 
-    detectionBatch = DetectionBatch(logger, camID, file, True)
-
-    if not detectionBatch.alreadyProcessed():
+    detectionBatch = DetectionBatch(logger, camID, file, False)
+
+    if detectionBatch.alreadyProcessed():
 
         detectionBatch.createEmptyPspsTables()
@@ -640,6 +651,6 @@
             detectionBatch.writeBatchManifest()
             detectionBatch.reportNullsInAllPspsTables(False)
-            #detectionBatch.createTarball()
-            #detectionBatch.publishToDatastore()
+            detectionBatch.createTarball()
+            detectionBatch.publishToDatastore()
     
     i = i+1
