Index: /trunk/pois/python/pois.py
===================================================================
--- /trunk/pois/python/pois.py	(revision 3810)
+++ /trunk/pois/python/pois.py	(revision 3811)
@@ -23,6 +23,6 @@
 
 def run(showLeaks = True, *args, **nargs):
-    """Wrapper for run, with a check on memory leaks after out-of-scope
-    objects have been garbage collected"""
+    #"""Wrapper for run, with a check on memory leaks after out-of-scope
+    #objects have been garbage collected."""
     #
     # Only look for leaks of memory allocated after this point
@@ -47,11 +47,27 @@
     return value
 
-def _run(fileDir = ".", refFile = "test1.fits", inFile = "test2.fits", outFile="testout.fits",
+def _run(fileDir = ".", refFile = "test1.fits", inFile = "test2.fits", outFile=None,
          section = "[100:500,100:500]",
          testing = False, verbose = 0, psLib_verbose = 0,
          display = {}, setTrace = True):
-    """POIS: Pan-STARRS (or Pricey's) Optimal Image Subtraction
-
-Attempts to fit for a general convolution kernel that will match the PSFs between two images."""
+    """POIS: Pan-STARRS (or Pricey's) Optimal Image Subtraction.
+
+Attempts to fit for a general convolution kernel that will match the PSFs between two images.
+Arguments:
+   fileDir	Directory for input and output files (default: .)
+   refFile      Reference image (default: test1.fits)
+   inFile       File to be analysed (default: test2.fits)
+   outFile	Write output to this file (default: none)
+   section	Section of datafiles to process, or None (=> all) (default: [100:500,100:500])
+
+   testing	Write some extra test information/files (default: False)
+   verbose      Verbosity passed to psTrace (default: 0).0, psLib_verbose = 0,
+   setTrace	Should the code fiddle with trace levels? (default: True)
+
+   display	Dictionary of things that can be displayed; use display="help" for help (default: {})
+
+E.g.
+   pois.run(fileDir="data", verbose=3, display={'stamps':1, 'reference':1, 'subtracted':1})
+"""
 
     startTime = getTime();
@@ -86,4 +102,21 @@
     subkeys = ['convolved', 'input', 'kernel', 'mask', 'reference', 'stamps', 'subtracted']
 
+    if display == "help":
+        print """Usage:
+        display={'key1':1, 'key2':True, 'key3':0, ...}   (1==True, 0==False)
+Keys:
+    all		Display everything that can be displayed
+    pause	Pause after every iteration over the stamp list
+
+    convolved	Show the kernel-convolved reference image
+    input	Show the input image
+    kernel	Show the convolution kernel
+    mask	Show the image mask
+    reference	Show the reference image
+    stamps	Overlay the reference image with the centroids of stamp stars (circle bad ones in red)
+    subtracted	Show the subtracted image
+        """
+        return            
+
     for k in (keys + subkeys):
         if not k in display:
@@ -117,5 +150,8 @@
     config.inFile = fileDir + inFile
     config.refFile = fileDir + refFile
-    config.outFile = fileDir + outFile
+    try:
+        config.outFile = fileDir + outFile
+    except:
+        config.outFile = outFile
 
     # Read inputs
@@ -258,5 +294,5 @@
     psTrace("pois.time", 1, ("Convolution completed at %f sec\n" % (getTime() - startTime)))
 
-    if testing:
+    if testing and config.outFile:
         # Save the convolved image
         convName = "%s.conv" % config.outFile
@@ -308,5 +344,5 @@
         displayImage(subImage, 3, "Subtracted image", "red")
 
-    if True:                            # start block scope
+    if config.outFile:
         subFile = psLib.psFitsAlloc(config.outFile)
         psLib.psFitsWriteImage(subFile, None, subImage, 0, None)
@@ -314,2 +350,5 @@
 
     psTrace("pois.time", 1, ("I/O completed at %f sec\n" % (getTime() - startTime)))
+
+if not run.__doc__:
+    run.__doc__ = _run.__doc__
