IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 35452


Ignore:
Timestamp:
Apr 28, 2013, 2:57:07 PM (13 years ago)
Author:
eugene
Message:

psfFlux, psfFluxErr, apFlux from FLUX fields in smf, not MAG fields; set flux <= 0.0 to 1e20

Location:
trunk/ippToPsps/jython
Files:
2 edited

Legend:

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

    r35417 r35452  
    439439               ,X_PSF_SIG \
    440440               ,Y_PSF_SIG \
    441                ,POW(10.0, (-0.4*PSF_INST_MAG)) / " + self.header['EXPTIME'] + " \
    442                ,ABS((PSF_INST_MAG_SIG*(POW(10.0, (-0.4*PSF_INST_MAG)) / " + self.header['EXPTIME'] + ")) / 1.085736) \
     441               ,PSF_INST_FLUX / " + self.header['EXPTIME'] + " \
     442               ,PSF_INST_FLUX_SIG / " + self.header['EXPTIME'] + " \
    443443               ,POW(10.0, (-0.4*PEAK_FLUX_AS_MAG)) / " + self.header['EXPTIME'] + " \
    444444               ,PSF_MAJOR \
     
    450450               ,MOMENTS_XY \
    451451               ,MOMENTS_YY \
    452                ,POW(10.0, -0.4 *AP_MAG) / " + self.header['EXPTIME'] + " \
     452               ,AP_FLUX / " + self.header['EXPTIME'] + " \
    453453               ,KRON_FLUX / " + self.header['EXPTIME'] + " \
    454454               ,KRON_FLUX_ERR / " + self.header['EXPTIME'] + " \
     
    466466        # self.logger.info(sql)
    467467
    468         self.scratchDb.execute(sql)
    469 
     468# these were used above (left over from before PSF_INST_FLUX, PSF_INST_FLUX_SIG were available?
     469#               ,POW(10.0, (-0.4*PSF_INST_MAG)) / " + self.header['EXPTIME'] + "
     470#               ,ABS((PSF_INST_MAG_SIG*(POW(10.0, (-0.4*PSF_INST_MAG)) / " + self.header['EXPTIME'] + ")) / 1.085736)
     471#               ,POW(10.0, -0.4 *AP_MAG) / " + self.header['EXPTIME'] + "
     472
     473        self.scratchDb.execute(sql)
     474
     475        # XXX EAM : I removed this old fix for invalid fluxes
    470476        # add a instFlux = 0.0 -> 0.000001
    471         # XXX EAM : why is this done?
    472         sql="UPDATE " + pspsTableName + " SET psfFlux = 0.0000001 WHERE psfFlux =  0"
    473         self.scratchDb.execute(sql)
     477        # XXX EAM : why is this done? 
     478        # sql="UPDATE " + pspsTableName + " SET psfFlux = 0.0000001 WHERE psfFlux =  0"
     479        # self.scratchDb.execute(sql)
    474480     
     481        # NOTE : Flux limits : in the current PSPS schema, negative fluxes
     482        # cause problems for sql queries which work in mags as SQL cannot do
     483        # something like (f < 0.0) ? -999 : -2.5*log10(f)
     484        # as a result, the negative fluxes here result in floating point errors
     485        sql = "UPDATE " + pspsTableName " SET psfFlux = 1e20 WHERE psfFlux <= 0.0"
     486        self.scratchDb.execute(sql)
     487       
     488        sql = "UPDATE " + pspsTableName " SET apFlux = 1e20 WHERE apFlux <= 0.0"
     489        self.scratchDb.execute(sql)
     490
     491        sql = "UPDATE " + pspsTableName " SET kronFlux = 1e20 WHERE kronFlux <= 0.0"
     492        self.scratchDb.execute(sql)
     493
    475494        # we don't delete these anymore
    476495        results['NULLINSTFLUX'] = 0;
  • trunk/ippToPsps/jython/stackbatch.py

    r35417 r35452  
    482482               ,X_PSF_SIG \
    483483               ,Y_PSF_SIG \
    484                ,POW(10.0, (-0.4*PSF_INST_MAG)) / " + str(self.expTime) + " \
    485                ,ABS((PSF_INST_MAG_SIG*(POW(10.0, (-0.4*PSF_INST_MAG)) / " + str(self.expTime) + ")) / 1.085736) \
     484               ,PSF_INST_FLUX / " + str(self.expTime) + " \
     485               ,PSF_INST_FLUX_SIG / " + str(self.expTime) + " \
    486486               ,POW(10.0, (-0.4*PEAK_FLUX_AS_MAG)) / " + str(self.expTime) + " \
    487487               ,SKY / " + str(self.expTime) + " \
     
    504504               ,MOMENTS_R1 \
    505505               ,MOMENTS_RH \
    506                ,POW(10.0, -0.4*AP_MAG) / " + str(self.expTime) + " \
     506               ,AP_FLUX / " + str(self.expTime) + " \
    507507               ,NULL \
    508508               ,KRON_FLUX / " + str(self.expTime) + " \
     
    515515               FROM SkyChip_psf"
    516516
     517# these were used above (left over from before PSF_INST_FLUX, PSF_INST_FLUX_SIG were available?
     518#               ,POW(10.0, (-0.4*PSF_INST_MAG)) / " + str(self.expTime) + "
     519#               ,ABS((PSF_INST_MAG_SIG*(POW(10.0, (-0.4*PSF_INST_MAG)) / " + str(self.expTime) + ")) / 1.085736)
     520#               ,POW(10.0, -0.4*AP_MAG) / " + str(self.expTime) + "
     521
    517522        # print "sql: ", sql
    518523        # response = raw_input("ready to insert stack det ")
     
    526531        self.logger.infoPair("Deleting", "entries with StackDetection.objID = 0")
    527532       
     533        # XXX EAM : this seems quite inefficient : these commands use updates to set
     534        # fields which are constant across all rows.  Why not just include these in
     535        # the original insert above?
     536
    528537        self.scratchDb.updateAllRows("StackDetection", "surveyID", str(self.surveyID))
    529538       
     
    560569        # response = raw_input("add primary key? ")
    561570 
    562         if self.stackType == "DEEP_STACK":
     571        ### XXX this should not be a DEEP_STACK only case...
     572        if false and self.stackType == "DEEP_STACK":
    563573
    564574            #if deep stack and instFlux = null and err not null
     
    572582            # response = raw_input("add psf flux ")
    573583           
     584        # NOTE : Flux limits : in the current PSPS schema, negative fluxes
     585        # cause problems for sql queries which work in mags as SQL cannot do
     586        # something like (f < 0.0) ? -999 : -2.5*log10(f)
     587        # as a result, the negative fluxes here result in floating point errors
     588        sql = "UPDATE StackDetection SET psfFlux = 1e20 WHERE psfFlux <= 0.0"
     589        self.scratchDb.execute(sql)
     590       
     591        sql = "UPDATE StackDetection SET apFlux = 1e20 WHERE apFlux <= 0.0"
     592        self.scratchDb.execute(sql)
     593
     594        sql = "UPDATE StackDetection SET kronFlux = 1e20 WHERE kronFlux <= 0.0"
     595        self.scratchDb.execute(sql)
     596
    574597        #leave null instflux in
    575598        #self.scratchDb.reportAndDeleteRowsWithNULLS("StackDetection", "instFlux")
Note: See TracChangeset for help on using the changeset viewer.