Changeset 32327 for trunk/ippToPsps/jython/detectionbatch.py
- Timestamp:
- Sep 5, 2011, 9:51:54 AM (15 years ago)
- File:
-
- 1 edited
-
trunk/ippToPsps/jython/detectionbatch.py (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippToPsps/jython/detectionbatch.py
r32305 r32327 538 538 self.scratchDb.makeColumnPrimaryKey("Detection", "ippDetectID") 539 539 540 '''541 Applies indexes to the IPP tables542 '''543 def indexIppTables(self):544 545 self.logger.infoPair("Creating indexes on", "IPP tables")546 547 for x in range(self.startX, self.endX):548 for y in range(self.startY, self.endY):549 550 # dodge the corners551 if x==0 and y==0: continue552 if x==0 and y==7: continue553 if x==7 and y==0: continue554 if x==7 and y==7: continue555 556 extension = "XY%d%d_psf" % (x, y)557 self.scratchDb.createIndex(extension, "IPP_IDET")558 559 '''560 Updates provided table with DVO IDs from DVO table561 '''562 def updateDvoIDs(self, table, sourceID, externID):563 564 imageID = self.scratchDb.getImageIDFromExternID(sourceID, externID)565 self.logger.debug("Updating table '" + table + "' with DVO IDs using imageID = %d" % imageID)566 sql = "UPDATE IGNORE " + table + " AS a, " + self.scratchDb.dvoDetectionTable + " AS b SET \567 a.ippObjID = b.ippObjID, \568 a.detectID = b.detectID, \569 a.objID = b.objID, \570 a.infoFlag = b.flags << 32 | a.infoFlag \571 WHERE a.ippDetectID = b.ippDetectID \572 AND b.sourceID = " + str(sourceID) + " \573 AND b.imageID = " + str(imageID)574 575 self.scratchDb.execute(sql)576 577 578 '''579 Does the processing, i.e. pulling stuff from IPP tables into PSPS tables580 '''581 def populatePspsTables(self):582 583 540 self.populateFrameMeta() 584 541 585 542 # dictionary objects to hold sourceIDs and imageIDs for later 586 s ourceIDs = {}587 imageIDs = {}543 self.sourceIDs = {} 544 self.imageIDs = {} 588 545 589 546 # loop through all OTAs and populate ImageMeta extensions … … 608 565 609 566 # check we have valid sourceID/imageID pair from the header 610 if self.safeDictionaryAccess(header, 'SOURCEID') == "NULL": 611 continue 612 if self.safeDictionaryAccess(header, 'IMAGEID') == "NULL": 613 continue 567 if self.safeDictionaryAccess(header, 'SOURCEID') == "NULL": continue 568 if self.safeDictionaryAccess(header, 'IMAGEID') == "NULL": continue 614 569 615 570 # store sourceID/imageID combo in Db so DVO can look up later … … 618 573 619 574 # store these for later 620 s ourceIDs[ota] = header['SOURCEID']621 imageIDs[ota] = header['IMAGEID']575 self.sourceIDs[ota] = header['SOURCEID'] 576 self.imageIDs[ota] = header['IMAGEID'] 622 577 623 578 # populate ImageMeta … … 628 583 if not self.useFullTables: 629 584 if not self.getIDsFromDVO(): return False 585 586 return True 587 588 589 ''' 590 Applies indexes to the IPP tables 591 ''' 592 def indexIppTables(self): 593 594 self.logger.infoPair("Creating indexes on", "IPP tables") 595 596 for x in range(self.startX, self.endX): 597 for y in range(self.startY, self.endY): 598 599 # dodge the corners 600 if x==0 and y==0: continue 601 if x==0 and y==7: continue 602 if x==7 and y==0: continue 603 if x==7 and y==7: continue 604 605 extension = "XY%d%d_psf" % (x, y) 606 self.scratchDb.createIndex(extension, "IPP_IDET") 607 608 ''' 609 Updates provided table with DVO IDs from DVO table 610 ''' 611 def updateDvoIDs(self, table, sourceID, externID): 612 613 imageID = self.scratchDb.getImageIDFromExternID(sourceID, externID) 614 self.logger.debug("Updating table '" + table + "' with DVO IDs using imageID = %d" % imageID) 615 sql = "UPDATE IGNORE " + table + " AS a, " + self.scratchDb.dvoDetectionTable + " AS b SET \ 616 a.ippObjID = b.ippObjID, \ 617 a.detectID = b.detectID, \ 618 a.objID = b.objID, \ 619 a.infoFlag = b.flags << 32 | a.infoFlag \ 620 WHERE a.ippDetectID = b.ippDetectID \ 621 AND b.sourceID = " + str(sourceID) + " \ 622 AND b.imageID = " + str(imageID) 623 624 self.scratchDb.execute(sql) 625 626 627 ''' 628 Does the processing, i.e. pulling stuff from IPP tables into PSPS tables 629 ''' 630 def populatePspsTables(self): 630 631 631 632 # loop through all OTAs again to update with DVO IDs … … 649 650 650 651 ota = "XY%d%d" % (x, y) 651 if ota not in s ourceIDs: continue652 if ota not in self.sourceIDs: continue 652 653 653 654 #self.logger.infoTitle("Processing " + ota) … … 660 661 661 662 # now add DVO IDs 662 self.updateDvoIDs("Detection_" + ota, s ourceIDs[ota],imageIDs[ota])663 self.updateDvoIDs("Detection_" + ota, self.sourceIDs[ota], self.imageIDs[ota]) 663 664 results['NULLOBJID'] = self.scratchDb.reportAndDeleteRowsWithNULLS("Detection_" + ota, "objID") 664 665 self.updateImageID("Detection_" + ota, x, y) … … 687 688 # update ImageMeta with count of detections for this OTA and photoCodeID 688 689 sql = "UPDATE ImageMeta_" + ota + " \ 689 SET nDetect = %d, photoCalID = %d" % (self.scratchDb.getRowCount("Detection_" + ota), self.scratchDb.getPhotoCalID(s ourceIDs[ota],imageIDs[ota]))690 SET nDetect = %d, photoCalID = %d" % (self.scratchDb.getRowCount("Detection_" + ota), self.scratchDb.getPhotoCalID(self.sourceIDs[ota], self.imageIDs[ota])) 690 691 self.scratchDb.execute(sql) 691 692
Note:
See TracChangeset
for help on using the changeset viewer.
