IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

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

File:
1 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;
Note: See TracChangeset for help on using the changeset viewer.