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

112 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, '_spectralline')).lstrip('.') 

13 try: 

14 return importlib.import_module(mname) 

15 except ImportError: 

16 return importlib.import_module('_spectralline') 

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

26 except ImportError: 

27 import _spectralline 

28 return _spectralline 

29 try: 

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

31 finally: 

32 if fp is not None: 

33 fp.close() 

34 return _mod 

35 _spectralline = swig_import_helper() 

36 del swig_import_helper 

37else: 

38 import _spectralline 

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

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

100 

101 __swig_setmethods__ = {} 

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

103 __swig_getmethods__ = {} 

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

105 __repr__ = _swig_repr 

106 

107 def __init__(self): 

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

109 this = _spectralline.new_spectralline() 

110 try: 

111 self.this.append(this) 

112 except __builtin__.Exception: 

113 self.this = this 

114 

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

116 """ 

117 splattotable(self, _filenames, _table) -> spectralline 

118 

119 

120 

121 Summary: 

122 Convert a downloaded Splatalogue spectral line list to a casa table. 

123 

124 Description: 

125 

126 

127 This method reads a spectral line list(s) downloaded from Splatalogue (www.splatalogue.net) and loads it into a CASA table which 

128 can be queried via eg this tool's search function. 

129 

130 REQUIRMENTS OF THE DOWNLOADED FILES 

131 

132 The downloaded files must be in a specific format for this method to succeed. The columns are the 

133 important things; one can filter the results as one desires using Splatalogue, but the particular columns must be present as described 

134 below. The columns which must be present in the downloaded file in this exact order are: 'Species', 'NRAO Recommended', 'Chemical Name', 

135 'Freq in GHz', 'Resolved QNs', 'CDMS/JPL Intensity', 'Sij^2; (D2)', 

136 'Log10 (Aij)', 'EL (K)', 'EU (K)', 'Linelist'. In order to get these columns in this order, one should 

137 select exactly the following items on the Splatalogue search interface. Under 'Specify Ranges' one should select 'GHz' for the frequency unit. 

138 Under 'Line Strength Display' select exactly 'CDMS/JPL Intensity', 

139 'Sij u2', and 'Aij'. Under 'Energy Levels', one should select exactly 'Elower (K)' and 'Eupper (K)'. Under 'Miscellaneous', one should 

140 select exactly 'Display Ordered Frequency ONLY' and 'Display NRAO Recommended Frequencies'. One should then initiate the search and on 

141 the resulting page, one should select the Tab Field Separator and then export the list. The resulting list should be in the proper 

142 format for importing into CASA. 

143 

144 RETURN VALUE 

145 This method returns an open spectralline tool which references the new table. The new table can also be opened by 

146 a spectralline tool using the open method (eg sl.open(tablename)). 

147 

148 

149 Input Parameters: 

150 filenames Files containing Splatalogue dumps 

151 table Output table name. 

152 

153 Example: 

154 

155 newsl = sl.splattotable('mysplatlist.txt', 'mynewsl.tbl') 

156 # search the new spectral line tool 

157 newsl.search([0,1000]) 

158 

159 -------------------------------------------------------------------------------- 

160 

161 """ 

162 return _spectralline.spectralline_splattotable(self, *args, **kwargs) 

163 

164 

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

166 """ 

167 open(self, _table) -> bool 

168 

169 

170 

171 Summary: 

172 Open a spectralline tool using the specified table. 

173 

174 Description: 

175 

176 

177 This method opens a CASA Splatalogue spectral line table. The table should have been created with 

178 splattotable(), search(), or any other sl method which creates a new CASA spectral line table. If no 

179 table name is supplied, the default CASA spectral line table included in the system will be opened. The 

180 opened tool can then be used to query the table via eg the sl.search() method. This method returns true 

181 if the table was successfully opened. 

182 

183 

184 Input Parameters: 

185 table CASA table containing Splatalogue data. 

186 

187 Example: 

188 

189 # open user created spectral line table 

190 isopen = sl.open('mysplat.tbl') 

191 if (isopen) 

192 sl.search([0,1000]) 

193 

194 # open system default spectral line table 

195 isopen = sl.open() 

196 if (isopen) 

197 sl.search([0,1000]) 

198 

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

200 

201 """ 

202 return _spectralline.spectralline_open(self, *args, **kwargs) 

203 

204 

205 def close(self): 

206 """ 

207 close(self) -> bool 

208 

209 

210 

211 Summary: 

212 close the spectralline tool 

213 

214 Description: 

215 

216 

217 The associated table is closed inside casapy and 

218 is no longer available for use. 

219 

220 

221 Example: 

222 

223 sl.close() 

224 

225 -------------------------------------------------------------------------------- 

226 

227 """ 

228 return _spectralline.spectralline_close(self) 

229 

230 

231 def done(self): 

232 """ 

233 done(self) -> bool 

234 

235 

236 

237 Summary: 

238 End the spectralline tool 

239 

240 Description: 

241 

242 

243 Effectively a synonym for function close. 

244 

245 

246 Example: 

247 

248 sl.done() 

249 

250 -------------------------------------------------------------------------------- 

251 

252 """ 

253 return _spectralline.spectralline_done(self) 

254 

255 

256 def search(self, *args, **kwargs): 

257 """ 

258 search(self, _outfile, _freqrange, _species, _reconly, _chemnames, _qns, _intensity, _smu2, _loga, _el, _eu, _rrlinclude, _rrlonly, _verbose, _logfile, _append) -> spectralline 

259 

260 

261 

262 Summary: 

263 Search a Splatalogue table that has been converted to a casa table 

264 

265 Description: 

266 

267 

268 Search the table associated with this tool. The return value is a spectralline tool with a new table containing the search 

269 results. This new table can be written to disk by specifying its name in the outfile parameter. If outfile is not specified 

270 (ie outfile=''), the resulting table is held in memory and deleted upon a call to close() or done() for the newly created tool 

271 or upon exiting casapy. Because Splatalogue does not have values for intensity, smu2, loga, el, and eu 

272 for radio recombination lines (rrls), one must specify to include rrls in the specified frequency range in the output. In this case, 

273 RRLs will be included ignoring any filters on intensity, smu2, loga, el, and eu. One can also specify to list only RRLs. One can specify 

274 to list the search results to the logger via the verbose parameter. If verbose is false, no logger output is listed, although the results 

275 can be listed later by running the list() method on the newly created spectral line tool. If verbose=true, one can also specify that 

276 the results be listed to a logfile and if this file already exists, one can specify that the results be appended to it or to overwrite 

277 it with the results. 

278 

279 

280 Input Parameters: 

281 outfile Results table name. Blank means do not write the table to disk. 

282 freqrange Frequency range in GHz. 

283 species Species to search for. 

284 reconly List only NRAO recommended frequencies. 

285 chemnames Chemical names to search for. 

286 qns Resolved quantum numbers to search for. 

287 intensity CDMS/JPL intensity range. -1 -& do not use an intensity range. 

288 smu2 S*mu*mu range in Debye**2. -1 -& do not use an S*mu*mu range. 

289 loga log(A) (Einstein coefficient) range. -1 -& do not use a loga range. 

290 el Lower energy state range in Kelvin. -1 -& do not use an el range. 

291 eu Upper energy state range in Kelvin. -1 -& do not use an eu range. 

292 rrlinclude Include RRLs in the result set? 

293 rrlonly Include only RRLs in the result set? 

294 verbose List result set to logger (and optionally logfile)? 

295 logfile List result set to this logfile (only used if verbose=true). 

296 append If true, append to logfile if it already exists, if false overwrite logfile it it exists. Only used if verbose=true and logfile not blank. 

297 

298 Example: 

299 

300 sl.open('myspectrallines.tbl') 

301 # do a search postponing listing the results to the logger. 

302 slrestool = sl.search(outfile='myresults.tbl', freqrange = [200,300], species=['HOCN', 'HOCO+']) 

303 # now list the results 

304 slrestool.list() 

305 # or one could also do the following after exiting and restarting casapy 

306 sl.open('myresults.tbl') 

307 sl.list() 

308 

309 -------------------------------------------------------------------------------- 

310 

311 """ 

312 return _spectralline.spectralline_search(self, *args, **kwargs) 

313 

314 

315 def list(self): 

316 """ 

317 list(self) 

318 

319 

320 

321 Summary: 

322 List the spectral lines in the associated table to the logger. 

323 

324 Description: 

325 

326 

327 List the spectral lines in the associated table to the logger. Note that listing tables containing more than 10,000 spectral lines can take quite a bit of time. 

328 

329 

330 -------------------------------------------------------------------------------- 

331 

332 """ 

333 return _spectralline.spectralline_list(self) 

334 

335 

336 def torecord(self): 

337 """ 

338 torecord(self) -> record * 

339 

340 

341 

342 Summary: 

343 Return data on the spectral lines in the table as a record. 

344 

345 Description: 

346 

347 

348 Return data on the spectral lines in the table as a record. 

349 

350 

351 -------------------------------------------------------------------------------- 

352 

353 """ 

354 return _spectralline.spectralline_torecord(self) 

355 

356 

357 def species(self, *args, **kwargs): 

358 """ 

359 species(self, _verbose, _logfile, _append) -> record * 

360 

361 

362 

363 Summary: 

364 List the unique species in the associated table to the logger. 

365 

366 Description: 

367 

368 

369 Return the unique species in the associated table as a list. 

370 

371 

372 Input Parameters: 

373 verbose List result set to logger (and optionally logfile)? 

374 logfile List result set to this logfile (only used if verbose=true). 

375 append If true, append to logfile if it already exists, if false overwrite logfile it it exists. Only used if show=true and logfile not blank. 

376 

377 -------------------------------------------------------------------------------- 

378 

379 """ 

380 return _spectralline.spectralline_species(self, *args, **kwargs) 

381 

382 

383 def chemnames(self, *args, **kwargs): 

384 """ 

385 chemnames(self, _verbose, _logfile, _append) -> record * 

386 

387 

388 

389 Summary: 

390 List the unique chemical names in the associated table to the logger. 

391 

392 Description: 

393 

394 

395 Return the unique chemical names in the associated table as a list. 

396 

397 

398 Input Parameters: 

399 verbose List result set to logger (and optionally logfile)? 

400 logfile List result set to this logfile (only used if verbose=true). 

401 append If true, append to logfile if it already exists, if false overwrite logfile it it exists. Only used if show=true and logfile not blank. 

402 

403 -------------------------------------------------------------------------------- 

404 

405 """ 

406 return _spectralline.spectralline_chemnames(self, *args, **kwargs) 

407 

408 

409 def nrows(self): 

410 """ 

411 nrows(self) -> long 

412 

413 

414 

415 Summary: 

416 Get the number of rows in the associated spectral line table. 

417 

418 Description: 

419 

420 

421 Get the number of rows in the associated spectral line table. 

422 

423 

424 -------------------------------------------------------------------------------- 

425 

426 """ 

427 return _spectralline.spectralline_nrows(self) 

428 

429 __swig_destroy__ = _spectralline.delete_spectralline 

430 __del__ = lambda self: None 

431spectralline_swigregister = _spectralline.spectralline_swigregister 

432spectralline_swigregister(spectralline) 

433 

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

435 

436