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

21 statements  

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

1 

2from casatools import miriadfiller 

3from casatasks import casalog 

4from .mstools import write_history 

5 

6def importmiriad ( 

7 mirfile=None, 

8 vis=None, 

9 tsys=None, 

10 spw=None, 

11 vel=None, 

12 linecal=None, 

13 wide=None, 

14 debug=None, 

15 ): 

16 """Convert a Miriad visibility file into a CASA visibility file (MS). 

17 The conversion of the Miriad visibility format into a measurement set. This version 

18 has been tested for both ATNF and CARMA Miriad files. 

19................  

20 Keyword arguments: 

21 mirfile -- Name of input Miriad visibility file (directory) 

22 default: none; example: mirfile='mydata.uv' 

23 

24.... vis -- Output ms name 

25 default: mirfile name with suffix replaced by '.ms' 

26 

27.... tsys -- Set True to use the system temperature to set the visibility weights 

28 default: False 

29 

30.... spw -- specify the spectral windows to use 

31........ default: all 

32 

33.... vel -- Velocity system to use: LSRK, LSRD or TOPO 

34.... default: TOPO for ATCA, LSRK for CARMA 

35 

36.... linecal -- (CARMA only) apply CARMA linecal on the fly? 

37.... default: False 

38 

39.... wide -- (CARMA only) specify the window averages to use 

40........ default: all 

41........  

42.... debug -- specify level of debug messages (0,1,2,3) 

43 default: 0 (=None) 

44 

45  

46 """ 

47 

48 # Python script 

49 mymf = miriadfiller() 

50 try: 

51 try: 

52 casalog.origin('importmiriad') 

53 # -----------------------------------------' 

54 # beginning of importmiriad implementation 

55 # ----------------------------------------- 

56 mymf.fill(vis,mirfile,tsys,spw,vel,linecal,wide,debug) 

57 except Exception as e: 

58 msg = "Failed to import miriad file %s" % mirfile 

59 raise RuntimeError(msg) 

60 

61 # Write the args to HISTORY. 

62 try: 

63 param_names = importmiriad.__code__.co_varnames[:importmiriad.__code__.co_argcount] 

64 vars = locals( ) 

65 param_vals = [vars[p] for p in param_names] 

66 

67 write_history( 

68 mymf, vis, 'importmiriad', param_names, 

69 param_vals, casalog 

70 ) 

71 except Exception: 

72 casalog.post("Failed to updated HISTORY", 'WARN') 

73 

74 finally: 

75 if (mymf): 

76 del mymf 

77 # ----------------------------------- 

78 # end of importmiriad implementation 

79 # -----------------------------------