Index: trunk/ippToPsps/jython/fits.py
===================================================================
--- trunk/ippToPsps/jython/fits.py	(revision 39085)
+++ trunk/ippToPsps/jython/fits.py	(revision 39103)
@@ -6,4 +6,6 @@
 import hashlib
 from subprocess import call, PIPE, Popen
+
+import tempfile
 
 '''
@@ -121,4 +123,16 @@
 
     '''
+    Find and read a header extension.
+    '''
+    def findAndReadHeader(self, name, VERBOSE):
+
+        if False:
+            status = self.findAndReadHeaderRaw(name, VERBOSE)
+            return status
+
+        status = self.findAndReadHeaderOhana(name, VERBOSE)
+        return status
+
+    '''
     Finds and reads a header extension.
 
@@ -132,5 +146,5 @@
     through STILTS
     '''
-    def findAndReadHeader(self, name, VERBOSE):
+    def findAndReadHeaderRaw(self, name, VERBOSE):
 
         found = False
@@ -167,4 +181,30 @@
 
     '''
+    Find and read a header extension.
+    '''
+    def findAndReadHeaderOhana(self, name, VERBOSE):
+
+        cmd = "fhead -n %s %s" % (name, self.originalPath)
+        p = Popen(cmd, shell=True, stdout=PIPE)
+        output = p.communicate()[0]        
+
+        header = {}
+
+        # split the output header bytes into key/value pairs for each 80-byte line
+        for i in range(0, len(output), 80):
+            # print "line %d : %s" % (i, output[i:i+80])
+            record = output[i:i+80]
+
+            match = re.match('^(HIERARCH )*([a-zA-Z0-9-_\.]+)\s*=\s+\'*([a-zA-Z0-9-+_\.:\s@#\(\)\,]+)\'*\\/*', record)
+
+            if match:
+                param = match.group(2)
+                value = match.group(3).strip()
+                if value == "NaN": value = "NULL"
+                header[param] = value
+
+        return header
+
+    '''
     Reads FITS header and stores all fields in a dictionary object
     '''
