IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Apr 15, 2011, 1:51:38 PM (15 years ago)
Author:
rhenders
Message:

Added some try/catch blocks for safety; now deleting all tables before processing begins

File:
1 edited

Legend:

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

    r31292 r31298  
    2222               "stack",
    2323               inputFile,
    24                "ThreePi") # TODO
     24               "MD04") # TODO
    2525
    2626       self.logger.info("StackBatch constructor. Creating batch from: '" + inputFile + "'")
    2727
     28       # delete PSPS tables
     29       self.dropTable("StackMeta")
     30       self.dropTable("StackDetection")
     31       self.dropTable("StackModelFit")
     32       self.dropTable("StackApFlx")
     33       self.dropTable("StackToImage")
     34
     35       # delete IPP tables
     36       self.dropTable("SkyChip_psf")
     37       self.dropTable("SkyChip_xsrc")
     38       self.dropTable("SkyChip_xfit")
     39       self.dropTable("SkyChip_xrad")
     40
    2841       # obs time makes no sense except for nightly stacks
     42       self.logger.info("Stack type: " + self.header['STK_TYPE'])
    2943       if self.header['STK_TYPE'] != "NIGHTLY_STACK": self.header['MJD-OBS'] = "-999"
    3044
     
    324338        self.updateDataRelease("StackDetection")
    325339        self.updateStackTypeID("StackDetection")
     340        self.updateDvoIDs("StackDetection")
    326341
    327342    '''
     
    336351               DISTINCT IPP_IDET \
    337352               FROM SkyChip_xrad"
    338         self.localStmt.execute(sql)
     353
     354        try:
     355            self.localStmt.execute(sql)
     356        except: return
    339357
    340358        # TODO temporarily loading 1st convolved fluxes into unconvolved fields
     
    364382        self.updateDataRelease("StackApFlx")
    365383        self.updateStackTypeID("StackApFlx")
     384        self.updateDvoIDs("StackApFlx")
    366385
    367386    '''
     
    373392        # insert all the detections
    374393        sql = "INSERT INTO StackModelFit (ippDetectID) SELECT DISTINCT IPP_IDET from SkyChip_xfit"
    375         self.localStmt.execute(sql)
     394        try:
     395            self.localStmt.execute(sql)
     396        except:
     397            return
     398
    376399
    377400        # populate model parameters
     
    388411        self.updateDataRelease("StackModelFit")
    389412        self.updateStackTypeID("StackModelFit")
     413        self.updateDvoIDs("StackModelFit")
    390414
    391415    '''
     
    420444
    421445    '''
     446    Temporary hack to fudge some object IDs
    422447    '''
    423448    def fudgeIDs(self):
     
    450475        self.setMinMaxObjID("StackDetection")
    451476
     477
    452478    '''
    453479    Does the processing, i.e. pulling stuff from IPP tables into PSPS tables
    454480    '''
    455481    def populatePspsTables(self):
     482
     483        self.getIDsFromDVO(self.header['SOURCEID'], self.header['IMAGEID'])
    456484
    457485        self.populateStackMeta()
     
    461489        self.populateStackToImage()
    462490
     491        self.setMinMaxObjID("StackDetection")
     492
    463493
    464494logging.config.fileConfig("logging.conf")
    465495logger = logging.getLogger("stackbatch")
    466496logger.info("Starting")
    467 sky_id = 299 # TODO
     497sky_id = 689 # TODO
    468498gpc1Db = Gpc1Db(logger)
    469499cmfFiles = gpc1Db.getStackStageCmfs(sky_id)
     
    477507    stackBatch.importIppTables("")
    478508    stackBatch.populatePspsTables()
    479     stackBatch.fudgeIDs()
    480509    stackBatch.reportNullsInAllPspsTables(False)
    481     #    stackBatch.replaceAllPspsNulls("-999") 
    482510    stackBatch.exportPspsTablesToFits()
    483511    stackBatch.writeBatchManifest()
Note: See TracChangeset for help on using the changeset viewer.