IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 32106


Ignore:
Timestamp:
Aug 16, 2011, 8:34:32 AM (15 years ago)
Author:
rhenders
Message:

now collecting stats per chip and printing to log in a table

File:
1 edited

Legend:

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

    r32061 r32106  
    363363    Populates the Detection table for this OTA
    364364    '''
    365     def populateDetectionTable(self, ota):
     365    def populateDetectionTable(self, ota, results):
    366366
    367367        pspsTableName = "Detection_" + ota
     
    378378        sql = "DELETE FROM " + ippTableName + " WHERE PSF_INST_MAG < -17.5"
    379379        self.scratchDb.execute(sql)
    380         DELETED = BEFORE - self.scratchDb.getRowCount(ippTableName)
    381         self.logger.infoPair("Saturated detections", "%d deleted" % DELETED)
     380        #DELETED = BEFORE - self.scratchDb.getRowCount(ippTableName)
     381        results['SATDET'] = BEFORE - self.scratchDb.getRowCount(ippTableName)
     382        #self.logger.infoPair("Saturated detections", "%d deleted" % DELETED)
    382383
    383384        # insert all detections into table
     
    442443
    443444        # now delete bad flux and bad chip positions
    444         self.scratchDb.reportAndDeleteRowsWithNULLS(pspsTableName, "instFlux")
    445         self.scratchDb.reportAndDeleteRowsWithNULLS(pspsTableName, "peakADU")
     445        results['NULLINSTFLUX'] = self.scratchDb.reportAndDeleteRowsWithNULLS(pspsTableName, "instFlux")
     446        results['NULLPEAKADU'] = self.scratchDb.reportAndDeleteRowsWithNULLS(pspsTableName, "peakADU")
    446447
    447448    '''
     
    638639        tables = []   
    639640        otaCount = 0
     641        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("+-------+---------------+---------------+---------------+---------------+---------------+")
    640645        for x in range(self.startX, self.endX):
    641646            for y in range(self.startY, self.endY):
     
    650655                if ota not in sourceIDs: continue
    651656
    652                 self.logger.infoTitle("Processing " + ota)
     657                #self.logger.infoTitle("Processing " + ota)
    653658
    654659                # populate remainder of tables
    655                 self.populateDetectionTable(ota)
     660                self.populateDetectionTable(ota, results)
    656661
    657662                # now add DVO IDs
    658663                self.updateDvoIDs("Detection_" + ota, sourceIDs[ota], imageIDs[ota])
    659                 self.scratchDb.reportAndDeleteRowsWithNULLS("Detection_" + ota, "objID")
     664                results['NULLOBJID'] = self.scratchDb.reportAndDeleteRowsWithNULLS("Detection_" + ota, "objID")
    660665                self.updateImageID("Detection_" + ota, x, y)
    661666                self.populateLikelihoods("Detection_" + ota)
    662                
    663                 # check we have something in this Detection table
    664                 if self.scratchDb.getRowCount("Detection_" + ota) < 1:
    665                     self.logger.infoPair("Skipping empty table for ota", ota)
     667                rowCount = self.scratchDb.getRowCount("Detection_" + ota)
     668                self.logger.info("| %5s | %13d | %13d | %13d | %13d | %13d |",
     669                        ota,
     670                        results['SATDET'],
     671                        results['NULLINSTFLUX'],
     672                        results['NULLPEAKADU'],
     673                        results['NULLOBJID'],
     674                        rowCount)
     675
     676                # check we have something in this Detection table TODO add this to table above
     677                if rowCount < 1:
     678                    self.logger.debugPair("Skipping empty table for ota", ota)
    666679                    continue;
    667680
     
    683696                otaCount = otaCount + 1
    684697
     698        # TODO print totals here
     699        self.logger.info("+-------+---------------+---------------+---------------+---------------+---------------+")
     700
    685701        # if we only have one table export, i.e. FrameMeta, then get out of here
    686702        if len(self.tablesToExport) == 1:
Note: See TracChangeset for help on using the changeset viewer.