Changeset 31821
- Timestamp:
- Jul 1, 2011, 4:00:52 PM (15 years ago)
- File:
-
- 1 edited
-
trunk/ippToPsps/jython/detectionbatch.py (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippToPsps/jython/detectionbatch.py
r31810 r31821 6 6 from java.lang import * 7 7 from java.sql import * 8 9 from java.lang import Math 10 from org.apache.commons.math.special import Erf 8 11 9 12 from xml.etree.ElementTree import ElementTree, Element, tostring … … 483 486 self.logger.info("Creating indexes on PSPS tables") 484 487 self.scratchDb.makeColumnUnique("Detection", "objID") 485 self.scratchDb. createIndex("Detection", "ippDetectID")488 self.scratchDb.makeColumnPrimaryKey("Detection", "ippDetectID") 486 489 487 490 ''' … … 521 524 522 525 self.scratchDb.execute(sql) 526 527 ''' 528 Generates psf, cosmic ray and extended source likelihoods 529 ''' 530 def populateLikelihoods(self, tableName): 531 532 sql = "SELECT ippDetectID, psfLikelihood, crLikelihood, extendedLikelihood, sgSep FROM " + tableName 533 rs = self.scratchDb.executeUpdatableQuery(sql) 534 535 sqrt2 = Math.sqrt(2) 536 537 while rs.next(): 538 539 sgSep = rs.getDouble(5) 540 psfLikelihood = Erf.erfc(Math.abs(sgSep)/sqrt2) 541 542 if sgSep > 0: 543 crLikelihood = 0 544 extendedLikelihood = 1.0 - psfLikelihood 545 else: 546 crLikelihood = 1.0 - psfLikelihood 547 extendedLikelihood = 0 548 549 # update columns 550 rs.updateDouble(2, psfLikelihood ) 551 rs.updateDouble(3, crLikelihood ) 552 rs.updateDouble(4, extendedLikelihood ) 553 554 # now 'commit' to database 555 rs.updateRow(); 523 556 524 557 … … 602 635 self.scratchDb.reportAndDeleteRowsWithNULLS("Detection_" + ota, "objID") 603 636 self.updateImageID("Detection_" + ota, x, y) 637 self.populateLikelihoods("Detection_" + ota) 604 638 605 639 # check we have something in this Detection table
Note:
See TracChangeset
for help on using the changeset viewer.
