Changeset 32140
- Timestamp:
- Aug 19, 2011, 11:47:13 AM (15 years ago)
- File:
-
- 1 edited
-
trunk/ippToPsps/jython/detectionbatch.py (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippToPsps/jython/detectionbatch.py
r32106 r32140 101 101 102 102 self.filter = self.header['FILTERID'][0:1] 103 self.filterID = self.scratchDb.getFilterID(self.filter) 103 104 104 105 # insert what we know about this stack batch into the stack table … … 367 368 pspsTableName = "Detection_" + ota 368 369 ippTableName = ota + "_psf" 369 370 371 results['ORIGINALTOTAL'] = self.scratchDb.getRowCount(ippTableName) 372 373 370 374 # drop then re-create table 371 375 self.scratchDb.dropTable(pspsTableName) … … 385 389 sql = "INSERT IGNORE INTO " + pspsTableName + " ( \ 386 390 ippDetectID \ 391 ,filterID \ 392 ,surveyID \ 393 ,obsTime \ 387 394 ,xPos \ 388 395 ,yPos \ … … 406 413 ,skyErr \ 407 414 ,sgSep \ 415 ,activeFlag \ 416 ,assocDate \ 417 ,historyModNum \ 418 ,dataRelease \ 408 419 ) \ 409 420 SELECT \ 410 421 IPP_IDET \ 422 , " + str(self.filterID) + "\ 423 , " + str(self.surveyID) + " \ 424 ," + str(self.obsTime) + " \ 411 425 ,X_PSF \ 412 426 ,Y_PSF \ … … 430 444 ,SKY_SIGMA \ 431 445 ,EXT_NSIGMA \ 446 , 0 \ 447 , '" + self.dateStr + "' \ 448 , 0 \ 449 , " + str(self.dataRelease) + "\ 432 450 FROM " + ippTableName 433 451 self.scratchDb.execute(sql) 434 435 # set obsTime436 sql = "UPDATE " + pspsTableName + " SET obsTime = %f, assocDate = '%s', activeFlag = 0" % (self.obsTime, self.dateStr)437 self.scratchDb.execute(sql)438 self.scratchDb.updateAllRows(pspsTableName, "dataRelease", str(self.dataRelease))439 self.scratchDb.updateAllRows(pspsTableName, "historyModNum", "0")440 441 self.scratchDb.updateAllRows(pspsTableName, "surveyID", str(self.surveyID))442 self.scratchDb.updateFilterID(pspsTableName, self.filter)443 452 444 453 # now delete bad flux and bad chip positions … … 640 649 otaCount = 0 641 650 results = {} 642 self.logger.info("+-------+---------------+---------------+---------------+---------------+---------------+") 643 self.logger.info("| OTA | Sat Det | NULL instFlux | NULL peak ADU | NULL obj ID | Remainder |") 644 self.logger.info("+-------+---------------+---------------+---------------+---------------+---------------+") 651 totalOriginal = totalSatDet = totalNulIInstFlux = totalNullPeakFlux = totalNullObjID = totalDetections = 0 652 self.logger.info("+-------+---------------+---------------+---------------+---------------+---------------+---------------+") 653 self.logger.info("| OTA | Initial total | Sat Det | NULL instFlux | NULL peak ADU | NULL obj ID | Remainder |") 654 self.logger.info("+-------+---------------+---------------+---------------+---------------+---------------+---------------+") 645 655 for x in range(self.startX, self.endX): 646 656 for y in range(self.startY, self.endY): … … 666 676 self.populateLikelihoods("Detection_" + ota) 667 677 rowCount = self.scratchDb.getRowCount("Detection_" + ota) 668 self.logger.info("| %5s | %13d | %13d | %13d | %13d | %13d | ",678 self.logger.info("| %5s | %13d | %13d | %13d | %13d | %13d | %13d |", 669 679 ota, 680 results['ORIGINALTOTAL'], 670 681 results['SATDET'], 671 682 results['NULLINSTFLUX'], … … 673 684 results['NULLOBJID'], 674 685 rowCount) 686 687 totalOriginal = totalOriginal + results['ORIGINALTOTAL'] 688 totalSatDet = totalSatDet + results['SATDET'] 689 totalNulIInstFlux = totalNulIInstFlux + results['NULLINSTFLUX'] 690 totalNullPeakFlux = totalNullPeakFlux + results['NULLPEAKADU'] 691 totalNullObjID = totalNullObjID + results['NULLOBJID'] 692 totalDetections = totalDetections + rowCount 675 693 676 694 # check we have something in this Detection table TODO add this to table above … … 696 714 otaCount = otaCount + 1 697 715 698 # TODO print totals here 699 self.logger.info("+-------+---------------+---------------+---------------+---------------+---------------+") 716 # print totals 717 self.logger.info("+-------+---------------+---------------+---------------+---------------+---------------+---------------+") 718 self.logger.info("| Total | %13d | %13d | %13d | %13d | %13d | %13d |", 719 totalOriginal, 720 totalSatDet, 721 totalNulIInstFlux, 722 totalNullPeakFlux, 723 totalNullObjID, 724 totalDetections) 725 self.logger.info("+-------+---------------+---------------+---------------+---------------+---------------+---------------+") 700 726 701 727 # if we only have one table export, i.e. FrameMeta, then get out of here
Note:
See TracChangeset
for help on using the changeset viewer.
