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

27 statements  

« prev     ^ index     » next       coverage.py v7.6.4, created at 2024-10-31 19:53 +0000

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

2##################### cc0cfcd467ffdd3243f66208fc9312dd ############################## 

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_listobs import listobs as _listobs_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 _listobs: 

15 """ 

16 listobs ---- Get the summary of a MeasurementSet and list it in the logger or in a file 

17 

18  

19 List the summary information of a data set in the logger or in a file, based on 

20 a data selection. Only rows can be selected and printed. No in-row selection is 

21 possible (channel or correlation). 

22  

23 Lists the following properties of a measurement set: 

24 scan list, field list, spectral window list with 

25 correlators, antenna locations, ms table information. 

26  

27 

28 --------- parameter descriptions --------------------------------------------- 

29 

30 vis Name of input visibility file (MS) 

31 selectdata Data selection parameters 

32 spw Selection based on spectral-window/frequency/channel. 

33 field Selection based on field names or field index numbers. Default is all. 

34 antenna Selection based on antenna/baselines. Default is all. 

35 uvrange Selection based on uv range. Default: entire range. Default units: meters. 

36 timerange Selection based on time range. Default is entire range. 

37 correlation Selection based on correlation. Default is all. 

38 scan Selection based on scan numbers. Default is all. 

39 intent Selection based on observation intent. Default is all. 

40 feed Selection based on multi-feed numbers: Not yet implemented 

41 array Selection based on (sub)array numbers. Default is all. 

42 observation Selection based on observation ID. Default is all. 

43 verbose Controls level of information detail reported. True reports more than False. 

44 listfile Name of disk file to write output. Default is none (output is written to logger only). 

45 listunfl List unflagged row counts? If true, it can have significant negative performance impact. 

46 cachesize EXPERIMENTAL. Maximum size in megabytes of cache in which data structures can be held. 

47 overwrite If True, tacitly overwrite listfile if it exists. 

48 RETURNS void 

49 

50 --------- examples ----------------------------------------------------------- 

51 

52  

53  

54 List the summary information of a data set in the logger or in a file, based on 

55 a data selection. Only rows can be selected and printed. No in-row selection is 

56 possible (channel or correlation). Refer to the task listvis to list visibilites. 

57  

58 Lists the following properties of a measurement set: 

59 scan list, field list, spectral window list with 

60 correlators, antenna locations, ms table information. 

61  

62 Keyword arguments: 

63 vis -- Name of input visibility file 

64 default: none. example: vis='ngc5921.ms' 

65  

66 selectdata -- Select a subset of data for flagging 

67 default: False 

68 options: True,False 

69 The summary listing will only apply to the specified selection. 

70  

71 antenna -- Select data based on baseline 

72 default: '' (all); example: antenna='5&6' baseline 5-6 

73 antenna='5&6;7&8' #baseline 5-6 and 7-8 

74 antenna='5' # all cross-correlation baselines between antenna 5 and all other available 

75 antennas 

76 antenna='5,6' # all baselines with antennas 5 and 6 

77 antenna='1&&1' # only the auto-correlation baselines for antenna 1 

78 antenna='1&&*' # cross and auto-correlation baselines between antenna 1 

79 and all other available antennas 

80 antenna='1~7&&&' # only the auto-correlation baselines for antennas in range 1~7 

81 spw -- Select data based on spectral window and channels 

82 default: '' (all); example: spw='1' 

83 spw='<2' #spectral windows less than 2 

84 spw='>1' #spectral windows greater than 1 

85 correlation -- Correlation types 

86 default: '' (all); 

87 example: correlation='RR LL' 

88 field -- Select data based on field id(s) or name(s) 

89 default: '' (all); example: field='1' 

90 field='0~2' # field ids inclusive from 0 to 2 

91 field='3C*' # all field names starting with 3C 

92 uvrange -- Select data within uvrange (default units meters) 

93 default: '' (all); example: 

94 uvrange='0~1000klambda'; uvrange from 0-1000 kilo-lamgda 

95 uvrange='>4klamda';uvranges greater than 4 kilo-lambda 

96 uvrange='0~1000km'; uvrange in kilometers 

97 timerange -- Select data based on time range: 

98 default = '' (all); example, 

99 timerange = 'YYYY/MM/DD/hh:mm:ss~YYYY/MM/DD/hh:mm:ss' 

100 Note: YYYY/MM/DD can be dropped as needed: 

101 timerange='09:14:0~09:54:0' # this time range 

102 timerange='09:44:00' # data within one integration of time 

103 timerange='>10:24:00' # data after this time 

104 timerange='09:44:00+00:13:00' #data 13 minutes after time 

105 scan -- Select data based on scan number 

106 default: '' (all); example: scan='>3' 

107 intent -- Select data based on observation intent 

108 default: '' (all); example: intent='*CAL*,*BAND*' 

109 feed -- Selection based on the feed - NOT IMPLEMENTED YET 

110 array -- Selection based on the antenna array 

111 observation -- Selection based on the observation ID 

112 default: '' (all); example: observation='1' or observation=1 

113  

114  

115 verbose -- level of detail 

116 verbose=True: (default); scan and antenna lists 

117 verbose=False: less information 

118  

119 listfile -- name of disk file to write output. 

120 default: None. Example: listfile='list.txt' 

121  

122 listunfl -- List unflagged row counts? If true, it can have significant negative performance impact. 

123  

124 cachesize -- maximum size of the memory cache in megabytes in which data structures can be 

125 stored. For very large datasets this can be increased for possibly better performance. 

126 THIS IS ONLY EXPERIEMENTAL FOR NOW, AND INCREASING THE VALUE OF THIS PARAMETER DOES NOT GUARANTEE INCREASED 

127 SPEED. DEPENDING ON ITS (LACK OF) USEFULNESS, IT MAY BE REMOVED IN THE FUTURE. 

128  

129  

130 The 'Int (s)' column is the average of the MS's INTERVAL column 

131 for each scan, so in a time-averaged MS 'Int' = 9.83s more likely 

132 means 5 10s integrations and 1 9s integration (timebin) than 6 

133 9.83s integrations. 

134  

135 DESCRIPTION OF ALGORITHM TO CALCULATE THE NUMBER OF UNFLAGGED ROWS 

136 The number of unflagged rows are only computed if listunfl=True. Computing these quantity 

137 can have a negative performance impact, especially for large datasets. 

138 The number of unflagged rows (the nUnflRows columns in the scans and fields portions of the listing) is 

139 calculated by summing the fractional unflagged bandwidth for each row (and hence why the number of unflagged 

140 rows, in general, is not an integer). Thus a row which has half of its 

141 total bandwidth flagged contributes 0.5 rows to the unflagged row count. A row with 20 of 32 channels of 

142 homogeneous width contributes 20/32 = 0.625 rows to the unflagged row count. A row with a value of False 

143 in the FLAG_ROW column is not counted in the number of unflagged rows. 

144  

145 

146 

147 """ 

148 

149 _info_group_ = """information""" 

150 _info_desc_ = """Get the summary of a MeasurementSet and list it in the logger or in a file""" 

151 

152 def __call__( self, vis='', selectdata=True, spw='', field='', antenna='', uvrange='', timerange='', correlation='', scan='', intent='', feed='', array='', observation='', verbose=True, listfile='', listunfl=False, cachesize=float(50), overwrite=False ): 

153 schema = {'vis': {'type': 'cReqPath', 'coerce': _coerce.expand_path}, 'selectdata': {'type': 'cBool'}, 'spw': {'anyof': [{'type': 'cStr', 'coerce': _coerce.to_str}, {'type': 'cStrVec', 'coerce': [_coerce.to_list,_coerce.to_strvec]}]}, 'field': {'anyof': [{'type': 'cStr', 'coerce': _coerce.to_str}, {'type': 'cStrVec', 'coerce': [_coerce.to_list,_coerce.to_strvec]}]}, 'antenna': {'anyof': [{'type': 'cStr', 'coerce': _coerce.to_str}, {'type': 'cStrVec', 'coerce': [_coerce.to_list,_coerce.to_strvec]}]}, 'uvrange': {'anyof': [{'type': 'cStr', 'coerce': _coerce.to_str}, {'type': 'cStrVec', 'coerce': [_coerce.to_list,_coerce.to_strvec]}]}, 'timerange': {'anyof': [{'type': 'cStr', 'coerce': _coerce.to_str}, {'type': 'cStrVec', 'coerce': [_coerce.to_list,_coerce.to_strvec]}]}, 'correlation': {'anyof': [{'type': 'cStr', 'coerce': _coerce.to_str}, {'type': 'cStrVec', 'coerce': [_coerce.to_list,_coerce.to_strvec]}]}, 'scan': {'anyof': [{'type': 'cStr', 'coerce': _coerce.to_str}, {'type': 'cStrVec', 'coerce': [_coerce.to_list,_coerce.to_strvec]}]}, 'intent': {'anyof': [{'type': 'cStr', 'coerce': _coerce.to_str}, {'type': 'cStrVec', 'coerce': [_coerce.to_list,_coerce.to_strvec]}]}, 'feed': {'anyof': [{'type': 'cStr', 'coerce': _coerce.to_str}, {'type': 'cStrVec', 'coerce': [_coerce.to_list,_coerce.to_strvec]}]}, 'array': {'anyof': [{'type': 'cStr', 'coerce': _coerce.to_str}, {'type': 'cStrVec', 'coerce': [_coerce.to_list,_coerce.to_strvec]}]}, 'observation': {'anyof': [{'type': 'cStr', 'coerce': _coerce.to_str}, {'type': 'cInt'}]}, 'verbose': {'type': 'cBool'}, 'listfile': {'type': 'cStr', 'coerce': _coerce.to_str}, 'listunfl': {'type': 'cBool'}, 'cachesize': {'type': 'cFloat', 'coerce': _coerce.to_float}, 'overwrite': {'type': 'cBool'}} 

154 doc = {'vis': vis, 'selectdata': selectdata, 'spw': spw, 'field': field, 'antenna': antenna, 'uvrange': uvrange, 'timerange': timerange, 'correlation': correlation, 'scan': scan, 'intent': intent, 'feed': feed, 'array': array, 'observation': observation, 'verbose': verbose, 'listfile': listfile, 'listunfl': listunfl, 'cachesize': cachesize, 'overwrite': overwrite} 

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

156 _logging_state_ = _start_log( 'listobs', [ 'vis=' + repr(_pc.document['vis']), 'selectdata=' + repr(_pc.document['selectdata']), 'spw=' + repr(_pc.document['spw']), 'field=' + repr(_pc.document['field']), 'antenna=' + repr(_pc.document['antenna']), 'uvrange=' + repr(_pc.document['uvrange']), 'timerange=' + repr(_pc.document['timerange']), 'correlation=' + repr(_pc.document['correlation']), 'scan=' + repr(_pc.document['scan']), 'intent=' + repr(_pc.document['intent']), 'feed=' + repr(_pc.document['feed']), 'array=' + repr(_pc.document['array']), 'observation=' + repr(_pc.document['observation']), 'verbose=' + repr(_pc.document['verbose']), 'listfile=' + repr(_pc.document['listfile']), 'listunfl=' + repr(_pc.document['listunfl']), 'cachesize=' + repr(_pc.document['cachesize']), 'overwrite=' + repr(_pc.document['overwrite']) ] ) 

157 task_result = None 

158 try: 

159 task_result = _listobs_t( _pc.document['vis'], _pc.document['selectdata'], _pc.document['spw'], _pc.document['field'], _pc.document['antenna'], _pc.document['uvrange'], _pc.document['timerange'], _pc.document['correlation'], _pc.document['scan'], _pc.document['intent'], _pc.document['feed'], _pc.document['array'], _pc.document['observation'], _pc.document['verbose'], _pc.document['listfile'], _pc.document['listunfl'], _pc.document['cachesize'], _pc.document['overwrite'] ) 

160 except Exception as exc: 

161 _except_log('listobs', exc) 

162 raise 

163 finally: 

164 task_result = _end_log( _logging_state_, 'listobs', task_result ) 

165 return task_result 

166 

167listobs = _listobs( ) 

168