Index: /branches/eam_branches/ipp-20121219/ippToPsps/jython/stackbatch.py
===================================================================
--- /branches/eam_branches/ipp-20121219/ippToPsps/jython/stackbatch.py	(revision 35007)
+++ /branches/eam_branches/ipp-20121219/ippToPsps/jython/stackbatch.py	(revision 35008)
@@ -51,4 +51,7 @@
                useFullTables)
 
+       # self.printline = 0
+       # # self.testprint()
+
        self.stackType = "DEEP_STACK" # TODO
 
@@ -63,4 +66,6 @@
        self.filterID = self.scratchDb.getFilterID(self.filter)
        self.skycell = meta[1];
+
+       # self.testprint()
 
        # skycell is, eg "skycell.1133.081"
@@ -76,4 +81,6 @@
        self.skycell = self.skycell[8:12]
        self.projectioncell = self.skycell
+
+       # self.testprint()
 
        # proposed new values. Need to coordinate with the SkyCell table
@@ -96,4 +103,6 @@
        self.scratchDb.dropTable("StackDetectionCalib")
 
+       # self.testprint()
+
        # delete IPP tables
        self.scratchDb.dropTable("SkyChip_psf")
@@ -115,4 +124,6 @@
        if not self.useFullTables:
            self.scratchDb.insertNewDvoExternID(self.header['SOURCEID'], self.header['IMAGEID'])
+
+       # self.testprint()
 
        # dump stuff to log
@@ -139,4 +150,8 @@
         self.scratchDb.execute(sql)
 
+
+    def testprint(self):
+      print "here ", self.printline
+      self.printline += 1
 
     '''
@@ -348,4 +363,14 @@
         self.logger.infoPair("Procesing table", "StackMeta")
 
+        self.fwhm_maj    = self.safeDictionaryAccess(self.header, 'FWHM_MAJ')
+        self.fwhm_maj_uq = self.safeDictionaryAccess(self.header, 'FW_MJ_UQ')
+        self.psfmodel    = self.safeDictionaryAccess(self.header, 'PSFMODEL')
+        if (self.fwhm_maj    == "NULL"): self.fwhm_maj    = -999
+        if (self.fwhm_maj_uq == "NULL"): self.fwhm_maj_uq = -999
+
+        # print "fwhm_maj    = ", self.fwhm_maj
+        # print "fwhm_maj_uq = ", self.fwhm_maj_uq
+        # print "psfmodel    = ", self.psfmodel
+
         sql = "INSERT INTO StackMeta (\
         stackMetaID \
@@ -375,7 +400,7 @@
         ," + self.header['FPA.ZP'] + " \
         ," + self.expTime + " \
-        ,'" + self.safeDictionaryAccess(self.header, 'PSFMODEL') + "' \
-        ,'" + self.safeDictionaryAccess(self.header, 'FWHM_MAJ') + "' \
-        ,'" + self.safeDictionaryAccess(self.header, 'FW_MJ_UQ') + "' \
+        ,'" + self.psfmodel   + "' \
+        ," + str(self.fwhm_maj)    + " \
+        ," + str(self.fwhm_maj_uq) + " \
         ,'" + self.header['CTYPE1'] + "' \
         ,'" + self.header['CTYPE2'] + "' \
@@ -486,6 +511,9 @@
                ," + self.historyModNum + " \
                FROM SkyChip_psf"
-        self.scratchDb.execute(sql)
-        
+
+        # print "sql: ", sql
+
+        self.scratchDb.execute(sql)
+
         #it is possible to drop some detections from dvo (that are present in the cmf). when that happens we get a 0 for objid
         #we drop those...
@@ -509,8 +537,10 @@
         
         self.updateDvoIDsAndFlags("StackDetection")
+        # response = raw_input("updated dvo ")
         
         sql = "ALTER IGNORE TABLE StackDetection ADD PRIMARY KEY (objID)"
         
         self.scratchDb.execute(sql)
+        # response = raw_input("add primary key? ")
   
         if self.stackType == "DEEP_STACK": 
@@ -524,4 +554,5 @@
             
             self.scratchDb.execute(sql)
+            # response = raw_input("add psf flux ")
             
         #leave null instflux in
@@ -529,4 +560,5 @@
         
         self.scratchDb.reportAndDeleteRowsWithNULLS("StackDetection", "objID")
+        # response = raw_input("delete nulls ")
         
         sql="DELETE FROM StackDetection where objID = 0"
@@ -534,4 +566,5 @@
         self.scratchDb.execute(sql)
         self.logger.infoPair("Delleting", "entries with StackDetection.objID = 0")
+        # response = raw_input("deleted objID is 0 ")
         
 
@@ -702,4 +735,5 @@
                FROM StackDetection"
         self.scratchDb.execute(sql)
+
         # insert calibration information from dvoDetections into the Table
         sql = "UPDATE " + tableName + " AS a, "  + self.scratchDb.dvoDetectionTable + " AS b \
@@ -802,4 +836,6 @@
                WHERE a.ippDetectID = b.ippDetectID \
                AND b.imageID = " + str(imageID)
+
+        # print "update dvo sql: ", sql
         self.scratchDb.execute(sql)
     
