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

34 statements  

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

1##################### generated by xml-casa (v2) from spectralline.xml ############## 

2##################### 457889d5971195da41697d078aca882f ############################## 

3from __future__ import absolute_import 

4from .__casac__.spectralline import spectralline as _spectralline 

5 

6from .errors import create_error_string 

7from .typecheck import CasaValidator as _validator 

8_pc = _validator( ) 

9from .coercetype import coerce as _coerce 

10_wrap_spectralline = lambda swig_object: spectralline(swig_object=swig_object) 

11 

12class spectralline: 

13 _info_group_ = """spectralline""" 

14 _info_desc_ = """spectral line tool""" 

15 ### self 

16 def __init__(self, *args, **kwargs): 

17 """ 

18 """ 

19 self._swigobj = kwargs.get('swig_object',None) 

20 if self._swigobj is None: 

21 self._swigobj = _spectralline() 

22 

23 def splattotable(self, filenames=[ ], table=''): 

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

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

26  

27 REQUIRMENTS OF THE DOWNLOADED FILES 

28  

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

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

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

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

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

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

35 Under "Line Strength Display" select exactly "CDMS/JPL Intensity", 

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

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

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

39 format for importing into CASA. 

40  

41 RETURN VALUE 

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

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

44  

45 """ 

46 return _wrap_spectralline(swig_object=self._swigobj.splattotable(filenames, table)) 

47 

48 def open(self, table=''): 

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

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

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

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

53 if the table was successfully opened. 

54  

55 """ 

56 return self._swigobj.open(table) 

57 

58 def close(self): 

59 """The associated table is closed inside casapy and 

60 is no longer available for use. 

61  

62 """ 

63 return self._swigobj.close() 

64 

65 def done(self): 

66 """Effectively a synonym for function close. 

67  

68 """ 

69 return self._swigobj.done() 

70 

71 def search(self, outfile='', freqrange=[ float(0) ], 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=True, logfile='', append=False): 

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

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

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

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

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

77 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 

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

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

80 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 

81 it with the results. 

82  

83 """ 

84 return _wrap_spectralline(swig_object=self._swigobj.search(outfile, freqrange, species, reconly, chemnames, qns, intensity, smu2, loga, el, eu, rrlinclude, rrlonly, verbose, logfile, append)) 

85 

86 def list(self): 

87 """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. 

88  

89 """ 

90 return self._swigobj.list() 

91 

92 def torecord(self): 

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

94  

95 """ 

96 return self._swigobj.torecord() 

97 

98 def species(self, verbose=False, logfile='', append=False): 

99 """Return the unique species in the associated table as a list. 

100  

101 """ 

102 return self._swigobj.species(verbose, logfile, append) 

103 

104 def chemnames(self, verbose=False, logfile='', append=False): 

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

106  

107 """ 

108 return self._swigobj.chemnames(verbose, logfile, append) 

109 

110 def nrows(self): 

111 """Get the number of rows in the associated spectral line table. 

112  

113 """ 

114 return self._swigobj.nrows() 

115