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

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 fluxscale.xml ################# 

2##################### d755b0baa9e1470fc32bae479b20569e ############################## 

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_fluxscale import fluxscale as _fluxscale_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 _fluxscale: 

15 """ 

16 fluxscale ---- Bootstrap the flux density scale from standard calibrators 

17 

18  

19 Bootstrap the flux density scale from standard calibrators. 

20  

21 

22 --------- parameter descriptions --------------------------------------------- 

23 

24 vis Name of input visibility file 

25 Default: none 

26  

27 Example: vis='ngc5921.ms' 

28 caltable Name of input calibration table 

29 Default: none 

30  

31 Example: caltable='ngc5921.gcal'. This cal 

32 table was obtained from task gaincal.= 

33 fluxtable Name of output, flux-scaled calibration table (required) 

34 Default: none 

35  

36 Example: fluxtable='ngc5921.gcal2' 

37  

38 The gains in this table have been adjusted by the 

39 derived flux density each calibrator. The 

40 MODEL_DATA column has NOT been updated for the 

41 flux density of the calibrator. Use setjy to do 

42 this if it is a point source. 

43 reference Reference field name(s) (transfer flux scale FROM) 

44 Default: none 

45  

46 Example: reference='1328+307' 

47  

48 The names of the fields with a known flux 

49 densities or visibilities that have been placed 

50 in the MODEL column by setjy or ft for a model 

51 not in the CASA system. The syntax is similar to 

52 field. Hence field index or names can be used. 

53 transfer Transfer field name(s) (transfer flux scale TO) 

54 Default: '' (all sources in caltable that are not 

55 specified as reference sources. Do not include 

56 unknown target sources) 

57  

58 The names of the fields with unknown flux 

59 densities. These should be point-like calibrator 

60 sources The syntax is similar to field. Hence 

61 source index or names can be used. 

62  

63 Examples: transfer='1445+099, 3C84'; transfer 

64 = '0,4' 

65  

66 NOTE: All fields in reference and transfer must 

67 have solutions in the caltable. 

68 listfile Name of listfile that contains the fit information. 

69 Default: '' (no fit listfile will be created) 

70  

71 The list file contains the flux density, flux 

72 density error, S/N, and number of solutions (all 

73 antennas and feeds) for each spectral window.  

74 NOTE: The nominal spectral window frequencies 

75 will be included in the future. 

76 append Append fluxscaled solutions to the fluxtable? 

77 Default: False (the fluxtable must not exist) 

78 Options: False|True 

79 refspwmap Vector of spectral windows enabling scaling across 

80 spectral windows 

81 Default: [-1] (none) 

82  

83 Example with 4 spectral windows: 

84 If the reference fields were observed only in 

85 spw=1 and 3, and the transfer fields were 

86 observed in all 4 spws (0,1,2,3), specify 

87 refspwmap=[1,1,3,3]. This will ensure that 

88 transfer fields observed in spws 0,1,2,3 will 

89 be referenced to reference field solutions 

90 only in spw 1 or 3. 

91 gainthreshold Threshold in the input gain solutions to be used in fractional deviation from median values. 

92 Default: -1 (no threshold) 

93  

94 Example: gainthreshold=0.15 (only used the 

95 gain solutions within 15% (inclusive) of the 

96 median gain value (per field and per spw). 

97 antenna Select data based on antenna/baseline 

98 Subparameter of antenna 

99 Default: '' (all) 

100  

101 If antenna string is a non-negative integer, it 

102 is assumed an antenna index, otherwise, it is 

103 assumed as an antenna name 

104  

105 Examples:  

106 antenna='5&6'; baseline between antenna 

107 index 5 and index 6. 

108 antenna='VA05&VA06'; baseline between VLA 

109 antenna 5 and 6. 

110 antenna='5&6;7&8'; baselines with 

111 indices 5-6 and 7-8 

112 antenna='5'; all baselines with antenna index 

113 5 

114 antenna='05'; all baselines with antenna 

115 number 05 (VLA old name) 

116 antenna='5,6,10'; all baselines with antennas 

117 5,6,10 index numbers 

118 timerange Select data based on time range 

119 Subparameter of antenna 

120 Default = '' (all) 

121  

122 Examples: 

123 timerange = 

124 'YYYY/MM/DD/hh:mm:ss~YYYY/MM/DD/hh:mm:ss' 

125 (Note: if YYYY/MM/DD is missing date defaults 

126 to first day in data set.) 

127 timerange='09:14:0~09:54:0' picks 40 min on 

128 first day  

129 timerange= '25:00:00~27:30:00' picks 1 hr to 3 

130 hr 30min on NEXT day 

131 timerange='09:44:00' pick data within one 

132 integration of time 

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

134 scan Scan number range 

135 Subparameter of antenna 

136 Default: '' = all 

137 incremental Create an incremental caltable containing only gain 

138 correction factors ( flux density= 1/(gain correction factor)**2)? 

139 Default: False 

140 Options: False|True 

141  

142 Example: incremental=True (output a caltable 

143 containing flux scale factors.) 

144  

145 NOTE: If you use the incremental option, note 

146 that BOTH this incremental fluxscale table AND an 

147 amplitude vs. time table should be supplied in 

148 applycal. 

149 fitorder Polynomial order of the spectral fitting for valid flux 

150 densities 

151 Default: 1 

152  

153 It falls back to a lower fitorder if there are 

154 not enough solutions to fit with the requested 

155 fitorder. 

156 display Display statistics and/or spectral fitting results. 

157 Default: False 

158 Options: False|True 

159  

160 Currently only a histogram of the correction 

161 factors to derive the final flux density for each 

162 spectral window will be plotted. 

163 

164 --------- examples ----------------------------------------------------------- 

165 

166  

167 For more information, see the task pages of fluxscale in CASA Docs: 

168  

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

170  

171 

172 

173 """ 

174 

175 _info_group_ = """calibration""" 

176 _info_desc_ = """Bootstrap the flux density scale from standard calibrators""" 

177 

178 def __call__( self, vis='', caltable='', fluxtable='', reference=[ ], transfer=[ ], listfile='', append=False, refspwmap=[ int(-1) ], gainthreshold=float(-1.0), antenna='', timerange='', scan='', incremental=False, fitorder=int(1), display=False ): 

179 schema = {'vis': {'type': 'cReqPath', 'coerce': _coerce.expand_path}, 'caltable': {'type': 'cStr', 'coerce': _coerce.to_str}, 'fluxtable': {'type': 'cStr', 'coerce': _coerce.to_str}, 'reference': {'type': 'cStrVec', 'coerce': [_coerce.to_list,_coerce.to_strvec]}, 'transfer': {'type': 'cStrVec', 'coerce': [_coerce.to_list,_coerce.to_strvec]}, 'listfile': {'type': 'cStr', 'coerce': _coerce.to_str}, 'append': {'type': 'cBool'}, 'refspwmap': {'type': 'cIntVec', 'coerce': [_coerce.to_list,_coerce.to_intvec]}, 'gainthreshold': {'type': 'cFloat', 'coerce': _coerce.to_float}, 'antenna': {'type': 'cStr', 'coerce': _coerce.to_str}, 'timerange': {'type': 'cStr', 'coerce': _coerce.to_str}, 'scan': {'type': 'cStr', 'coerce': _coerce.to_str}, 'incremental': {'type': 'cBool'}, 'fitorder': {'type': 'cInt'}, 'display': {'type': 'cBool'}} 

180 doc = {'vis': vis, 'caltable': caltable, 'fluxtable': fluxtable, 'reference': reference, 'transfer': transfer, 'listfile': listfile, 'append': append, 'refspwmap': refspwmap, 'gainthreshold': gainthreshold, 'antenna': antenna, 'timerange': timerange, 'scan': scan, 'incremental': incremental, 'fitorder': fitorder, 'display': display} 

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

182 _logging_state_ = _start_log( 'fluxscale', [ 'vis=' + repr(_pc.document['vis']), 'caltable=' + repr(_pc.document['caltable']), 'fluxtable=' + repr(_pc.document['fluxtable']), 'reference=' + repr(_pc.document['reference']), 'transfer=' + repr(_pc.document['transfer']), 'listfile=' + repr(_pc.document['listfile']), 'append=' + repr(_pc.document['append']), 'refspwmap=' + repr(_pc.document['refspwmap']), 'gainthreshold=' + repr(_pc.document['gainthreshold']), 'antenna=' + repr(_pc.document['antenna']), 'timerange=' + repr(_pc.document['timerange']), 'scan=' + repr(_pc.document['scan']), 'incremental=' + repr(_pc.document['incremental']), 'fitorder=' + repr(_pc.document['fitorder']), 'display=' + repr(_pc.document['display']) ] ) 

183 task_result = None 

184 try: 

185 task_result = _fluxscale_t( _pc.document['vis'], _pc.document['caltable'], _pc.document['fluxtable'], _pc.document['reference'], _pc.document['transfer'], _pc.document['listfile'], _pc.document['append'], _pc.document['refspwmap'], _pc.document['gainthreshold'], _pc.document['antenna'], _pc.document['timerange'], _pc.document['scan'], _pc.document['incremental'], _pc.document['fitorder'], _pc.document['display'] ) 

186 except Exception as exc: 

187 _except_log('fluxscale', exc) 

188 raise 

189 finally: 

190 task_result = _end_log( _logging_state_, 'fluxscale', task_result ) 

191 return task_result 

192 

193fluxscale = _fluxscale( ) 

194