Coverage for /wheeldirectory/casa-6.7.0-12-py3.10.el8/lib/py/lib/python3.10/site-packages/casatasks/private/task_splattotable.py: 94%
16 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
1##########################################################################
2# task_splattotable.py
3#
4# Copyright (C) 2008, 2009
5# Associated Universities, Inc. Washington DC, USA.
6#
7# This script is free software; you can redistribute it and/or modify it
8# under the terms of the GNU Library General Public License as published by
9# the Free Software Foundation; either version 2 of the License, or (at your
10# option) any later version.
11#
12# This library is distributed in the hope that it will be useful, but WITHOUT
13# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
15# License for more details.
16#
17# You should have received a copy of the GNU Library General Public License
18# along with this library; if not, write to the Free Software Foundation,
19# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
20#
21# Correspondence concerning AIPS++ should be adressed as follows:
22# Internet email: casa-feedback@nrao.edu.
23# Postal address: AIPS++ Project Office
24# National Radio Astronomy Observatory
25# 520 Edgemont Road
26# Charlottesville, VA 22903-2475 USA
27#
28# <author>
29# Dave Mehringer
30# </author>
31#
32# <summary>
33# Task to convert a spectral line list exported from Splatalogue (www.splatalogue.net) to a CASA table
34# </summary>
35#
36# <reviewed reviwer="" date="" tests="" demos="">
37# </reviewed>
38#
39# <prerequisite>
40# <ul>
41#
42# </ul>
43# </prerequisite>
44#
45# <etymology>
46# splattotable => splat(alogue) to (CASA) table
47# </etymology>
48#
49# <synopsis>
50# splattotable converts a splatalogue spectral line list to a CASA table. It is built on sl.splattotable.
51# </synopsis>
52#
53# <example>
54# newsl = splattotable("mysplatlist.txt", "mynewsl.tbl", true)
55#
56# </example>
57#
58# <motivation>
59# To allow splatalogue spectral line lists to be searchable in CASA.
60# </motivation>
61#
62###########################################################################
64from casatools import spectralline
65from casatasks import casalog
67def splattotable(filenames=None, table=None):
68 casalog.origin('splattotable')
69 newsl = None
70 mysl = spectralline()
72 try:
73 if (len(table) == 0):
74 raise ValueError("table must be specified.")
75 newsl = mysl.splattotable(filenames=filenames, table=table)
76 if (not newsl):
77 raise RuntimeError("Error when running sl.splattotable")
79 finally:
80 if newsl:
81 newsl.done()
82 if mysl:
83 mysl.done()