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

27 statements  

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

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

2##################### cb03f5d962db38b1742a644543cef968 ############################## 

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_concat import concat as _concat_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 _concat: 

15 """ 

16 concat ---- Concatenate several visibility data sets. 

17 

18  

19 The list of data sets given in the vis argument are chronologically 

20 concatenated into an output data set in concatvis, i.e. the data sets 

21 in vis are first ordered by the time of their earliest integration and 

22 then concatenated. If concatvis already exists (e.g., it is the same 

23 as the first input data set), then the other input data sets will be 

24 appended to the concatvis data set.There is no limit to the number of 

25 input data sets. 

26  

27 If there are fields whose direction agrees within the direction will 

28 be the one from the chronologically first input MS. Spectral windows 

29 for each data set with the same chanelization, and within a specified 

30 frequency tolerance of another data set will be combined into one 

31 spectral window. 

32  

33 If none of the input data sets have any scratch columns (model and 

34 corrected columns), none are created in the concatvis. Otherwise 

35 these columns are created on output and initialized to their default 

36 value (1 in model column, data in corrected column) for those data 

37 with no input columns. 

38  

39 Each appended dataset is assigned a new observation id (provided the 

40 entries in the observation table are indeed different). 

41 

42 --------- parameter descriptions --------------------------------------------- 

43 

44 vis Name of input visibility file 

45 default: none 

46  

47 Example: 

48 vis='['src2.ms','ngc5921.ms','ngc315.ms'] 

49 concatvis Name of visibility file that will contain the 

50 concatenated data 

51 default: none 

52  

53 Example: concatvis='outvis.ms' 

54  

55 Note: if this file exits on disk then the input 

56 files are added to this file. Otherwise the new 

57 file contains the concatenated data. Be careful 

58 here when concatenating to an existing file. 

59 freqtol Frequency shift tolerance for considering data as the 

60 same spwid. The number of channels must also be the same. 

61 Default: '' == 1 Hz 

62  

63 Example: freqtol='10MHz' will not combine spwid 

64 unless they are within 10 MHz. 

65  

66 Note: This option is useful to combine spectral 

67 windows with very slight frequency differences 

68 caused by Doppler tracking, for example. 

69 dirtol Direction shift tolerance for considering data as the 

70 same field 

71 Default: '' == 1 mas (milliarcsec) 

72  

73 Example: dirtol='1arcsec' will not combine 

74 data for a field unless their phase center 

75 differ by less than 1 arcsec.  

76  

77 Note: If the field names are different in the 

78 input data sets, the name in the output data set 

79 will be the first relevant data set in the list. 

80 respectname If true, fields with a different name are not merged even 

81 if their direction agrees (within dirtol) 

82 Default: False 

83 timesort If true, sort by TIME in ascending order 

84 Default: False (data in order as read in) 

85  

86 Example: timesort=True 

87  

88 Note: There is no constraint on data that is 

89 simultaneously observed for more than one field; 

90 for example multi-source correlation of VLBA 

91 data. 

92 copypointing Make a proper copy of the POINTING subtable  

93 Default:True (can be time consuming!) 

94  

95 If False, the result is an empty POINTING table. 

96 visweightscale List of the weight scaling factors to be applied to the 

97 individual MSs 

98 Default: [] (empty list) - no scaling 

99  

100 The weights of the individual MSs will be scaled 

101 in the concatenated output MS by the factors in 

102 this list. SIGMA will be scaled by 

103 1/sqrt(factor). Useful for handling heterogeneous 

104 arrays. Use plotms to inspect the "Wt" column as 

105 a reference for determining the scaling factors. 

106  

107 Example: [1.,3.,3.] - scale the weights of the 

108 second and third MS by a factor 3 and the 

109 SIGMA column of these MS by a factor 

110 1/sqrt(3). 

111 forcesingleephemfield Make sure that there is only one joint ephemeris for every field in this list 

112 Default: '' (standard treatment of all ephemeris 

113 fields) 

114  

115 By default, concat will only merge two ephemeris 

116 fields if the first ephemeris covers the time 

117 range of the second. Otherwise, two separate 

118 fields with separate ephemerides are placed in 

119 the output MS. 

120 In order to override this behaviour and make 

121 concat merge the non-overlapping or only 

122 partially overlapping input ephemerides, the name 

123 or id of the field in question needs to be placed 

124 into the list in parameter 

125 'forcesingleephemfield'. 

126  

127 Example: ['Neptune'] - will make sure that there 

128 is only one joint ephemeris for field Neptune in 

129 the output MS 

130 

131 --------- examples ----------------------------------------------------------- 

132 

133  

134  

135 For more information, see the task pages of concat in CASA Docs: 

136  

137 https://casa.nrao.edu/casadocs/ 

138 

139 

140 """ 

141 

142 _info_group_ = """manipulation""" 

143 _info_desc_ = """Concatenate several visibility data sets.""" 

144 

145 def __call__( self, vis=[ ], concatvis='', freqtol='', dirtol='', respectname=False, timesort=False, copypointing=True, visweightscale=[ ], forcesingleephemfield='' ): 

146 schema = {'vis': {'type': 'cReqPathVec', 'coerce': [_coerce.to_list,_coerce.expand_pathvec]}, 'concatvis': {'type': 'cStr', 'coerce': _coerce.to_str}, 'freqtol': {'type': 'cVariant', 'coerce': [_coerce.to_variant]}, 'dirtol': {'type': 'cVariant', 'coerce': [_coerce.to_variant]}, 'respectname': {'type': 'cBool'}, 'timesort': {'type': 'cBool'}, 'copypointing': {'type': 'cBool'}, 'visweightscale': {'type': 'cFloatVec', 'coerce': [_coerce.to_list,_coerce.to_floatvec]}, 'forcesingleephemfield': {'type': 'cVariant', 'coerce': [_coerce.to_variant]}} 

147 doc = {'vis': vis, 'concatvis': concatvis, 'freqtol': freqtol, 'dirtol': dirtol, 'respectname': respectname, 'timesort': timesort, 'copypointing': copypointing, 'visweightscale': visweightscale, 'forcesingleephemfield': forcesingleephemfield} 

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

149 _logging_state_ = _start_log( 'concat', [ 'vis=' + repr(_pc.document['vis']), 'concatvis=' + repr(_pc.document['concatvis']), 'freqtol=' + repr(_pc.document['freqtol']), 'dirtol=' + repr(_pc.document['dirtol']), 'respectname=' + repr(_pc.document['respectname']), 'timesort=' + repr(_pc.document['timesort']), 'copypointing=' + repr(_pc.document['copypointing']), 'visweightscale=' + repr(_pc.document['visweightscale']), 'forcesingleephemfield=' + repr(_pc.document['forcesingleephemfield']) ] ) 

150 task_result = None 

151 try: 

152 task_result = _concat_t( _pc.document['vis'], _pc.document['concatvis'], _pc.document['freqtol'], _pc.document['dirtol'], _pc.document['respectname'], _pc.document['timesort'], _pc.document['copypointing'], _pc.document['visweightscale'], _pc.document['forcesingleephemfield'] ) 

153 except Exception as exc: 

154 _except_log('concat', exc) 

155 raise 

156 finally: 

157 task_result = _end_log( _logging_state_, 'concat', task_result ) 

158 return task_result 

159 

160concat = _concat( ) 

161