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_clearcal 00013 def clearcal(vis='', field='', spw='', intent='', addmodel=True): 00014 00015 """Re-initializes the calibration for a visibility data set 00016 00017 Clearcal reinitializes the calibration columns in a measurement set. 00018 Specificially, it will set the MODEL_DATA column to unity in total intensity 00019 and zero in polarization, and it will set the CORRECTED_DATA column to the original 00020 (observed) DATA in the DATA column. Use the field and spw parameters to select 00021 which data to initialize. If the dataset does not yet have the scratch 00022 columns, they will be created and initilized for the whole dataset (field and spw 00023 ill be ignored). 00024 00025 Keyword arguments: 00026 vis -- Name of input visibility file 00027 default: none; example: vis='ngc5921.ms' 00028 00029 field -- Select field using field id(s) or field name(s). 00030 [run listobs to obtain the list id's or names] 00031 default: ''=all fields 00032 If field string is a non-negative integer, it is assumed a field index 00033 otherwise, it is assumed a field name 00034 field='0~2'; field ids 0,1,2 00035 field='0,4,5~7'; field ids 0,4,5,6,7 00036 field='3C286,3C295'; field named 3C286 adn 3C295 00037 field = '3,4C*'; field id 3, all names starting with 4C 00038 spw -- Select spectral window 00039 default: ''=all spectral windows and channels 00040 spw='0~2,4'; spectral windows 0,1,2,4 (all channels) 00041 spw='<2'; spectral windows less than 2 (i.e. 0,1) 00042 spw='0:5~61'; spw 0, channels 5 to 61 00043 spw='0,10,3:3~45'; spw 0,10 all channels, spw 3, channels 3 to 45. 00044 spw='0~2:2:6'; spw 0,1,2 with channels 2 through 6 in each. 00045 NB: Multiple channel ranges per spw are not supported in clearcal. 00046 intent -- Select observing intent 00047 default: '' (no selection by intent) 00048 intent='*BANDPASS*' (selects data labelled with 00049 BANDPASS intent) 00050 addmodel -- add MODEL_DATA along with CORRECTED_DATA if True; 00051 otherwise it will add/reset only CORRECTED_DATA, model visibilities 00052 will then be evaluated when needed. 00053 00054 00055 """ 00056 00057 # 00058 # The following is work around to avoid a bug with current python translation 00059 # 00060 mytmp = {} 00061 00062 mytmp['vis'] = vis 00063 mytmp['field'] = field 00064 mytmp['spw'] = spw 00065 mytmp['intent'] = intent 00066 mytmp['addmodel'] = addmodel 00067 pathname='file:///'+os.environ.get('CASAPATH').split()[0]+'/share/xml/' 00068 trec = casac.utils().torecord(pathname+'clearcal.xml') 00069 00070 casalog.origin('clearcal') 00071 if trec.has_key('clearcal') and casac.utils().verify(mytmp, trec['clearcal']) : 00072 result = task_clearcal.clearcal(vis, field, spw, intent, addmodel) 00073 00074 else : 00075 result = False 00076 return result