IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Oct 31, 2012, 11:54:39 AM (14 years ago)
Author:
bills
Message:

Changes to PSPS table definitions for SA 10.
Detection tables contain all fluxes
Object table contains all magnitudes
Populate DetectionCalib and StackDetectinCalib

File:
1 edited

Legend:

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

    r34615 r34630  
    197197        sql = "UPDATE StackModelFit AS a, SkyChip_xfit AS b SET \
    198198        "+model+"Radius=b.EXT_WIDTH_MAJ,  \
    199         "+model+"Flux=b.EXT_INST_MAG,  \
    200         "+model+"FluxErr=b.EXT_INST_MAG_SIG, \
     199        "+model+"Flux=POW(10, -0.4 * b.EXT_INST_MAG) " + str(self.expTime) " ,  \
     200        "+model+"FluxErr=ABS(b.EXT_INST_MAG_SIG) * POW(10, -0.4 * b.EXT_INST_MAG) " + str(self.expTime) " / 1.085736, \
    201201        "+model+"Ab=b.EXT_WIDTH_MAJ/b.EXT_WIDTH_MIN, \
    202202        "+model+"Phi=b.EXT_THETA,  \
     
    230230        "+modelLong+"Covar77=b.EXT_COVAR_06_06   \
    231231        WHERE a.ippDetectID=b.IPP_IDET AND b.MODEL_TYPE = '"+ippModelType+"'"
    232 
    233         #SA10 convert mag to flux in calculation above
    234232
    235233        self.scratchDb.execute(sql)
     
    369367               ,ABS((PSF_INST_MAG_SIG*(POW(10.0, (-0.4*PSF_INST_MAG)) / " + str(self.expTime) + ")) / 1.085736) \
    370368               ,POW(10.0, (-0.4*PEAK_FLUX_AS_MAG)) / " + str(self.expTime) + " \
    371                ,SKY \
    372                ,SKY_SIGMA \
     369               ,SKY / " + str(self.expTime) + " \
     370               ,SKY_SIGMA / " + str(self.expTime) + " \
    373371               ,EXT_NSIGMA \
    374372               ,PSF_MAJOR \
     
    388386               ,MOMENTS_R1 \
    389387               ,MOMENTS_RH \
    390                ,AP_MAG \
     388               ,POW(10.0, (-0.4*AP_MAG) / " + str(self.expTime) + " \
    391389               , NULL \
    392390               ,KRON_FLUX / " + str(self.expTime) + " \
     
    398396               ," + self.historyModNum + " \
    399397               FROM SkyChip_psf"
    400 
    401                #SA10 to do
    402                # put in correct formula for apFlux, psfFlux, psfLikelihood, sgsep
    403                # need correct units of anything in Flux
    404398        self.scratchDb.execute(sql)
    405399       
     
    481475        petRadius=b.PETRO_RADIUS \
    482476        ,petRadiusErr=b.PETRO_RADIUS_ERR \
    483         ,petFlux=b.PETRO_MAG \
    484         ,petFluxErr=b.PETRO_MAG_ERR \
     477        ,petFlux=POW(10.0, -0.4 * b.PETRO_MAG) /" + str(self.expTime) + " \
     478        ,petFluxErr=ABS((b.PETRO_MAG_ERR * POW(10.0, (-0.4*b.petroMag))) / " + str(self.expTime) + " / 1.085736 \
    485479        ,petR50=b.PETRO_RADIUS_50 \
    486480        ,petR50Err=b.PETRO_RADIUS_50_ERR \
     
    489483        ,petCf=b.PETRO_FILL \
    490484        WHERE a.ippDetectID=b.IPP_IDET"
    491         #SA10 Put correct calculation for PetFlux
    492485        self.scratchDb.execute(sql)
    493486
     
    620613        self.logger.info(sql)
    621614        self.scratchDb.execute(sql)
    622         #SA10 TODO
    623         # insert ra/dec/calstuff into Table
    624         # heather discovered dec is called 'dec_'
    625         sql = "UPDATE " + tableName + " SET ra = -999, dec_ =-999, raErr = -999, decErr = -999, zp = -999, zpErr = -999, expTime = -999, airMass = -999"
     615        # insert calibration information from dvoDetections into the Table
     616        sql = "UPDATE " + tableName + " AS a, "  + self.scratchDb.dvoDetectionTable + " AS b \
     617            SET a.ra = b.ra, \
     618            a.dec_ = b.dec_, \
     619            a.raErr = b.raErr, \
     620            a.decErr = b.decErr, \
     621            a.zp = b.zp, \
     622            a.zpErr = b.zpErr, \
     623            a.expTime = b.expTime, \
     624            a.airMass = b.airMass   \
     625            WHERE a.objID = b.objID AND a.detectID = b.detectID"
    626626        self.logger.info(sql)
    627627        self.scratchDb.execute(sql)
Note: See TracChangeset for help on using the changeset viewer.