Changeset 31324 for trunk/ippToPsps/jython/stackbatch.py
- Timestamp:
- Apr 19, 2011, 10:59:57 AM (15 years ago)
- File:
-
- 1 edited
-
trunk/ippToPsps/jython/stackbatch.py (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippToPsps/jython/stackbatch.py
r31316 r31324 193 193 "+modelLong+"Covar68=b.EXT_COVAR_05_07, \ 194 194 "+modelLong+"Covar78=b.EXT_COVAR_06_07, \ 195 "+modelLong+"Covar88=b.EXT_COVAR_07_07 \ 195 "+modelLong+"Covar88=b.EXT_COVAR_07_07, \ 196 "+modelLong+"serNu=b.EXT_PAR_07, \ 197 "+modelLong+"serNuErr=SQRT(EXT_COVAR_07_07) \ 196 198 WHERE a.ippDetectID=b.IPP_IDET AND b.MODEL_TYPE = '"+ippModelType+"'" 197 199 … … 204 206 def populateStackMeta(self): 205 207 self.logger.info("Procesing StackMeta table") 208 209 photoCalID = self.getPhotoCalID() 206 210 207 211 sql = "INSERT INTO StackMeta (\ 208 212 stackMetaID \ 209 213 ,skycellID \ 214 ,photoCalID \ 210 215 ,photoZero \ 211 216 ,nP2Images \ … … 226 231 " + self.header['STK_ID'] + " \ 227 232 ," + self.skycell + " \ 233 ," + str(photoCalID) + " \ 228 234 ," + self.header['FPA.ZP'] + " \ 229 235 ," + self.header['NINPUTS'] + " \ … … 421 427 self.logger.info("Procesing StackToImage table") 422 428 423 sql = "INSERT INTO StackToImage (stackMetaID) VALUES (" + self.header['STK_ID'] + ")" 424 self.localStmt.execute(sql) 429 imageIDs = self.gpc1Db.getImageIDsForThisStackID(self.header['STK_ID']) 430 431 for imageID in imageIDs: 432 sql = "INSERT INTO StackToImage (stackMetaID, imageID) \ 433 VALUES (\ 434 " + self.header['STK_ID'] + ", " + imageID + ")" 435 self.localStmt.execute(sql) 425 436 426 437 ''' … … 452 463 self.logger.info("Creating bogus IDs on all detections") 453 464 454 sql = "INSERT INTO dvo (ippDetectID) SELECT IPP_IDET FROM SkyChip_psf";455 self.localStmt.execute(sql) 456 457 sql = "SELECT ippDetectID FROM dvo "465 sql = "INSERT INTO dvoDetection (ippDetectID) SELECT IPP_IDET FROM SkyChip_psf"; 466 self.localStmt.execute(sql) 467 468 sql = "SELECT ippDetectID FROM dvoDetection" 458 469 rs = self.localStmt.executeQuery(sql) 459 470 … … 466 477 467 478 for id in ids: 468 sql = "UPDATE dvo SET ippObjID = %d, objID = %d WHERE ippDetectID = %s" % (i, o, id)479 sql = "UPDATE dvoDetection SET ippObjID = %d, objID = %d WHERE ippDetectID = %s" % (i, o, id) 469 480 self.localStmt.execute(sql) 470 481 i = i + 1 … … 477 488 self.setMinMaxObjID("StackDetection") 478 489 490 ''' 491 Updates provided table with DVO IDs from DVO table 492 ''' 493 def updateDvoIDs(self, table): 494 495 self.logger.info("Updating table '" + table + "' with DVO IDs...") 496 sql = "UPDATE " + table + " AS a, dvoDetection AS b SET \ 497 a.ippObjID = b.ippObjID, \ 498 a.stackDetectID = b.detectID, \ 499 a.objID = b.objID \ 500 WHERE a.ippDetectID = b.ippDetectID" 501 self.localStmt.execute(sql) 502 self.logger.info("...done") 503 479 504 480 505 ''' … … 483 508 def populatePspsTables(self): 484 509 485 self.getIDsFromDVO(self.header['SOURCEID'], self.header['IMAGEID']) 510 if not self.getIDsFromDVO(self.header['SOURCEID'], self.header['IMAGEID']): 511 return False 486 512 487 513 self.populateStackMeta() … … 493 519 #self.fudgeIDs() 494 520 self.setMinMaxObjID("StackDetection") 495 521 522 return True 496 523 497 524 logging.config.fileConfig("logging.conf") … … 501 528 #sky_id = 299 # TODO 502 529 gpc1Db = Gpc1Db(logger) 503 cmfFiles = gpc1Db.getStackStageCmfs(sky_id)504 530 skyIDs = gpc1Db.getSkyIDsInThisDVODb("HAFTest.Staticsky") 531 skyIDs = [689] 505 532 i = 0 506 for file in cmfFiles: 507 508 stackBatch = StackBatch(logger, sky_id, file) 533 for skyID in skyIDs: 534 535 logger.info(" sky ID = %d" % skyID) 536 537 cmfFiles = gpc1Db.getStackStageCmfs(skyID) 538 539 for file in cmfFiles: 540 541 logger.info("-------------- New Batch ----------") 542 stackBatch = StackBatch(logger, skyID, file) 509 543 510 stackBatch.createEmptyPspsTables() 511 stackBatch.importIppTables("") 512 stackBatch.populatePspsTables() 513 stackBatch.reportNullsInAllPspsTables(False) 514 stackBatch.exportPspsTablesToFits() 515 stackBatch.writeBatchManifest() 516 #stackBatch.createTarball() 517 #stackBatch.publishToDatastore() 518 519 i = i + 1 520 if i > 0: break # TODO just doing one filter for now 544 stackBatch.createEmptyPspsTables() 545 stackBatch.importIppTables("") 546 if stackBatch.populatePspsTables(): 547 548 stackBatch.reportNullsInAllPspsTables(False) 549 stackBatch.exportPspsTablesToFits() 550 stackBatch.writeBatchManifest() 551 #stackBatch.createTarball() 552 #stackBatch.publishToDatastore() 553 554 i = i + 1 555 if i > 0: break # TODO just doing one filter for now 521 556 522 557 logger.info("Finished")
Note:
See TracChangeset
for help on using the changeset viewer.
