IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Apr 19, 2011, 10:59:57 AM (15 years ago)
Author:
rhenders
Message:

now searching for all stacks for a given DVO db, and looping through them all; writing stackDetectID; using new dvo Db tables; added two extra sersic parameters

File:
1 edited

Legend:

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

    r31316 r31324  
    193193            "+modelLong+"Covar68=b.EXT_COVAR_05_07,  \
    194194            "+modelLong+"Covar78=b.EXT_COVAR_06_07,  \
    195             "+modelLong+"Covar88=b.EXT_COVAR_07_07   \
     195            "+modelLong+"Covar88=b.EXT_COVAR_07_07,   \
     196            "+modelLong+"serNu=b.EXT_PAR_07,   \
     197            "+modelLong+"serNuErr=SQRT(EXT_COVAR_07_07)  \
    196198            WHERE a.ippDetectID=b.IPP_IDET AND b.MODEL_TYPE = '"+ippModelType+"'"
    197199
     
    204206    def populateStackMeta(self):
    205207        self.logger.info("Procesing StackMeta table")
     208
     209        photoCalID = self.getPhotoCalID()
    206210
    207211        sql = "INSERT INTO StackMeta (\
    208212        stackMetaID \
    209213        ,skycellID \
     214        ,photoCalID \
    210215        ,photoZero \
    211216        ,nP2Images \
     
    226231        " + self.header['STK_ID'] + " \
    227232        ," + self.skycell + " \
     233        ," + str(photoCalID) + " \
    228234        ," + self.header['FPA.ZP'] + " \
    229235        ," + self.header['NINPUTS'] + " \
     
    421427        self.logger.info("Procesing StackToImage table")
    422428
    423         sql = "INSERT INTO StackToImage (stackMetaID) VALUES (" + self.header['STK_ID'] + ")"
    424         self.localStmt.execute(sql)
     429        imageIDs = self.gpc1Db.getImageIDsForThisStackID(self.header['STK_ID'])
     430
     431        for imageID in imageIDs:
     432            sql = "INSERT INTO StackToImage (stackMetaID, imageID) \
     433                   VALUES (\
     434                   " + self.header['STK_ID'] + ", " + imageID + ")"
     435            self.localStmt.execute(sql)
    425436
    426437    '''
     
    452463        self.logger.info("Creating bogus IDs on all detections")
    453464
    454         sql = "INSERT INTO dvo (ippDetectID) SELECT IPP_IDET FROM SkyChip_psf";
    455         self.localStmt.execute(sql)
    456 
    457         sql = "SELECT ippDetectID FROM dvo"
     465        sql = "INSERT INTO dvoDetection (ippDetectID) SELECT IPP_IDET FROM SkyChip_psf";
     466        self.localStmt.execute(sql)
     467
     468        sql = "SELECT ippDetectID FROM dvoDetection"
    458469        rs = self.localStmt.executeQuery(sql)
    459470
     
    466477
    467478        for id in ids:
    468             sql = "UPDATE dvo SET ippObjID = %d, objID = %d WHERE ippDetectID = %s" % (i, o, id)
     479            sql = "UPDATE dvoDetection SET ippObjID = %d, objID = %d WHERE ippDetectID = %s" % (i, o, id)
    469480            self.localStmt.execute(sql)
    470481            i = i + 1
     
    477488        self.setMinMaxObjID("StackDetection")
    478489
     490    '''
     491    Updates provided table with DVO IDs from DVO table
     492    '''
     493    def updateDvoIDs(self, table):
     494
     495        self.logger.info("Updating table '" + table + "' with DVO IDs...")
     496        sql = "UPDATE " + table + " AS a, dvoDetection AS b SET \
     497               a.ippObjID = b.ippObjID, \
     498               a.stackDetectID = b.detectID, \
     499               a.objID = b.objID \
     500               WHERE a.ippDetectID = b.ippDetectID"
     501        self.localStmt.execute(sql)
     502        self.logger.info("...done")
     503
    479504
    480505    '''
     
    483508    def populatePspsTables(self):
    484509
    485         self.getIDsFromDVO(self.header['SOURCEID'], self.header['IMAGEID'])
     510        if not self.getIDsFromDVO(self.header['SOURCEID'], self.header['IMAGEID']):
     511            return False
    486512
    487513        self.populateStackMeta()
     
    493519        #self.fudgeIDs()
    494520        self.setMinMaxObjID("StackDetection")
    495 
     521       
     522        return True
    496523
    497524logging.config.fileConfig("logging.conf")
     
    501528#sky_id = 299 # TODO
    502529gpc1Db = Gpc1Db(logger)
    503 cmfFiles = gpc1Db.getStackStageCmfs(sky_id)
    504 
     530skyIDs = gpc1Db.getSkyIDsInThisDVODb("HAFTest.Staticsky")
     531skyIDs = [689]
    505532i = 0
    506 for file in cmfFiles:
    507 
    508     stackBatch = StackBatch(logger, sky_id, file)
     533for skyID in skyIDs:
     534
     535    logger.info(" sky ID = %d" % skyID)
     536
     537    cmfFiles = gpc1Db.getStackStageCmfs(skyID)
     538
     539    for file in cmfFiles:
     540
     541        logger.info("-------------- New Batch ----------")
     542        stackBatch = StackBatch(logger, skyID, file)
    509543   
    510     stackBatch.createEmptyPspsTables()
    511     stackBatch.importIppTables("")
    512     stackBatch.populatePspsTables()
    513     stackBatch.reportNullsInAllPspsTables(False)
    514     stackBatch.exportPspsTablesToFits()
    515     stackBatch.writeBatchManifest()
    516     #stackBatch.createTarball()
    517     #stackBatch.publishToDatastore()
    518 
    519     i = i + 1
    520     if i > 0: break # TODO just doing one filter for now
     544        stackBatch.createEmptyPspsTables()
     545        stackBatch.importIppTables("")
     546        if stackBatch.populatePspsTables():
     547
     548            stackBatch.reportNullsInAllPspsTables(False)
     549            stackBatch.exportPspsTablesToFits()
     550            stackBatch.writeBatchManifest()
     551            #stackBatch.createTarball()
     552            #stackBatch.publishToDatastore()
     553
     554        i = i + 1
     555        if i > 0: break # TODO just doing one filter for now
    521556
    522557logger.info("Finished")
Note: See TracChangeset for help on using the changeset viewer.