IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 31936


Ignore:
Timestamp:
Jul 25, 2011, 4:20:22 PM (15 years ago)
Author:
rhenders
Message:

using new Batch class method to substitude a default value for certain missing header fields

File:
1 edited

Legend:

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

    r31932 r31936  
    8080       #self.endY = 8
    8181
    82        if self.safeDictionaryAccess(self.header, 'MJD-OBS') == "NULL" or self.safeDictionaryAccess(self.header, 'EXPTIME') == "NULL":
    83            self.obsTime = 1.0
    84            self.logger.errorPair("Fields missing from rimary header", "MJD-OBS or EXPTIME (or both)")
    85            if not self.testMode:
    86                self.everythingOK = False
    87                return
    88            self.logger.infoPair("Hardcoding obs time to", "%f" % self.obsTime)
    89        else:
    90            self.obsTime = float(self.header['MJD-OBS']) + (float(self.header['EXPTIME']) / 172800.0)
     82       # get a fre primary header values. if in test mode, then use defaults
     83       if self.safeDictionaryAccessWithDefault(self.header, 'MJD-OBS', "1") == "NULL":
     84           self.everythingOK = False
     85           return
     86
     87       if self.safeDictionaryAccessWithDefault(self.header, 'EXPTIME', "1") == "NULL":
     88           self.everythingOK = False
     89           return
     90
     91       if self.safeDictionaryAccessWithDefault(self.header, 'FILTERID', "g.0000") == "NULL":
     92           self.everythingOK = False
     93           return
     94       
     95       self.obsTime = float(self.header['MJD-OBS']) + (float(self.header['EXPTIME']) / 172800.0)
    9196     
    9297       # set up some defauts
    9398       self.calibModNum = 0
    94 
    9599       self.totalNumPhotoRef = 0
    96100
    97        # get filterID using init table
    98        if self.safeDictionaryAccess(self.header, 'FILTERID') == "NULL":
    99           self.filter = 'g'
    100           self.logger.errorPair("Field missing from rimary header", "FILTERID")
    101           if not self.testMode:
    102               self.everythingOK = False
    103               return
    104           self.logger.infoPair("Hardcoding filter to", "%s" % self.filter)
    105        else:
    106           self.filter = self.header['FILTERID'][0:1]
     101
     102       self.filter = self.header['FILTERID'][0:1]
    107103
    108104       # insert what we know about this stack batch into the stack table
     
    615611
    616612                # check we have valid sourceID/imageID pair from the header
    617                 if 'SOURCEID' not in header or 'IMAGEID' not in header:
    618                     self.logger.errorPair("Can't read SOURCEID/IMAGEID pair for", ota)
     613                if self.safeDictionaryAccessWithDefault(header, 'SOURCEID', "0") == "NULL":
     614                    continue
     615                if self.safeDictionaryAccessWithDefault(header, 'IMAGEID', "0") == "NULL":
    619616                    continue
    620617
Note: See TracChangeset for help on using the changeset viewer.