IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 35369


Ignore:
Timestamp:
Apr 5, 2013, 6:16:49 AM (13 years ago)
Author:
eugene
Message:

fix test for imageID in dvo

Location:
branches/eam_branches/ipp-20130307/ippToPsps/jython
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20130307/ippToPsps/jython/detectionbatch.py

    r35352 r35369  
    681681        # store these for later
    682682        self.imageIDs[chipname] = header['IMAGEID']
     683        self.sourceIDs[chipname] = header['SOURCEID']
    683684           
    684685        # populate ImageMeta
     
    702703        # dictionary objects to hold imageIDs for later
    703704        self.imageIDs = {}
     705        self.sourceIDs = {}
    704706
    705707        # loop through all OTAs and populate ImageMeta extensions
     
    791793
    792794        # does this chip exist in the DVO image table (if NOT, then skip it)
    793         if not self.scratchDb.haveThisChip(self.imageIDs[chipname]):
     795        if not self.scratchDb.haveThisChip(self.imageIDs[chipname], self.sourceIDs[chipname]):
    794796            self.logger.info("| %5s |            ------------- Chip not in DVO : rejecting ------------                    |" % chipname)
    795797            return False
  • branches/eam_branches/ipp-20130307/ippToPsps/jython/scratchdb.py

    r35352 r35369  
    370370    Checks whether the given chipID is in the DVO Image table
    371371    '''
    372     def haveThisChip(self, imageID):
    373 
    374         sql = "SELECT IMAGE_ID FROM " + self.dvoImagesTable + " WHERE IMAGE_ID = " + str(imageID)
    375 
    376         try:
    377             rs = self.executeQuery(sql)
    378             rs.first()
     372    def haveThisChip(self, imageID, sourceID):
     373
     374        sql = "SELECT EXTERN_ID FROM " \
     375            + self.dvoImagesTable + \
     376            " WHERE EXTERN_ID = " + str(imageID) + \
     377            " AND SOURCE_ID = " + str(sourceID)
     378
     379        try:
     380            rs = self.executeQuery(sql)
     381           
     382            if not rs:
     383                print "missing result set for imageID query"
     384                raise
     385
     386            # if no returned rows, return an error
     387            if not rs.next():
     388                print "DVO lacks imageID ", imageID
     389                print "sql: ", sql
     390                return False
     391
    379392            if rs.getInt(1) == int(imageID):
    380393                # print "DVO has imageID ", imageID
    381394                return True
     395
    382396            else:
    383                 print "DVO lacks imageID ", imageID
     397                print "DVO has wrong imageID? ", imageID
    384398                print "result was ", rs.getInt(1)
    385399                print "sql: ", sql
    386                 return False
     400                raise
     401
    387402        except:
    388403            print "DVO imageID query failed ", imageID
    389404            print "sql: ", sql
    390             return False
    391 
     405            raise
     406
     407        # how can I reach this?
    392408        return True
    393409
Note: See TracChangeset for help on using the changeset viewer.