Index: trunk/ippToPsps/jython/detectionbatch.py
===================================================================
--- trunk/ippToPsps/jython/detectionbatch.py	(revision 31935)
+++ trunk/ippToPsps/jython/detectionbatch.py	(revision 31936)
@@ -80,29 +80,25 @@
        #self.endY = 8
 
-       if self.safeDictionaryAccess(self.header, 'MJD-OBS') == "NULL" or self.safeDictionaryAccess(self.header, 'EXPTIME') == "NULL":
-           self.obsTime = 1.0
-           self.logger.errorPair("Fields missing from rimary header", "MJD-OBS or EXPTIME (or both)")
-           if not self.testMode: 
-               self.everythingOK = False
-               return
-           self.logger.infoPair("Hardcoding obs time to", "%f" % self.obsTime)
-       else:
-           self.obsTime = float(self.header['MJD-OBS']) + (float(self.header['EXPTIME']) / 172800.0)
+       # get a fre primary header values. if in test mode, then use defaults
+       if self.safeDictionaryAccessWithDefault(self.header, 'MJD-OBS', "1") == "NULL":
+           self.everythingOK = False
+           return
+
+       if self.safeDictionaryAccessWithDefault(self.header, 'EXPTIME', "1") == "NULL":
+           self.everythingOK = False
+           return
+
+       if self.safeDictionaryAccessWithDefault(self.header, 'FILTERID', "g.0000") == "NULL":
+           self.everythingOK = False
+           return
+       
+       self.obsTime = float(self.header['MJD-OBS']) + (float(self.header['EXPTIME']) / 172800.0)
       
        # set up some defauts
        self.calibModNum = 0
-
        self.totalNumPhotoRef = 0
 
-       # get filterID using init table
-       if self.safeDictionaryAccess(self.header, 'FILTERID') == "NULL":
-          self.filter = 'g'
-          self.logger.errorPair("Field missing from rimary header", "FILTERID")
-          if not self.testMode: 
-              self.everythingOK = False
-              return
-          self.logger.infoPair("Hardcoding filter to", "%s" % self.filter)
-       else:
-          self.filter = self.header['FILTERID'][0:1]
+
+       self.filter = self.header['FILTERID'][0:1]
 
        # insert what we know about this stack batch into the stack table
@@ -615,6 +611,7 @@
 
                 # check we have valid sourceID/imageID pair from the header
-                if 'SOURCEID' not in header or 'IMAGEID' not in header: 
-                    self.logger.errorPair("Can't read SOURCEID/IMAGEID pair for", ota)
+                if self.safeDictionaryAccessWithDefault(header, 'SOURCEID', "0") == "NULL":
+                    continue
+                if self.safeDictionaryAccessWithDefault(header, 'IMAGEID', "0") == "NULL":
                     continue
 
