Coverage for /wheeldirectory/casa-6.7.0-11-py3.10.el8/lib/py/lib/python3.10/site-packages/casatools/__casac__/imagemetadata.py: 38%

108 statements  

« prev     ^ index     » next       coverage.py v7.6.4, created at 2024-10-23 15:54 +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, '_imagemetadata')).lstrip('.') 

13 try: 

14 return importlib.import_module(mname) 

15 except ImportError: 

16 return importlib.import_module('_imagemetadata') 

17 _imagemetadata = 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('_imagemetadata', [dirname(__file__)]) 

26 except ImportError: 

27 import _imagemetadata 

28 return _imagemetadata 

29 try: 

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

31 finally: 

32 if fp is not None: 

33 fp.close() 

34 return _mod 

35 _imagemetadata = swig_import_helper() 

36 del swig_import_helper 

37else: 

38 import _imagemetadata 

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 imagemetadata(_object): 

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

100 

101 __swig_setmethods__ = {} 

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

103 __swig_getmethods__ = {} 

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

105 __repr__ = _swig_repr 

106 

107 def __init__(self): 

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

109 this = _imagemetadata.new_imagemetadata() 

110 try: 

111 self.this.append(this) 

112 except __builtin__.Exception: 

113 self.this = this 

114 

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

116 """ 

117 add(self, _key, _value) -> bool 

118 

119 

120 

121 Summary: 

122 Add a key-value pair if possible. 

123 

124 Description: 

125 

126 

127 Add a key-value pair if possible. 

128 

129 

130 Input Parameters: 

131 key The name of the FITS or other keyword. 

132 value Associated value to add. 

133 

134 Example: 

135 

136 imd.open('myim.im') 

137 # add a keyword 'test' with value 'first' 

138 if add('test', 'first'): 

139 print 'test=first has been added' 

140 else: 

141 print 'Unable to add key test' 

142 imd.done() 

143 

144 -------------------------------------------------------------------------------- 

145 

146 """ 

147 return _imagemetadata.imagemetadata_add(self, *args, **kwargs) 

148 

149 

150 def close(self): 

151 """ 

152 close(self) -> bool 

153 

154 

155 

156 Summary: 

157 Close the image metadata tool. Synonym for done(). 

158 

159 Description: 

160 

161 

162 

163 This function closes the image metadata tool. This means that it detaches the 

164 tool from its underlying metadata object. Methods cannot be run on it until it 

165 is opened with another or the same image. 

166 

167 Example: 

168 

169 imd.open('myim.im') 

170 # do stuff 

171 imd.close() 

172 

173 -------------------------------------------------------------------------------- 

174 

175 """ 

176 return _imagemetadata.imagemetadata_close(self) 

177 

178 

179 def done(self): 

180 """ 

181 done(self) -> bool 

182 

183 

184 

185 Summary: 

186 Close the image metadata tool. Synonym for close(). 

187 

188 Description: 

189 

190 

191 

192 This function closes the image metadata tool. This means that it detaches the 

193 tool from its underlying metadata object. Methods cannot be run on it until it 

194 is opened with another or the same image. 

195 

196 

197 

198 Example: 

199 

200 imd.open('myim.im') 

201 # do stuff 

202 imd.done() 

203 

204 -------------------------------------------------------------------------------- 

205 

206 """ 

207 return _imagemetadata.imagemetadata_done(self) 

208 

209 

210 def get(self, *args, **kwargs): 

211 """ 

212 get(self, _key) -> variant * 

213 

214 

215 

216 Summary: 

217 Get the value associated with the specified, case-insensitive FITS keyword. 

218 

219 Description: 

220 

221 

222 Get the value associated with the specified, case-insensitive FITS keyword. 

223 

224 

225 Input Parameters: 

226 key The name of the FITS or other keyword. 

227 

228 Example: 

229 

230 imd.open('myim.im') 

231 imtype = imd.get('imtype') 

232 imd.done() 

233 

234 -------------------------------------------------------------------------------- 

235 

236 """ 

237 return _imagemetadata.imagemetadata_get(self, *args, **kwargs) 

238 

239 

240 def list(self, *args, **kwargs): 

241 """ 

242 list(self, _verbose) -> record * 

243 

244 

245 

246 Summary: 

247 Get a dictionary of FITS-like header items. 

248 

249 Description: 

250 

251 

252 Get a listing of traditional FITS-like 'header' items. 

253 

254 

255 Input Parameters: 

256 verbose If true, print listing to logger 

257 

258 Example: 

259 

260 imd.open('myim.im') 

261 mylist = imd.list(False) 

262 imd.done() 

263 crval1 = mylist{'crval1'} 

264 

265 -------------------------------------------------------------------------------- 

266 

267 """ 

268 return _imagemetadata.imagemetadata_list(self, *args, **kwargs) 

269 

270 

271 def open(self, *args, **kwargs): 

272 """ 

273 open(self, _infile) -> bool 

274 

275 

276 

277 Summary: 

278 Open this image metadata tool providing access to an image's metadata. 

279 

280 Description: 

281 

282 

283 

284 This method creates access to the specified image's metadata. 

285 

286 

287 

288 Input Parameters: 

289 infile Image name. The image can be in any casa supported format. 

290 

291 Example: 

292 

293 immd.open('myim.im') 

294 # do stuff with the tool and then close it. 

295 immd.done() 

296 

297 -------------------------------------------------------------------------------- 

298 

299 """ 

300 return _imagemetadata.imagemetadata_open(self, *args, **kwargs) 

301 

302 

303 def remove(self, *args, **kwargs): 

304 """ 

305 remove(self, _key, _value) -> bool 

306 

307 

308 

309 Summary: 

310 Remove or clear the value of a keyword if possible. 

311 

312 Description: 

313 

314 

315 Remove or clear the value of a keyword if possible. If key='masks', a value specifying the mask 

316 to remove may be specified. If no value is specified, all masks are removed. 

317 

318 

319 Input Parameters: 

320 key The name of the FITS or other keyword. 

321 value Value to remove if the key is multi-valued. Only used in the case of key='masks'. 

322 

323 Example: 

324 

325 imd.open('myim.im') 

326 # clear the brightness unit 

327 if imd.remove('bunit'): 

328 print 'bunit has been cleared' 

329 else: 

330 print 'Unable to clear bunit' 

331 imd.done() 

332 

333 -------------------------------------------------------------------------------- 

334 

335 """ 

336 return _imagemetadata.imagemetadata_remove(self, *args, **kwargs) 

337 

338 

339 def set(self, *args, **kwargs): 

340 """ 

341 set(self, _key, _value) -> bool 

342 

343 

344 

345 Summary: 

346 Set a keyword to the specified value if possible. 

347 

348 Description: 

349 

350 

351 Set a key-value pair if possible. 

352 

353 

354 Input Parameters: 

355 key The name of the FITS or other keyword. 

356 value Associated value to set. 

357 

358 Example: 

359 

360 Note that when setting the reference value of a polarizaiton axis, one must 

361 provide an array of stokes/polarization strings (['I', 'Q', 'XX']) that is the 

362 same length as the stokes axis. If the stokes axis is degenerate, one can alternatively 

363 provide a string indicating the stokes value. 

364 

365 imd.open('myim.im') 

366 # Set keyword 'telescope' with value 'Argus Array' 

367 if imd.set('telescope', 'Argus Array'): 

368 print 'telescope has been updated' 

369 else: 

370 print 'Unable to update telescope.' 

371 imd.done() 

372 

373 # set polarizations for an image with three pixels on the stokes axis crval3 

374 imd.open('myim.im') 

375 if imd.set('crval3', [XY, LL, 'Q']): 

376 print 'polarization values have been updated' 

377 else: 

378 print 'Unable to update polarization values.' 

379 imd.done() 

380 

381 -------------------------------------------------------------------------------- 

382 

383 """ 

384 return _imagemetadata.imagemetadata_set(self, *args, **kwargs) 

385 

386 __swig_destroy__ = _imagemetadata.delete_imagemetadata 

387 __del__ = lambda self: None 

388imagemetadata_swigregister = _imagemetadata.imagemetadata_swigregister 

389imagemetadata_swigregister(imagemetadata) 

390 

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

392 

393