casa
$Rev:20696$
|
00001 # 00002 # This file was generated using xslt from its XML file 00003 # 00004 # Copyright 2009, Associated Universities Inc., Washington DC 00005 # 00006 import sys 00007 import os 00008 from casac import * 00009 import string 00010 from taskinit import casalog 00011 #from taskmanager import tm 00012 import task_importfits 00013 def importfits(fitsimage='', imagename='', whichrep=0, whichhdu=0, zeroblanks=True, overwrite=False): 00014 00015 """Convert an image FITS file into a CASA image 00016 00017 Standard image FITS files are processed into a Casa image 00018 00019 Keyword arguments: 00020 fitsimage -- Name of input image FITS file 00021 default: none; example='3C273XC1.fits' 00022 imagename -- Name of output CASA image 00023 default: none; example: imagename='3C273XC1.image' 00024 whichrep -- If fits image has multiple coordinate reps, 00025 choose one. 00026 default: 0 means first; example: whichrep=1 00027 whichhdu -- If fits file contains multiple images, 00028 choose this one 00029 default=0 mean first; example: whichhdu=1 00030 zeroblanks -- Set blanked pixels to zero (not NaN) 00031 default=True; example: zeroblanks=True 00032 overwrite -- Overwrite pre-existing imagename 00033 default=False; example: overwrite=True 00034 00035 00036 """ 00037 00038 # 00039 # The following is work around to avoid a bug with current python translation 00040 # 00041 mytmp = {} 00042 00043 mytmp['fitsimage'] = fitsimage 00044 mytmp['imagename'] = imagename 00045 mytmp['whichrep'] = whichrep 00046 mytmp['whichhdu'] = whichhdu 00047 mytmp['zeroblanks'] = zeroblanks 00048 mytmp['overwrite'] = overwrite 00049 pathname='file:///'+os.environ.get('CASAPATH').split()[0]+'/share/xml/' 00050 trec = casac.utils().torecord(pathname+'importfits.xml') 00051 00052 casalog.origin('importfits') 00053 if trec.has_key('importfits') and casac.utils().verify(mytmp, trec['importfits']) : 00054 result = task_importfits.importfits(fitsimage, imagename, whichrep, whichhdu, zeroblanks, overwrite) 00055 00056 else : 00057 result = False 00058 return result