Changeset 31810 for trunk/ippToPsps/jython/detectionbatch.py
- Timestamp:
- Jul 1, 2011, 9:01:00 AM (15 years ago)
- File:
-
- 1 edited
-
trunk/ippToPsps/jython/detectionbatch.py (modified) (13 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippToPsps/jython/detectionbatch.py
r31504 r31810 7 7 from java.sql import * 8 8 9 from xml.etree.ElementTree import ElementTree, Element, tostring 10 9 11 from batch import Batch 10 12 from gpc1db import Gpc1Db … … 24 26 def __init__(self, 25 27 logger, 28 configDoc, 26 29 gpc1Db, 27 30 ippToPspsDb, 28 scratchDb,29 31 camID, 30 inputFile, 31 test=False, 32 useFullTables=False): 32 inputFile): 33 33 34 34 super(DetectionBatch, self).__init__( 35 35 logger, 36 configDoc, 36 37 gpc1Db, 37 38 ippToPspsDb, 38 scratchDb,39 39 camID, 40 40 "detection", 41 41 inputFile, 42 "MD04", # TODO 43 #"3PI") # TODO 44 useFullTables) 42 #"MD04") # TODO 43 "3PI") 45 44 46 45 if not self.everythingOK: return 47 48 # meta data to the log49 self.logger.info("New Detection Batch:")50 self.logger.info("Cam ID: %d" % self.id)51 self.logger.info("file: %s" % inputFile)52 self.logger.info("Exp ID: %d" % self.expID)53 self.logger.info("Exp name: %s" % self.expName)54 self.logger.info("Distribution group: %s" % self.distGroup)55 46 56 47 # create an output filename, which is {expID}.FITS … … 59 50 60 51 # if test mode 61 if test:52 if self.testMode: 62 53 self.startX = 3 63 54 self.endX = 4 … … 79 70 # set up some defauts 80 71 self.calibModNum = 0 81 self.dataRelease = 082 72 83 73 self.totalNumPhotoRef = 0 … … 88 78 # insert what we know about this stack batch into the stack table 89 79 self.ippToPspsDb.insertDetectionMeta(self.batchID, self.expID, self.filter) 80 81 ''' 82 Prints metadata to the log 83 ''' 84 def printMe(self): 85 86 super(DetectionBatch, self).printMe() 87 88 self.logger.info("Cam ID: %d" % self.id) 89 self.logger.info("Exp ID: %d" % self.expID) 90 self.logger.info("Exp name: %s" % self.expName) 91 self.logger.info("Distribution group: %s" % self.distGroup) 92 90 93 91 94 … … 145 148 ,1 \ 146 149 ,1 \ 147 ,' ' \150 ,'" + str(self.analysisVer) + "' \ 148 151 ,' ' \ 149 152 ,' ' \ … … 207 210 frameID \ 208 211 ,ccdID \ 212 ,bias \ 213 ,biasScat \ 209 214 ,sky \ 210 215 ,skyScat \ … … 267 272 " + str(self.expID) + " \ 268 273 ," + ota[2:4] + " \ 274 ," + str(self.bias) + " \ 275 ," + str(self.biasScat) + " \ 269 276 ," + self.safeDictionaryAccess(header, 'MSKY_MN') + " \ 270 277 ," + self.safeDictionaryAccess(header, 'MSKY_SIG') + " \ … … 364 371 ,momentYY \ 365 372 ,apMag \ 373 ,kronFlux \ 374 ,kronFluxErr \ 366 375 ,infoFlag \ 367 376 ,sky \ … … 386 395 ,MOMENTS_YY \ 387 396 ,AP_MAG \ 397 ,KRON_FLUX \ 398 ,KRON_FLUX_ERR \ 388 399 ,FLAGS\ 389 400 ,SKY \ … … 645 656 self.expName = meta[1]; 646 657 self.distGroup = meta[2]; 647 648 return self.ippToPspsDb.alreadyProcessed("detection", "exp_id", self.expID) 658 self.analysisVer = meta[3]; 659 self.bias = meta[4]; 660 self.biasScat = meta[5]; 661 662 if not self.analysisVer: self.analysisVer = -999 663 664 #return self.ippToPspsDb.alreadyProcessed("detection", "exp_id", self.expID) 665 return 0 649 666 650 667 … … 664 681 ''' 665 682 def importIppTables(self, filter=""): 666 return super(DetectionBatch, self).importIppTables(".*.psf") 683 684 if self.testMode: regex = "XY33.psf" 685 else : regex = ".*.psf" 686 687 return super(DetectionBatch, self).importIppTables(regex) 667 688 668 689 … … 674 695 675 696 676 # TODO put in config677 useFullTables=True678 testMode=False679 680 697 logging.config.fileConfig("logging.conf") 681 logger = logging.getLogger(" detectionbatch")698 logger = logging.getLogger("ippToPspsLog") 682 699 logger.setLevel(logging.INFO) 683 700 logger.info("Starting") 684 701 702 configDoc = ElementTree(file="config.xml") 703 dvoGpc1Label = configDoc.find("dvo/gpc1Label").text 704 685 705 gpc1Db = Gpc1Db(logger) 686 706 ippToPspsDb = IppToPspsDb(logger) 687 scratchDb = ScratchDb(logger, useFullTables) 688 689 camIDs = gpc1Db.getIDsInThisDVODbForThisStage("MD04.V2", "cam") 690 logger.info("Found %d exposures" % len(camIDs)) 691 692 i = 0 693 for camID in camIDs: 694 695 #if camID < 43764: continue # TODO 696 697 file = gpc1Db.getCameraStageSmf(camID) 707 708 ids = gpc1Db.getIDsInThisDVODbForThisStage(dvoGpc1Label, "cam") 709 for id in ids: 710 711 if not int(configDoc.find("options/force").text) and ippToPspsDb.alreadyProcessed(id): continue 712 713 file = gpc1Db.getCameraStageSmf(id) 698 714 699 715 detectionBatch = DetectionBatch(logger, 716 configDoc, 700 717 gpc1Db, 701 718 ippToPspsDb, 702 scratchDb, 703 camID, 704 file, 705 testMode, 706 useFullTables) 719 id, 720 file) 721 detectionBatch.printMe() 707 722 detectionBatch.run() 708 723
Note:
See TracChangeset
for help on using the changeset viewer.
