Coverage for /wheeldirectory/casa-6.7.0-12-py3.10.el8/lib/py/lib/python3.10/site-packages/casatools/__casac__/linearmosaic.py: 37%

102 statements  

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

1# This file was automatically generated by SWIG (http://www.swig.org). 

2# Version 3.0.12 

3# 

4# Do not make changes to this file unless you know what you are doing--modify 

5# the SWIG interface file instead. 

6 

7from sys import version_info as _swig_python_version_info 

8if _swig_python_version_info >= (2, 7, 0): 

9 def swig_import_helper(): 

10 import importlib 

11 pkg = __name__.rpartition('.')[0] 

12 mname = '.'.join((pkg, '_linearmosaic')).lstrip('.') 

13 try: 

14 return importlib.import_module(mname) 

15 except ImportError: 

16 return importlib.import_module('_linearmosaic') 

17 _linearmosaic = swig_import_helper() 

18 del swig_import_helper 

19elif _swig_python_version_info >= (2, 6, 0): 

20 def swig_import_helper(): 

21 from os.path import dirname 

22 import imp 

23 fp = None 

24 try: 

25 fp, pathname, description = imp.find_module('_linearmosaic', [dirname(__file__)]) 

26 except ImportError: 

27 import _linearmosaic 

28 return _linearmosaic 

29 try: 

30 _mod = imp.load_module('_linearmosaic', fp, pathname, description) 

31 finally: 

32 if fp is not None: 

33 fp.close() 

34 return _mod 

35 _linearmosaic = swig_import_helper() 

36 del swig_import_helper 

37else: 

38 import _linearmosaic 

39del _swig_python_version_info 

40 

41try: 

42 _swig_property = property 

43except NameError: 

44 pass # Python < 2.2 doesn't have 'property'. 

45 

46try: 

47 import builtins as __builtin__ 

48except ImportError: 

49 import __builtin__ 

50 

51def _swig_setattr_nondynamic(self, class_type, name, value, static=1): 

52 if (name == "thisown"): 

53 return self.this.own(value) 

54 if (name == "this"): 

55 if type(value).__name__ == 'SwigPyObject': 

56 self.__dict__[name] = value 

57 return 

58 method = class_type.__swig_setmethods__.get(name, None) 

59 if method: 

60 return method(self, value) 

61 if (not static): 

62 if _newclass: 

63 object.__setattr__(self, name, value) 

64 else: 

65 self.__dict__[name] = value 

66 else: 

67 raise AttributeError("You cannot add attributes to %s" % self) 

68 

69 

70def _swig_setattr(self, class_type, name, value): 

71 return _swig_setattr_nondynamic(self, class_type, name, value, 0) 

72 

73 

74def _swig_getattr(self, class_type, name): 

75 if (name == "thisown"): 

76 return self.this.own() 

77 method = class_type.__swig_getmethods__.get(name, None) 

78 if method: 

79 return method(self) 

80 raise AttributeError("'%s' object has no attribute '%s'" % (class_type.__name__, name)) 

81 

82 

83def _swig_repr(self): 

84 try: 

85 strthis = "proxy of " + self.this.__repr__() 

86 except __builtin__.Exception: 

87 strthis = "" 

88 return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,) 

89 

90try: 

91 _object = object 

92 _newclass = 1 

93except __builtin__.Exception: 

94 class _object: 

95 pass 

96 _newclass = 0 

97 

98class linearmosaic(_object): 

99 """Proxy of C++ casac::linearmosaic class.""" 

100 

101 __swig_setmethods__ = {} 

102 __setattr__ = lambda self, name, value: _swig_setattr(self, linearmosaic, name, value) 

103 __swig_getmethods__ = {} 

104 __getattr__ = lambda self, name: _swig_getattr(self, linearmosaic, name) 

105 __repr__ = _swig_repr 

106 

107 def __init__(self): 

108 """__init__(self) -> linearmosaic""" 

109 this = _linearmosaic.new_linearmosaic() 

110 try: 

111 self.this.append(this) 

112 except __builtin__.Exception: 

113 self.this = this 

114 

115 def defineoutputimage(self, *args, **kwargs): 

116 """ 

117 defineoutputimage(self, _nx, _ny, _cellx, _celly, _imagecenter, _outputimage, _outputweight) -> bool 

118 

119 

120 

121 Summary: 

122 Set the output direction image parameters and name 

123 

124 Description: 

125 

126 

127 Define the direction axes output image parameters. 

128 The output image will get the same number of spectral and polarization planes as the input images. This function create a fresh new output image. If an image of the same name exist on disk it will be erased. The spectral and polarization part of the image will be identical to the images that are being mosaiced. 

129 

130 The output image will by default be flux correct and the weight image will be ${sum_p A_p^2(theta)}$ where the primary beam is $ A_p(theta)$ 

131 

132 Input Parameters: 

133 nx Total number of spatial pixels in x 

134 ny Total number of spatial pixels in y 

135 cellx Cellsize in x (e.g. '1arcsec') 

136 celly Cellsize in y (e.g. '1arcsec') 

137 imagecenter Direction of phase center as a diretion measure  

138 outputimage output image name  

139 outputweight output weight image name  

140 

141 Example: 

142 

143 lm.defineoutputimage(nx=3000, cellx='3arcsec', imagecenter='19h13m13.469 4d50m09.649', outputimage='test.linmos', outputweight='test.weightlinmos') 

144 

145 -------------------------------------------------------------------------------- 

146 

147 """ 

148 return _linearmosaic.linearmosaic_defineoutputimage(self, *args, **kwargs) 

149 

150 

151 def setoutputimage(self, *args, **kwargs): 

152 """ 

153 setoutputimage(self, _outputimage, _outputweight, _imageweighttype, _weighttype) -> bool 

154 

155 

156 

157 Summary: 

158 Use this function to mosaic on an existing image and weight image 

159 

160 Description: 

161 

162 

163 Use this function if the mosaicing is to be done onto a previous mosaic or image. For now the stokes and spectral characteristic of the images to be mosaic and the output image has to be similar (i.e the user has to regrid them prior to linearmosaic if necessary). 

164 The weightimage represents the sensitivity image of the image (for example the weighted primary beam coverage of a mosaic) 

165 

166 {tt imageweighttype} parameter: 

167 

168 If the image is of the type that has been normalized to be flux correct then the imageweighttype should 0. 

169 If the image has been apodized by a primary beam then imageweighttype should be 1 

170 and if the image is multiplied by $PB^2$ then it should be 2. 

171 

172 {tt weighttype} parameter: 

173 This should be 1 if the weight image is the sum of Primary beams or equivalent 

174 and it should be 2 if it is the sum of of $PB^2$ 

175 

176 Input Parameters: 

177 outputimage Existing mosaic imagename 

178 outputweight Existing weight image for mosaic 

179 imageweighttype what kind of weight was already applied to image n 0: flux correct n 1: Primary beam equivalent weight n 2: $PB^2$ equivalent weight n  

180 weighttype what kind of weight is weight image n 1: Primary beam equivalent weight n 2: $PB^2$ equivalent n  

181 

182 Example: 

183 

184 lm.setoutputimage(outputimage='testoo.linmos', outputweight='testoo.linmos.weight', imageweightype=0, weighttype=2) 

185 

186 -------------------------------------------------------------------------------- 

187 

188 """ 

189 return _linearmosaic.linearmosaic_setoutputimage(self, *args, **kwargs) 

190 

191 

192 def saultweightimage(self, *args, **kwargs): 

193 """ 

194 saultweightimage(self, _outputimage, _fracpeak) -> bool 

195 

196 

197 

198 Summary: 

199 Use this function to create a Sault-weighted image 

200 

201 Description: 

202 

203 

204 'Sault weighted' image is one which is more pleasant to view (without high noise at the edges of mosaic images), it is flux correct upto a where the beam coverage becomes low and is tapered off onwards just to keep the noise from rising in the overall image(see Eq[2] from Sault, Staveley-Smith and Brouw (1996), Astron. Astrophys. Suppl, 120, 375) 

205 

206 Input Parameters: 

207 outputimage Name of image to create the Sault-Weighted image 

208 fracpeak Upto what fraction of peak of coverage should the image be flux correct 

209 

210 Example: 

211 

212 lm.defineoutputimage(nx=3000, cellx='3arcsec', imagecenter='19h13m13.469 4d50m09.649', outputimage='test.linmos') 

213 lm.makemosaic(images=['FIELD_31/img.image', 'FIELD_33/img.image'], weightimages=['FIELD_31/img.pb', 'FIELD_33/img.pb']) 

214 ###the above will make a flux correct mosaic of the 2 images in a flux correct fashion in test.linmos 

215 #Now make a Sault weighted image to use in the viewer 

216 lm.saultweightimage('test_sault.linmos') 

217 

218 -------------------------------------------------------------------------------- 

219 

220 """ 

221 return _linearmosaic.linearmosaic_saultweightimage(self, *args, **kwargs) 

222 

223 

224 def setlinmostype(self, *args, **kwargs): 

225 """ 

226 setlinmostype(self, _linmostype) -> bool 

227 

228 

229 

230 Summary: 

231 Use this function to set if you want to mosaic in flatnoise domain 

232 

233 Description: 

234 

235 

236 Use this function if the mosaicing is to be done using a non optimal weighting mode. 

237 

238 

239 For now {tt optimal} (which is the default) follows this equation 

240 begin{equation} 

241 I^{lm}(theta)={{sum_p A_p(theta)(I_p(theta)A_p(theta))w_p}over{sum_p A_p^2(theta)w_p}} 

242 end{equation} 

243 

244 And {tt pbweight} follows this one 

245 begin{equation} 

246 I^{lm}(theta)={{sum_p (I_p(theta)A_p(theta))w_p}over{sum_p A_p(theta)w_p}} 

247 end{equation} 

248 

249 where $A_p(theta)$ is the primary beam (PB) of a given pointing $p$, $w_p$ is a sensitivity weight and the image of that pointing is $I_p(theta)$; the linear mosaic being $I^{lm}(theta)$ 

250 For now $w_p=1$ 

251 

252 Input Parameters: 

253 linmostype Type of weighting for linear mosaic 

254 

255 -------------------------------------------------------------------------------- 

256 

257 """ 

258 return _linearmosaic.linearmosaic_setlinmostype(self, *args, **kwargs) 

259 

260 

261 def makemosaic(self, *args, **kwargs): 

262 """ 

263 makemosaic(self, _images, _weightimages, _imageweighttype, _weighttype) -> bool 

264 

265 

266 

267 Summary: 

268 mosaic images in a weighted fashion onto ouput image 

269 

270 Description: 

271 

272 

273 Put the list of images onto the mosaic image using the weight images 

274 

275 Input Parameters: 

276 images Name of images to mosaic 

277 weightimages Name of images to mosaic 

278 imageweighttype what kind of weight is already applied to image n 0: flux correct n 1: Primary beam equivalent weight n 2: PB^2 equivalent n  

279 weighttype what kind of weight image it is n 1: Primary beam equivalent weight n 2: PB^2 equivalent n  

280 

281 Example: 

282 

283 lm.defineoutputimage(nx=3000, cellx='3arcsec', imagecenter='19h13m13.469 4d50m09.649', outputimage='test.linmos') 

284 

285 ###make a mosaic of two fields 

286 lm.makemosaic(images=['FIELD_31/img.image', 'FIELD_33/img.image'], weightimages=['FIELD_31/img.pb', 'FIELD_33/img.pb']) 

287 

288 ####now we have another submosaic (which is flux corrected) we want to add to this mosaic 

289 

290 lm.makemosaic(images='submosaic.image', weightimages='submosaic.flux', imageweighttype=0, weighttype=1) 

291 

292 -------------------------------------------------------------------------------- 

293 

294 """ 

295 return _linearmosaic.linearmosaic_makemosaic(self, *args, **kwargs) 

296 

297 __swig_destroy__ = _linearmosaic.delete_linearmosaic 

298 __del__ = lambda self: None 

299linearmosaic_swigregister = _linearmosaic.linearmosaic_swigregister 

300linearmosaic_swigregister(linearmosaic) 

301 

302# This file is compatible with both classic and new-style classes. 

303 

304