Index: /branches/sj_ippTests_branch_20080929/ippTests/compIPPphoto.py
===================================================================
--- /branches/sj_ippTests_branch_20080929/ippTests/compIPPphoto.py	(revision 20548)
+++ /branches/sj_ippTests_branch_20080929/ippTests/compIPPphoto.py	(revision 20549)
@@ -79,5 +79,5 @@
     ,(['m_rr_cc_psf'],['d_mag'],'scatter')
     ,(['sky_sdss'],['sky_ps1'],'scatter')
-    ,(['y_psf'],['objc_rowc'],'histogram')
+    ,(['d_pointsource'],['pointsource_ps1'],'histogram')
     ,(['sky_sdss'],['sky_ps1'],'histogram')
     ,(['psfinstmag_sdss'],['psf_inst_mag'],'histogram')
@@ -93,5 +93,6 @@
     ]
 
-def mergePlots(summaryTable,plotcol_1frame_tlist=plotcol_1frame_tlist,filtlist=['u','g','r','i','z'],workdir='/IPP/data/SDSS/stripe82/coadd/compare'):
+def mergePlots(summaryTable,plotcol_1frame_tlist=plotcol_1frame_tlist,filtlist=['u','g','r','i','z'],\
+                   workdir='/IPP/data/SDSS/stripe82/coadd/compare'):
     from subprocess import call
     from glob import glob
@@ -101,8 +102,8 @@
     outroot = re.sub('(\.[sc]mf|\.fits?)$','',summaryTable)
     for filt in filtlist:
-        rootstr = "win_match_%s"%(filt)
+        rootstr = "filestats_match_%s"%(filt)
         globstr = "%s_*.eps"%(rootstr)
         filelist = glob(globstr)
-        outname = rootstr + ".eps"
+        outname = "merged_filestats_%s_%s.eps" % ( filt,outroot )
         cmdstr = "gs -dNOPAUSE -sDEVICE=pswrite -sOutputFile=%s %s -c quit" %(outname,' '.join(filelist))
         print "Making %s" %(outname)
@@ -114,4 +115,5 @@
                      plotcol_summary_tlist=plotcol_summary_tlist,\
                      cmfDir = '/IPP/data/SDSS/stripe82/coadd/prod/run_ipp_20080815/',\
+                     workdir = '/Users/jester/science/sdss/coadd/Hawaii/compare_tsObj',
                      copyfields_list = ['RUN','RERUN','CAMCOL','FIELD','FILTER','FWHM_MAJ','FWHM_MIN'],\
                      skip=True):
@@ -173,6 +175,8 @@
     for filt in filters:
         print bandindex_hash[filt], filt
-        plotStatsOnefile(summaryhash,sumgoodrows_hash,summaryTable,plotcol_summary_tlist,bandindex_hash[filt],bandid=filt)
-    mergePlots(summaryTable,plotcol_1frame_tlist=plotcol_1frame_tlist,filtlist=filters)
+        plotStatsOnefile(summaryhash,sumgoodrows_hash,summaryTable,plotcol_summary_tlist,\
+                             bandindex_hash[filt],bandid=filt,outroot="runstats_")
+    mergePlots(summaryTable,plotcol_1frame_tlist=plotcol_1frame_tlist,\
+                   filtlist=filters,workdir=workdir)
     return column_hash,goodrow_hash
 
@@ -205,5 +209,5 @@
     
 def plotStatsOnefile(values_hash,goodrow_hash,matchtable,plotcol_tlist,bandindex,\
-                         format='epsport',bandid='',expand=0.8):
+                         format='epsport',bandid='',expand=0.8,outroot = "filestats_"):
     """Make diagnostic plots for a single table, based on values in
     values_hash"""
@@ -214,4 +218,5 @@
     from sm import cvar,angle
     import re
+    import sm,smLib
     # In histograms, only plot core of distribution within these percentiles:
     histo_min_ntile = 0.03
@@ -221,5 +226,5 @@
     outname_l = []
     nplots = len(plotcol_tlist)
-    all_outname = "win_" + re.sub('(\.[sc]mf|\.fits?)$','',matchtable) +".eps"
+    all_outname = outroot + re.sub('(\.[sc]mf|\.fits?)$','',matchtable) +".eps"
     smOpenPlot(all_outname,format=format)
     # all the explict sm. and smLib. calls should be wrapped into
@@ -285,19 +290,11 @@
                     minbin=None
                     maxbin=None
+                # Which one *am* I plotting first???
                 smHistoPlot(values2,ltype=0,nbins=Nbins,minbin=minbin,maxbin=maxbin,\
-                                xlab=col2name,ylab="N",expand=expand)
+                                xlab=col1name,ylab="N",expand=expand)
                 smHistoPlot(values1,append=True,minbin=minbin,maxbin=maxbin,nbins=Nbins,\
                             ltype=2,expand=expand)
             firstplot = False
     smClosePlot()
-    all_outname = "nup_" + re.sub('(\.[sc]mf|\.fits?)$','',matchtable) +".eps"
-    tmp_outname = "tmp_" + re.sub('(\.[sc]mf|\.fits?)$','',matchtable) +".eps"
-    # print "creating ", all_outname
-    # mergecmd = "gs -dNOPAUSE -sDEVICE=pswrite -sOutputFile=%s %s -c quit" %(tmp_outname,' '.join(outname_l))
-    # call(mergecmd,shell=True)
-    # psnupcmd = "psnup -pletter -%i %s %s"%(nplots,tmp_outname,all_outname)
-    # print "calling ", psnupcmd
-    # call(psnupcmd,shell=True)
-    # os.remove(tmp_outname)
     return all_outname
 
@@ -706,5 +703,5 @@
     # should work if called from something where sm is in scope?
     sm.expand(1.8)
-    sm.lweight(5)
+    sm.lweight(3)
 
 # Plotting convention will be like in sm: you need to open a file,
@@ -775,5 +772,5 @@
     import sm
     sm.expand(1.8)
-    sm.lweight(5)
+    sm.lweight(3)
     # Silently ignore any problems with plot generation
     try:
@@ -794,5 +791,5 @@
     import sm
     sm.expand(expand)
-    sm.lweight(5)
+    sm.lweight(3)
     # Silently ignore any problems with plot generation
     try:
