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_visstat 00013 def visstat(vis='', axis='amplitude', datacolumn='data', useflags=True, spw='', field='', selectdata=True, antenna='', uvrange='', timerange='', correlation='', scan='', array='', observation=''): 00014 00015 """Displays statistical information from a measurement set, or from a measurement set selection 00016 00017 This task returns statistical information about data in a measurement 00018 set. 00019 00020 The following values are computed: mean value, sum of values, 00021 sum of squared values, median, median absolute deviation, quartile, 00022 minimum, maximum, variance, standard deviation, and root mean square. 00023 00024 The following axes are supported: uvw, flag, weight, sigma, antenna1, 00025 antenna2, feed1, feed2, field_id, array_id, data_desc_id, flag_row, 00026 interval, scan, scan_number, time, weight_spectrum, amp, amplitude, 00027 phase, real, imag, imaginary, and uvrange. 00028 00029 Optionally, the statistical information can be computed based only 00030 on a given subset of the measurement set. 00031 00032 Note: If the MS consists of inhomogeneous data, for example several 00033 spectral windows each having a different number of channels, it may be 00034 necessary to use selection parameters to select a homogeneous subset of 00035 the MS, e.g. spw='2'. 00036 00037 Keyword arguments: 00038 00039 vis --- Name of input visibility file 00040 default: '', example: vis='my.ms' 00041 00042 axis -- Which data to analyze. 00043 00044 default: 'amplitude' 00045 axis='phase' 00046 axis='imag' 00047 axis='scan_number' 00048 axis='flag' 00049 00050 The phase of a complex number is in radians in the range [-pi; pi[. 00051 00052 00053 datacolumn -- Which data column to use for complex data. 00054 default: 'data' 00055 datacolumn='data' 00056 datacolumn='corrected' 00057 datacolumn='model' 00058 00059 useflags -- Take MS flags into account? 00060 default: True 00061 useflag=False 00062 useflag=True 00063 If useflags=False, flagged values are included in the statistics. 00064 If useflags=True, any flagged values are not used in the statistics. 00065 00066 spw -- Select data based on spectral window and channels 00067 default: '' (all); example: spw='1' 00068 spw='<2' #spectral windows less than 2 00069 spw='>1' #spectral windows greater than 1 00070 spw='0:0~10' # first 10 channels from spw 0 00071 spw='0:0~5;56~60' # multiple separated channel chunks. 00072 00073 field -- Select data based on field id(s) or name(s) 00074 default: '' (all); example: field='1' 00075 field='0~2' # field ids inclusive from 0 to 2 00076 field='3C*' # all field names starting with 3C 00077 00078 selectdata -- Other data selection parameters 00079 default: True 00080 antenna -- Select data based on baseline 00081 default: '' (all); example: antenna='5&6' baseline 5-6 00082 antenna='5&6;7&8' #baseline 5-6 and 7-8 00083 antenna='5' # all baselines with antenna 5 00084 antenna='5,6' # all baselines with antennas 5 and 6 00085 correlation -- Correlation types 00086 default: '' (all); 00087 example: correlation='RR LL' 00088 uvrange -- Select data within uvrange (default units meters) 00089 default: '' (all); example: 00090 uvrange='0~1000klambda'; uvrange from 0-1000 kilo-lambda 00091 uvrange='>4klambda';uvranges greater than 4 kilo-lambda 00092 uvrange='0~1000km'; uvrange in kilometers 00093 timerange -- Select data based on time range: 00094 default = '' (all); example, 00095 timerange = 'YYYY/MM/DD/hh:mm:ss~YYYY/MM/DD/hh:mm:ss' 00096 Note: YYYY/MM/DD can be dropped as needed: 00097 timerange='09:14:0~09:54:0' # this time range 00098 timerange='09:44:00' # data within one integration of time 00099 timerange='>10:24:00' # data after this time 00100 timerange='09:44:00+00:13:00' #data 13 minutes after time 00101 scan -- Select data based on scan number 00102 default: '' (all); example: scan='>3' 00103 array -- Selection based on the antenna array 00104 observation -- Selection by observation ID(s). 00105 default: '' (all); example: observation='1~3' 00106 00107 00108 """ 00109 00110 # 00111 # The following is work around to avoid a bug with current python translation 00112 # 00113 mytmp = {} 00114 00115 mytmp['vis'] = vis 00116 mytmp['axis'] = axis 00117 mytmp['datacolumn'] = datacolumn 00118 mytmp['useflags'] = useflags 00119 mytmp['spw'] = spw 00120 mytmp['field'] = field 00121 mytmp['selectdata'] = selectdata 00122 mytmp['antenna'] = antenna 00123 mytmp['uvrange'] = uvrange 00124 mytmp['timerange'] = timerange 00125 mytmp['correlation'] = correlation 00126 mytmp['scan'] = scan 00127 mytmp['array'] = array 00128 mytmp['observation'] = observation 00129 pathname='file:///'+os.environ.get('CASAPATH').split()[0]+'/share/xml/' 00130 trec = casac.utils().torecord(pathname+'visstat.xml') 00131 00132 casalog.origin('visstat') 00133 if trec.has_key('visstat') and casac.utils().verify(mytmp, trec['visstat']) : 00134 result = task_visstat.visstat(vis, axis, datacolumn, useflags, spw, field, selectdata, antenna, uvrange, timerange, correlation, scan, array, observation) 00135 00136 else : 00137 result = False 00138 return result