Changeset 32051 for trunk/ippToPsps
- Timestamp:
- Aug 5, 2011, 3:29:16 PM (15 years ago)
- File:
-
- 1 edited
-
trunk/ippToPsps/jython/detectionbatch.py (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippToPsps/jython/detectionbatch.py
r32037 r32051 367 367 def populateDetectionTable(self, ota): 368 368 369 tableName = "Detection_" + ota 369 pspsTableName = "Detection_" + ota 370 ippTableName = ota + "_psf" 370 371 371 372 # drop then re-create table 372 self.scratchDb.dropTable( tableName)373 sql = "CREATE TABLE " + tableName + " LIKE Detection"373 self.scratchDb.dropTable(pspsTableName) 374 sql = "CREATE TABLE " + pspsTableName + " LIKE Detection" 374 375 try: self.scratchDb.execute(sql) 375 376 except: pass 377 378 # delete all detections with PSF_INST_MAG < 17.5, as decreed by Gene 379 BEFORE = self.scratchDb.getRowCount(ippTableName) 380 sql = "DELETE FROM " + ippTableName + " WHERE PSF_INST_MAG < -17.5" 381 self.scratchDb.execute(sql) 382 DELETED = BEFORE - self.scratchDb.getRowCount(ippTableName) 383 self.logger.infoPair("Saturated detections", "%d deleted" % DELETED) 376 384 377 385 # insert all detections into table 378 sql = "INSERT IGNORE INTO " + tableName + " ( \386 sql = "INSERT IGNORE INTO " + pspsTableName + " ( \ 379 387 ippDetectID \ 380 388 ,xPos \ … … 423 431 ,SKY_SIGMA \ 424 432 ,EXT_NSIGMA \ 425 FROM " + ota + "_psf"433 FROM " + ippTableName 426 434 self.scratchDb.execute(sql) 427 435 428 436 # set obsTime 429 sql = "UPDATE " + tableName + " SET obsTime = %f, assocDate = '%s', activeFlag = 0" % (self.obsTime, self.dateStr)430 self.scratchDb.execute(sql) 431 self.scratchDb.updateAllRows( tableName, "dataRelease", str(self.dataRelease))432 self.scratchDb.updateAllRows( tableName, "historyModNum", "0")433 434 self.scratchDb.updateAllRows( tableName, "surveyID", str(self.surveyID))435 self.scratchDb.updateFilterID( tableName, self.filter)437 sql = "UPDATE " + pspsTableName + " SET obsTime = %f, assocDate = '%s', activeFlag = 0" % (self.obsTime, self.dateStr) 438 self.scratchDb.execute(sql) 439 self.scratchDb.updateAllRows(pspsTableName, "dataRelease", str(self.dataRelease)) 440 self.scratchDb.updateAllRows(pspsTableName, "historyModNum", "0") 441 442 self.scratchDb.updateAllRows(pspsTableName, "surveyID", str(self.surveyID)) 443 self.scratchDb.updateFilterID(pspsTableName, self.filter) 436 444 437 445 # now delete bad flux and bad chip positions 438 self.scratchDb.reportAndDeleteRowsWithNULLS( tableName, "instFlux")439 self.scratchDb.reportAndDeleteRowsWithNULLS( tableName, "peakADU")446 self.scratchDb.reportAndDeleteRowsWithNULLS(pspsTableName, "instFlux") 447 self.scratchDb.reportAndDeleteRowsWithNULLS(pspsTableName, "peakADU") 440 448 441 449 '''
Note:
See TracChangeset
for help on using the changeset viewer.
