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

124 statements  

« prev     ^ index     » next       coverage.py v7.6.4, created at 2024-10-31 17:39 +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, '_synthesisutils')).lstrip('.') 

13 try: 

14 return importlib.import_module(mname) 

15 except ImportError: 

16 return importlib.import_module('_synthesisutils') 

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

26 except ImportError: 

27 import _synthesisutils 

28 return _synthesisutils 

29 try: 

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

31 finally: 

32 if fp is not None: 

33 fp.close() 

34 return _mod 

35 _synthesisutils = swig_import_helper() 

36 del swig_import_helper 

37else: 

38 import _synthesisutils 

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

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

100 

101 __swig_setmethods__ = {} 

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

103 __swig_getmethods__ = {} 

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

105 __repr__ = _swig_repr 

106 

107 def __init__(self): 

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

109 this = _synthesisutils.new_synthesisutils() 

110 try: 

111 self.this.append(this) 

112 except __builtin__.Exception: 

113 self.this = this 

114 

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

116 """ 

117 contdatapartition(self, _selpars, _npart) -> record * 

118 

119 

120 

121 Summary: 

122 Partition data selection parameters for continuum imaging 

123 

124 Input Parameters: 

125 selpars All selection parameters for one or more MSs 

126 npart Number of partitions 

127 

128 -------------------------------------------------------------------------------- 

129 

130 """ 

131 return _synthesisutils.synthesisutils_contdatapartition(self, *args, **kwargs) 

132 

133 

134 def advisechansel(self, *args, **kwargs): 

135 """ 

136 advisechansel(self, _freqstart, _freqend, _freqstep, _freqframe, _ephemtable, _msname, _fieldid, _getfreqrange, _spwselection) -> record * 

137 

138 

139 

140 Summary: 

141 Advise on spw and chan selection optimal for the image frequency range wanted 

142 

143 Description: 

144 

145 

146 It is a helper function, for cube imaging, that allows you to 

147 determine the spectral window data selection you may need to cover a 

148 given range of frequencies. 

149 

150 In the mode with getfreqrange=False, the freqstep can be used (i.e., set to the channel width) to achieve the extra padding needed for data selection at the beginning and end of the desired cube range in order to retrieve all channels that will potentially contribute to the edge channels of the cube (to maximize S/N). If freqstep is not specified, it is taken as zero, and the output channel range will typically be slightly smaller. 

151 

152 The meaning of freqframe parameter is dependent on the value of getfreqrange. 

153 When getfreqrange=False, frequency parameters are considered as input parameters that are known to be in the frame specified by freqframe; but when getfreqrange=True, the frequency parameters are output parameters that will be determined in the frame specified by freqframe. In the former case, the frequencies will be converted to the frame of the data as a function of time in order to locate which channels match. 

154 

155 You need to specify the field_id for which this calculation is 

156 being done. 

157 

158 If the parameter {tt getfreqrange=True} then the reverse is requested. You set {tt spwselection} to be the range of data selection you want to use and you'll get the range of frequency covered in the frame you set. The freqstart and freqend output values correspond to the frequency of the extreme edges of the requested channel range. 

159 Inputs 

160 ---------------- 

161 freqstart 

162 Begining of frequency range 

163 allowed: double, string, quantity 

164 example: freqstart='1.0GHz' 

165 Default: 

166 ---------------- 

167 freqend 

168 End of frequency range 

169 allowed: double, string, quantity 

170 example: freqend='2.0GHz' 

171 Default:'' 

172 ----------------- 

173 freqstep 

174 spectral channel resolution of intended image 

175 allowed: double, string, quantity 

176 example: freqstep='1.0MHz' 

177 Default:'' 

178 ----------------- 

179 freqframe 

180 frame in which frequency is being expressed in other parameters. For solar system moving sources if the frame of the source is intended then this parameter can be 'SOURCE' 

181 allowed : one of the following strings 'LSRK', 'LSRD', 'BARY', 'GEO', 'TOPO', 'GALACTO', 'LGROUP','CMB', 'SOURCE' 

182 Default: 'LSRK' 

183 ---------------- 

184 msname 

185 name of a valid measurement set. 

186 allowed: string 

187 Default: '' 

188 ----------------- 

189 ephemtable 

190 when freqframe='SOURCE' this parameter is used 

191 name of a valid ephemeris table or 'TRACKFIELD' to use the ephemeris table attached to the FIELD subtable of the ms or one of the following solar system object: 'MERCURY', 'VENUS', 'MARS', 'JUPITER', 'SATURN', 'URANUS', 'NEPTUNE', 'PLUTO', 'SUN', 'MOON' 

192 allowed: string 

193 Default: '' 

194 ----------------- 

195 fieldid 

196 fieldid to use (needed to get the direction on the sky for any spectral frame conversion) 

197 allowed: integer 

198 Default: 0 

199 ------------------- 

200 getfreqrange 

201 if set then freqrange is returned in the frame requested for the data selected 

202 allowed: bool 

203 Default: False 

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

205 spwselection 

206 if getfreqrange=True then this is needed to find the range of frequency in the frame requested. It should have the spectral window selection syntax as defined in the msselection (Casa memo 3) 

207 allowed: string 

208 Default: '' 

209 

210 Input Parameters: 

211 freqstart Begining of frequency range in Hz 

212 freqend End of frequency range in Hz 

213 freqstep spectral channel resolution of intended image in Hz 

214 freqframe frame in which frequency is being expressed in other parameters 

215 ephemtable valid ephemeris table name or TRACKFIELD (use ephemeris in FIELD subtable) if freqframe is SOURCE 

216 msname name of an ms, if empty string it will use the ms's used in selectvis 

217 fieldid fieldid to use when msname is not empty otherwise ignored and field selected in selectvis is used 

218 getfreqrange if set then freqrange is returned in the frame requested for the data selected 

219 spwselection if getfreqrange=True then this is needed to find the range of frequency in the frame requested 

220 

221 Example: 

222 

223 Example 1 

224 In this example, we are interested in an image cube which span 20.0682GHz to 20.1982 in LSRK which will have a channel resolution of 3.9MHz. The field we are interested the one with fieldid=4 

225 

226 ############################# 

227 >>> from casatools import synthesisutils 

228 >>> syut=synthesisutils() 

229 >>> syut.advisechansel(freqstart='20.0682GHz', freqend='20.1982GHz', freqstep='3.9kHz', freqframe='LSRK', msname='test1.ms') 

230 {'nchan': array([109, 23], dtype=int32), 'spw': array([4, 5], dtype=int32), 

231 'start': array([19, 0], dtype=int32)} 

232 # implies 108 channels of spw 4 starting channel 19 and 23 channels of spw 5 starting at channel 0 would contribute data to the frequency range under consideration 

233 ############################# 

234 

235 Example 2 

236 

237 To determine what is the frequency range in a given frame is covered by a given spwselection of the ms 

238 

239 ############## 

240 >>> syut.advisechansel(msname='test3.ms', freqframe='LSRK', getfreqrange=True, spwselection='0:20~210') 

241 

242 {'freqend': {'unit': 'Hz', 'value': 362746224619.3091}, 'freqstart': {'unit': 'Hz', 'value': 362512788988.5036}} 

243 

244 ############## 

245 

246 Example 3: 

247 

248 Same as Example 1 but with a solar system moving source and the frequency range provided is in the frame of the source. We are using the ephemeris table attached to the FIELD subtable of the ms. 

249 

250 ########## 

251 >>> syut.advisechansel(msname='uid___A002_Xc05f54_X142a_target.spw31.contsub.ms', freqstart='362.5145206GHz', freqend='362.7476643GHz', freqstep='122.064714kHz', fieldid=3, freqframe='SOURCE', ephemtable='TRACKFIELD') 

252 ########### 

253 Now one can do the same with a valid ephemeris table 

254 ########### 

255 >>> syut.advisechansel(msname='uid___A002_Xc05f54_X142a_target.spw31.contsub.ms', freqstart='362.5145206GHz', freqend='362.7476643GHz', freqstep='122.064714kHz', fieldid=3, freqframe='SOURCE', ephemtable='EPHEM0_Titan_57889.1.tab') 

256 ########### 

257 

258 Or if we want it in the frame of a solar system source known by casa, e.g 'SATURN' 

259 ############ 

260 >>> syut.advisechansel(msname='uid___A002_Xc05f54_X142a_target.spw31.contsub.ms', freqstart='362.5145206GHz', freqend='362.7476643GHz', freqstep='122.064714kHz', fieldid=3, freqframe='SOURCE', ephemtable='SATURN') 

261 ############ 

262 

263 Example 4: 

264 

265 Same as Example 2 but with a solar system moving source and the frequency range we want to find is in the frame of the source. 

266 

267 ############ 

268 >>> syut.advisechansel(msname='uid___A002_Xc05f54_X142a_target.spw31.contsub.ms', fieldid=3, freqframe='SOURCE', ephemtable='TRACKFIELD', getfreqrange=True, spwselection='31:9~1919') 

269 ############# 

270 similarly if we want it in the frame of a solar system source known casa e.g saturn 

271 ############# 

272 >>> syut.advisechansel(msname='uid___A002_Xc05f54_X142a_target.spw31.contsub.ms', fieldid=3, freqframe='SOURCE', ephemtable='SATURN', getfreqrange=True, spwselection='31:9~1919') 

273 ############# 

274 

275 -------------------------------------------------------------------------------- 

276 

277 """ 

278 return _synthesisutils.synthesisutils_advisechansel(self, *args, **kwargs) 

279 

280 

281 def cubedatapartition(self, *args, **kwargs): 

282 """ 

283 cubedatapartition(self, _selpars, _npart, _fstart, _fend, _frame) -> record * 

284 

285 

286 

287 Summary: 

288 Partition data selection parameters for CUBE imaging 

289 

290 Description: 

291 

292 

293 returns a dictionary with data spectral parttiion that maps data to nparts 

294 of the input range frequency... usually to be used for doing data selection 

295 when imaging a cube from fstart to fend in npart subcubes 

296 

297 Input Parameters: 

298 selpars All selection parameters for one or more MSs 

299 npart Number of partitions 

300 fstart start frequency of cube image 

301 fend end frequency of cube image 

302 frame frame of fstart and fend 

303 

304 Example: 

305 

306 ##make a synthesisutils tool 

307 siu=casac.synthesisutils() 

308 ### define first ms parameters 

309 msrec={'msname':'ngc5921.ms.contsub', 'field':'0', 'spw':'0'} 

310 pars={'ms0':msrec} 

311 ## can add ms1, ms2 etc for multiple ms into dictionary pars 

312 

313 ##now get the data selections for 20 subpart of a cube that 

314 ## spans from 1.412787GHz to 1.413287GHz 

315 siu.cubedatapartition(selprs=pars, npart=20, fstart='1.412787GHz', fend='1.413287GHz', frame='LSRK') 

316 

317 -------------------------------------------------------------------------------- 

318 

319 """ 

320 return _synthesisutils.synthesisutils_cubedatapartition(self, *args, **kwargs) 

321 

322 

323 def cubeimagepartition(self, *args, **kwargs): 

324 """ 

325 cubeimagepartition(self, _impars, _npart) -> record * 

326 

327 

328 

329 Summary: 

330 Partition image cube parameters for CUBE deconvolution 

331 

332 Input Parameters: 

333 impars All imaging parameters for one or more image fields 

334 npart Number of partitions 

335 

336 -------------------------------------------------------------------------------- 

337 

338 """ 

339 return _synthesisutils.synthesisutils_cubeimagepartition(self, *args, **kwargs) 

340 

341 

342 def cubedataimagepartition(self, *args, **kwargs): 

343 """ 

344 cubedataimagepartition(self, _selpars, _incsys, _npart, _nchannel) -> record * 

345 

346 

347 

348 Summary: 

349 Partition data/image cube parameters for CUBE deconvolution 

350 

351 Input Parameters: 

352 selpars All selection parameters for one or more MSs 

353 incsys input coordinate system 

354 npart Number of partitions 

355 nchannel Number of channels 

356 

357 -------------------------------------------------------------------------------- 

358 

359 """ 

360 return _synthesisutils.synthesisutils_cubedataimagepartition(self, *args, **kwargs) 

361 

362 

363 def checkselectionparams(self, *args, **kwargs): 

364 """ 

365 checkselectionparams(self, _selpars) -> record * 

366 

367 

368 

369 Summary: 

370 Check and Fix Selection Parameters for one MS 

371 

372 Input Parameters: 

373 selpars All selection parameters for one MS 

374 

375 -------------------------------------------------------------------------------- 

376 

377 """ 

378 return _synthesisutils.synthesisutils_checkselectionparams(self, *args, **kwargs) 

379 

380 

381 def checkimageparams(self, *args, **kwargs): 

382 """ 

383 checkimageparams(self, _impars) -> record * 

384 

385 

386 

387 Summary: 

388 Check and Fix Imaging Parameters for one field 

389 

390 Input Parameters: 

391 impars All imaging parameters for one image-field 

392 

393 -------------------------------------------------------------------------------- 

394 

395 """ 

396 return _synthesisutils.synthesisutils_checkimageparams(self, *args, **kwargs) 

397 

398 

399 def checkgridparams(self, *args, **kwargs): 

400 """ 

401 checkgridparams(self, _gridpars) -> record * 

402 

403 

404 

405 Summary: 

406 Check and Fix Gridding/FTM Parameters for one field 

407 

408 Input Parameters: 

409 gridpars All gridding/ftm parameters for one image-field 

410 

411 -------------------------------------------------------------------------------- 

412 

413 """ 

414 return _synthesisutils.synthesisutils_checkgridparams(self, *args, **kwargs) 

415 

416 

417 def updateimpars(self, *args, **kwargs): 

418 """ 

419 updateimpars(self, _impars) -> record * 

420 

421 

422 

423 Summary: 

424 check the consistency between the csys record and other impars and update/modify impars if necessary 

425 

426 Input Parameters: 

427 impars All image parameters of one image-field 

428 

429 -------------------------------------------------------------------------------- 

430 

431 """ 

432 return _synthesisutils.synthesisutils_updateimpars(self, *args, **kwargs) 

433 

434 

435 def getOptimumSize(self, *args, **kwargs): 

436 """ 

437 getOptimumSize(self, _size) -> long 

438 

439 

440 

441 Summary: 

442 Get Optimum Image size 

443 

444 Input Parameters: 

445 size Input size 

446 

447 -------------------------------------------------------------------------------- 

448 

449 """ 

450 return _synthesisutils.synthesisutils_getOptimumSize(self, *args, **kwargs) 

451 

452 

453 def fitPsfBeam(self, *args, **kwargs): 

454 """ 

455 fitPsfBeam(self, _imagename, _nterms, _psfcutoff) -> bool 

456 

457 

458 

459 Summary: 

460 Fit a restoring beam to the PSF, and save it in the PSF image. 

461 

462 Input Parameters: 

463 imagename Image Prefix name 

464 nterms Single or Multi-Term (to pick namng conventions) 

465 psfcutoff A fractional cut-off level to determine what part of the PSF is sent to the beam fitter 

466 

467 -------------------------------------------------------------------------------- 

468 

469 """ 

470 return _synthesisutils.synthesisutils_fitPsfBeam(self, *args, **kwargs) 

471 

472 

473 def taylor_coeffs_to_cube(self, *args, **kwargs): 

474 """ 

475 taylor_coeffs_to_cube(self, _cubename, _mtname, _nterms, _reffreq) -> bool 

476 

477 

478 

479 Summary: 

480 Convert Taylor-coefficient images to a Cube 

481 

482 Input Parameters: 

483 cubename Cube Image Name prefix 

484 mtname Multi-Term Image Name Prefix 

485 nterms Single or Multi-Term (to pick naming conventions) 

486 reffreq Reference Frequency to use for the Taylor expansion 

487 

488 -------------------------------------------------------------------------------- 

489 

490 """ 

491 return _synthesisutils.synthesisutils_taylor_coeffs_to_cube(self, *args, **kwargs) 

492 

493 

494 def cube_to_taylor_sum(self, *args, **kwargs): 

495 """ 

496 cube_to_taylor_sum(self, _cubename, _mtname, _nterms, _reffreq, _imtype, _pblimit) -> bool 

497 

498 

499 

500 Summary: 

501 Convert Cube images to Taylor Weighted averages across frequency 

502 

503 Input Parameters: 

504 cubename Cube Image Name prefix 

505 mtname Multi-Term Image Name Prefix 

506 nterms Single or Multi-Term (to pick naming conventions) 

507 reffreq Reference Frequency to use for the Taylor expansion 

508 imtype 0 : Collapse the PSF cube to 2nterms-1 images. 1 : Collapse the residual cube to nterms images. 2 : Collapse the pb cube to a single .tt0 image 

509 pblimit pblimit 

510 

511 -------------------------------------------------------------------------------- 

512 

513 """ 

514 return _synthesisutils.synthesisutils_cube_to_taylor_sum(self, *args, **kwargs) 

515 

516 

517 def remove_freq_dep_pb(self, *args, **kwargs): 

518 """ 

519 remove_freq_dep_pb(self, _cubename, _mtname, _pblimit) -> bool 

520 

521 

522 

523 Summary: 

524 Divide by the frequency dependent PB and multiply by an avg PB 

525 

526 Input Parameters: 

527 cubename Cube Image Name prefix 

528 mtname mt-prefix for average PB to apply after removing the frequency dependent PB 

529 pblimit pblimit 

530 

531 -------------------------------------------------------------------------------- 

532 

533 """ 

534 return _synthesisutils.synthesisutils_remove_freq_dep_pb(self, *args, **kwargs) 

535 

536 

537 def apply_freq_dep_pb(self, *args, **kwargs): 

538 """ 

539 apply_freq_dep_pb(self, _cubename, _mtname, _pblimit) -> bool 

540 

541 

542 

543 Summary: 

544 Divide by the avgPB and multiply by the frequency dependent PB 

545 

546 Input Parameters: 

547 cubename Cube Image Name prefix 

548 mtname mt-prefix for average PB to remove before applying the frequency dependent PB 

549 pblimit pblimit 

550 

551 -------------------------------------------------------------------------------- 

552 

553 """ 

554 return _synthesisutils.synthesisutils_apply_freq_dep_pb(self, *args, **kwargs) 

555 

556 

557 def done(self): 

558 """ 

559 done(self) -> bool 

560 

561 

562 

563 Summary: 

564 Close the tool 

565 

566 -------------------------------------------------------------------------------- 

567 

568 """ 

569 return _synthesisutils.synthesisutils_done(self) 

570 

571 __swig_destroy__ = _synthesisutils.delete_synthesisutils 

572 __del__ = lambda self: None 

573synthesisutils_swigregister = _synthesisutils.synthesisutils_swigregister 

574synthesisutils_swigregister(synthesisutils) 

575 

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

577 

578