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

20 statements  

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

1import inspect 

2from types import CodeType 

3 

4from casatasks import casalog 

5from casatools import quanta 

6 

7from . import sdutil 

8 

9qa = quanta() 

10 

11""" 

12The following code is based on the mstransform code, with 

13task name and some task parameters modified. 

14To minimise code modification, the parameters used by 

15mstransform but not by sdpolaverage are kept and the 

16default values for mstransform are given to them. 

17(CAS-12083, 2019/1/22 WK) 

18""" 

19 

20 

21@sdutil.sdtask_decorator 

22def sdpolaverage( 

23 infile, 

24 datacolumn, 

25 antenna, 

26 field, 

27 spw, 

28 timerange, 

29 scan, 

30 intent, 

31 polaverage, 

32 outfile): 

33 

34 # followings are parameters of mstransform but not used by sdpolaverage. 

35 # just putting default values 

36 do_timeaverage = False 

37 timebin = "0s" 

38 timespan = "" 

39 

40 # Only parse timeaverage parameters when timebin > 0s 

41 if do_timeaverage: 

42 tb = qa.convert(qa.quantity(timebin), 's')['value'] 

43 if not tb > 0: 

44 raise ValueError("Parameter timebin must be > '0s' to do time averaging") 

45 

46 # extra parameter for do_mst 

47 ext_config = {"do_timeaverage": False, 

48 "keepflags": True, 

49 "do_check_tileshape": True, 

50 "polaverage": polaverage, 

51 "parse_chanaverage": False} 

52 

53 sdpolaverage: CodeType = inspect.currentframe().f_code 

54 

55 sdutil.do_mst( 

56 infile, 

57 datacolumn, 

58 field, 

59 spw, 

60 timerange, 

61 scan, 

62 antenna, 

63 timebin, 

64 timespan, 

65 outfile, 

66 intent, 

67 sdpolaverage, 

68 ext_config) 

69 

70 sdutil.add_history(sdpolaverage, casalog, outfile)