Coverage for /wheeldirectory/casa-6.7.0-12-py3.10.el8/lib/py/lib/python3.10/site-packages/casatasks/private/task_smoothcal.py: 92%

12 statements  

« prev     ^ index     » next       coverage.py v7.6.4, created at 2024-11-01 07:19 +0000

1import os 

2 

3from casatools import calibrater 

4from casatasks import casalog 

5 

6_cb = calibrater() 

7 

8def smoothcal(vis,tablein,caltable,field,smoothtype,smoothtime): 

9 """ Smooth calibration solution(s) derived from one or more sources: 

10 

11 Keyword arguments: 

12 vis -- Name of input visibility file (MS) 

13 default: none; example: vis='ngc5921.ms' 

14 tablein -- Input calibration table (any type) 

15 default: none; example: tablein='ngc5921.gcal' 

16 caltable -- Output calibration table (smoothed) 

17 default: none; example: caltable='ngc5921_smooth.gcal' 

18 field -- subset of sources to select 

19 default: '' means all; example: field='0319_415_1 3C286' 

20 smoothtype -- The smoothing filter to be used 

21 default: 'median'; example: smoothtype='mean' 

22 Options: 'median','mean' 

23 smoothtime -- Smoothing filter time (sec) 

24 default: 60.0; example: smoothtime=10. 

25 """ 

26 

27 #Python script 

28 try: 

29 casalog.origin('smoothcal') 

30 if ((type(vis)==str) & (os.path.exists(vis))): 

31 _cb.open(filename=vis,compress=False,addcorr=False,addmodel=False) 

32 

33 else: 

34 raise ValueError('Visibility data set not found - please verify the name') 

35 

36 _cb.smooth(tablein=tablein,tableout=caltable,field=field,smoothtype=smoothtype,smoothtime=smoothtime) 

37 

38 finally: 

39 _cb.close()