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_exportfits 00013 def exportfits(imagename='', fitsimage='', velocity=False, optical=False, bitpix=-32, minpix=0, maxpix=-1, overwrite=False, dropstokes=False, stokeslast=True): 00014 00015 """Convert a CASA image to a FITS file 00016 00017 CASA-produced images can be written to disk for transporting 00018 to other software packages. No subimaging of the fits image 00019 can be made with this task. 00020 00021 Keyword arguments: 00022 imagename -- Name of input CASA image 00023 default: none; example: imagename='3C273XC1.image' 00024 fitsimage -- Name of ouput image FITS file 00025 default: none; example='3C273XC1.fits' 00026 velocity -- Use velocity (rather than frequency) as spectral axis 00027 default: False 00028 optical -- Use the optical (rather than radio) velocity convention 00029 default: False; 00030 bitpix -- Bits per pixel 00031 default: -32 (floating point) 00032 <Options: -32 (floating point), 16 (integer)> 00033 minpix -- Minimum pixel value 00034 default: 0 = autoscale 00035 maxpix -- Maximum pixel value 00036 default: 0 = autoscale 00037 overwrite -- Overwrite pre-existing imagename 00038 default=False; example: overwrite=True 00039 dropstokes -- Drop Stokes axis? 00040 default: False; example: dropstokes=True 00041 stokeslast -- Put Stokes axis last in header? 00042 default: True; example: stokeslast=False 00043 async -- Run asynchronously 00044 default = False; 00045 00046 """ 00047 00048 # 00049 # The following is work around to avoid a bug with current python translation 00050 # 00051 mytmp = {} 00052 00053 mytmp['imagename'] = imagename 00054 mytmp['fitsimage'] = fitsimage 00055 mytmp['velocity'] = velocity 00056 mytmp['optical'] = optical 00057 mytmp['bitpix'] = bitpix 00058 mytmp['minpix'] = minpix 00059 mytmp['maxpix'] = maxpix 00060 mytmp['overwrite'] = overwrite 00061 mytmp['dropstokes'] = dropstokes 00062 mytmp['stokeslast'] = stokeslast 00063 pathname='file:///'+os.environ.get('CASAPATH').split()[0]+'/share/xml/' 00064 trec = casac.utils().torecord(pathname+'exportfits.xml') 00065 00066 casalog.origin('exportfits') 00067 if trec.has_key('exportfits') and casac.utils().verify(mytmp, trec['exportfits']) : 00068 result = task_exportfits.exportfits(imagename, fitsimage, velocity, optical, bitpix, minpix, maxpix, overwrite, dropstokes, stokeslast) 00069 00070 else : 00071 result = False 00072 return result