IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 3811


Ignore:
Timestamp:
Apr 29, 2005, 9:29:36 AM (21 years ago)
Author:
rhl
Message:

outFile can be None; improved docs

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/pois/python/pois.py

    r3792 r3811  
    2323
    2424def run(showLeaks = True, *args, **nargs):
    25     """Wrapper for run, with a check on memory leaks after out-of-scope
    26     objects have been garbage collected"""
     25    #"""Wrapper for run, with a check on memory leaks after out-of-scope
     26    #objects have been garbage collected."""
    2727    #
    2828    # Only look for leaks of memory allocated after this point
     
    4747    return value
    4848
    49 def _run(fileDir = ".", refFile = "test1.fits", inFile = "test2.fits", outFile="testout.fits",
     49def _run(fileDir = ".", refFile = "test1.fits", inFile = "test2.fits", outFile=None,
    5050         section = "[100:500,100:500]",
    5151         testing = False, verbose = 0, psLib_verbose = 0,
    5252         display = {}, setTrace = True):
    53     """POIS: Pan-STARRS (or Pricey's) Optimal Image Subtraction
    54 
    55 Attempts to fit for a general convolution kernel that will match the PSFs between two images."""
     53    """POIS: Pan-STARRS (or Pricey's) Optimal Image Subtraction.
     54
     55Attempts to fit for a general convolution kernel that will match the PSFs between two images.
     56Arguments:
     57   fileDir      Directory for input and output files (default: .)
     58   refFile      Reference image (default: test1.fits)
     59   inFile       File to be analysed (default: test2.fits)
     60   outFile      Write output to this file (default: none)
     61   section      Section of datafiles to process, or None (=> all) (default: [100:500,100:500])
     62
     63   testing      Write some extra test information/files (default: False)
     64   verbose      Verbosity passed to psTrace (default: 0).0, psLib_verbose = 0,
     65   setTrace     Should the code fiddle with trace levels? (default: True)
     66
     67   display      Dictionary of things that can be displayed; use display="help" for help (default: {})
     68
     69E.g.
     70   pois.run(fileDir="data", verbose=3, display={'stamps':1, 'reference':1, 'subtracted':1})
     71"""
    5672
    5773    startTime = getTime();
     
    86102    subkeys = ['convolved', 'input', 'kernel', 'mask', 'reference', 'stamps', 'subtracted']
    87103
     104    if display == "help":
     105        print """Usage:
     106        display={'key1':1, 'key2':True, 'key3':0, ...}   (1==True, 0==False)
     107Keys:
     108    all         Display everything that can be displayed
     109    pause       Pause after every iteration over the stamp list
     110
     111    convolved   Show the kernel-convolved reference image
     112    input       Show the input image
     113    kernel      Show the convolution kernel
     114    mask        Show the image mask
     115    reference   Show the reference image
     116    stamps      Overlay the reference image with the centroids of stamp stars (circle bad ones in red)
     117    subtracted  Show the subtracted image
     118        """
     119        return           
     120
    88121    for k in (keys + subkeys):
    89122        if not k in display:
     
    117150    config.inFile = fileDir + inFile
    118151    config.refFile = fileDir + refFile
    119     config.outFile = fileDir + outFile
     152    try:
     153        config.outFile = fileDir + outFile
     154    except:
     155        config.outFile = outFile
    120156
    121157    # Read inputs
     
    258294    psTrace("pois.time", 1, ("Convolution completed at %f sec\n" % (getTime() - startTime)))
    259295
    260     if testing:
     296    if testing and config.outFile:
    261297        # Save the convolved image
    262298        convName = "%s.conv" % config.outFile
     
    308344        displayImage(subImage, 3, "Subtracted image", "red")
    309345
    310     if True:                            # start block scope
     346    if config.outFile:
    311347        subFile = psLib.psFitsAlloc(config.outFile)
    312348        psLib.psFitsWriteImage(subFile, None, subImage, 0, None)
     
    314350
    315351    psTrace("pois.time", 1, ("I/O completed at %f sec\n" % (getTime() - startTime)))
     352
     353if not run.__doc__:
     354    run.__doc__ = _run.__doc__
Note: See TracChangeset for help on using the changeset viewer.