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

27 statements  

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

1##################### generated by xml-casa (v2) from vishead.xml ################### 

2##################### 28a1aac10872a7390117356863149c1a ############################## 

3from __future__ import absolute_import 

4import numpy 

5from casatools.typecheck import CasaValidator as _val_ctor 

6_pc = _val_ctor( ) 

7from casatools.coercetype import coerce as _coerce 

8from casatools.errors import create_error_string 

9from .private.task_vishead import vishead as _vishead_t 

10from casatasks.private.task_logging import start_log as _start_log 

11from casatasks.private.task_logging import end_log as _end_log 

12from casatasks.private.task_logging import except_log as _except_log 

13 

14class _vishead: 

15 """ 

16 vishead ---- List, summary, get, and put metadata in a measurement set 

17 

18  

19  

20 This task allows the user to manipulate some meta-data keywords in a 

21 measurement set. The mode='list' shows those keywords that are 

22 presently implemented, with their values. The contents associated 

23 with the keywords can be obtained with mode='get' and changed with mode='put'. 

24  

25 The modes that are available are: 

26  

27 list --- List all keywords that are recognized, and list the 

28 value(s) for each. Only these keywords can be obtained 

29 (get) or changed (put) 

30 summary --- Provides a summary that is equivalent to running listobs(verbose=False) 

31 get --- Get the specified keyword value(s) from the ms 

32 put --- Put the specified keyword value(s) into the ms 

33  

34 Keywords currently implemented are: 

35  

36 cal_grp 

37 field Field names 

38 fld_code Field Observing codes 

39 freq_group_name 

40 log 

41 observer Observer name 

42 project Project name 

43 ptcs Phase tracking centers for each field 

44 release_date 

45 schedule 

46 schedule_type 

47 spw_name Spectral parameters? 

48 source_name Source Names (=Field Names?) 

49 telescope Telescope Name 

50  

51 Note that the default list of keywords is a subset of the former list. To get 

52 all the keywords set listitemts=[]. See task parameter listitems for more details. 

53 

54 --------- parameter descriptions --------------------------------------------- 

55 

56 vis Name of input visibility file 

57 mode Mode of operation for vishead 

58 listitems Keyword items to list. This parameter is only relevant in list mode. Note that the default list is a subset of the possible keywords. To get all the keywords set listitems=[] 

59 hdkey Keyword to get/put 

60 hdindex Index (counting from 0) if keyword is an array (used in get/put mode only). The empty string means all elements 

61 hdvalue Value of the keywords to be put in the MS (used in put mode only) 

62 

63 --------- examples ----------------------------------------------------------- 

64 

65  

66 

67 

68 """ 

69 

70 _info_group_ = """information, manipulation""" 

71 _info_desc_ = """List, summary, get, and put metadata in a measurement set""" 

72 

73 def __call__( self, vis='', mode='summary', listitems=[ 'telescope','observer','project','field','freq_group_name','spw_name','schedule','schedule_type','release_date' ], hdkey='', hdindex='', hdvalue='' ): 

74 schema = {'vis': {'type': 'cReqPath', 'coerce': _coerce.expand_path}, 'mode': {'type': 'cStr', 'coerce': _coerce.to_str, 'allowed': [ 'put', 'get', 'summary', 'list', '' ]}, 'listitems': {'type': 'cStrVec', 'coerce': [_coerce.to_list,_coerce.to_strvec]}, 'hdkey': {'type': 'cStr', 'coerce': _coerce.to_str}, 'hdindex': {'type': 'cStr', 'coerce': _coerce.to_str}, 'hdvalue': {'type': 'cVariant', 'coerce': [_coerce.to_variant]}} 

75 doc = {'vis': vis, 'mode': mode, 'listitems': listitems, 'hdkey': hdkey, 'hdindex': hdindex, 'hdvalue': hdvalue} 

76 assert _pc.validate(doc,schema), create_error_string(_pc.errors) 

77 _logging_state_ = _start_log( 'vishead', [ 'vis=' + repr(_pc.document['vis']), 'mode=' + repr(_pc.document['mode']), 'listitems=' + repr(_pc.document['listitems']), 'hdkey=' + repr(_pc.document['hdkey']), 'hdindex=' + repr(_pc.document['hdindex']), 'hdvalue=' + repr(_pc.document['hdvalue']) ] ) 

78 task_result = None 

79 try: 

80 task_result = _vishead_t( _pc.document['vis'], _pc.document['mode'], _pc.document['listitems'], _pc.document['hdkey'], _pc.document['hdindex'], _pc.document['hdvalue'] ) 

81 except Exception as exc: 

82 _except_log('vishead', exc) 

83 raise 

84 finally: 

85 task_result = _end_log( _logging_state_, 'vishead', task_result ) 

86 return task_result 

87 

88vishead = _vishead( ) 

89