Index: trunk/ippToPsps/jython/detectionbatch.py
===================================================================
--- trunk/ippToPsps/jython/detectionbatch.py	(revision 31284)
+++ trunk/ippToPsps/jython/detectionbatch.py	(revision 31285)
@@ -6,4 +6,9 @@
 from batch import Batch
 
+import logging.config
+
+'''
+DetectionBatch class
+'''
 class DetectionBatch(Batch):
 
@@ -11,32 +16,17 @@
     Constructor
     '''
-    def __init__(self):
+    def __init__(self, logger, expID, inputFile):
        super(DetectionBatch, self).__init__(
+               logger,
                "detection", 
-               "detdemo.fits", 
-               "detection.fits",
-               "localhost",
-               "ipptopsps_scratch",
-               "ipp",
-               "ipp",
-               "3PI") # TODO
+               inputFile, 
+               "ThreePi") # TODO
 
+       self.logger.info("DetectionBatch constructor. Creating batch from: '" + inputFile + "'")
 
+       # create an output filename, which is {expID}.FITS
+       self.outputFitsFile = "%08d.FITS" % expID
+       self.outputFitsPath = "%s/%s" % (self.localOutPath, self.outputFitsFile)
 
-    '''
-    Updates a table with stackMetaID
-    '''
-    def updateStackMetaID(self, table):
-
-        sql = "UPDATE " + table + "  SET stackMetaID=" + self.header['STK_ID']
-        self.stmt.execute(sql)
-
-    '''
-    Updates a table with stackTypeID grabbed from FitModel init table
-    '''
-    def updateStackTypeID(self, table):
-
-        sql = "UPDATE "+table+" AS a, StackType AS b SET a.stackTypeID=b.stackTypeID WHERE b.name = '"+self.header['STK_TYPE']+"'"
-        self.stmt.execute(sql)
 
     '''
@@ -81,5 +71,5 @@
         ," + self.header['PC002002'] + " \
         )"
-        self.stmt.execute(sql)
+        self.localStmt.execute(sql)
 
         self.updateSurveyID("ImageMeta")
@@ -106,5 +96,5 @@
                       FROM XY%d%d_psf" % (x, y)
 
-               self.stmt.execute(sql)
+               self.localStmt.execute(sql)
 
 
@@ -133,4 +123,19 @@
 
     '''
+    Updates provided table with DVO IDs from DVO table
+    '''
+    def updateDvoIDs(self, table):
+
+        self.logger.info("Updating table '" + table + "' with DVO IDs...")
+        sql = "UPDATE " + table + " AS a, dvo AS b SET \
+               a.ippObjID = b.ippObjID, \
+               a.detectID = b.detectID, \
+               a.objID = b.objID \
+               WHERE a.ippDetectID = b.ippDetectID"
+        self.localStmt.execute(sql)
+        self.logger.info("...done")
+
+
+    '''
     Does the processing, i.e. pulling stuff from IPP tables into PSPS tables
     '''
@@ -140,5 +145,4 @@
         self.filter = self.header['FILTERID']
         self.filter = self.filter[0:1]
-        print "filter = ", self.filter
 
         #self.populateStackMeta()
@@ -147,8 +151,24 @@
         #self.populateStackApFlx()
 
-    
-detectionBatch = DetectionBatch()
+        self.getIDsFromDVO("33", "8345290") # TODO need to get sourceID and imageID from chip header
+        self.updateDvoIDs("Detection")
+        self.setMinMaxObjID("Detection")
+
+
+
+logging.config.fileConfig("logging.conf")
+logger = logging.getLogger("detectionbatch")
+logger.info("Starting")
+
+expID = 230033;
+inputFile = "detdemo.fits" 
+detectionBatch = DetectionBatch(logger, expID, inputFile)
 detectionBatch.createEmptyPspsTables()
 detectionBatch.importIppTables("XY33\.psf")
 detectionBatch.populatePspsTables()
 detectionBatch.exportPspsTablesToFits()
+detectionBatch.exportPspsTablesToFits()
+detectionBatch.writeBatchManifest()
+detectionBatch.reportNullsInAllPspsTables(False)
+
+
