- Timestamp:
- Nov 6, 2015, 1:14:41 PM (11 years ago)
- Location:
- trunk/ippToPsps/jython
- Files:
-
- 2 edited
-
forcedwarpbatch.py (modified) (22 diffs)
-
stackbatch.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippToPsps/jython/forcedwarpbatch.py
r39029 r39062 57 57 "FW", 58 58 None) 59 60 # gpc1Db.getForcedWarpStageSmf(forcedWarpID)61 # there is a funny problem with order here: we need to open the file first to read the header to get62 # to skycell ID63 # forcedWarpID = self.forcedWarpID64 59 65 60 # make a set of lists (needs to be outside of the loop … … 99 94 self.logger.infoPair("index",num) 100 95 self.logger.infoPair("forcedWarpID", forcedWarpID) 101 self.logger.infoPair("getting the fits file for add_id", forcedWarpID)96 self.logger.infoPair("getting the fits file for add_id", forcedWarpID) 102 97 self.fits[num] = gpc1Db.getForcedWarpStageCmf(skychunk.dvoLabel, int(forcedWarpID)) 103 98 … … 169 164 self.logger.infoPair("projection cell found ",self.projectionID[num]) 170 165 self.logger.infoPair("skycell found", self.skycellID[num]) 171 self.dropTableVerbose("ForcedWarpMeasurement"+"_"+str( forcedWarpID))172 self.dropTableVerbose("ForcedWarpMasked"+"_"+str( forcedWarpID))173 self.dropTableVerbose("ForcedWarpExtended"+"_"+str( forcedWarpID))174 self.dropTableVerbose("ForcedWarpMeta"+"_"+str( forcedWarpID))175 self.dropTableVerbose("ForcedWarpToImage"+"_"+str( forcedWarpID))176 self.dropTableVerbose("ForcedWarpLensing"+"_"+str( forcedWarpID))166 self.dropTableVerbose("ForcedWarpMeasurement"+"_"+str(num)) 167 self.dropTableVerbose("ForcedWarpMasked"+"_"+str(num)) 168 self.dropTableVerbose("ForcedWarpExtended"+"_"+str(num)) 169 self.dropTableVerbose("ForcedWarpMeta"+"_"+str(num)) 170 self.dropTableVerbose("ForcedWarpToImage"+"_"+str(num)) 171 self.dropTableVerbose("ForcedWarpLensing"+"_"+str(num)) 177 172 if not self.config.retry: 178 self.scratchDb.dropTable("ForcedWarpMeasurement"+"_"+str(forcedWarpID)) 179 self.scratchDb.dropTable("ForcedWarpMasked"+"_"+str(forcedWarpID)) 180 self.scratchDb.dropTable("ForcedWarpExtended"+"_"+str(forcedWarpID)) 181 self.scratchDb.dropTable("ForcedWarpMeta"+"_"+str(forcedWarpID)) 182 self.scratchDb.dropTable("ForcedWarpToImage"+"_"+str(forcedWarpID)) 183 self.scratchDb.dropTable("ForcedWarpLensing"+"_"+str(forcedWarpID)) 184 # get a few primary header values. if in test mode, then use defaults 185 # create the tables 186 187 # XXX why are these deleted? 188 sql = "CREATE TABLE ForcedWarpMeasurement_" + str(forcedWarpID) + " like ForcedWarpMeasurement" 189 print sql 190 #try: self.scratchDb.execute(sql) 191 #except: raise 192 sql = "CREATE TABLE ForcedWarpExtended_" + str(forcedWarpID) + " like ForcedWarpExtended" 193 #try: self.scratchDb.execute(sql) 194 #except: raise 195 sql = "CREATE TABLE ForcedWarpMeta_" + str(forcedWarpID) + " like ForcedWarpMeta" 196 #try: self.scratchDb.execute(sql) 197 #except: raise 198 sql = "CREATE TABLE ForcedWarpToImage_" + str(forcedWarpID) + " like ForcedWarpToImage" 199 #try: self.scratchDb.execute(sql) 200 #except: raise 201 sql = "CREATE TABLE ForcedWarpLensing_" + str(forcedWarpID) + " like ForcedWarpLensing" 202 #try: self.scratchDb.execute(sql) 203 #except: raise 173 self.scratchDb.dropTable("ForcedWarpMeasurement"+"_"+str(num)) 174 self.scratchDb.dropTable("ForcedWarpMasked"+"_"+str(num)) 175 self.scratchDb.dropTable("ForcedWarpExtended"+"_"+str(num)) 176 self.scratchDb.dropTable("ForcedWarpMeta"+"_"+str(num)) 177 self.scratchDb.dropTable("ForcedWarpToImage"+"_"+str(num)) 178 self.scratchDb.dropTable("ForcedWarpLensing"+"_"+str(num)) 179 180 # get a few primary header values. if in test mode, then use defaults 204 181 205 182 ## MEH md5sum test 206 183 self.md5sum[num] = self.fits[num].getMd5sum() 207 184 208 self.logger.infoPair("calculating ObsTime","ok")209 185 # MJD-OBS is the exposure start, EXTIME / 172800 = (EXPTIME sec / 84600 sec/day) / 2 210 211 186 self.obsTime[num] = float(self.header[num]['MJD-OBS']) + (float(self.expTime[num]) / 172800.0) 212 213 187 self.logger.infoPair("obstime",self.obsTime[num]) 188 214 189 self.filterID[num] = self.scratchDb.getFilterID(self.filterName[num][0]) 215 190 self.logger.infoPair("filterID is ",self.filterID[num]) 216 self.logger.infoPair("inserting basics into ","ForcedWarpMeta"+"_"+forcedWarpID) 217 191 192 self.logger.infoPair("inserting basics into ", "ipptopsps.forcedwarp") 218 193 self.ippToPspsDb.insertForcedWarpMeta( int(self.batchID), int(self.expID[num]), self.filterName[num][0]) 219 194 220 195 num=num+1 196 221 197 # create an output filename, which is {expID}.FITS 222 198 self.outputFitsFile = "%08d.FITS" % self.id … … 231 207 def populateForcedWarpMeta(self,num): 232 208 forcedWarpID = self.number[num] 233 tableName = "ForcedWarpMeta_" + forcedWarpID209 tableName = "ForcedWarpMeta_" + str(num) 234 210 235 211 self.logger.infoPair("Processing table", tableName) … … 330 306 forcedwarpID = self.number[num] 331 307 self.logger.infoPair("Procesing table", "ForcedWarpToImage") 332 sql = "CREATE TABLE ForcedWarpToImage_"+forcedwarpID+" LIKE ForcedWarpToImage" 333 try: self.scratchDb.execute(sql) 334 except: pass 335 336 #forcedwarpID = self.forcedWarpID 308 309 tableName = "ForcedWarpToImage_" + str(num) 310 311 sql = "CREATE TABLE " + tableName + " LIKE ForcedWarpToImage" 312 self.scratchDb.execute(sql) 313 337 314 if forcedwarpID > 0: 338 315 339 316 imageIDs = self.gpc1Db.getImageIDsForThisForcedWarpID(forcedwarpID) 340 317 341 318 for imageID in imageIDs: 342 319 343 sql = "INSERT INTO ForcedWarpToImage_"+str(forcedwarpID)+" (forcedwarpID, imageID) \ 344 VALUES (\ 345 " + str(forcedwarpID) + ", " + imageID + ")" 320 sql = "INSERT INTO " + tableName + " (forcedwarpID, imageID) VALUES ( " + str(forcedwarpID) + ", " + imageID + ")" 346 321 try: self.scratchDb.execute(sql) 347 322 except: 348 323 self.logger.infoPair("can't execute sql",sql) 349 324 raise 350 # now update StackMeta with correct number of inputs351 352 #self.tablesToExport.append("ForcedWarpToImage")353 354 355 356 357 325 358 326 ''' … … 361 329 def populateForcedWarpMeasurement(self,num): 362 330 forcedWarpID = self.number[num] 363 pspsTableName = "ForcedWarpMeasurement_"+forcedWarpID 364 ippTableName = "SkyChip_psf_"+forcedWarpID 365 366 sql = "CREATE TABLE ForcedWarpMeasurement_"+forcedWarpID+" LIKE ForcedWarpMeasurement" 367 try: self.scratchDb.execute(sql) 368 except: pass 369 370 self.logger.infoPair("Procesing table", "ForcedWarpMeasurement_"+forcedWarpID) 371 372 BEFORE = self.scratchDb.getRowCount(ippTableName) 331 pspsTableName = "ForcedWarpMeasurement_" + str(num) 332 maskTableName = "ForcedWarpMasked_" + str(num) 333 ippTableName = "SkyChip_psf_" + str(num) 334 335 sql = "CREATE TABLE " + pspsTableName + " LIKE ForcedWarpMeasurement" 336 self.scratchDb.execute(sql) 337 338 self.logger.infoPair("Procesing table", pspsTableName) 339 373 340 expTimeString = str(self.expTime[num]) 374 341 375 #missing are zp, telluricExt, airmass (not easy to get ?)376 377 342 sqlLine = sqlUtility("INSERT INTO " + pspsTableName + " (") 378 343 sqlLine.group("ippDetectID", "IPP_IDET") … … 401 366 sqlLine.group("FpsfQfPerfect", "PSF_QF_PERFECT") 402 367 sqlLine.group("FpsfChiSq", "PSF_CHISQ") 403 # sqlLine.group("FpsfLikelihood", "psfLikelihood(EXT_NSIGMA)") -- deprecated in r38867 (not measured in FW cmfs)404 368 sqlLine.group("FmomentXX", "MOMENTS_XX * PLTSCALE * PLTSCALE") 405 369 sqlLine.group("FmomentXY", "MOMENTS_XY * PLTSCALE * PLTSCALE") … … 429 393 # insert the per-object data (IDs, random stack ID, processingVersion, etc) 430 394 # self.selectDvoObjIDs() 431 self.logger.infoPair("inserting dvo info: find imageID", "from externID")395 self.logger.infoPair("inserting dvo info: find imageID", "from externID") 432 396 imageID = self.scratchDb.getImageIDFromExternID(self.warpSkyFileID[num]) 433 self.logger.infoPair("updating", "forcedWarpMeasurement_"+forcedWarpID)434 435 sqlLine = sqlUtility("UPDATE ForcedWarpMeasurement_"+forcedWarpID+" as a, " + self.scratchDb.dvoDetectionTable + " as b SET ")397 self.logger.infoPair("updating", pspsTableName) 398 399 sqlLine = sqlUtility("UPDATE " + pspsTableName + " as a, " + self.scratchDb.dvoDetectionTable + " as b SET ") 436 400 sqlLine.group("a.objID", "b.objID") 437 401 sqlLine.group("a.detectID", "b.detectID") … … 456 420 457 421 self.logger.infoPair("need to cull"," nulls objid") 458 rowCountBefore = self.scratchDb.getRowCount( "ForcedWarpMeasurement_"+forcedWarpID)459 results= self.scratchDb.reportAndDeleteRowsWithNULLS( "ForcedWarpMeasurement_"+forcedWarpID, "objID")460 rowCountAfter = self.scratchDb.getRowCount( "ForcedWarpMeasurement_"+forcedWarpID)422 rowCountBefore = self.scratchDb.getRowCount(pspsTableName) 423 results= self.scratchDb.reportAndDeleteRowsWithNULLS(pspsTableName, "objID") 424 rowCountAfter = self.scratchDb.getRowCount(pspsTableName) 461 425 self.logger.infoPair("row count of ForcedWarpMeasurement", rowCountBefore) 462 426 self.logger.infoPair("row count of ForcedWarpMeasurement after cull of null objID ", rowCountAfter) … … 465 429 self.logger.infoPair ("skip this batch", "it is bad") 466 430 return False 467 # self.generateRandomIDs() 468 469 self.logger.infoPair("Adding 'row' columns to", "ForcedWarpMeasurement_"+forcedWarpID) 470 self.scratchDb.addRowCountColumn("ForcedWarpMeasurement_"+forcedWarpID, "row") 471 self.logger.infoPair("Adding unique ids to", "ForcedWarpMeasurement_"+forcedWarpID) 472 self.generateUniquePspsIDs(num) 473 self.logger.infoPair("Dropping row column from", "ForcedWarpMeasurement_"+forcedWarpID+" table") 474 self.scratchDb.dropColumn("ForcedWarpMeasurement_"+forcedWarpID, "row") 431 432 self.logger.infoPair("Adding 'row' columns to", pspsTableName) 433 self.scratchDb.addRowCountColumn(pspsTableName, "row") 434 435 self.logger.infoPair("Adding unique ids to", pspsTableName) 436 self.generateUniquePspsIDs(tableName, num) 437 438 self.logger.infoPair("Dropping row column from", pspsTableName) 439 self.scratchDb.dropColumn(pspsTableName, "row") 475 440 476 441 # now move the rows with no data to ForcedWarpMasked 477 self.logger.infoPair("Procesing table", "ForcedWarpMasked_"+forcedWarpID) 478 sql = "CREATE TABLE ForcedWarpMasked_"+forcedWarpID+" LIKE ForcedWarpMasked" 479 try: self.scratchDb.execute(sql) 480 except: pass 442 self.logger.infoPair("Procesing table", maskTableName) 443 sql = "CREATE TABLE " + maskTableName + " LIKE ForcedWarpMasked" 444 self.scratchDb.execute(sql) 481 445 482 446 # This is the definition of a "masked measurement". … … 484 448 maskedCondition = "FpsfQfPerfect < .0001 OR FpsfQfPerfect is NULL" 485 449 486 sql = "INSERT INTO ForcedWarpMasked_"+forcedWarpID+" \ 487 SELECT objID, uniquePspsFWid, ippObjID, ippDetectID, filterID, surveyID, \ 488 forcedSummaryID, forcedWarpID, randomWarpID, tessID, projectionID, \ 489 skyCellID, dvoRegionID, obsTime \ 490 FROM ForcedWarpMeasurement_"+forcedWarpID+" WHERE "+maskedCondition 491 try: self.scratchDb.execute(sql) 492 except: pass 493 494 sql = "DELETE FROM ForcedWarpMeasurement_"+forcedWarpID+" WHERE "+maskedCondition 495 try: self.scratchDb.execute(sql) 496 except: pass 450 sql = "INSERT INTO " + maskTableName 451 sql += " SELECT objID, uniquePspsFWid, ippObjID, ippDetectID, filterID, surveyID," 452 sql += " forcedSummaryID, forcedWarpID, randomWarpID, tessID, projectionID," 453 sql += " skyCellID, dvoRegionID, obsTime" 454 sql += " FROM " + pspsTableName + " WHERE " + maskedCondition 455 self.scratchDb.execute(sql) 456 457 sql = "DELETE FROM " pspsTableName + " WHERE " + maskedCondition 458 self.scratchDb.execute(sql) 497 459 498 460 # add indexes ForcedWarpMeasurement 499 self.scratchDb.createIndex( "ForcedWarpMeasurement_"+forcedWarpID, "objID")500 self.scratchDb.createIndex( "ForcedWarpMeasurement_"+forcedWarpID, "ippDetectID")461 self.scratchDb.createIndex(pspsTableName, "objID") 462 self.scratchDb.createIndex(pspsTableName, "ippDetectID") 501 463 502 464 # add indexes ForcedWarpMasked 503 self.scratchDb.createIndex( "ForcedWarpMasked_"+forcedWarpID, "objID")504 self.scratchDb.createIndex( "ForcedWarpMasked_"+forcedWarpID, "ippDetectID")465 self.scratchDb.createIndex(maskTableName, "objID") 466 self.scratchDb.createIndex(maskTableName, "ippDetectID") 505 467 506 468 ''' … … 509 471 def populateForcedWarpExtended(self,num): 510 472 forcedWarpID = self.number[num] 511 pspsTableName = "ForcedWarpExtended_" +forcedWarpID512 ippTableName = "SkyChip_xrad_" +forcedWarpID513 sql = "CREATE TABLE ForcedWarpExtended_"+forcedWarpID+" LIKE ForcedWarpExtended"514 try: self.scratchDb.execute(sql) 515 except: pass516 517 #self.tablesToExport.append("ForcedWarpExtended") 518 519 #isert stuff from SkyChip_psf473 pspsTableName = "ForcedWarpExtended_" + str(num) 474 ippTableName = "SkyChip_xrad_" + str(num) 475 fMeasTableName = "ForcedWarpMeasurement_" + str(num) 476 477 sql = "CREATE TABLE " + pspsTableName + " LIKE ForcedWarpExtended" 478 self.scratchDb.execute(sql) 479 480 # insert stuff from SkyChip_xrad 481 self.logger.infoPair("inserting data from", ippTableName) 520 482 sqlLine = sqlUtility("INSERT INTO " + pspsTableName + " (") 521 483 sqlLine.group("ippDetectID", "IPP_IDET") … … 534 496 535 497 sql = sqlLine.makeRaw(") SELECT ", " FROM " + ippTableName) 536 537 try: self.scratchDb.execute(sql) 538 except: 539 self.logger.errorPair("failed sql: ", sql) 540 raise 541 542 #insert the things from FOrcedWarpMeasurement 543 self.logger.infoPair("inserting objID,etc from","ForcedWarpMeasurement_"+forcedWarpID) 544 sqlLine = sqlUtility("UPDATE " + pspsTableName + " as a, ForcedWarpMeasurement_"+forcedWarpID+" as b SET ") 498 self.scratchDb.execute(sql) 499 500 # insert the things from ForcedWarpMeasurement 501 self.logger.infoPair("adding objID, etc from", fMeasTableName) 502 sqlLine = sqlUtility("UPDATE " + pspsTableName + " as a, " + fMeasTableName + " as b SET ") 545 503 sqlLine.group("a.objID","b.objID") 546 504 sqlLine.group("a.uniquePspsFWid","b.uniquePspsFWid") … … 555 513 sqlLine.group("a.obsTime","b.obsTime") 556 514 sql = sqlLine.makeEquals("Where a.ippDetectID = b.ippDetectID") 557 try: self.scratchDb.execute(sql) 558 except: 559 self.logger.errorPair("failed sql: ", sql) 560 raise 515 self.scratchDb.execute(sql) 561 516 562 # add in the psps unique ids from stuff 563 self.logger.infoPair("adding information from Skychip_xrad_"+forcedWarpID+" into","ForcedWarpExtended_"+forcedWarpID) 564 565 # cull bad d 517 # cull bad entris 566 518 self.logger.infoPair("need to cull"," nulls objid") 567 results= self.scratchDb.reportAndDeleteRowsWithNULLS("ForcedWarpExtended_"+forcedWarpID, "objID") 568 569 self.scratchDb.createIndex("ForcedWarpExtended_"+forcedWarpID, "objID") 570 571 572 573 ''' 574 Populates the ForcedWarpExtended table 519 results = self.scratchDb.reportAndDeleteRowsWithNULLS(pspsTableName, "objID") 520 self.scratchDb.createIndex(pspsTableName, "objID") 521 522 ''' 523 Populates the ForcedWarpExtended table 575 524 ''' 576 525 def populateForcedWarpLensing(self, num): 577 forcedWarpID = self.number[num]578 pspsTableName = "ForcedWarpLensing_"+forcedWarpID579 ippTableName = "SkyChip_psf_"+forcedWarpID580 sql = "CREATE TABLE ForcedWarpLensing_"+forcedWarpID+" LIKE ForcedWarpLensing"581 try: self.scratchDb.execute(sql) 582 except: pass583 584 #self.tablesToExport.append("ForcedWarpExtended") 585 586 #isert stuff from SkyChip_psf526 forcedWarpID = self.number[num] 527 ippTableName = "SkyChip_psf_" + str(num) 528 pspsTableName = "ForcedWarpLensing_" + str(num) 529 fMeasTableName = "ForcedWarpMeasurement_" + str(num) 530 531 sql = "CREATE TABLE " + pspsTableName + " LIKE ForcedWarpLensing" 532 self.scratchDb.execute(sql) 533 534 # insert stuff from SkyChip_psf 535 self.logger.infoPair("adding information from " + ippTableName + " into", pspsTableName) 587 536 sqlLine = sqlUtility("INSERT INTO " + pspsTableName + " (") 588 537 sqlLine.group("ippDetectID", "IPP_IDET") … … 609 558 sqlLine.group("psfE1", "LENS_E1_PSF") 610 559 sqlLine.group("psfE2", "LENS_E2_PSF") 560 611 561 sql = sqlLine.makeRaw(") SELECT ", " FROM " + ippTableName) 612 613 try: self.scratchDb.execute(sql) 614 except: 615 self.logger.errorPair("failed sql: ", sql) 616 raise 617 618 #insert the things from FOrcedWarpMeasurement 619 self.logger.infoPair("inserting objID,etc from","ForcedWarpMeasurement_"+forcedWarpID) 620 sqlLine = sqlUtility("UPDATE " + pspsTableName + " as a, ForcedWarpMeasurement_"+forcedWarpID+" as b SET ") 562 self.scratchDb.execute(sql) 563 564 # insert the things from ForcedWarpMeasurement 565 self.logger.infoPair("inserting objID,etc from", fMeasTableName) 566 sqlLine = sqlUtility("UPDATE " + pspsTableName + " as a, " + fMeasTableName + " as b SET ") 621 567 sqlLine.group("a.objID","b.objID") 622 568 sqlLine.group("a.uniquePspsFWid","b.uniquePspsFWid") … … 630 576 sqlLine.group("a.dvoRegionID","b.dvoRegionID") 631 577 sqlLine.group("a.obsTime","b.obsTime") 578 632 579 sql = sqlLine.makeEquals("Where a.ippDetectID = b.ippDetectID") 633 try: self.scratchDb.execute(sql) 634 except: 635 self.logger.errorPair("failed sql: ", sql) 636 raise 637 638 # add in the psps unique ids from stuff 639 self.logger.infoPair("adding information from Skychip_psf_"+forcedWarpID+" into","ForcedWarpLensing_"+forcedWarpID) 640 641 # cull bad d 580 self.scratchDb.execute(sql) 581 582 # cull bad entries 642 583 self.logger.infoPair("need to cull"," nulls objid") 643 results= self.scratchDb.reportAndDeleteRowsWithNULLS("ForcedWarpLensing_"+forcedWarpID, "objID") 644 645 self.scratchDb.createIndex("ForcedWarpLensing_"+forcedWarpID, "objID") 646 647 584 results= self.scratchDb.reportAndDeleteRowsWithNULLS(pspsTableName, "objID") 585 586 self.scratchDb.createIndex(pspsTableName, "objID") 648 587 649 588 ''' … … 656 595 self.tablesToExport=[] 657 596 658 #this should be done659 #number = 0660 #for forcedWarpID in self.forcedWarpIds:661 597 for num in self.number: 662 print "hawaht?"663 598 forcedWarpID = self.number[num] 664 self.logger.infoPair("Populating","ForcedWarpMeta_"+forcedWarpID) 599 myTable = "ForcedWarpMeta_" + str(num) 600 self.logger.infoPair("Populating", myTable) 665 601 self.populateForcedWarpMeta(num) 666 self.tablesToExport.append( "ForcedWarpMeta_"+forcedWarpID)602 self.tablesToExport.append(myTable) 667 603 668 self.logger.infoPair("Populating","ForcedWarpMeasurement_"+forcedWarpID) 604 myTable = "ForcedWarpMeasurement_" + str(num) 605 self.logger.infoPair("Populating", myTable) 669 606 self.populateForcedWarpMeasurement(num) 670 self.tablesToExport.append("ForcedWarpMeasurement_"+forcedWarpID) 671 self.tablesToExport.append("ForcedWarpMasked_"+forcedWarpID) 607 self.tablesToExport.append(myTable) 608 609 self.logger.infoPair("setting min/max objid from", myTable) 610 self.setMinMaxObjID([myTable]) 611 612 # populateForcedWarpMeasurement also populates ForcedWarpMasked (from ForcedWarpMeasurement) 613 self.tablesToExport.append("ForcedWarpMasked_" + str(num)) 672 614 673 self.logger.infoPair("Populating","ForcedWarpExtended_"+forcedWarpID) 615 myTable = "ForcedWarpExtended_" + str(num) 616 self.logger.infoPair("Populating", myTable) 674 617 self.populateForcedWarpExtended(num) 675 self.tablesToExport.append("ForcedWarpExtended_"+forcedWarpID) 676 677 self.logger.infoPair("Populating","ForcedWarpLensing_"+forcedWarpID) 618 self.tablesToExport.append(myTable) 619 620 myTable = "ForcedWarpLensing_" + str(num) 621 self.logger.infoPair("Populating", myTable) 678 622 self.populateForcedWarpLensing(num) 679 self.tablesToExport.append( "ForcedWarpLensing_"+forcedWarpID)680 681 682 self.logger.infoPair("Populating", "ForcedWarpToImage_"+forcedWarpID)623 self.tablesToExport.append(myTable) 624 625 myTable = "ForcedWarpToImage_" + str(num) 626 self.logger.infoPair("Populating", myTable) 683 627 self.populateForcedWarpToImage(num) 684 self.tablesToExport.append("ForcedWarpToImage_"+forcedWarpID) 685 686 687 self.logger.infoPair("setting min/max objid from","ForcedWarpMeasurement_"+forcedWarpID) 688 self.setMinMaxObjID(["ForcedWarpMeasurement_"+forcedWarpID]) 628 self.tablesToExport.append(myTable) 689 629 690 630 self.logger.infoPair("finishing","populatePspsTables") … … 730 670 731 671 ## output table names need to have "_num" appended. 732 fitsOptions = "-tablesuffix _" + str( forcedWarpID)672 fitsOptions = "-tablesuffix _" + str(num) 733 673 734 674 # this option is equivalent to the stilts "addcol table_index $0" call … … 750 690 751 691 for table in tables: 752 myTable = table.name + "_" + str( forcedWarpID)692 myTable = table.name + "_" + str(num) 753 693 count = count + 1 754 694 755 695 self.tablesLoaded.append(myTable) 756 696 757 self.indexIppTables(forcedWarpID) 697 # after all tables are read for this forcedWarpID, then index the set 698 self.indexIppTables(num) 758 699 759 # after all tables are read for this forcedWarpID, then index the set760 700 self.logger.infoPair("Done. Imported", "%d tables" % count) 761 701 return True … … 765 705 ''' 766 706 def importIppTablesStilts(self, columns="*", tableRE=""): 707 708 print "*** STILTS import is now deprecated ***" 709 os._exit(4) 767 710 768 711 self.tablesLoaded = [] … … 819 762 820 763 821 def generateRandomIDs(self,forcedWarpID):822 sql = "UPDATE ForcedWarpMeasurement_"+forcedWarpID+" set randomWarpID = RAND("+str(self.batchID)+")"823 try:824 self.scratchDb.execute(sql)825 except:826 self.logger.errorPair('failed sql',sql)827 raise828 829 830 764 ''' 831 765 Updates table and generates pspsuniqueids 832 766 ''' 833 834 def generateUniquePspsIDs(self,num): 767 def generateUniquePspsIDs(self, tableName, num): 835 768 836 sql = "UPDATE ForcedWarpMeasurement_"+str(self.number[num])+" set uniquePspsFWid = (("+str(self.batchID)+"*1000000000 ) + ("+str(num)+"*1000000 ) + row)" 837 try: self.scratchDb.execute(sql) 838 except: 839 self.logger.errorPair('failed sql',sql) 840 raise 769 sql = "UPDATE " + tableName + " set uniquePspsFWid = (("+str(self.batchID)+"*1000000000 ) + ("+str(num)+"*1000000 ) + row)" 770 self.scratchDb.execute(sql) 841 771 842 772 ''' … … 869 799 Applies indexes to the IPP tables 870 800 ''' 871 def indexIppTables(self, forcedWarpID):872 873 self.logger.infoPair("Creating indexes on " + forcedWarpID, "IPP tables")801 def indexIppTables(self,num): 802 803 self.logger.infoPair("Creating indexes on " + str(num), "IPP tables") 874 804 875 805 # it probably should not be an error not to have one of these: 876 cmfTable = "SkyChip_psf_" + forcedWarpID806 cmfTable = "SkyChip_psf_" + str(num) 877 807 if cmfTable in self.tablesLoaded: self.scratchDb.createIndex(cmfTable, "IPP_IDET") 878 808 879 cmfTable = "SkyChip_xfit_" + forcedWarpID809 cmfTable = "SkyChip_xfit_" + str(num) 880 810 if cmfTable in self.tablesLoaded: self.scratchDb.createIndex(cmfTable, "IPP_IDET") 881 811 882 cmfTable = "SkyChip_xrad_" + forcedWarpID812 cmfTable = "SkyChip_xrad_" + str(num) 883 813 if cmfTable in self.tablesLoaded: self.scratchDb.createIndex(cmfTable, "IPP_IDET") 884 814 885 cmfTable = "SkyChip_xsrc_" + forcedWarpID815 cmfTable = "SkyChip_xsrc_" + str(num) 886 816 if cmfTable in self.tablesLoaded: self.scratchDb.createIndex(cmfTable, "IPP_IDET") 887 817 888 cmfTable = "SkyChip_xgal_" + forcedWarpID818 cmfTable = "SkyChip_xgal_" + str(num) 889 819 if cmfTable in self.tablesLoaded: self.scratchDb.createIndex(cmfTable, "IPP_IDET") 890 820 891 ## self.scratchDb.createIndex("SkyChip_xfit_"+forcedWarpID, "IPP_IDET")892 ## self.scratchDb.createIndex("SkyChip_xrad_"+forcedWarpID, "IPP_IDET")893 ## self.scratchDb.createIndex("SkyChip_xsrc_"+forcedWarpID, "IPP_IDET")894 ## self.scratchDb.createIndex("SkyChip_xgal_"+forcedWarpID, "IPP_IDET")895 896 821 return True 897 898 '''899 Updates table and generates pspsuniqueids900 '''901 902 def updatePspsUniqueIDs(self,table):903 sql = "UPDATE ForcedWarpMeasurement_"+forcedWarpID+" set uniquePspsFWid = (("+str(self.batchID)+"*1000000000 ) + (str(number)*1000000 ) + row)"904 try: self.scratchDb.execute(sql)905 except:906 self.logger.errorPair('failed sql',sql)907 raise -
trunk/ippToPsps/jython/stackbatch.py
r39048 r39062 55 55 None) 56 56 57 self.stackType = "DEEP_STACK" # TODO57 self.stackType = "DEEP_STACK" # XXX NOTE:this is currently hard-wired for 3pi. Before we run MD, this needs to be updated. 58 58 self.stackTypeID = self.getStackTypeID() 59 59
Note:
See TracChangeset
for help on using the changeset viewer.
