Index: trunk/ippToPsps/jython/forcedwarpbatch.py
===================================================================
--- trunk/ippToPsps/jython/forcedwarpbatch.py	(revision 39517)
+++ trunk/ippToPsps/jython/forcedwarpbatch.py	(revision 39518)
@@ -501,4 +501,6 @@
         fMeasTableName = "ForcedWarpMeasurement_" + str(num)
 
+        expTimeString = str(self.expTime[num])
+
         sql = "CREATE TABLE " + pspsTableName + " LIKE ForcedWarpExtended"
         self.scratchDb.execute(sql)
@@ -508,15 +510,15 @@
         sqlLine = sqlUtility("INSERT INTO " + pspsTableName + " (")
         sqlLine.group("ippDetectID",     "IPP_IDET")
-        sqlLine.group("flxR5",           "APER_FLUX_3")
-        sqlLine.group("flxR5Err",        "APER_FLUX_ERR_3" )
-        sqlLine.group("flxR5Std",        "APER_FLUX_STDEV_3")
+        sqlLine.group("flxR5",           "APER_FLUX_3 / " + expTimeString)
+        sqlLine.group("flxR5Err",        "APER_FLUX_ERR_3 / " + expTimeString)
+        sqlLine.group("flxR5Std",        "APER_FLUX_STDEV_3 / " + expTimeString)
         sqlLine.group("flxR5Fill",       "APER_FILL_3")
-        sqlLine.group("flxR6",           "APER_FLUX_4")
-        sqlLine.group("flxR6Err",        "APER_FLUX_ERR_4" )
-        sqlLine.group("flxR6Std",        "APER_FLUX_STDEV_4")
+        sqlLine.group("flxR6",           "APER_FLUX_4 / " + expTimeString)
+        sqlLine.group("flxR6Err",        "APER_FLUX_ERR_4 / " + expTimeString)
+        sqlLine.group("flxR6Std",        "APER_FLUX_STDEV_4 / " + expTimeString)
         sqlLine.group("flxR6Fill",       "APER_FILL_4")
-        sqlLine.group("flxR7",           "APER_FLUX_5")
-        sqlLine.group("flxR7Err",        "APER_FLUX_ERR_5" )
-        sqlLine.group("flxR7Std",        "APER_FLUX_STDEV_5")
+        sqlLine.group("flxR7",           "APER_FLUX_5 / " + expTimeString)
+        sqlLine.group("flxR7Err",        "APER_FLUX_ERR_5 / " + expTimeString)
+        sqlLine.group("flxR7Std",        "APER_FLUX_STDEV_5 / " + expTimeString)
         sqlLine.group("flxR7Fill",       "APER_FILL_5")
 
@@ -543,4 +545,25 @@
         self.scratchDb.execute(sql)
         
+        # Normalize by zpFactor by joining our table against the dvoDetectionTable
+        self.logger.infoPair("inserting dvo info: find imageID", "from externID")
+        imageID = self.scratchDb.getImageIDFromExternID(self.warpSkyFileID[num])
+        self.logger.infoPair("updating", pspsTableName)
+
+        sqlLine = sqlUtility("UPDATE " + pspsTableName + " as a, " + self.scratchDb.dvoDetectionTable + " as b SET ")
+        sqlLine.group("a.flxR5",     "a.flxR5     * b.zpFactor")
+        sqlLine.group("a.flxR5Err",  "a.flxR5Err  * b.zpFactor")
+        sqlLine.group("a.flxR5Std",  "a.flxR5Std  * b.zpFactor")
+
+        sqlLine.group("a.flxR6",     "a.flxR6     * b.zpFactor")
+        sqlLine.group("a.flxR6Err",  "a.flxR6Err  * b.zpFactor")
+        sqlLine.group("a.flxR6Std",  "a.flxR6Std  * b.zpFactor")
+
+        sqlLine.group("a.flxR7",     "a.flxR7     * b.zpFactor")
+        sqlLine.group("a.flxR7Err",  "a.flxR7Err  * b.zpFactor")
+        sqlLine.group("a.flxR7Std",  "a.flxR7Std  * b.zpFactor")
+
+        sql = sqlLine.makeEquals("WHERE a.ippDetectID = b.ippDetectID AND b.imageID = " +str( imageID))
+        self.scratchDb.execute(sql)
+
         # cull bad entris
         self.logger.infoPair("need to cull"," nulls objid")
