IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 32140


Ignore:
Timestamp:
Aug 19, 2011, 11:47:13 AM (15 years ago)
Author:
rhenders
Message:

now reporting to log original total of detections in smf file; also reporting totals for all columns across whole exposure; various Detection table updates now moved into main INSERT SQL to speed things up a little

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ippToPsps/jython/detectionbatch.py

    r32106 r32140  
    101101
    102102       self.filter = self.header['FILTERID'][0:1]
     103       self.filterID = self.scratchDb.getFilterID(self.filter)
    103104
    104105       # insert what we know about this stack batch into the stack table
     
    367368        pspsTableName = "Detection_" + ota
    368369        ippTableName = ota + "_psf"
    369        
     370       
     371        results['ORIGINALTOTAL'] = self.scratchDb.getRowCount(ippTableName)
     372
     373
    370374        # drop then re-create table
    371375        self.scratchDb.dropTable(pspsTableName)
     
    385389        sql = "INSERT IGNORE INTO " + pspsTableName + " ( \
    386390               ippDetectID \
     391               ,filterID \
     392               ,surveyID \
     393               ,obsTime \
    387394               ,xPos \
    388395               ,yPos \
     
    406413               ,skyErr \
    407414               ,sgSep \
     415               ,activeFlag \
     416               ,assocDate \
     417               ,historyModNum \
     418               ,dataRelease \
    408419               ) \
    409420               SELECT \
    410421               IPP_IDET \
     422               , " + str(self.filterID) + "\
     423               , " + str(self.surveyID) + " \
     424               ," + str(self.obsTime) + " \
    411425               ,X_PSF \
    412426               ,Y_PSF \
     
    430444               ,SKY_SIGMA \
    431445               ,EXT_NSIGMA \
     446               , 0 \
     447               , '" + self.dateStr + "' \
     448               , 0 \
     449               , " + str(self.dataRelease) + "\
    432450               FROM " + ippTableName
    433451        self.scratchDb.execute(sql)
    434 
    435         # set obsTime
    436         sql = "UPDATE " + pspsTableName + " SET obsTime = %f, assocDate = '%s', activeFlag = 0" % (self.obsTime, self.dateStr)
    437         self.scratchDb.execute(sql)
    438         self.scratchDb.updateAllRows(pspsTableName, "dataRelease", str(self.dataRelease))
    439         self.scratchDb.updateAllRows(pspsTableName, "historyModNum", "0")
    440 
    441         self.scratchDb.updateAllRows(pspsTableName, "surveyID", str(self.surveyID))
    442         self.scratchDb.updateFilterID(pspsTableName, self.filter)
    443452
    444453        # now delete bad flux and bad chip positions
     
    640649        otaCount = 0
    641650        results = {}
    642         self.logger.info("+-------+---------------+---------------+---------------+---------------+---------------+")
    643         self.logger.info("|  OTA  |   Sat Det     | NULL instFlux | NULL peak ADU | NULL obj ID   |  Remainder    |")
    644         self.logger.info("+-------+---------------+---------------+---------------+---------------+---------------+")
     651        totalOriginal = totalSatDet = totalNulIInstFlux = totalNullPeakFlux = totalNullObjID = totalDetections = 0
     652        self.logger.info("+-------+---------------+---------------+---------------+---------------+---------------+---------------+")
     653        self.logger.info("|  OTA  | Initial total |   Sat Det     | NULL instFlux | NULL peak ADU | NULL obj ID   |  Remainder    |")
     654        self.logger.info("+-------+---------------+---------------+---------------+---------------+---------------+---------------+")
    645655        for x in range(self.startX, self.endX):
    646656            for y in range(self.startY, self.endY):
     
    666676                self.populateLikelihoods("Detection_" + ota)
    667677                rowCount = self.scratchDb.getRowCount("Detection_" + ota)
    668                 self.logger.info("| %5s | %13d | %13d | %13d | %13d | %13d |",
     678                self.logger.info("| %5s | %13d | %13d | %13d | %13d | %13d | %13d |",
    669679                        ota,
     680                        results['ORIGINALTOTAL'],
    670681                        results['SATDET'],
    671682                        results['NULLINSTFLUX'],
     
    673684                        results['NULLOBJID'],
    674685                        rowCount)
     686
     687                totalOriginal = totalOriginal + results['ORIGINALTOTAL']
     688                totalSatDet = totalSatDet + results['SATDET']
     689                totalNulIInstFlux = totalNulIInstFlux + results['NULLINSTFLUX']
     690                totalNullPeakFlux = totalNullPeakFlux + results['NULLPEAKADU']
     691                totalNullObjID = totalNullObjID + results['NULLOBJID']
     692                totalDetections = totalDetections + rowCount
    675693
    676694                # check we have something in this Detection table TODO add this to table above
     
    696714                otaCount = otaCount + 1
    697715
    698         # TODO print totals here
    699         self.logger.info("+-------+---------------+---------------+---------------+---------------+---------------+")
     716        # print totals
     717        self.logger.info("+-------+---------------+---------------+---------------+---------------+---------------+---------------+")
     718        self.logger.info("| Total | %13d | %13d | %13d | %13d | %13d | %13d |",
     719                totalOriginal,
     720                totalSatDet,
     721                totalNulIInstFlux,
     722                totalNullPeakFlux,
     723                totalNullObjID,
     724                totalDetections)
     725        self.logger.info("+-------+---------------+---------------+---------------+---------------+---------------+---------------+")
    700726
    701727        # if we only have one table export, i.e. FrameMeta, then get out of here
Note: See TracChangeset for help on using the changeset viewer.