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

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

2##################### 0e3591a3f62455e598c37cb372657674 ############################## 

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_slsearch import slsearch as _slsearch_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 _slsearch: 

15 """ 

16 slsearch ---- Search a spectral line table. 

17 

18 --------- parameter descriptions --------------------------------------------- 

19 

20 tablename Input spectral line table name to search. If not specified, use the default table in the system. 

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

22 freqrange Frequency range in GHz. 

23 species Species to search for. 

24 reconly List only NRAO recommended frequencies. 

25 chemnames Chemical names to search for. 

26 qns Resolved quantum numbers to search for. 

27 intensity CDMS/JPL intensity range. -1 -> do not use an intensity range. 

28 smu2 Quantum mechanical line strength. -1 -> do not use a smu2 range. 

29 loga log(A) (Einstein coefficient) range. -1 -> do not use a loga range. 

30 el Lower energy state range in Kelvin. -1 -> do not use an el range. 

31 eu Upper energy state range in Kelvin. -1 -> do not use an eu range. 

32 rrlinclude Include RRLs in the result set? 

33 rrlonly Include only RRLs in the result set? 

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

35 logfile List result set to this logfile (only used if verbose=True). 

36 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. 

37 RETURNS bool 

38 

39 --------- examples ----------------------------------------------------------- 

40 

41  

42  

43 PARAMETER SUMMARY 

44  

45 tablename Input spectral line table name to search. If not specified, use the default table in the system. 

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

47 freqrange Frequency range in GHz. 

48 species Species to search for. 

49 reconly List only NRAO recommended frequencies. 

50 chemnames Chemical names to search for. 

51 qns Resolved quantum numbers to search for. 

52 intensity CDMS/JPL intensity range. -1 -> do not use an intensity range. 

53 smu2 S*mu*mu range in Debye**2. -1 -> do not use an S*mu*mu range. 

54 loga log(A) (Einstein coefficient) range. -1 -> do not use a loga range. 

55 el Lower energy state range in Kelvin. -1 -> do not use an el range. 

56 eu Upper energy state range in Kelvin. -1 -> do not use an eu range. 

57 rrlinclude Include RRLs in the result set? 

58 rrlonly Include only RRLs in the result set? 

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

60 logfile List result set to this logfile (only used if verbose=True). 

61 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. 

62  

63 Search the specfied spectral line table. The results table can be written to disk by specifying its name in the outfile parameter. 

64 If outfile is not specified (ie outfile=""), no table is created. Because Splatalogue does not have values for intensity, smu2, 

65 loga, eu, and el for radio recombination lines (rrls), one must specify to include RRLs in the specified frequency range in the 

66 output. In this case, RRLs will be included ignoring any filters on intensity, smu2, loga, eu, and el. One can also specify to 

67 list only RRLs. One can specify to list the search results to the logger via the verbose parameter. If verbose is False, no 

68 logger output is listed. If verbose=True, one can also specify that the results be listed to a logfile and if this file already 

69 exists, one can specify that the results be appended to it or to overwrite it with the results. 

70  

71 # put search results in a table but do not list to the logger 

72 slsearch("myspectrallines.tbl", verbose=False) 

73 

74 

75 """ 

76 

77 _info_group_ = """information""" 

78 _info_desc_ = """Search a spectral line table.""" 

79 

80 def __call__( self, tablename='', outfile='', freqrange=[ float(84),float(90) ], species=[ ], reconly=False, chemnames=[ ], qns=[ ], intensity=[ float(-1) ], smu2=[ float(-1) ], loga=[ float(-1) ], el=[ float(-1) ], eu=[ float(-1) ], rrlinclude=True, rrlonly=False, verbose=False, logfile='""', append=False ): 

81 schema = {'tablename': {'type': 'cPath', 'coerce': _coerce.expand_path}, 'outfile': {'type': 'cStr', 'coerce': _coerce.to_str}, 'freqrange': {'type': 'cFloatVec', 'coerce': [_coerce.to_list,_coerce.to_floatvec]}, 'species': {'type': 'cStrVec', 'coerce': [_coerce.to_list,_coerce.to_strvec]}, 'reconly': {'type': 'cBool'}, 'chemnames': {'type': 'cStrVec', 'coerce': [_coerce.to_list,_coerce.to_strvec]}, 'qns': {'type': 'cStrVec', 'coerce': [_coerce.to_list,_coerce.to_strvec]}, 'intensity': {'type': 'cFloatVec', 'coerce': [_coerce.to_list,_coerce.to_floatvec]}, 'smu2': {'type': 'cFloatVec', 'coerce': [_coerce.to_list,_coerce.to_floatvec]}, 'loga': {'type': 'cFloatVec', 'coerce': [_coerce.to_list,_coerce.to_floatvec]}, 'el': {'type': 'cFloatVec', 'coerce': [_coerce.to_list,_coerce.to_floatvec]}, 'eu': {'type': 'cFloatVec', 'coerce': [_coerce.to_list,_coerce.to_floatvec]}, 'rrlinclude': {'type': 'cBool'}, 'rrlonly': {'type': 'cBool'}, 'verbose': {'type': 'cBool'}, 'logfile': {'type': 'cStr', 'coerce': _coerce.to_str}, 'append': {'type': 'cBool'}} 

82 doc = {'tablename': tablename, 'outfile': outfile, 'freqrange': freqrange, 'species': species, 'reconly': reconly, 'chemnames': chemnames, 'qns': qns, 'intensity': intensity, 'smu2': smu2, 'loga': loga, 'el': el, 'eu': eu, 'rrlinclude': rrlinclude, 'rrlonly': rrlonly, 'verbose': verbose, 'logfile': logfile, 'append': append} 

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

84 _logging_state_ = _start_log( 'slsearch', [ 'tablename=' + repr(_pc.document['tablename']), 'outfile=' + repr(_pc.document['outfile']), 'freqrange=' + repr(_pc.document['freqrange']), 'species=' + repr(_pc.document['species']), 'reconly=' + repr(_pc.document['reconly']), 'chemnames=' + repr(_pc.document['chemnames']), 'qns=' + repr(_pc.document['qns']), 'intensity=' + repr(_pc.document['intensity']), 'smu2=' + repr(_pc.document['smu2']), 'loga=' + repr(_pc.document['loga']), 'el=' + repr(_pc.document['el']), 'eu=' + repr(_pc.document['eu']), 'rrlinclude=' + repr(_pc.document['rrlinclude']), 'rrlonly=' + repr(_pc.document['rrlonly']), 'verbose=' + repr(_pc.document['verbose']), 'logfile=' + repr(_pc.document['logfile']), 'append=' + repr(_pc.document['append']) ] ) 

85 task_result = None 

86 try: 

87 task_result = _slsearch_t( _pc.document['tablename'], _pc.document['outfile'], _pc.document['freqrange'], _pc.document['species'], _pc.document['reconly'], _pc.document['chemnames'], _pc.document['qns'], _pc.document['intensity'], _pc.document['smu2'], _pc.document['loga'], _pc.document['el'], _pc.document['eu'], _pc.document['rrlinclude'], _pc.document['rrlonly'], _pc.document['verbose'], _pc.document['logfile'], _pc.document['append'] ) 

88 except Exception as exc: 

89 _except_log('slsearch', exc) 

90 raise 

91 finally: 

92 task_result = _end_log( _logging_state_, 'slsearch', task_result ) 

93 return task_result 

94 

95slsearch = _slsearch( ) 

96