IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Apr 8, 2011, 6:31:08 PM (15 years ago)
Author:
watersc1
Message:

merge from trunk

Location:
branches/czw_branch/20110406
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/czw_branch/20110406

  • branches/czw_branch/20110406/ippToPsps/jython/stackbatch.py

    r31202 r31253  
    77from gpc1db import Gpc1Db
    88from batch import Batch
     9import logging.config
    910
    1011class StackBatch(Batch):
     
    1314    Constructor
    1415    '''
    15     def __init__(self, skyID, inputFile):
     16    def __init__(self, logger, skyID, inputFile):
    1617       super(StackBatch, self).__init__(
     18               logger,
    1719               "stack",
    1820               inputFile,
    1921               "MD04") # TODO
    2022
    21        self.log("StackBatch constructor. Creating batch from input file here: ''" + inputFile + "'")
     23       self.logger.info("StackBatch constructor. Creating batch from: ''" + inputFile + "'")
    2224
    2325       # obs time makes no sense except for nightly stacks
     
    185187    '''
    186188    def populateStackMeta(self):
    187         self.log("Procesing StackMeta table")
     189        self.logger.info("Procesing StackMeta table")
    188190
    189191        sql = "INSERT INTO StackMeta (\
     
    233235    '''
    234236    def populateStackDetection(self):
    235         self.log("Procesing StackDetection table")
     237        self.logger.info("Procesing StackDetection table")
    236238
    237239        # insert all the detections
     
    297299    '''
    298300    def populateStackApFlx(self):
    299         self.log("Procesing StackApFlx table")
     301        self.logger.info("Procesing StackApFlx table")
    300302 
    301303        sql = "INSERT INTO StackApFlx \
     
    307309
    308310        # TODO temporarily loading 1st convolved fluxes into unconvolved fields
    309         self.log("    Adding un-convolved fluxes")
     311        self.logger.info("    Adding un-convolved fluxes")
    310312        self.updateApFlxs("", "< 7.0")
    311         self.log("    Adding 1st convolved fluxes")
     313        self.logger.info("    Adding 1st convolved fluxes")
    312314        self.updateApFlxs("c1", "< 7.0")
    313         self.log("    Adding 2nd convolved fluxes")
     315        self.logger.info("    Adding 2nd convolved fluxes")
    314316        self.updateApFlxs("c2", "> 7.0")
    315317
    316         self.log("    Adding petrosians for extended sources")
     318        self.logger.info("    Adding petrosians for extended sources")
    317319        sql = "UPDATE StackApFlx AS a, SkyChip_xsrc AS b SET \
    318320        petRadius=b.PETRO_RADIUS \
     
    337339    '''
    338340    def populateStackModelFit(self):
    339         self.log("Procesing StackModelFit table")
     341        self.logger.info("Procesing StackModelFit table")
    340342
    341343        # insert all the detections
     
    344346
    345347        # populate model parameters
    346         self.log("    Adding deVaucouleurs fit")
     348        self.logger.info("    Adding deVaucouleurs fit")
    347349        self.updateModelFit("deV", "PS_MODEL_DEV")
    348         self.log("    Adding exponential fit")
     350        self.logger.info("    Adding exponential fit")
    349351        self.updateModelFit("exp", "PS_MODEL_EXP")
    350         self.log("    Adding sersic fit")
     352        self.logger.info("    Adding sersic fit")
    351353        self.updateModelFit("ser", "PS_MODEL_SERSIC")
    352354
     
    361363    '''
    362364    def populateStackToImage(self):
    363         self.log("Procesing StackToImage table")
     365        self.logger.info("Procesing StackToImage table")
    364366
    365367        sql = "INSERT INTO StackToImage (stackMetaID) VALUES (" + self.header['STK_ID'] + ")"
     
    371373    def indexPspsTables(self):
    372374
    373         self.log("Creating indexes on PSPS tables")
     375        self.logger.info("Creating indexes on PSPS tables")
    374376        self.createIndex("StackDetection", "ippDetectID")
    375377        self.createIndex("StackApFlx", "ippDetectID")
     
    381383    def indexIppTables(self):
    382384
    383         self.log("Creating indexes on IPP tables")
     385        self.logger.info("Creating indexes on IPP tables")
    384386        self.createIndex("SkyChip_psf", "IPP_IDET")
    385387        self.createIndex("SkyChip_xfit", "IPP_IDET")
     
    391393    def fudgeIDs(self):
    392394
    393         self.log("Creating bogus IDs on all detections")
     395        self.logger.info("Creating bogus IDs on all detections")
    394396
    395397        sql = "INSERT INTO dvo (ippDetectID) SELECT IPP_IDET FROM SkyChip_psf";
     
    430432
    431433
    432 sky_id = 299
    433 gpc1Db = Gpc1Db()
     434logging.config.fileConfig("logging.conf")
     435logger = logging.getLogger("stackbatch")
     436sky_id = 299 # TODO
     437gpc1Db = Gpc1Db(logger)
    434438cmfFiles = gpc1Db.getStackStageCmfs(sky_id)
    435439
     
    437441for file in cmfFiles:
    438442
    439     stackBatch = StackBatch(sky_id, file)
     443    stackBatch = StackBatch(logger, sky_id, file)
    440444   
    441445    stackBatch.createEmptyPspsTables()
    442     #stackBatch.importIppTables("")
    443     stackBatch.populatePspsTables()
    444     stackBatch.fudgeIDs()
    445     #stackBatch.reportNullsInAllPspsTables(False)
    446     #stackBatch.replaceAllPspsNulls("-999") 
    447     stackBatch.exportPspsTablesToFits()
    448     stackBatch.writeBatchManifest()
     446    stackBatch.importIppTables("")
     447#    stackBatch.populatePspsTables()
     448 #   stackBatch.fudgeIDs()
     449  #  stackBatch.reportNullsInAllPspsTables(False)
     450  #  stackBatch.replaceAllPspsNulls("-999") 
     451  #  stackBatch.exportPspsTablesToFits()
     452  #  stackBatch.writeBatchManifest()
     453  #  stackBatch.createTarball()
     454  #  stackBatch.publishToDatastore()
    449455
    450456    i = i + 1
Note: See TracChangeset for help on using the changeset viewer.