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

27 statements  

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

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

2##################### 790188cc655c2a2e1e60d0786440bfaa ############################## 

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_phaseshift import phaseshift as _phaseshift_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 _phaseshift: 

15 """ 

16 phaseshift ---- Rotate a Measurement Set to a new phase-center 

17 

18  

19 This application changes the phase center of a selected subset of an input MS, by taking into 

20 account the full 3D geometry in the UVW plane (similar to the phasecenter setting in the 

21 imaging tasks). This function produces an output MS with modified UVW values, visibility 

22 phases, and a new phase_direction entry in the FIELD sub-table. 

23  

24 

25 --------- parameter descriptions --------------------------------------------- 

26 

27 vis Name of input visibility file 

28 Default: none, must be specified 

29  

30 Example: vis='ngc5921.ms' 

31 outputvis Name of output visibility file 

32 Default: None, must be specified 

33  

34 Example: outputvis='ngc5921_out.ms' 

35 keepmms Create a Multi-MS as the output if the input is a 

36 Multi-MS. 

37  

38 Default: True 

39 Options: True|False 

40  

41 By default it will create a Multi-MS when the 

42 input is a Multi-MS. The output Multi-MS will 

43 have the same partition axis of the input 

44 MMS. See CASA Docs for more information on 

45 the MMS format. 

46 field Select field using field id(s) or field name(s) 

47 Default: '' (all fields) 

48  

49 Use 'go listobs' to obtain the list id's or 

50 names. If field string is a non-negative integer, 

51 it is assumed a field index, otherwise, it is 

52 assumed a field name. 

53  

54 Examples: 

55 field='0~2'; field ids 0,1,2 

56 field='0,4,5~7'; field ids 0,4,5,6,7 

57 field='3C286,3C295'; field named 3C286 and 

58 3C295 

59 field = '3,4C\*'; field id 3, all names 

60 starting with 4C 

61 spw Select spectral window/channels 

62 Default: ''=all spectral windows and channels 

63  

64 Examples: 

65 spw='0~2,4'; spectral windows 0,1,2,4 (all channels) 

66 spw='<2'; spectral windows less than 2 (i.e. 0,1) 

67 spw='0:5~61'; spw 0, channels 5 to 61 

68 spw='0,10,3:3~45'; spw 0,10 all channels, spw 

69 3 - chans 3 to 45. 

70 spw='0~2:2~6'; spw 0,1,2 with channels 2 

71 through 6 in each. 

72 spw = '\*:3~64' channels 3 through 64 for all sp id's 

73 spw = ' :3~64' will NOT work. 

74 scan Scan number range 

75 Default: '' = all 

76 intent Select observing intent 

77 Default: '' (no selection by intent) 

78  

79 Example: intent='*BANDPASS*' (selects data 

80 labelled with BANDPASS intent) 

81 array (Sub)array number range 

82 Default: '' (all) 

83 observation Select by observation ID(s) 

84 Default: '' = all 

85  

86 Example: observation='0~2,4' 

87 datacolumn Which data column(s) to process 

88 (case-insensitive). 

89 Default: 'all' (= whichever of the options that 

90 are present) 

91 Options: 'data', 'model', 'corrected', 

92 'all','float_data', 'lag_data', 

93 'float_data,data', 'lag_data,data' 

94  

95 Example: datacolumn='data' 

96 phasecenter Direction coordinates of new phase center, specified as absolute 

97 world coordinates including frame, eg  

98  

99 phasecenter = 'J2000 19h53m50 40d06m00' 

100 phasecenter = 'B1950 292.5deg -40.0deg' 

101 phasecenter = 'ICRS 13:05:27.2780 -049.28.04.458' 

102 phasecenter = 'GALACTIC 47.5rad -60.22rad' 

103  

104 Time dependent systems (eg, AZEL) are not supported, nor are ephemeris objects. 

105  

106 This will change the phase of the baseline visibilities so that the  

107 final image is centered at the new location. Additionally the uvw  

108 coordinates and the the PHASE_DIR column from the FIELD sub-table  

109 will be changed accordingly.  

110  

111 This operation will be done for all selected fields, so all fields in the output 

112 MS will have as center the new location. The new phase center is not constrained to 

113 be located inside any images to be created. 

114 

115 --------- examples ----------------------------------------------------------- 

116 

117  

118 

119 

120 """ 

121 

122 _info_group_ = """manipulation""" 

123 _info_desc_ = """Rotate a Measurement Set to a new phase-center""" 

124 

125 def __call__( self, vis='', outputvis='', keepmms=True, field='', spw='', scan='', intent='', array='', observation='', datacolumn='all', phasecenter='' ): 

126 schema = {'vis': {'type': 'cReqPath', 'coerce': _coerce.expand_path}, 'outputvis': {'type': 'cStr', 'coerce': _coerce.to_str}, 'keepmms': {'type': 'cBool'}, 'field': {'type': 'cStr', 'coerce': _coerce.to_str}, 'spw': {'type': 'cStr', 'coerce': _coerce.to_str}, 'scan': {'type': 'cStr', 'coerce': _coerce.to_str}, 'intent': {'type': 'cStr', 'coerce': _coerce.to_str}, 'array': {'type': 'cStr', 'coerce': _coerce.to_str}, 'observation': {'type': 'cStr', 'coerce': _coerce.to_str}, 'datacolumn': {'type': 'cStr', 'coerce': _coerce.to_str, 'allowed': [ 'DATA', 'model', 'corrected', 'LAG_DATA', 'lag_data', 'FLOAT_DATA,DATA', 'FLOAT_DATA', 'CORRECTED', 'lag_data,data', 'float_data', 'float_data,data', 'DATA,MODEL,CORRECTED', 'ALL', 'MODEL', 'all', 'data,model,corrected', 'LAG_DATA,DATA', 'data' ]}, 'phasecenter': {'type': 'cStr', 'coerce': _coerce.to_str}} 

127 doc = {'vis': vis, 'outputvis': outputvis, 'keepmms': keepmms, 'field': field, 'spw': spw, 'scan': scan, 'intent': intent, 'array': array, 'observation': observation, 'datacolumn': datacolumn, 'phasecenter': phasecenter} 

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

129 _logging_state_ = _start_log( 'phaseshift', [ 'vis=' + repr(_pc.document['vis']), 'outputvis=' + repr(_pc.document['outputvis']), 'keepmms=' + repr(_pc.document['keepmms']), 'field=' + repr(_pc.document['field']), 'spw=' + repr(_pc.document['spw']), 'scan=' + repr(_pc.document['scan']), 'intent=' + repr(_pc.document['intent']), 'array=' + repr(_pc.document['array']), 'observation=' + repr(_pc.document['observation']), 'datacolumn=' + repr(_pc.document['datacolumn']), 'phasecenter=' + repr(_pc.document['phasecenter']) ] ) 

130 task_result = None 

131 try: 

132 task_result = _phaseshift_t( _pc.document['vis'], _pc.document['outputvis'], _pc.document['keepmms'], _pc.document['field'], _pc.document['spw'], _pc.document['scan'], _pc.document['intent'], _pc.document['array'], _pc.document['observation'], _pc.document['datacolumn'], _pc.document['phasecenter'] ) 

133 except Exception as exc: 

134 _except_log('phaseshift', exc) 

135 raise 

136 finally: 

137 task_result = _end_log( _logging_state_, 'phaseshift', task_result ) 

138 return task_result 

139 

140phaseshift = _phaseshift( ) 

141