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_sdscale 00013 def sdscale(infile='', antenna=0, factor=1.0, scaletsys=True, outfile='', overwrite=False): 00014 00015 """ASAP SD task: scale the sd spectra 00016 Keyword arguments: 00017 infile -- name of input SD dataset 00018 antenna -- antenna name or id (only effective for MS input). 00019 factor -- scaling factor. float or one- or two-dimensional float list. 00020 default: 1 (no scaling) 00021 scaletsys -- scaling of associated Tsys 00022 default: True 00023 outfile -- output file name 00024 outfile='' will write the data to a file named, 00025 <infile>_scaled<factor> 00026 default: '' 00027 overwrite -- overwrite the output file if already exists 00028 options: (bool) True,False 00029 default: False 00030 00031 00032 DESCRIPTION: 00033 00034 Task sdscale performs scaling of single-dish spectra. 00035 By setting scaletsys = True, associated Tsys is also scaled. 00036 Tsys informations are written in the casalogger and they are 00037 automatically stored in 'casapy.log'. 00038 The infile can be any of ASAP, MS, SDFITS, or RPFITS format. 00039 If outfile name is given or outfile=''(default), the scaled data 00040 is written to a new file with the same format as the input data 00041 (Note: in case of the RPFITS format input data, it will be written 00042 to SDFITS format). 00043 00044 The scaling factor, factor, accepts both scalar type and list 00045 type value. The list must be one or two dimensional. If factor is 00046 one dimensional, its length must coincide with a number of spectral 00047 channel. If factor is two dimensional, its shape must be 00048 (n, 1) or (n, m), where n is a number of spectrum, while m is a 00049 number of channel for each spcetum. m can be variable for each 00050 spectrum. In addition, the factor can be an ASCII filename that 00051 stores a space-separated list of scaling factor consisting of 00052 adequate number of rows and columns. For example, if the contents 00053 of input ASCII file is shown as, 00054 00055 0.5 0.3 0.2 00056 1.0 0.2 0.9 00057 00058 it is interpreted as a list [[0.5, 0.3, 0.2],[1.0, 0.2, 0.9]]. 00059 00060 WARNING for the GBT raw SDFITS format data as input: 00061 SDtasks are able to handle GBT raw SDFITS format data since the 00062 data filler is available. However, the functionality is not well 00063 tested yet, so that there may be unknown bugs. 00064 00065 00066 """ 00067 00068 # 00069 # The following is work around to avoid a bug with current python translation 00070 # 00071 mytmp = {} 00072 00073 mytmp['infile'] = infile 00074 mytmp['antenna'] = antenna 00075 mytmp['factor'] = factor 00076 mytmp['scaletsys'] = scaletsys 00077 mytmp['outfile'] = outfile 00078 mytmp['overwrite'] = overwrite 00079 pathname='file:///'+os.environ.get('CASAPATH').split()[0]+'/share/xml/' 00080 trec = casac.utils().torecord(pathname+'sdscale.xml') 00081 00082 casalog.origin('sdscale') 00083 if trec.has_key('sdscale') and casac.utils().verify(mytmp, trec['sdscale']) : 00084 result = task_sdscale.sdscale(infile, antenna, factor, scaletsys, outfile, overwrite) 00085 00086 else : 00087 result = False 00088 return result