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_splattotable 00013 def splattotable(filenames=[''], table='', wantreturn=True): 00014 00015 """Convert a downloaded Splatalogue spectral line list to a casa table. 00016 PARAMETER SUMMARY 00017 filenames Files containing Splatalogue lists. 00018 table Output table name. 00019 wantreturn Do you want the task to return a spectralline tool attached to the results table? If not false is returned. 00020 00021 This task reads a spectral line list(s) downloaded from Splatalogue (www.splatalogue.net) and loads it into a CASA table which 00022 can be queried via eg the slsearch task. 00023 00024 REQUIRMENTS OF THE DOWNLOADED FILES 00025 00026 The downloaded files must be in a specific format for this task to succeed. The columns are the 00027 important things; one can filter the results as one desires using Splatalogue, but the particular columns must be present as described 00028 below. The columns which must be present in the downloaded file in this exact order are: "Species", "NRAO Recommended", "Chemical Name", 00029 "Freq in GHz", "Resolved QNs", "CDMS/JPL Intensity", "Sijmu2 (D2)", 00030 "Log10 (Aij)", "EL (K)", "EU (K)", "Linelist". In order to get these columns in this order, one should 00031 select exactly the following items on the Splatalogue search interface. Under "Specify Ranges" one should select "GHz" for the frequency unit. 00032 Under "Line Strength Display" select exactly "CDMS/JPL Intensity", 00033 "Sij mu2", and "Aij". Under "Energy Levels", one should select exactly "Elower (K)" and "Eupper (K)". Under "Miscellaneous", one should 00034 select exactly "Display Ordered Frequency ONLY" and "Display NRAO Recommended Frequencies". One should then initiate the search and on 00035 the resulting page, one should select the Tab Field Separator and then export the list. The resulting list should be in the proper 00036 format for importing into CASA. 00037 00038 RETURN VALUE 00039 This task returns an open spectralline tool which references the new table if wantarray=true. The new table can also be opened by 00040 a spectralline tool using the open method (eg sl.open(tablename)). False is returned if wantarray=false. 00041 00042 00043 newsl = splattotable("mysplatlist.txt", "mynewsl.tbl", true) 00044 00045 00046 00047 """ 00048 if type(filenames)==str: filenames=[filenames] 00049 00050 # 00051 # The following is work around to avoid a bug with current python translation 00052 # 00053 mytmp = {} 00054 00055 mytmp['filenames'] = filenames 00056 mytmp['table'] = table 00057 mytmp['wantreturn'] = wantreturn 00058 pathname='file:///'+os.environ.get('CASAPATH').split()[0]+'/share/xml/' 00059 trec = casac.utils().torecord(pathname+'splattotable.xml') 00060 00061 casalog.origin('splattotable') 00062 if trec.has_key('splattotable') and casac.utils().verify(mytmp, trec['splattotable']) : 00063 result = task_splattotable.splattotable(filenames, table, wantreturn) 00064 00065 else : 00066 result = False 00067 return result