Index: /branches/sj_ippTests_branch_20080929/ippTests/compIPPphoto.py
===================================================================
--- /branches/sj_ippTests_branch_20080929/ippTests/compIPPphoto.py	(revision 20509)
+++ /branches/sj_ippTests_branch_20080929/ippTests/compIPPphoto.py	(revision 20510)
@@ -106,5 +106,7 @@
 
 def compIPPphoto(summaryTable,mode,plotcol_1frame_tlist=plotcol_1frame_tlist,\
-                     plotcol_summary_tlist=plotcol_summary_tlist,skip=True):
+                     plotcol_summary_tlist=plotcol_summary_tlist,\
+                 cmfDir = '/IPP/data/SDSS/stripe82/coadd/prod/run_ipp_20080815/',\
+                 skip=True):
     """summaryTable: .fits table for output
     mode: new or append for creating summaryTable new or appending current run's output to it.
@@ -134,5 +136,5 @@
     column_hash={}
     stats_hash={}
-    chipfile_l,fpObjc_l = makePlan()
+    chipfile_l,fpObjc_l = makePlan(cmfDir=cmfDir)
     filters = []
     bandindex_hash = {}
@@ -198,4 +200,6 @@
     """Make diagnostic plots for a single table, based on values in
     values_hash"""
+    # XXX Todo: window commands instead of (or in addition to?) psnup
+    # for putting plots on same paper
     from subprocess import call
     from numpy import concatenate
@@ -356,5 +360,5 @@
     return outl
 
-def computeStatistics(tablename,copyfields_list = ['RUN','RERUN','CAMCOL','FIELD','FILTER','FWHM_X','FWHM_Y']):
+def computeStatistics(tablename,copyfields_list = ['RUN','RERUN','CAMCOL','FIELD','FILTER','FWHM_MAJ','FWHM_MIN']):
     """Compute desired statistics for offsets etc. and add them as
     ESO-style HIERARCH fields to the table header (8 characters are
@@ -534,50 +538,4 @@
     return array(good1_l),array(good2_l),array(good3_l)
     
-def makePlan(lastcamcol=1):
-    """Make paired list of which fpObjc file to compare to which IPP
-    .cmf file. Could also think about constructing the fpObjc filename
-    from run, camcol, field read from .cmf primary header, which
-    replicates most of the fpC primary header."""
-     
-    # For testing:
-    # return ['1056-0192.421/1056-0192.421.ch.421.CHIP1.cmf'],['1056-0192.421/fpObjc-001056-1-0192.fit']
-
-    from glob import glob
-    fpObjcDir = '/IPP/data/SDSS/stripe82/coadd/input/fpObjcs/'
-    cmfDir = '/IPP/data/SDSS/stripe82/coadd/prod/run_ipp/'
-    runlist = [1056,1755,3388,3434,3465,4145,4192,4203,4247,4263,5052]
-    firstfield_h = {
-        1056:192,
-        1755:329,
-        3388:273,
-        3434:306,
-        3465:185,
-        4145:63,
-        4192:309,
-        4203:358,
-        4247:62,
-        4263:69,
-        5052:62
-        }
-    Nfields = 18
-    camcollist = range(1,lastcamcol+1)
-    sdsslist = []
-    ps1list = []
-    for run in runlist[0:1]:
-        firstfield = firstfield_h[run]
-        for field in range(firstfield,firstfield+Nfields+1):
-            for camcol in camcollist:
-                sdssname = fpObjcDir + "fpObjc-%06i-%i-%04i.fit" % ( run, camcol, field)
-                # The following should just return 5 files (1 per
-                # filter), but just to be sure, let's check and return
-                # the correct number of sdss files to match:
-                ps1glob = glob(cmfDir + "%i-%04i.*/%i-%04i.*.ch.*.CHIP%i.cmf" %(run,field,run,field,camcol))
-                for ps1name in ps1glob:
-                    ps1list.append(ps1name)
-                    sdsslist.append(sdssname)
-                # Need to remember that CHIPx corresponds to CAMCOLx; could change
-                # naming rule to make filter name appear in filename, too.
-    return ps1list,sdsslist
-
 def matchSdssPs1(SDSSfpObjc,PS1cmf,xoff=0.5,yoff=0.5,matchrad=0.7,skip=False):
     """Call matchByPos to match an SDSS fpObjc.fits and a PS1 bla.cmf
@@ -599,5 +557,5 @@
     filters = ['u','g','r','i','z']
     # Read primary  header of PS1 file to work out band
-    ps1copyfields_hash = headerfieldHash(['FWHM_X','FWHM_Y','FILTER'],PS1cmf,HDU=0)
+    ps1copyfields_hash = headerfieldHash(['FWHM_MAJ','FWHM_MIN','FILTER'],PS1cmf,HDU=0)
     sdssbandstr = ps1copyfields_hash['FILTER']
     bandindex = filters.index(sdssbandstr)
@@ -946,2 +904,52 @@
 
     
+def makePlan(fpObjcDir = '/IPP/data/SDSS/stripe82/coadd/input/fpObjcs/',\
+                 cmfDir = '/IPP/data/SDSS/stripe82/coadd/prod/run_ipp_20080815/',\
+                 lastcamcol=1,\
+                 runlist=[1056,1755,3388,3434,3465,4145,4192,4203,4247,4263,5052],\
+                 firstfield_h = {
+        1056:192,
+        1755:329,
+        3388:273,
+        3434:306,
+        3465:185,
+        4145:63,
+        4192:309,
+        4203:358,
+        4247:62,
+        4263:69,
+        5052:62
+        }, \
+                 Nfields = 18):
+    """Make paired list of which fpObjc file to compare to which IPP
+    .cmf file. Could also think about constructing the fpObjc filename
+    from run, camcol, field read from .cmf primary header, which
+    replicates most of the fpC primary header."""
+    if cmfDir[-1] != '/':
+        cmfDir += '/'
+    if fpObjcDir[-1] != '/':
+        fpObjcDir += '/'
+    # For testing:
+    # return ['1056-0192.421/1056-0192.421.ch.421.CHIP1.cmf'],['1056-0192.421/fpObjc-001056-1-0192.fit']
+
+    from glob import glob
+    camcollist = range(1,lastcamcol+1)
+    sdsslist = []
+    ps1list = []
+    for run in runlist:
+        firstfield = firstfield_h[run]
+        for field in range(firstfield,firstfield+Nfields+1):
+            for camcol in camcollist:
+                sdssname = fpObjcDir + "fpObjc-%06i-%i-%04i.fit" % ( run, camcol, field)
+                # The following should just return 5 files (1 per
+                # filter), but just to be sure, let's check and return
+                # the correct number of sdss files to match:
+                globstr = cmfDir + "%i-%04i.*/%i-%04i.*.ch.*.CHIP%i.cmf" %(run,field,run,field,camcol)
+                ps1glob = glob(globstr)
+                for ps1name in ps1glob:
+                    ps1list.append(ps1name)
+                    sdsslist.append(sdssname)
+                # Need to remember that CHIPx corresponds to CAMCOLx; could change
+                # naming rule to make filter name appear in filename, too.
+    return ps1list,sdsslist
+
