casa
$Rev:20696$
|
00001 # 00002 # This file was generated using xslt from its XML file 00003 # 00004 # Copyright 2009, Associated Universities Inc., Washington DC 00005 # 00006 import sys 00007 import os 00008 from casac import * 00009 import string 00010 from taskinit import casalog 00011 #from taskmanager import tm 00012 import task_slsearch 00013 def slsearch(tablename='', outfile='', freqrange=[84,90], species=[''], reconly=False, chemnames=[''], qns=[''], intensity=[-1], smu2=[-1], loga=[-1], el=[-1], eu=[-1], rrlinclude=True, rrlonly=False, verbose=False, logfile='""', append=False, wantreturn=True): 00014 00015 """Search a spectral line table. 00016 00017 PARAMETER SUMMARY 00018 00019 tablename Input spectral line table name to search. If not specified, use the default table in the system. 00020 outfile Results table name. Blank means do not write the table to disk. 00021 freqrange Frequency range in GHz. 00022 species Species to search for. 00023 reconly List only NRAO recommended frequencies. 00024 chemnames Chemical names to search for. 00025 qns Resolved quantum numbers to search for. 00026 intensity CDMS/JPL intensity range. -1 -> do not use an intensity range. 00027 smu2 S*mu*mu range in Debye**2. -1 -> do not use an S*mu*mu range. 00028 loga log(A) (Einstein coefficient) range. -1 -> do not use a loga range. 00029 el Lower energy state range in Kelvin. -1 -> do not use an el range. 00030 eu Upper energy state range in Kelvin. -1 -> do not use an eu range. 00031 rrlinclude Include RRLs in the result set? 00032 rrlonly Include only RRLs in the result set? 00033 verbose List result set to logger (and optionally logfile)? 00034 logfile List result set to this logfile (only used if verbose=True). 00035 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. 00036 wantreturn If true, return the spectralline tool associated with the result set. 00037 00038 Search the specfied spectral line table. The return value (if wantreturn=true) is a spectralline tool with a new table containing the search 00039 results. This new table can be written to disk by specifying its name in the outfile parameter. If outfile is not specified 00040 (ie outfile=""), the resulting table is held in memory and deleted upon a call to close() or done() for the newly created tool 00041 or upon exiting casapy if wantreturn=True or immediately upon completion of task execution if wantreturn=False. Because Splatalogue does not have values for intensity, smu2, loga, eu, and el 00042 for radio recombination lines (rrls), one must specify to include rrls in the specified frequency range in the output. In this case, 00043 RRLs will be included ignoring any filters on intensity, smu2, loga, eu, and el. One can also specify to list only RRLs. One can specify 00044 to list the search results to the logger via the verbose parameter. If verbose is False, no logger output is listed, although the results 00045 can be listed later by running the sl.list() method on the newly created spectral line tool if wantreturn=True. If verbose=True, one can also specify that 00046 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 00047 it with the results. 00048 00049 slrestool = slsearch("myspectrallines.tbl", verbose=False) 00050 # do a search postponing listing the results to the logger. 00051 slrestool = sl.search(outfile="myresults.tbl", freqrange = [200,300], species=['HOCN', 'HOCO+']) 00052 # now list the results 00053 slrestool.list() 00054 # or one could also do the following after exiting and restarting casapy 00055 sl.open("myresults.tbl") 00056 sl.list() 00057 00058 00059 00060 """ 00061 if type(freqrange)==float: freqrange=[freqrange] 00062 if type(species)==str: species=[species] 00063 if type(chemnames)==str: chemnames=[chemnames] 00064 if type(qns)==str: qns=[qns] 00065 if type(intensity)==float: intensity=[intensity] 00066 if type(smu2)==float: smu2=[smu2] 00067 if type(loga)==float: loga=[loga] 00068 if type(el)==float: el=[el] 00069 if type(eu)==float: eu=[eu] 00070 00071 # 00072 # The following is work around to avoid a bug with current python translation 00073 # 00074 mytmp = {} 00075 00076 mytmp['tablename'] = tablename 00077 mytmp['outfile'] = outfile 00078 mytmp['freqrange'] = freqrange 00079 mytmp['species'] = species 00080 mytmp['reconly'] = reconly 00081 mytmp['chemnames'] = chemnames 00082 mytmp['qns'] = qns 00083 mytmp['intensity'] = intensity 00084 mytmp['smu2'] = smu2 00085 mytmp['loga'] = loga 00086 mytmp['el'] = el 00087 mytmp['eu'] = eu 00088 mytmp['rrlinclude'] = rrlinclude 00089 mytmp['rrlonly'] = rrlonly 00090 mytmp['verbose'] = verbose 00091 mytmp['logfile'] = logfile 00092 mytmp['append'] = append 00093 mytmp['wantreturn'] = wantreturn 00094 pathname='file:///'+os.environ.get('CASAPATH').split()[0]+'/share/xml/' 00095 trec = casac.utils().torecord(pathname+'slsearch.xml') 00096 00097 casalog.origin('slsearch') 00098 if trec.has_key('slsearch') and casac.utils().verify(mytmp, trec['slsearch']) : 00099 result = task_slsearch.slsearch(tablename, outfile, freqrange, species, reconly, chemnames, qns, intensity, smu2, loga, el, eu, rrlinclude, rrlonly, verbose, logfile, append, wantreturn) 00100 00101 else : 00102 result = False 00103 return result