casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables
task_slsearch.py
Go to the documentation of this file.
00001 
00002 ##########################################################################
00003 # task_slsearch.py
00004 #
00005 # Copyright (C) 2008, 2009
00006 # Associated Universities, Inc. Washington DC, USA.
00007 #
00008 # This script is free software; you can redistribute it and/or modify it
00009 # under the terms of the GNU Library General Public License as published by
00010 # the Free Software Foundation; either version 2 of the License, or (at your
00011 # option) any later version.
00012 #
00013 # This library is distributed in the hope that it will be useful, but WITHOUT
00014 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00015 # FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
00016 # License for more details.
00017 #
00018 # You should have received a copy of the GNU Library General Public License
00019 # along with this library; if not, write to the Free Software Foundation,
00020 # Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
00021 #
00022 # Correspondence concerning AIPS++ should be adressed as follows:
00023 #        Internet email: aips2-request@nrao.edu.
00024 #        Postal address: AIPS++ Project Office
00025 #                        National Radio Astronomy Observatory
00026 #                        520 Edgemont Road
00027 #                        Charlottesville, VA 22903-2475 USA
00028 #
00029 # <author>
00030 # Dave Mehringer
00031 # </author>
00032 #
00033 # <summary>
00034 # Task to search a spectral line table
00035 # </summary>
00036 #
00037 # <reviewed reviwer="" date="" tests="" demos="">
00038 # </reviewed>
00039 #
00040 # <prerequisite>
00041 # <ul>
00042 #
00043 # </ul>
00044 # </prerequisite>
00045 #
00046 # <etymology>
00047 # slsearch => s(pectral) l(ine) search
00048 # </etymology>
00049 #
00050 # <synopsis>
00051 # slsearch searches a spectral line table. It is built on sl.search().
00052 # </synopsis> 
00053 #
00054 # <example>
00055 # newsl = slsearch(table="mysplatlist.tbl")
00056 #
00057 # </example>
00058 #
00059 # <motivation>
00060 # To allow splatalogue spectral line lists to be searchable in CASA.
00061 # </motivation>
00062 #
00063 ###########################################################################
00064 from taskinit import *
00065 
00066 def slsearch(
00067     table=None, outfile=None, freqrange=None,
00068     species=None, reconly=None, chemnames=None,
00069     qns=None, intensity=None, smu2=None,
00070     loga=None, el=None, eu=None, rrlinclude=None,
00071     rrlonly=None, verbose=None, logfile=None, 
00072     append=None, wantreturn=None
00073 ):
00074     casalog.origin('slsearch')
00075     newsl = None
00076     mysl = sltool()
00077     try:
00078         mysl.open(table)
00079         newsl = mysl.search(
00080             outfile=outfile, freqrange=freqrange,
00081             species=species, reconly=reconly,
00082             chemnames=chemnames, qns=qns,
00083             intensity=intensity, smu2=smu2,
00084             loga=loga, el=el, eu=eu,
00085             rrlinclude=rrlinclude, rrlonly=rrlonly,
00086             verbose=verbose, logfile=logfile,
00087             append=append
00088         )
00089             
00090         if (not newsl):
00091             raise Exception, "Exception when running sl.search()"
00092     except Exception, instance:
00093         casalog.post( str( '*** Error ***') + str(instance), 'SEVERE')
00094         newsl = None
00095     mysl.done()
00096     if (wantreturn):
00097         return newsl
00098     else:
00099         if (newsl):
00100             newsl.done()
00101         return False