Coverage for /wheeldirectory/casa-6.7.0-12-py3.10.el8/lib/py/lib/python3.10/site-packages/casatasks/private/task_slsearch.py: 100%
17 statements
« prev ^ index » next coverage.py v7.6.4, created at 2024-11-01 07:19 +0000
« prev ^ index » next coverage.py v7.6.4, created at 2024-11-01 07:19 +0000
2##########################################################################
3# task_slsearch.py
4#
5# Copyright (C) 2008, 2009
6# Associated Universities, Inc. Washington DC, USA.
7#
8# This script is free software; you can redistribute it and/or modify it
9# under the terms of the GNU Library General Public License as published by
10# the Free Software Foundation; either version 2 of the License, or (at your
11# option) any later version.
12#
13# This library is distributed in the hope that it will be useful, but WITHOUT
14# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
16# License for more details.
17#
18# You should have received a copy of the GNU Library General Public License
19# along with this library; if not, write to the Free Software Foundation,
20# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
21#
22# Correspondence concerning AIPS++ should be adressed as follows:
23# Internet email: casa-feedback@nrao.edu.
24# Postal address: AIPS++ Project Office
25# National Radio Astronomy Observatory
26# 520 Edgemont Road
27# Charlottesville, VA 22903-2475 USA
28#
29# <author>
30# Dave Mehringer
31# </author>
32#
33# <summary>
34# Task to search a spectral line table
35# </summary>
36#
37# <reviewed reviwer="" date="" tests="" demos="">
38# </reviewed>
39#
40# <prerequisite>
41# <ul>
42#
43# </ul>
44# </prerequisite>
45#
46# <etymology>
47# slsearch => s(pectral) l(ine) search
48# </etymology>
49#
50# <synopsis>
51# slsearch searches a spectral line table. It is built on sl.search().
52# </synopsis>
53#
54# <example>
55# newsl = slsearch(table="mysplatlist.tbl")
56#
57# </example>
58#
59# <motivation>
60# To allow splatalogue spectral line lists to be searchable in CASA.
61# </motivation>
62#
63###########################################################################
65from casatools import spectralline
66from casatasks import casalog
68def slsearch(
69 table=None, outfile=None, freqrange=None,
70 species=None, reconly=None, chemnames=None,
71 qns=None, intensity=None, smu2=None,
72 loga=None, el=None, eu=None, rrlinclude=None,
73 rrlonly=None, verbose=None, logfile=None,
74 append=None
75):
76 casalog.origin('slsearch')
77 newsl = None
78 mysl = spectralline()
79 try:
80 newsl = False
81 if (mysl.open(table)):
82 newsl = mysl.search(
83 outfile=outfile, freqrange=freqrange,
84 species=species, reconly=reconly,
85 chemnames=chemnames, qns=qns,
86 intensity=intensity, smu2=smu2,
87 loga=loga, el=el, eu=eu,
88 rrlinclude=rrlinclude, rrlonly=rrlonly,
89 verbose=verbose, logfile=logfile,
90 append=append
91 )
93 if (not newsl):
94 raise RuntimeError("Error when running sl.search()")
95 return True
97 finally:
98 if mysl:
99 mysl.done()
100 if newsl:
101 newsl.done()