IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 32051 for trunk/ippToPsps


Ignore:
Timestamp:
Aug 5, 2011, 3:29:16 PM (15 years ago)
Author:
rhenders
Message:

now deleting any rows in IPP tables with PSF_INST_MAG < -17.5

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ippToPsps/jython/detectionbatch.py

    r32037 r32051  
    367367    def populateDetectionTable(self, ota):
    368368
    369         tableName = "Detection_" + ota
     369        pspsTableName = "Detection_" + ota
     370        ippTableName = ota + "_psf"
    370371       
    371372        # 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"
    374375        try: self.scratchDb.execute(sql)
    375376        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)
    376384
    377385        # insert all detections into table
    378         sql = "INSERT IGNORE INTO " + tableName + " ( \
     386        sql = "INSERT IGNORE INTO " + pspsTableName + " ( \
    379387               ippDetectID \
    380388               ,xPos \
     
    423431               ,SKY_SIGMA \
    424432               ,EXT_NSIGMA \
    425                FROM " + ota + "_psf"
     433               FROM " + ippTableName
    426434        self.scratchDb.execute(sql)
    427435
    428436        # 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)
    436444
    437445        # 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")
    440448
    441449    '''
Note: See TracChangeset for help on using the changeset viewer.