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/stackbatch.py

    r32588 r33638  
    3030    def __init__(self,
    3131                 logger,
    32                  configPath,
    33                  configDoc,
     32                 config,
    3433                 gpc1Db,
    3534                 ippToPspsDb,
     35                 scratchDb,
    3636                 stackID,
    37                  batchID):
     37                 batchID,
     38                 useFullTables):
    3839
    3940       super(StackBatch, self).__init__(
    4041               logger,
    41                configPath,
    42                configDoc,
     42               config,
    4343               gpc1Db,
    4444               ippToPspsDb,
     45               scratchDb,
    4546               stackID,
    4647               batchID,
    4748               "ST",
    48                gpc1Db.getStackStageCmf(stackID))
     49               gpc1Db.getStackStageCmf(config.dvoLabel, stackID),
     50               useFullTables)
    4951
    5052       if not self.everythingOK: return
     
    6062       self.filter = meta[0];
    6163       self.filter = self.filter[0:1]
     64       self.filterID = self.scratchDb.getFilterID(self.filter)
    6265       self.skycell = meta[1];
    6366
     
    7780       self.analysisVer = meta[2];
    7881
    79        self.expTime = gpc1Db.getStackExpTime(self.id)
    80 
    81        self.logger.debug("Got exp time of %d" % self.expTime)
     82       #self.expTime = gpc1Db.getStackExpTime(self.id)
     83       self.expTime = self.header['EXPTIME']
    8284
    8385       # delete PSPS tables
     
    281283        " + str(self.id) + " \
    282284        ," + self.skycell + " \
    283         ," + str(self.scratchDb.getPhotoCalID(self.header['SOURCEID'], self.header['IMAGEID'])) + " \
     285        ," + str(self.scratchDb.getPhotoCalID(self.header['IMAGEID'])) + " \
    284286        ," + self.header['FPA.ZP'] + " \
    285         ," + str(self.expTime) + " \
     287        ," + self.expTime + " \
    286288        ,'" + self.safeDictionaryAccess(self.header, 'PSFMODEL') + "' \
    287289        ,'" + self.safeDictionaryAccess(self.header, 'FWHM_MAJ') + "' \
     
    304306        self.scratchDb.updateAllRows("StackMeta", "surveyID", str(self.surveyID))
    305307        self.scratchDb.updateFilterID("StackMeta", self.filter)
    306         self.scratchDb.updateAllRows("StackMeta", "dataRelease", str(self.dataRelease))
     308        self.scratchDb.updateAllRows("StackMeta", "dataRelease", str(self.config.dataRelease))
    307309        self.updateStackTypeID("StackMeta")
    308310
     
    400402        self.scratchDb.updateAllRows("StackDetection", "surveyID", str(self.surveyID))
    401403        self.scratchDb.updateFilterID("StackDetection", self.filter)
    402         self.scratchDb.updateAllRows("StackDetection", "dataRelease", str(self.dataRelease))
     404        self.scratchDb.updateAllRows("StackDetection", "dataRelease", str(self.config.dataRelease))
    403405        self.scratchDb.updateAllRows("StackDetection", "primaryF", "0")
    404406        self.scratchDb.updateAllRows("StackDetection", "activeFlag", "0")
     
    442444        # TODO temporarily loading 1st convolved fluxes into unconvolved fields
    443445        self.logger.infoPair("Adding fluxes", "un-convolved")
    444         self.updateApFlxs("", "< 7.0")
     446        self.updateApFlxs("", "IS NULL")
    445447        self.logger.infoPair("Adding fluxes", "1st convolved")
    446448        self.updateApFlxs("c1", "< 7.0")
     
    458460        ,petR90=b.PETRO_RADIUS_90 \
    459461        ,petR90Err=b.PETRO_RADIUS_90_ERR \
     462        ,petCf=b.PETRO_FILL \
    460463        WHERE a.ippDetectID=b.IPP_IDET"
    461464        self.scratchDb.execute(sql)
     
    463466        self.scratchDb.updateAllRows("StackApFlx", "surveyID", str(self.surveyID))
    464467        self.scratchDb.updateFilterID("StackApFlx", self.filter)
    465         self.scratchDb.updateAllRows("StackApFlx", "dataRelease", str(self.dataRelease))
     468        self.scratchDb.updateAllRows("StackApFlx", "dataRelease", str(self.config.dataRelease))
    466469        self.scratchDb.updateAllRows("StackApFlx", "primaryF", "0")
    467470        self.scratchDb.updateAllRows("StackApFlx", "activeFlag", "0")
     
    497500        self.scratchDb.updateAllRows("StackModelFit", "surveyID", str(self.surveyID))
    498501        self.scratchDb.updateFilterID("StackModelFit", self.filter)
    499         self.scratchDb.updateAllRows("StackModelFit", "dataRelease", str(self.dataRelease))
     502        self.scratchDb.updateAllRows("StackModelFit", "dataRelease", str(self.config.dataRelease))
    500503        self.scratchDb.updateAllRows("StackModelFit", "primaryF", "0")
    501504        self.scratchDb.updateAllRows("StackModelFit", "activeFlag", "0")
     
    515518        rs.first()
    516519        nMissing = rs.getInt(1)
    517         self.logger.infoPair("Detections deleted from %s that are not in StackDetection" + table, "%5d" % nMissing)
    518520 
    519521        if nMissing < 1: return
     
    521523        sql = "DELETE FROM " + table + " WHERE ippDetectID NOT IN (SELECT ippDetectID FROM StackDetection)"
    522524        self.scratchDb.execute(sql)
     525        self.logger.infoPair("Detections not in StackDetection", "%d deleted from %s" % (nMissing, table))
    523526       
    524527
     
    562565
    563566        self.scratchDb.updateAllRows("SkinnyObject", "surveyID", str(self.surveyID))
    564         self.scratchDb.updateAllRows("SkinnyObject", "dataRelease", str(self.dataRelease))
     567        self.scratchDb.updateAllRows("SkinnyObject", "dataRelease", str(self.config.dataRelease))
    565568
    566569    '''
     
    582585
    583586        self.scratchDb.updateFilterID("ObjectCalColor", self.filter)
    584         self.scratchDb.updateAllRows("ObjectCalColor", "dataRelease", str(self.dataRelease))
     587        self.scratchDb.updateAllRows("ObjectCalColor", "dataRelease", str(self.config.dataRelease))
    585588
    586589
     
    616619    def updateDvoIDs(self, table):
    617620
    618         imageID = self.scratchDb.getImageIDFromExternID(self.header['SOURCEID'], self.header['IMAGEID'])
     621        imageID = self.scratchDb.getImageIDFromExternID(self.header['IMAGEID'])
    619622        self.logger.debug("Updating table '" + table + "' with DVO IDs...")
    620623        sql = "UPDATE " + table + " AS a, " + self.scratchDb.dvoDetectionTable + " AS b SET \
    621624               a.ippObjID = b.ippObjID, \
    622                a.stackDetectID = b.detectID, \
     625               a.stackDetectID = 10 * b.detectID + " + str(self.filterID) + ", \
    623626               a.objID = b.objID \
    624627               WHERE a.ippDetectID = b.ippDetectID \
    625                AND b.sourceID = " + self.header['SOURCEID'] + "\
    626628               AND b.imageID = " + str(imageID)
    627629        self.scratchDb.execute(sql)
Note: See TracChangeset for help on using the changeset viewer.