casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables
task_visstat.py
Go to the documentation of this file.
00001 from taskinit import *
00002 
00003 def visstat(vis=None,
00004             axis=None,
00005             datacolumn=None,
00006             useflags=None,
00007             spw=None,
00008             field=None,
00009             selectdata=None,
00010             antenna=None,
00011             uvrange=None,
00012             timerange=None,
00013             correlation=None,
00014             scan=None,
00015             array=None,
00016             observation=None):
00017 
00018     casalog.origin('visstat')  
00019 
00020     ms = casac.ms()
00021 
00022     ms.open(vis)
00023 
00024     if axis in ['amp', 'amplitude', 'phase', 'imag', 'imaginary', 'real']:
00025         complex_type = axis
00026         col = datacolumn
00027     else:
00028         complex_type = ''
00029         col = axis
00030 
00031     if (not selectdata):
00032         antenna=''
00033         uvrange=''
00034         timerange=''
00035         correlation=''
00036         scan=''
00037         array=''
00038         observation = ''
00039         
00040     s = ms.statistics(column=col.upper(),
00041                       complex_value=complex_type,
00042                       useflags=useflags,
00043                       spw=spw,
00044                       field=field,
00045                       baseline=antenna,
00046                       uvrange=uvrange,
00047                       time=timerange,
00048                       correlation=correlation,
00049                       scan=scan,
00050                       array=array,
00051                       obs=str(observation))
00052 
00053     for stats in s.keys():
00054         casalog.post(stats + " values --- ", "NORMAL")
00055         
00056         if s[stats]['npts'] > 0:
00057             casalog.post("         -- number of points [npts]:           " + str(int(round(s[stats]['npts']))), "NORMAL")
00058             casalog.post("         -- minimum value [min]:               " + str(s[stats]['min'  ]), "NORMAL")
00059             casalog.post("         -- maximum value [max]:               " + str(s[stats]['max'  ]), "NORMAL")
00060             casalog.post("         -- Sum of values [sum]:               " + str(s[stats]['sum'  ]), "NORMAL")
00061             casalog.post("         -- Sum of squared values [sumsq]:     " + str(s[stats]['sumsq']), "NORMAL")
00062 
00063         casalog.post(stats + " statistics --- ", "NORMAL")
00064         if s[stats]['npts'] > 0:
00065                 casalog.post("        -- Mean of the values [mean]:                 " + str(s[stats]['mean']), "NORMAL")
00066                 casalog.post("        -- Variance of the values [var]:              " + str(s[stats]['var']), "NORMAL")
00067                 casalog.post("        -- Standard deviation of the values [stddev]: " + str(s[stats]['stddev']), "NORMAL")
00068                 casalog.post("        -- Root mean square [rms]:                    " + str(s[stats]['rms']), "NORMAL")
00069                 casalog.post("        -- Median of the pixel values [median]:       " + str(s[stats]['median']), "NORMAL")
00070                 casalog.post("        -- Median of the deviations [medabsdevmed]:   " + str(s[stats]['medabsdevmed']), "NORMAL")
00071                 casalog.post("        -- Quartile [quartile]:                       " + str(s[stats]['quartile']), "NORMAL")
00072         else:
00073             casalog.post(stats + " -- No valid points found", "WARN")
00074 
00075     return s
00076 
00077 
00078         
00079