casa
$Rev:20696$
|
00001 from taskinit import * 00002 00003 def calstat(caltable=None, 00004 axis=None, 00005 datacolumn=None, 00006 useflags=None): 00007 00008 casalog.origin('calstat') 00009 00010 tb.close() 00011 tb.open(caltable) 00012 00013 if axis in ['amp', 'amplitude', 'phase', 'imag', 'imaginary', 'real']: 00014 complex_type = axis 00015 col = datacolumn 00016 else: 00017 complex_type = '' 00018 col = axis 00019 00020 if col == 'corrected': 00021 col = 'CORRECTED_DATA' 00022 if col == 'model': 00023 col = 'MODEL_DATA' 00024 s = tb.statistics(column=col.upper(), 00025 complex_value=complex_type, 00026 useflags=useflags) 00027 00028 tb.close() 00029 00030 for stats in s.keys(): 00031 casalog.post(stats + " values --- ", "NORMAL") 00032 00033 if s[stats]['npts'] > 0: 00034 casalog.post(" -- number of points [npts]: " + str(int(round(s[stats]['npts']))), "NORMAL") 00035 casalog.post(" -- minimum value [min]: " + str(s[stats]['min' ]), "NORMAL") 00036 casalog.post(" -- maximum value [max]: " + str(s[stats]['max' ]), "NORMAL") 00037 casalog.post(" -- Sum of values [sum]: " + str(s[stats]['sum' ]), "NORMAL") 00038 casalog.post(" -- Sum of squared values [sumsq]: " + str(s[stats]['sumsq']), "NORMAL") 00039 00040 casalog.post(stats + " statistics --- ", "NORMAL") 00041 if s[stats]['npts'] > 0: 00042 casalog.post(" -- Mean of the values [mean]: " + str(s[stats]['mean']), "NORMAL") 00043 casalog.post(" -- Variance of the values [var]: " + str(s[stats]['var']), "NORMAL") 00044 casalog.post(" -- Standard deviation of the values [stddev]: " + str(s[stats]['stddev']), "NORMAL") 00045 casalog.post(" -- Root mean square [rms]: " + str(s[stats]['rms']), "NORMAL") 00046 casalog.post(" -- Median of the pixel values [median]: " + str(s[stats]['median']), "NORMAL") 00047 casalog.post(" -- Median of the deviations [medabsdevmed]: " + str(s[stats]['medabsdevmed']), "NORMAL") 00048 casalog.post(" -- Quartile [quartile]: " + str(s[stats]['quartile']), "NORMAL") 00049 else: 00050 casalog.post(stats + " -- No valid points found", "WARN") 00051 00052 return s