Coverage for /wheeldirectory/casa-6.7.0-12-py3.10.el8/lib/py/lib/python3.10/site-packages/casatasks/private/task_calstat.py: 11%
37 statements
« prev ^ index » next coverage.py v7.6.4, created at 2024-10-31 17:39 +0000
« prev ^ index » next coverage.py v7.6.4, created at 2024-10-31 17:39 +0000
2from casatasks import casalog
3from casatools import table
4_tb = table( )
6def calstat(caltable=None,
7 axis=None,
8 datacolumn=None):
10 casalog.origin('calstat')
12 _tb.close()
13 _tb.open(caltable)
15 if axis in ['amp', 'amplitude', 'phase', 'imag', 'imaginary', 'real']:
16 complex_type = axis
17 col = datacolumn
18 else:
19 complex_type = ''
20 col = axis
22 if col == 'corrected':
23 col = 'CORRECTED_DATA'
24 if col == 'model':
25 col = 'MODEL_DATA'
26 s = _tb.statistics(column=col.upper(),
27 complex_value=complex_type)
29 _tb.close()
31 for stats in s.keys():
32 casalog.post(stats + " values --- ", "NORMAL")
34 if s[stats]['npts'] > 0:
35 casalog.post(" -- number of points [npts]: " + str(int(round(s[stats]['npts']))), "NORMAL")
36 casalog.post(" -- minimum value [min]: " + str(s[stats]['min' ]), "NORMAL")
37 casalog.post(" -- maximum value [max]: " + str(s[stats]['max' ]), "NORMAL")
38 casalog.post(" -- Sum of values [sum]: " + str(s[stats]['sum' ]), "NORMAL")
39 casalog.post(" -- Sum of squared values [sumsq]: " + str(s[stats]['sumsq']), "NORMAL")
41 casalog.post(stats + " statistics --- ", "NORMAL")
42 if s[stats]['npts'] > 0:
43 casalog.post(" -- Mean of the values [mean]: " + str(s[stats]['mean']), "NORMAL")
44 casalog.post(" -- Variance of the values [var]: " + str(s[stats]['var']), "NORMAL")
45 casalog.post(" -- Standard deviation of the values [stddev]: " + str(s[stats]['stddev']), "NORMAL")
46 casalog.post(" -- Root mean square [rms]: " + str(s[stats]['rms']), "NORMAL")
47 casalog.post(" -- Median of the pixel values [median]: " + str(s[stats]['median']), "NORMAL")
48 casalog.post(" -- Median of the deviations [medabsdevmed]: " + str(s[stats]['medabsdevmed']), "NORMAL")
49 casalog.post(" -- Quartile [quartile]: " + str(s[stats]['quartile']), "NORMAL")
50 else:
51 casalog.post(stats + " -- No valid points found", "WARN")
53 return s