IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jan 5, 2016, 3:34:49 PM (11 years ago)
Author:
eugene
Message:

need to handle possibly NULL / NaN values in the headers

File:
1 edited

Legend:

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

    r39123 r39305  
    228228        pltscale2 = pltscale * pltscale
    229229
    230         psfFwhmMajor = pltscale * self.getKeyFloat(header, "%.8f", 'FWHM_MAJ')
    231         psfFwhmMinor = pltscale * self.getKeyFloat(header, "%.8f", 'FWHM_MIN')
    232         psfFWHM = 0.5*(psfFwhmMajor + psfFwhmMinor)
     230        # NOTE: getKeyFloat returns the header value if it is a float,
     231        # -999 if the value is missing and "NULL" if the value in the
     232        # header is a NaN.  any math operations below need to handle
     233        # these cases correctly
     234
     235        # NOTE 2: getKeyFloat NOW returns the header value if it is a
     236        # float or "NULL" if the value is missing or if the value in
     237        # the header is a NaN.  any math operations below need to
     238        # handle these cases correctly
     239
     240        psfFwhmMajor = self.getKeyFloat(header, "%.8f", 'FWHM_MAJ')
     241        if (psfFwhmMajor != "NULL"): psfFwhmMajor *= pltscale
     242
     243        psfFwhmMinor = self.getKeyFloat(header, "%.8f", 'FWHM_MIN')
     244        if (psfFwhmMinor != "NULL"): psfFwhmMinor *= pltscale
     245
     246        psfFWHM = "NULL"
     247        if (psfFwhmMajor != "NULL") and (psfFwhmMinor != "NULL"):
     248            psfFWHM = 0.5*(psfFwhmMajor + psfFwhmMinor)
    233249
    234250        psfmodel_name = self.getKeyValue(header, 'PSFMODEL')
     
    252268        sqlLine.group("ippSkycalID",    self.ippSkycalID[num])
    253269        sqlLine.group("stackMetaID",    self.stackMetaID[num])
    254 # no astrometry calibration for forced warp
    255 #       sqlLine.group("astroScat",      self.getKeyFloat(header, "%.8f", 'CERROR'))
    256 #       sqlLine.group("nAstroRef",      self.getKeyValue(header, 'NASTRO'))
    257 #       sqlLine.group("nPhotoRef",      self.getKeyValue(header, 'NASTRO'))
    258 #       sqlLine.group("photoScat",      self.getKeyFloat(self.header, "%.8f", 'ZPT_ERR'));
    259270        sqlLine.group("psfModelID",     psfmodelID)
    260271        sqlLine.group("psfFWHM",        psfFWHM)
    261272        sqlLine.group("psfWidMajor",    psfFwhmMajor)
    262273        sqlLine.group("psfWidMinor",    psfFwhmMinor)
    263         # sqlLine.group("psfFwhm_mean",   self.getKeyFloat(header, "%.8f", 'FWHM_MAJ'))
    264         # sqlLine.group("psfFwhm_max",    self.getKeyFloat(header, "%.8f", 'FW_MJ_UQ'))
     274
     275        # sqlLine.group("photoZero",      self.getKeyFloat(header, "%.8f", 'FPA.ZP'))
    265276
    266277        sqlLine.group("psfTheta",       self.getKeyFloat(header, "%.8f", 'ANGLE'))
    267 
    268         # sqlLine.group("photoZero",      self.getKeyFloat(header, "%.8f", 'FPA.ZP'))
    269278        sqlLine.group("photoZero",      zpImage)
    270279
Note: See TracChangeset for help on using the changeset viewer.