Index: trunk/ippToPsps/jython/diffbatch.py
===================================================================
--- trunk/ippToPsps/jython/diffbatch.py	(revision 39133)
+++ trunk/ippToPsps/jython/diffbatch.py	(revision 39134)
@@ -775,13 +775,18 @@
             for table in tables:
                 # check for AP_NPIX columns: missing for SAS39
-                if table.name == "SkyChip_psf":
+                self.logger.debugPair("checking table", table.name)
+                if table.name == "SkyChip.psf":
                     columns = table.columns()
-                    if 'AP_NPIX' in columns:
-                        self.haveApNpix[num] = 1
-                    if 'PSF_FWHM_MAJ' in columns:
-                        self.havePsfFwhm[num] = 1
-                    if 'SRC_CHIP_X' in columns:
-                        self.haveSrcPos[num] = 1
-
+                    for column in columns:
+                        columnString = str(column)
+                        if columnString == 'AP_NPIX': 
+                            self.haveApNpix[num] = 1
+                            self.logger.debugPair("found AP_NPIX in file", fileNamePos)
+                        if columnString == 'PSF_FWHM_MAJ':
+                            self.havePsfFwhm[num] = 1
+                            self.logger.debugPair("found PSF_FWHM_MAG in file", fileNamePos)
+                        if columnString == 'SRC_CHIP_X':
+                            self.haveSrcPos[num] = 1
+                            self.logger.debugPair("found SRC_CHIP_X in file", fileNamePos)
 
                 myTable = table.name.replace(".","_") + "_" + str(num)
Index: trunk/ippToPsps/jython/testCode.py
===================================================================
--- trunk/ippToPsps/jython/testCode.py	(revision 39133)
+++ trunk/ippToPsps/jython/testCode.py	(revision 39134)
@@ -96,4 +96,10 @@
         print "words[1]: " + words[1]
 
+        myList = ["word1", "word2", "word3"]
+        if "word1" in myList:
+            print "found word1"
+
+        if 'word1' in myList:
+            print "alt word1"
         
 
Index: trunk/ippToPsps/test/mksasdata.dvo
===================================================================
--- trunk/ippToPsps/test/mksasdata.dvo	(revision 39133)
+++ trunk/ippToPsps/test/mksasdata.dvo	(revision 39134)
@@ -22,5 +22,6 @@
 list expfiles -glob sasdata.v39/*.smf
 list wrpfiles -glob sasdata.v39/*.wrp.*ff*.cmf
-list diffiles -glob sasdata.v39/*.WS.dif.*.cmf
+# list diffiles -glob sasdata.v39/*.WS.dif.*.cmf
+list diffiles -glob sasdata.v40/*.WS.dif.*.inv.cmf
 list stkfiles -glob sasdata.v39/*skycal*.cmf
 
@@ -192,14 +193,35 @@
 
 # create a populated catdir with a set of cmf files, save the filenames in list for use by insert.exp
-macro mkcatdir.dif
-  if ($0 != 1)
-    echo "mkcatdir.dif"
+macro mkcatdir.dif.old
+  if ($0 != 1)
+    echo "mkcatdir.dif.old"
     break
   end
 
   for i 0 $diffiles:n
-    $diffile = $diffiles:$i
+    $difffile = $diffiles:$i
     echo addstar -D SKY_DEPTH 4 -D CATDIR $catdir_diff -D CATFORMAT PS1_V5 -D CAMERA gpc1 -update $diffile -D ZERO_POINT_OPTION CHIP_HEADER -accept-astrom -D ZERO_POINT_KEYWORD FPA.ZP
     exec addstar -D SKY_DEPTH 4 -D CATDIR $catdir_diff -D CATFORMAT PS1_V5 -D CAMERA gpc1 -update $diffile -D ZERO_POINT_OPTION CHIP_HEADER -accept-astrom -D ZERO_POINT_KEYWORD FPA.ZP
+    # echo addstar -D CAMERA gpc1 -D CATDIR $catdir -D CATFORMAT PS1_V5 $stkfile -update -quick-airmass -D ZERO_POINT_OPTION CHIP_HEADER
+  end
+end
+
+# create a populated catdir with a set of cmf files, save the filenames in list for use by insert.exp
+macro mkcatdir.dif
+  if ($0 != 1)
+    echo "mkcatdir.dif"
+    break
+  end
+
+  for i 0 $diffiles:n
+    $negfile = $diffiles:$i
+    strsub $negfile inv.cmf cmf -var posfile
+    exec rm -f diff.list.txt
+    output diff.list.txt
+    echo $posfile
+    echo $negfile
+    output stdout
+    echo addstar -D SKY_DEPTH 4 -D CATDIR $catdir_diff -D CATFORMAT PS1_V5 -D CAMERA gpc1 -update -list diff.list.txt -D ZERO_POINT_OPTION CHIP_HEADER -accept-astrom -D ZERO_POINT_KEYWORD FPA.ZP -diff-inv
+    exec addstar -D SKY_DEPTH 4 -D CATDIR $catdir_diff -D CATFORMAT PS1_V5 -D CAMERA gpc1 -update -list diff.list.txt -D ZERO_POINT_OPTION CHIP_HEADER -accept-astrom -D ZERO_POINT_KEYWORD FPA.ZP -diff-inv
     # echo addstar -D CAMERA gpc1 -D CATDIR $catdir -D CATFORMAT PS1_V5 $stkfile -update -quick-airmass -D ZERO_POINT_OPTION CHIP_HEADER
   end
@@ -380,12 +402,13 @@
 
   for i 0 $diffiles:n
-    $filename = $diffiles:$i
-    strlen $filename Nchar
-    substr $filename 0 {$Nchar - 4} path_base; # the database needs the path without the extension (.smf/.cmf)
-
-    $diffSkyfileID = `echo $filename | fields IMAGEID | prcol 2`
+    $negfile = $diffiles:$i
+    strsub $negfile inv.cmf cmf -var posfile
+    strlen $posfile Nchar
+    substr $posfile 0 {$Nchar - 4} path_base; # the database needs the path without the extension (.smf/.cmf)
+
+    $diffSkyfileID = `echo $posfile | fields IMAGEID | prcol 2`
     $skycell = "skycell.1315.090"
-    $filter  = `echo $filename | fields FPA.FILTERID | prcol 2`
-    $mjd     = `echo $filename | fields MJD-OBS | prcol 2`
+    $filter  = `echo $posfile | fields FPA.FILTERID | prcol 2`
+    $mjd     = `echo $posfile | fields MJD-OBS | prcol 2`
     
     $wrpID = $i
