IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jan 22, 2013, 5:07:13 AM (13 years ago)
Author:
eugene
Message:

protect against bad values of fwhm, psfmodel in header

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20121219/ippToPsps/jython/stackbatch.py

    r34902 r35008  
    5151               useFullTables)
    5252
     53       # self.printline = 0
     54       # # self.testprint()
     55
    5356       self.stackType = "DEEP_STACK" # TODO
    5457
     
    6366       self.filterID = self.scratchDb.getFilterID(self.filter)
    6467       self.skycell = meta[1];
     68
     69       # self.testprint()
    6570
    6671       # skycell is, eg "skycell.1133.081"
     
    7681       self.skycell = self.skycell[8:12]
    7782       self.projectioncell = self.skycell
     83
     84       # self.testprint()
    7885
    7986       # proposed new values. Need to coordinate with the SkyCell table
     
    96103       self.scratchDb.dropTable("StackDetectionCalib")
    97104
     105       # self.testprint()
     106
    98107       # delete IPP tables
    99108       self.scratchDb.dropTable("SkyChip_psf")
     
    115124       if not self.useFullTables:
    116125           self.scratchDb.insertNewDvoExternID(self.header['SOURCEID'], self.header['IMAGEID'])
     126
     127       # self.testprint()
    117128
    118129       # dump stuff to log
     
    139150        self.scratchDb.execute(sql)
    140151
     152
     153    def testprint(self):
     154      print "here ", self.printline
     155      self.printline += 1
    141156
    142157    '''
     
    348363        self.logger.infoPair("Procesing table", "StackMeta")
    349364
     365        self.fwhm_maj    = self.safeDictionaryAccess(self.header, 'FWHM_MAJ')
     366        self.fwhm_maj_uq = self.safeDictionaryAccess(self.header, 'FW_MJ_UQ')
     367        self.psfmodel    = self.safeDictionaryAccess(self.header, 'PSFMODEL')
     368        if (self.fwhm_maj    == "NULL"): self.fwhm_maj    = -999
     369        if (self.fwhm_maj_uq == "NULL"): self.fwhm_maj_uq = -999
     370
     371        # print "fwhm_maj    = ", self.fwhm_maj
     372        # print "fwhm_maj_uq = ", self.fwhm_maj_uq
     373        # print "psfmodel    = ", self.psfmodel
     374
    350375        sql = "INSERT INTO StackMeta (\
    351376        stackMetaID \
     
    375400        ," + self.header['FPA.ZP'] + " \
    376401        ," + self.expTime + " \
    377         ,'" + self.safeDictionaryAccess(self.header, 'PSFMODEL') + "' \
    378         ,'" + self.safeDictionaryAccess(self.header, 'FWHM_MAJ') + "' \
    379         ,'" + self.safeDictionaryAccess(self.header, 'FW_MJ_UQ') + "' \
     402        ,'" + self.psfmodel  + "' \
     403        ," + str(self.fwhm_maj)    + " \
     404        ," + str(self.fwhm_maj_uq) + " \
    380405        ,'" + self.header['CTYPE1'] + "' \
    381406        ,'" + self.header['CTYPE2'] + "' \
     
    486511               ," + self.historyModNum + " \
    487512               FROM SkyChip_psf"
    488         self.scratchDb.execute(sql)
    489        
     513
     514        # print "sql: ", sql
     515
     516        self.scratchDb.execute(sql)
     517
    490518        #it is possible to drop some detections from dvo (that are present in the cmf). when that happens we get a 0 for objid
    491519        #we drop those...
     
    509537       
    510538        self.updateDvoIDsAndFlags("StackDetection")
     539        # response = raw_input("updated dvo ")
    511540       
    512541        sql = "ALTER IGNORE TABLE StackDetection ADD PRIMARY KEY (objID)"
    513542       
    514543        self.scratchDb.execute(sql)
     544        # response = raw_input("add primary key? ")
    515545 
    516546        if self.stackType == "DEEP_STACK":
     
    524554           
    525555            self.scratchDb.execute(sql)
     556            # response = raw_input("add psf flux ")
    526557           
    527558        #leave null instflux in
     
    529560       
    530561        self.scratchDb.reportAndDeleteRowsWithNULLS("StackDetection", "objID")
     562        # response = raw_input("delete nulls ")
    531563       
    532564        sql="DELETE FROM StackDetection where objID = 0"
     
    534566        self.scratchDb.execute(sql)
    535567        self.logger.infoPair("Delleting", "entries with StackDetection.objID = 0")
     568        # response = raw_input("deleted objID is 0 ")
    536569       
    537570
     
    702735               FROM StackDetection"
    703736        self.scratchDb.execute(sql)
     737
    704738        # insert calibration information from dvoDetections into the Table
    705739        sql = "UPDATE " + tableName + " AS a, "  + self.scratchDb.dvoDetectionTable + " AS b \
     
    802836               WHERE a.ippDetectID = b.ippDetectID \
    803837               AND b.imageID = " + str(imageID)
     838
     839        # print "update dvo sql: ", sql
    804840        self.scratchDb.execute(sql)
    805841   
Note: See TracChangeset for help on using the changeset viewer.