Index: /trunk/ippToPsps/jython/detectionbatch.py
===================================================================
--- /trunk/ippToPsps/jython/detectionbatch.py	(revision 38955)
+++ /trunk/ippToPsps/jython/detectionbatch.py	(revision 38956)
@@ -112,5 +112,11 @@
        # MJD-OBS is the exposure start, EXTIME / 172800 = (EXPTIME sec / 84600 sec/day) / 2
        self.obsTime = float(self.header['MJD-OBS']) + (float(self.header['EXPTIME']) / 172800.0)
-      
+    
+       ## MEH md5sum options test 
+       self.md5sum = None
+       self.md5sum = self.fits.getMd5sum()
+       #self.md5sum = self.fits.getMd5sumShell()
+       #self.md5sum = self.fits.getMd5sumFile()
+  
        # set up some defauts
        self.totalNumPhotoRef = 0
@@ -137,6 +143,4 @@
         sqlLine = sqlUtility("INSERT INTO FrameMeta (")
 
-        # sqlLine.group("md5sum",               ' needs a number');
- 
         sqlLine.group("frameID",               str(self.expID));
         sqlLine.group("frameName",             self.expName);
@@ -148,4 +152,5 @@
         sqlLine.group("telescopeID",           "1");
         sqlLine.group("analysisVer",           self.analysisVer);
+        sqlLine.group("md5sum",                str(self.md5sum))
         sqlLine.group("photoScat",             self.getKeyFloat(self.header, "%.8f", 'ZPT_ERR'));
         sqlLine.group("expStart",              self.getKeyFloat(self.header, "%.10f", 'MJD-OBS'));
Index: /trunk/ippToPsps/jython/diffbatch.py
===================================================================
--- /trunk/ippToPsps/jython/diffbatch.py	(revision 38955)
+++ /trunk/ippToPsps/jython/diffbatch.py	(revision 38956)
@@ -73,4 +73,5 @@
        self.skycellName = {}
        self.analysisVer = {}
+       self.md5sum = {}
        self.expTime = {}
        self.obsTime = {}
@@ -149,4 +150,6 @@
                self.skycellID[num] = -1
 
+           ## MEH md5sum test
+           self.md5sum[num] = self.fits[num].getMd5sum()
 
        # drop the existing tables    
@@ -219,4 +222,5 @@
         sqlLine.group("photoCalID",            self.photoCalID[num]);
         sqlLine.group("analysisVer",           str(self.analysisVer[num]));
+	sqlLine.group("md5sum",                str(self.md5sum[num]))
         sqlLine.group("expTime",               self.expTime[num]);
         sqlLine.group("ctype1",                self.getKeyValue(self.header[num], 'CTYPE1'));
Index: /trunk/ippToPsps/jython/fits.py
===================================================================
--- /trunk/ippToPsps/jython/fits.py	(revision 38955)
+++ /trunk/ippToPsps/jython/fits.py	(revision 38956)
@@ -4,4 +4,6 @@
 import re
 import shutil
+import hashlib
+from subprocess import call, PIPE, Popen
 
 '''
@@ -42,4 +44,25 @@
        # move file pointer back to the start of the file
        self.rewindToStart()
+
+
+    '''
+    Get md5sum for file 
+    '''
+    def getMd5sum(self):
+    	## memory inefficient all at once read but should be ok...
+    	md5 = hashlib.md5(open(self.originalPath,'rb').read())
+	return md5.hexdigest()
+
+    def getMd5sumShell(self):
+    	md5cmd = "md5sum %s" % (self.originalPath)
+	md5 = Popen(md5cmd, shell=True, stdout=PIPE).stdout.read()
+	return md5[0:32]
+
+    def getMd5sumFile(self):
+    	## unclear if rb by default for file so maybe not best
+        md5 = hashlib.md5(self.file.read())
+	## if used, then need to move file pointer back to the start of the file for others to use
+	self.rewindToStart()
+        return md5.hexdigest()
 
     '''
Index: /trunk/ippToPsps/jython/forcedwarpbatch.py
===================================================================
--- /trunk/ippToPsps/jython/forcedwarpbatch.py	(revision 38955)
+++ /trunk/ippToPsps/jython/forcedwarpbatch.py	(revision 38956)
@@ -78,4 +78,5 @@
        self.expTime = {}
        self.analysisVer = {}
+       set.md5sum = {}
        self.tessName = {}
        self.obsTime = {}
@@ -198,4 +199,6 @@
            #except: raise
 
+           ## MEH md5sum test
+	   self.md5sum[num] = self.fits[num].getMd5sum()
 
            self.logger.infoPair("calculating ObsTime","ok")
@@ -265,4 +268,5 @@
         sqlLine.group("photoCalID",     photoCalID)
         sqlLine.group("analysisVer",    str(self.analysisVer[num]))
+	sqlLine.group("md5sum",         str(self.md5sum[num]))
         sqlLine.group("expTime",        self.expTime[num])
 # no astrometry calibration for forced warp
Index: /trunk/ippToPsps/jython/stackbatch.py
===================================================================
--- /trunk/ippToPsps/jython/stackbatch.py	(revision 38955)
+++ /trunk/ippToPsps/jython/stackbatch.py	(revision 38956)
@@ -63,4 +63,5 @@
        self.fits = {}
        self.headerSet = {}
+       self.md5sum = {}
 
        # we have two sets of imageIDs here:
@@ -112,4 +113,7 @@
            self.logger.infoPair(filter + " imageID = ", imageID)       
            self.imageIDs[filter] = imageID
+
+	   ## MEH -- md5sum test
+           self.md5sum[filter] = self.fits[filter].getMd5sum()
 
        # did we find any valid stacks?
@@ -281,4 +285,5 @@
         sqlLine.group("photoCalID",         photoCalID) 
         sqlLine.group("analysisVer",        str(self.analysisVer))
+	sqlLine.group("md5sum",             str(self.md5sum[filter]))
         sqlLine.group("detectionThreshold", detectionThreshold)
         sqlLine.group("expTime",            self.getKeyFloat(header, "%.5f", 'EXPTIME'))  
