Coverage for /wheeldirectory/casa-6.7.0-12-py3.10.el8/lib/py/lib/python3.10/site-packages/casatasks/virtualconcat.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 virtualconcat.xml ############# 

2##################### fccb7fde89f14ceba514bdd8be54ae42 ############################## 

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_virtualconcat import virtualconcat as _virtualconcat_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 _virtualconcat: 

15 """ 

16 virtualconcat ---- Concatenate several visibility data sets into a multi-MS 

17 

18 --------- parameter descriptions --------------------------------------------- 

19 

20 vis List of names of input visibility files to be concatenated 

21 concatvis Name of the output visibility file (a multi-MS) 

22 freqtol Frequency shift tolerance for considering data as the same spwid 

23 dirtol Direction shift tolerance for considering data as the same field 

24 respectname If true, fields with a different name are not merged even if their direction agrees 

25 visweightscale List of the weight scaling factors to be applied to the individual MSs 

26 keepcopy If true, a copy of the input MSs is kept in their original place. 

27 copypointing If true, keep the POINTING table information in the output MMS. If false, don\'t. 

28 

29 --------- examples ----------------------------------------------------------- 

30 

31  

32  

33 The list of data sets given in the vis argument are moved into an output 

34 multi-MS data set concatvis and virtually concatenated. 

35  

36 NOTE: This task will modify the input datasets by moving them and reindexing them. 

37 If you want to keep a copy of your original data, please set the parameter 

38 keepcopy to True. 

39  

40 There is no limit to the number of input data sets. 

41  

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

43 columns), none are created in the concatvis. Otherwise these columns are 

44 created on output and initialized to their default value (1 in model column, 

45 data in corrected column) for those data with no input columns. 

46  

47 Spectral windows for each data set with the same chanelization, and within a 

48 specified frequency tolerance of another data set will be combined into one 

49 spectral window. 

50  

51 A field position in one data set that is within a specified direction tolerance 

52 of another field position in any other data set will be combined into one 

53 field. The field names need not be the same---only their position is used. 

54  

55 Each appended dataset is assigned a new observation id if the corresponding 

56 rows in the observation table are not the same. 

57  

58 Keyword arguments: 

59 vis -- Name of input visibility files to be combined 

60 default: none; example: vis = ['src2.ms','ngc5921.ms','ngc315.ms'] 

61 concatvis -- Name of visibility file that will contain the concatenated data 

62 note: if this file exits on disk then the input files are 

63 added to this file. Otherwise the new file contains 

64 the concatenated data. Be careful here when concatenating to 

65 an existing file. 

66 default: none; example: concatvis='src2.ms' 

67 example: concatvis='outvis.ms' 

68  

69 other examples: 

70 virtualconcat(vis=['src2.ms','ngc5921.ms'], concatvis='out.mms') 

71 will concatenate 'ngc5921.ms' and 'src2.ms' into a file named 

72 'out.mms'; the original 'ngc5921.ms' and 'src2.ms' are gone. 

73 'out.mms' is a multims. As most of the data is only moved, not 

74 copied, this is faster and subsequent tasks can run in parallel 

75 on the subMSs of out.mms. 

76 virtualconcat(vis=['src2.ms','ngc5921.ms'], concatvis='out.mms', keepcopy=True) 

77 will concatenate 'ngc5921.ms' and 'src2.ms' into a file named 

78 'out.mms'; the original 'ngc5921.ms' and 'src2.ms' are as before 

79 but you consume more disk space and time for the copy. 

80 . 

81  

82 Note: run flagmanager to save flags in the concatvis 

83  

84 freqtol -- Frequency shift tolerance for considering data to be in the same 

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

86 default: '' do not combine unless frequencies are equal 

87 example: freqtol='10MHz' will not combine spwid unless they are 

88 within 10 MHz. 

89 Note: This option is useful to conbine spectral windows with very slight 

90 frequency differences caused by Doppler tracking, for example. 

91  

92 dirtol -- Direction shift tolerance for considering data as the same field 

93 default: '' means always combine. 

94 example: dirtol='1.arcsec' will not combine data for a field unless 

95 their phase center differ by less than 1 arcsec. If the field names 

96 are different in the input data sets, the name in the output data 

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

98  

99 respectname -- If true, fields with a different name are not merged even if their 

100 direction agrees (within dirtol). 

101 default: True 

102  

103 visweightscale -- The weights of the individual MSs will be scaled in the concatenated 

104 output MS by the factors in this list. Useful for handling heterogeneous arrays. 

105 Use plotms to inspect the "Wt" column as a reference for determining the scaling 

106 factors. See the cookbook for more details. 

107 example: [1.,3.,3.] - scale the weights of the second and third MS by a factor 3. 

108 default: [] (empty list) - no scaling 

109  

110 keepcopy -- If true, a copy of the input MSs is kept in their original place. 

111 default: false 

112  

113 copypointing -- If true, the POINTING table information will be present in the output. 

114 If false, the result is an empty POINTING table. 

115 default: true 

116 

117 

118 """ 

119 

120 _info_group_ = """manipulation""" 

121 _info_desc_ = """Concatenate several visibility data sets into a multi-MS""" 

122 

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

124 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'}, 'visweightscale': {'type': 'cFloatVec', 'coerce': [_coerce.to_list,_coerce.to_floatvec]}, 'keepcopy': {'type': 'cBool'}, 'copypointing': {'type': 'cBool'}} 

125 doc = {'vis': vis, 'concatvis': concatvis, 'freqtol': freqtol, 'dirtol': dirtol, 'respectname': respectname, 'visweightscale': visweightscale, 'keepcopy': keepcopy, 'copypointing': copypointing} 

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

127 _logging_state_ = _start_log( 'virtualconcat', [ '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']), 'visweightscale=' + repr(_pc.document['visweightscale']), 'keepcopy=' + repr(_pc.document['keepcopy']), 'copypointing=' + repr(_pc.document['copypointing']) ] ) 

128 task_result = None 

129 try: 

130 task_result = _virtualconcat_t( _pc.document['vis'], _pc.document['concatvis'], _pc.document['freqtol'], _pc.document['dirtol'], _pc.document['respectname'], _pc.document['visweightscale'], _pc.document['keepcopy'], _pc.document['copypointing'] ) 

131 except Exception as exc: 

132 _except_log('virtualconcat', exc) 

133 raise 

134 finally: 

135 task_result = _end_log( _logging_state_, 'virtualconcat', task_result ) 

136 return task_result 

137 

138virtualconcat = _virtualconcat( ) 

139