Index: trunk/ippToPsps/jython/detectionbatch.py
===================================================================
--- trunk/ippToPsps/jython/detectionbatch.py	(revision 34615)
+++ trunk/ippToPsps/jython/detectionbatch.py	(revision 34630)
@@ -452,5 +452,5 @@
                ,MOMENTS_XY \
                ,MOMENTS_YY \
-               ,AP_MAG \
+               ,POW(10.0, -0.4 *AP_MAG) / " + self.header['EXPTIME'] + " \
                ,KRON_FLUX / " + self.header['EXPTIME'] + " \
                ,KRON_FLUX_ERR / " + self.header['EXPTIME'] + " \
@@ -458,6 +458,6 @@
                ,PSF_CHISQ \
                ,FLAGS2 << 32 | FLAGS\
-               ,SKY \
-               ,SKY_SIGMA \
+               ,SKY  / " + self.header['EXPTIME'] + " \
+               ,SKY_SIGMA  / " + self.header['EXPTIME'] + " \
                ,EXT_NSIGMA \
                , 0 \
@@ -466,12 +466,4 @@
                , " + str(self.config.dataRelease) + "\
                FROM " + ippTableName
-        # SA10 todo
-        # need to correct formulas for psfFlux/psfFluxErr
-        # need to correct apMag apFlux
-        # need to correct unites kronFlux/Err to correct units
-        # need to change psfqfperfect -> psfqfperfect PSF_QF_PERFECT?
-        # need to change psfchisq  PSF_CHI_SQ?
-        # need to change unites of sky/skyErr to adu/s/pixel
-        # need formula for sgsep/psflikelhood
         # self.logger.info(sql)
         self.scratchDb.execute(sql)
@@ -557,8 +549,16 @@
                FROM Detection_" + ota
         self.scratchDb.execute(sql)
-        #SA10 TODO
-        # insert ra/dec/calstuff into Table
-        # heather discovered dec is called 'dec_'
-        sql = "UPDATE " + tableName + " SET ra = -999, dec_ =-999, raErr = -999, decErr = -999, zp = -999, zpErr = -999, expTime = -999, airMass = -999"
+
+        # insert calibration information from dvoDetections into the Table
+        sql = "UPDATE " + tableName + " AS a, "  + self.scratchDb.dvoDetectionTable + " AS b \
+            SET a.ra = b.ra, \
+            a.dec_ = b.dec_, \
+            a.raErr = b.raErr, \
+            a.decErr = b.decErr, \
+            a.zp = b.zp, \
+            a.zpErr = b.zpErr, \
+            a.expTime = b.expTime, \
+            a.airMass = b.airMass   \
+            WHERE a.objID = b.objID AND a.detectID = b.detectID"
         self.scratchDb.execute(sql)
         self.scratchDb.updateAllRows(tableName, "dataRelease", str(self.config.dataRelease))
