IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jun 27, 2018, 3:31:55 PM (8 years ago)
Author:
eugene
Message:

merge changes from trunk

Location:
branches/czw_branch/20170908
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/czw_branch/20170908

  • branches/czw_branch/20170908/ippToPsps/jython/forcedwarpbatch.py

    r40011 r40483  
    424424        # self.selectDvoObjIDs()
    425425        self.logger.infoPair("inserting dvo info: find imageID", "from externID")
    426         imageID = self.scratchDb.getImageIDFromExternIDandPhotcodeRange(self.warpSkyFileID[num],12000,12500)
    427         self.logger.infoPair("I don't like this", "it is hardwired to gpc1")
     426
     427        # get the imageID: this code has cases for simtest vs gpc1 cameras
     428        # if self.config.test:
     429        self.logger.infoPair("current camera is", self.config.camera)
     430        if self.config.camera == "gpc1":
     431            self.logger.infoPair("I don't like this", "it is hardwired to gpc1")
     432            imageID = self.scratchDb.getImageIDFromExternIDandPhotcodeRange(self.warpSkyFileID[num],12000,12500)
     433        if self.config.camera == "simtest":
     434            imageID = self.scratchDb.getImageIDFromExternIDandPhotcodeRange(self.warpSkyFileID[num],15100,15500)
     435        if imageID == 0:
     436            self.logger.infoPair ("failed to get imageID for", str(num))
     437            raise
     438
    428439        self.logger.infoPair("updating", pspsTableName)
    429440
     
    433444        sqlLine.group("a.ippObjID",   "b.ippObjID")
    434445        sqlLine.group("a.dvoRegionID","b.catID")
    435         sqlLine.group("a.zp",         "b.zp")
     446        sqlLine.group("a.zp",         "b.zpPSF")
    436447        sqlLine.group("a.telluricExt","b.telluricExt")
    437448        sqlLine.group("a.airmass",    "b.airmass")
    438449        sqlLine.group("a.FinfoFlag3", "b.flags")
    439450
    440         sqlLine.group("a.FpsfFlux",     "a.FpsfFlux     * b.zpFactor")
    441         sqlLine.group("a.FpsfFluxErr",  "a.FpsfFluxErr  * b.zpFactor")
    442         sqlLine.group("a.FapFlux",      "a.FapFlux      * b.zpFactor")
    443         sqlLine.group("a.FapFluxErr",   "a.FapFluxErr   * b.zpFactor")
    444         sqlLine.group("a.FkronFlux",    "a.FkronFlux    * b.zpFactor")
    445         sqlLine.group("a.FkronFluxErr", "a.FkronFluxErr * b.zpFactor")
    446         sqlLine.group("a.Fsky",         "a.Fsky         * b.zpFactor")
    447         sqlLine.group("a.FskyErr",      "a.FskyErr      * b.zpFactor")
     451        sqlLine.group("a.FpsfFlux",     "a.FpsfFlux     * b.zpFactorPSF")
     452        sqlLine.group("a.FpsfFluxErr",  "a.FpsfFluxErr  * b.zpFactorPSF")
     453        sqlLine.group("a.FapFlux",      "a.FapFlux      * b.zpFactorAPER")
     454        sqlLine.group("a.FapFluxErr",   "a.FapFluxErr   * b.zpFactorAPER")
     455        sqlLine.group("a.FkronFlux",    "a.FkronFlux    * b.zpFactorAPER")
     456        sqlLine.group("a.FkronFluxErr", "a.FkronFluxErr * b.zpFactorAPER")
     457        sqlLine.group("a.Fsky",         "a.Fsky         * b.zpFactorAPER")
     458        sqlLine.group("a.FskyErr",      "a.FskyErr      * b.zpFactorAPER")
    448459
    449460        sql = sqlLine.makeEquals("WHERE a.ippDetectID = b.ippDetectID AND b.imageID = " +str( imageID))
     
    457468        self.logger.infoPair("row count of ForcedWarpMeasurement after cull of null objID ", rowCountAfter)
    458469        if rowCountAfter == 0:
    459             self.skipBatch = True
    460             self.logger.infoPair ("skip this batch", "it is bad")
    461             return False
     470            if self.haveLensPSF[num] ==0:
     471                self.logger.infoPair("skipping this table", "no lenspsf and no dvo, run this:")
     472                self.logger.infoPair("update addRun join addProcessedExp using (add_id) set fault = 43 where add_id = ",str(self.number[num]))
     473                self.skipBatch = True
     474                return False
     475            else:   
     476                self.skipBatch = True
     477                self.logger.infoPair ("skip this batch", "it is bad")
     478                return False
     479
     480
    462481
    463482        self.logger.infoPair("Adding 'row' columns to", pspsTableName)
     
    557576
    558577        sqlLine = sqlUtility("UPDATE " + pspsTableName + " as a, " + self.scratchDb.dvoDetectionTable + " as b SET ")
    559         sqlLine.group("a.flxR5",     "a.flxR5     * b.zpFactor")
    560         sqlLine.group("a.flxR5Err",  "a.flxR5Err  * b.zpFactor")
    561         sqlLine.group("a.flxR5Std",  "a.flxR5Std  * b.zpFactor")
    562 
    563         sqlLine.group("a.flxR6",     "a.flxR6     * b.zpFactor")
    564         sqlLine.group("a.flxR6Err",  "a.flxR6Err  * b.zpFactor")
    565         sqlLine.group("a.flxR6Std",  "a.flxR6Std  * b.zpFactor")
    566 
    567         sqlLine.group("a.flxR7",     "a.flxR7     * b.zpFactor")
    568         sqlLine.group("a.flxR7Err",  "a.flxR7Err  * b.zpFactor")
    569         sqlLine.group("a.flxR7Std",  "a.flxR7Std  * b.zpFactor")
     578        sqlLine.group("a.flxR5",     "a.flxR5     * b.zpFactorAPER")
     579        sqlLine.group("a.flxR5Err",  "a.flxR5Err  * b.zpFactorAPER")
     580        sqlLine.group("a.flxR5Std",  "a.flxR5Std  * b.zpFactorAPER")
     581
     582        sqlLine.group("a.flxR6",     "a.flxR6     * b.zpFactorAPER")
     583        sqlLine.group("a.flxR6Err",  "a.flxR6Err  * b.zpFactorAPER")
     584        sqlLine.group("a.flxR6Std",  "a.flxR6Std  * b.zpFactorAPER")
     585
     586        sqlLine.group("a.flxR7",     "a.flxR7     * b.zpFactorAPER")
     587        sqlLine.group("a.flxR7Err",  "a.flxR7Err  * b.zpFactorAPER")
     588        sqlLine.group("a.flxR7Std",  "a.flxR7Std  * b.zpFactorAPER")
    570589
    571590        sql = sqlLine.makeEquals("WHERE a.ippDetectID = b.ippDetectID AND b.imageID = " +str( imageID))
     
    657676        # each of the "populate*" methods below add their tables to the list:
    658677        self.tablesToExport=[]
     678        tables = [] # list of tables to calculate min/max objid on...
    659679   
    660680        for num in self.number:   
     
    671691            self.logger.infoPair("Populating", myTable)
    672692            if not self.populateForcedWarpMeasurement(num):
    673                 self.logger.infoPair ("skippping ForcedWarpMeasurement", str(num))
     693                self.logger.infoPair ("failed on ForcedWarpMeasurement", str(num))
    674694                #continue
    675695                raise
    676696            self.tablesToExport.append(myTable)
    677 
    678             self.logger.infoPair("setting min/max objid from", myTable)
    679             self.setMinMaxObjID([myTable])
     697            tables.append(myTable)
     698            #self.logger.infoPair("setting min/max objid from", myTable)
     699 
     700            #self.setMinMaxObjID([myTable])
    680701
    681702            # populateForcedWarpMeasurement also populates ForcedWarpMasked (from ForcedWarpMeasurement)
     
    697718            self.populateForcedWarpToImage(num)
    698719            self.tablesToExport.append(myTable)
     720        self.logger.infoPair("setting min/max objid from", "all the fw tables")
     721        self.setMinMaxObjID(tables)
     722        self.logger.infoPair("finishing","populatePspsTables")
     723
    699724           
    700             self.logger.infoPair("finishing","populatePspsTables")
    701 
    702725
    703726        return True
     
    762785            self.haveLensPSF[num] = 0
    763786            self.haveLensing[num] = 0
     787
    764788            for table in tables:
    765789                # check for AP_NPIX columns: missing for SAS39
Note: See TracChangeset for help on using the changeset viewer.