IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Mar 30, 2012, 2:49:37 PM (14 years ago)
Author:
eugene
Message:

merge changes from trunk

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20111122/ippToPsps/jython/detectionbatch.py

    r32592 r33638  
    3333    def __init__(self,
    3434                 logger,
    35                  configPath,
    36                  configDoc,
     35                 config,
    3736                 gpc1Db,
    3837                 ippToPspsDb,
     38                 scratchDb,
    3939                 camID,
    40                  batchID):
     40                 batchID,
     41                 useFullTables):
    4142
    4243       super(DetectionBatch, self).__init__(
    4344               logger,
    44                configPath,
    45                configDoc,
     45               config,
    4646               gpc1Db,
    4747               ippToPspsDb,
     48               scratchDb,
    4849               camID,
    4950               batchID,
    5051               "P2",
    51                gpc1Db.getCameraStageSmf(camID))
     52               gpc1Db.getCameraStageSmf(camID),
     53               useFullTables)
    5254
    5355       if not self.everythingOK: return
     
    7375
    7476       # if test mode
    75        if self.testMode:
     77       if self.config.test:
    7678           self.startX = 3
    7779           self.endX = 4
     
    219221        self.scratchDb.updateFilterID("FrameMeta", self.filter)
    220222        self.scratchDb.updateAllRows("FrameMeta", "calibModNum", str(self.calibModNum))
    221         self.scratchDb.updateAllRows("FrameMeta", "dataRelease", str(self.dataRelease))
     223        self.scratchDb.updateAllRows("FrameMeta", "dataRelease", str(self.config.dataRelease))
    222224
    223225    '''
     
    322324               ," + self.safeDictionaryAccess(header, 'DAPMIFIT') + " \
    323325               ,'" + self.safeDictionaryAccess(header, 'DETECTOR') + "' \
    324                ," + str(self.scratchDb.getDvoImageFlags(header['SOURCEID'], header['IMAGEID'])) + " \
     326               ," + str(self.scratchDb.getDvoImageFlags(header['IMAGEID'])) + " \
    325327               ,'" + self.safeDictionaryAccess(header, 'DETREND.MASK') + "' \
    326328               ,'" + self.safeDictionaryAccess(header, 'DETREND.DARK') + "' \
     
    366368        self.scratchDb.updateFilterID(tableName, self.filter)
    367369        self.scratchDb.updateAllRows(tableName, "calibModNum", str(self.calibModNum))
    368         self.scratchDb.updateAllRows(tableName, "dataRelease", str(self.dataRelease))
     370        self.scratchDb.updateAllRows(tableName, "dataRelease", str(self.config.dataRelease))
    369371        if 'NASTRO' in header: self.totalNumPhotoRef = self.totalNumPhotoRef + int(header['NASTRO'])
    370372        self.scratchDb.replaceNullsInThisColumn(tableName, "polyOrder", "0")
     
    416418               ,momentYY \
    417419               ,apMag \
    418                ,kronFlux \
    419                ,kronFluxErr \
    420420               ,infoFlag \
    421421               ,sky \
     
    448448               ,MOMENTS_YY \
    449449               ,AP_MAG \
    450                ,KRON_FLUX \
    451                ,KRON_FLUX_ERR \
    452450               ,FLAGS\
    453451               ,SKY \
     
    457455               , '" + self.dateStr + "' \
    458456               , 0 \
    459                , " + str(self.dataRelease) + "\
     457               , " + str(self.config.dataRelease) + "\
    460458               FROM " + ippTableName
    461459        self.scratchDb.execute(sql)
     
    501499        self.scratchDb.execute(sql)
    502500
    503         self.scratchDb.updateAllRows(tableName, "dataRelease", str(self.dataRelease))
     501        self.scratchDb.updateAllRows(tableName, "dataRelease", str(self.config.dataRelease))
    504502
    505503    '''
     
    530528
    531529        self.scratchDb.updateAllRows(tableName, "calibModNum", str(self.calibModNum))
    532         self.scratchDb.updateAllRows(tableName, "dataRelease", str(self.dataRelease))
     530        self.scratchDb.updateAllRows(tableName, "dataRelease", str(self.config.dataRelease))
    533531
    534532
     
    545543        self.populateFrameMeta()
    546544     
    547         # dictionary objects to hold sourceIDs and imageIDs for later
    548         self.sourceIDs = {}
     545        # dictionary objects to hold imageIDs for later
    549546        self.imageIDs = {}
    550547
     
    578575
    579576                # store these for later
    580                 self.sourceIDs[ota] = header['SOURCEID']
    581577                self.imageIDs[ota] = header['IMAGEID']
    582578
     
    614610    Updates provided table with DVO IDs from DVO table
    615611    '''
    616     def updateDvoIDs(self, table, sourceID, externID):
    617 
    618         imageID = self.scratchDb.getImageIDFromExternID(sourceID, externID)
     612    def updateDvoIDs(self, table, externID):
     613
     614        imageID = self.scratchDb.getImageIDFromExternID(externID)
    619615        self.logger.debug("Updating table '" + table + "' with DVO IDs using imageID = %d" % imageID)
    620616        sql = "UPDATE IGNORE " + table + " AS a, " + self.scratchDb.dvoDetectionTable + " AS b SET \
     
    624620               a.infoFlag = b.flags << 32 | a.infoFlag \
    625621               WHERE a.ippDetectID = b.ippDetectID \
    626                AND b.sourceID = " + str(sourceID) + " \
    627622               AND b.imageID = " + str(imageID)
    628623
     
    655650
    656651                ota = "XY%d%d" % (x, y)
    657                 if ota not in self.sourceIDs: continue
     652                if ota not in self.imageIDs: continue
    658653
    659654                #self.logger.infoTitle("Processing " + ota)
     
    666661
    667662                # now add DVO IDs
    668                 self.updateDvoIDs("Detection_" + ota, self.sourceIDs[ota], self.imageIDs[ota])
     663                self.updateDvoIDs("Detection_" + ota, self.imageIDs[ota])
    669664                results['NULLOBJID'] = self.scratchDb.reportAndDeleteRowsWithNULLS("Detection_" + ota, "objID")
    670665                self.updateImageID("Detection_" + ota, x, y)
     
    693688                # update ImageMeta with count of detections for this OTA and photoCodeID
    694689                sql = "UPDATE ImageMeta_" + ota + " \
    695                        SET nDetect = %d, photoCalID = %d" % (self.scratchDb.getRowCount("Detection_" + ota), self.scratchDb.getPhotoCalID(self.sourceIDs[ota], self.imageIDs[ota]))
     690                       SET nDetect = %d, photoCalID = %d" % (self.scratchDb.getRowCount("Detection_" + ota), self.scratchDb.getPhotoCalID(self.imageIDs[ota]))
    696691                self.scratchDb.execute(sql)
    697692
     
    757752    def importIppTables(self, filter=""):
    758753
    759        if self.testMode: regex = "XY33.psf"
     754       if self.config.test: regex = "XY33.psf"
    760755       else : regex = ".*.psf"
    761756 
    762        columns = "IPP_IDET X_PSF Y_PSF X_PSF_SIG Y_PSF_SIG PSF_INST_MAG PSF_INST_MAG_SIG PEAK_FLUX_AS_MAG PSF_MAJOR PSF_MINOR PSF_THETA EXT_NSIGMA PSF_QF MOMENTS_XX MOMENTS_XY MOMENTS_YY AP_MAG KRON_FLUX KRON_FLUX_ERR FLAGS SKY SKY_SIGMA EXT_NSIGMA"
     757       columns = "IPP_IDET X_PSF Y_PSF X_PSF_SIG Y_PSF_SIG PSF_INST_MAG PSF_INST_MAG_SIG PEAK_FLUX_AS_MAG PSF_MAJOR PSF_MINOR PSF_THETA EXT_NSIGMA PSF_QF MOMENTS_XX MOMENTS_XY MOMENTS_YY AP_MAG FLAGS SKY SKY_SIGMA EXT_NSIGMA"
    763758
    764759       return super(DetectionBatch, self).importIppTables(columns, regex)
Note: See TracChangeset for help on using the changeset viewer.