IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 38921


Ignore:
Timestamp:
Oct 21, 2015, 8:51:41 AM (11 years ago)
Author:
bills
Message:

Add ForceWarpMasked table to hold forced warp measurements with no pixels (totally masked sources)
Set tessID and projectionID correctly.

File:
1 edited

Legend:

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

    r38902 r38921  
    8484       self.skycellID = {}
    8585       self.projectionID = {}
     86       self.tessID = {}
    8687
    8788       #I give a number to the forcedwarp stuff, I am not sure if this is the best way but it might work
     
    131132           self.logger.infoPair("found tess_id",self.tessName[num])
    132133
    133            # tessName = self.getKeyValue(self.header, 'TESS_ID')
    134            # self.tessID = self.scratchDb.getTessID(tessName)
     134           self.tessID[num] = self.scratchDb.getTessID(self.tessName[num])
    135135
    136136           # As the database doesn't have the software_ver entry, pull the photometry version as the analysis version.
     
    160160           self.logger.infoPair("skycell found", self.skycellID[num])
    161161           self.dropTableVerbose("ForcedWarpMeasurement"+"_"+str(forcedWarpID))
     162           self.dropTableVerbose("ForcedWarpMasked"+"_"+str(forcedWarpID))
    162163           self.dropTableVerbose("ForcedWarpExtended"+"_"+str(forcedWarpID))
    163164           self.dropTableVerbose("ForcedWarpMeta"+"_"+str(forcedWarpID))
     
    166167           if not self.config.retry:
    167168               self.scratchDb.dropTable("ForcedWarpMeasurement"+"_"+str(forcedWarpID))
     169               self.scratchDb.dropTable("ForcedWarpMasked"+"_"+str(forcedWarpID))
    168170               self.scratchDb.dropTable("ForcedWarpExtended"+"_"+str(forcedWarpID))
    169171               self.scratchDb.dropTable("ForcedWarpMeta"+"_"+str(forcedWarpID))
     
    255257
    256258        sqlLine.group("forcedWarpID",   str(forcedWarpID))
     259        sqlLine.group("tessID",         str(self.tessID[num]))
    257260        sqlLine.group("projectionID",   str(self.projectionID[num]))
    258261        sqlLine.group("skyCellID",      str(self.skycellID[num]))
     
    336339
    337340    '''
    338     Populates the ForcedWarpMeasurement table
     341    Populates the ForcedWarpMeasurement and ForcedWarpMasked tables
    339342    '''
    340343    def populateForcedWarpMeasurement(self,num):
     
    361364        sqlLine.group("filterID",          str(self.filterID[num]))
    362365        sqlLine.group("surveyID",          str(self.surveyID))
     366        sqlLine.group("tessID",            str(self.tessID[num]))
     367        sqlLine.group("projectionID",      str(self.projectionID[num]))
    363368        sqlLine.group("skycellID",         str(self.skycellID[num]))
    364369        sqlLine.group("expTime",           str(self.expTime[num]))
     
    447452        self.logger.infoPair("Dropping row column from", "ForcedWarpMeasurement_"+forcedWarpID+" table")
    448453        self.scratchDb.dropColumn("ForcedWarpMeasurement_"+forcedWarpID, "row")
     454
     455        # now move the rows with no data to ForcedWarpMasked
     456        self.logger.infoPair("Procesing table", "ForcedWarpMasked_"+forcedWarpID)
     457        sql = "CREATE TABLE ForcedWarpMasked_"+forcedWarpID+" LIKE ForcedWarpMasked"
     458        try: self.scratchDb.execute(sql)
     459        except: pass
     460
     461        # This is the definition of a "masked measurement".
     462        # Do we have NULL columns at this point or are they already -999? This test catches them either way
     463        maskedCondition = "FpsfQfPerfect < .0001 OR FpsfQfPerfect is NULL"
     464
     465        sql = "INSERT INTO ForcedWarpMasked_"+forcedWarpID+" \
     466               SELECT objID, uniquePspsFWid, ippObjID, ippDetectID, filterID, surveyID, \
     467                forcedSummaryID, forcedWarpID, randomWarpID, tessID, projectionID, \
     468                skyCellID, dvoRegionID, obsTime \
     469               FROM ForcedWarpMeasurement_"+forcedWarpID+" WHERE "+maskedCondition
     470        try: self.scratchDb.execute(sql)
     471        except: pass
     472
     473        sql = "DELETE FROM ForcedWarpMeasurement_"+forcedWarpID+" WHERE "+maskedCondition
     474        try: self.scratchDb.execute(sql)
     475        except: pass
    449476           
    450477        # add indexes ForcedWarpMeasurement
    451478        self.scratchDb.createIndex("ForcedWarpMeasurement_"+forcedWarpID, "objID")
    452479        self.scratchDb.createIndex("ForcedWarpMeasurement_"+forcedWarpID, "ippDetectID")
     480
     481        # add indexes ForcedWarpMasked
     482        self.scratchDb.createIndex("ForcedWarpMasked_"+forcedWarpID, "objID")
     483        self.scratchDb.createIndex("ForcedWarpMasked_"+forcedWarpID, "ippDetectID")
    453484
    454485    '''
     
    617648            self.populateForcedWarpMeasurement(num)         
    618649            self.tablesToExport.append("ForcedWarpMeasurement_"+forcedWarpID)
     650            self.tablesToExport.append("ForcedWarpMasked_"+forcedWarpID)
    619651           
    620652            self.logger.infoPair("Populating","ForcedWarpExtended_"+forcedWarpID)
Note: See TracChangeset for help on using the changeset viewer.