Changeset 3811 for trunk/pois/python/pois.py
- Timestamp:
- Apr 29, 2005, 9:29:36 AM (21 years ago)
- File:
-
- 1 edited
-
trunk/pois/python/pois.py (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/pois/python/pois.py
r3792 r3811 23 23 24 24 def run(showLeaks = True, *args, **nargs): 25 """Wrapper for run, with a check on memory leaks after out-of-scope26 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.""" 27 27 # 28 28 # Only look for leaks of memory allocated after this point … … 47 47 return value 48 48 49 def _run(fileDir = ".", refFile = "test1.fits", inFile = "test2.fits", outFile= "testout.fits",49 def _run(fileDir = ".", refFile = "test1.fits", inFile = "test2.fits", outFile=None, 50 50 section = "[100:500,100:500]", 51 51 testing = False, verbose = 0, psLib_verbose = 0, 52 52 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 55 Attempts to fit for a general convolution kernel that will match the PSFs between two images. 56 Arguments: 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 69 E.g. 70 pois.run(fileDir="data", verbose=3, display={'stamps':1, 'reference':1, 'subtracted':1}) 71 """ 56 72 57 73 startTime = getTime(); … … 86 102 subkeys = ['convolved', 'input', 'kernel', 'mask', 'reference', 'stamps', 'subtracted'] 87 103 104 if display == "help": 105 print """Usage: 106 display={'key1':1, 'key2':True, 'key3':0, ...} (1==True, 0==False) 107 Keys: 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 88 121 for k in (keys + subkeys): 89 122 if not k in display: … … 117 150 config.inFile = fileDir + inFile 118 151 config.refFile = fileDir + refFile 119 config.outFile = fileDir + outFile 152 try: 153 config.outFile = fileDir + outFile 154 except: 155 config.outFile = outFile 120 156 121 157 # Read inputs … … 258 294 psTrace("pois.time", 1, ("Convolution completed at %f sec\n" % (getTime() - startTime))) 259 295 260 if testing :296 if testing and config.outFile: 261 297 # Save the convolved image 262 298 convName = "%s.conv" % config.outFile … … 308 344 displayImage(subImage, 3, "Subtracted image", "red") 309 345 310 if True: # start block scope346 if config.outFile: 311 347 subFile = psLib.psFitsAlloc(config.outFile) 312 348 psLib.psFitsWriteImage(subFile, None, subImage, 0, None) … … 314 350 315 351 psTrace("pois.time", 1, ("I/O completed at %f sec\n" % (getTime() - startTime))) 352 353 if not run.__doc__: 354 run.__doc__ = _run.__doc__
Note:
See TracChangeset
for help on using the changeset viewer.
