Splatalogue — Module for performing splatalogue queries.¶
Module to search Splatalogue.net via splat, modeled loosely on ftp://ftp.cv.nrao.edu/NRAO-staff/bkent/slap/idl/ :author: Adam Ginsburg <adam.g.ginsburg@gmail.com> :updated for CASA: Brian Kent <bkent@nrao.edu> :updated for ADMIT: Douglas Friedel <friedel@illinois.edu>
Dependencies for python requests and astropy modules have been removed.
-
class
admit.util.Splatalogue.
SpeciesLookuptable
[source]¶ Simple class that extends the dictionary class so that keys can be searched
Methods
clear
(() -> None. Remove all items from D.)copy
(() -> a shallow copy of D)find
(s[, flags, return_dict])Search dictionary keys for a regex match to string s fromkeys
(...)v defaults to None. get
((k[,d]) -> D[k] if k in D, ...)has_key
((k) -> True if D has a key k, else False)items
(() -> list of D’s (key, value) pairs, ...)iteritems
(() -> an iterator over the (key, ...)iterkeys
(() -> an iterator over the keys of D)itervalues
(...)keys
(() -> list of D’s keys)pop
((k[,d]) -> v, ...)If key is not found, d is returned if given, otherwise KeyError is raised popitem
(() -> (k, v), ...)2-tuple; but raise KeyError if D is empty. setdefault
((k[,d]) -> D.get(k,d), ...)update
(([E, ...)If E present and has a .keys() method, does: for k in E: D[k] = E[k] values
(() -> list of D’s values)viewitems
(...)viewkeys
(...)viewvalues
(...)-
find
(s, flags=0, return_dict=True)[source]¶ Search dictionary keys for a regex match to string s
Parameters: s : str
String to compile as a regular expression
return_dict : bool
Return a dictionary if true or just the matching values if false. Default: True
flags : int
re (regular expression) flags. Default: 0
Returns: Subset of parent dictionary if return_dict, else list of values
corresponding to matches
-
-
class
admit.util.Splatalogue.
Splatalogue
(**kwargs)[source]¶ Class for searching for lines in the online Splatalogue database. The resulting Splatalogue tables can be returned as a list of dictionaries.
Parameters: kwargs : dict
The keyword value pairs of the arguments, possible keywords are:
- min_frequency : float
Lower limit of frequency search range in GHz. Default: 0.0
- max_frequency : float
Upper limit of frequency search range in GHz. Defualt: 100000.0
- band : str
The frequency band to search in. ‘min/max_frequency’ and ‘band’ are mutually exclusive. If both are given then ‘band’ is preferred. Possibles are
“any”: All bands
“alma3”: ALMA Band 3 (84-116 GHz)
“alma4”: ALMA Band 4 (125-163 GHz)
“alma5”: ALMA Band 5 (163-211 GHz)
“alma6”: ALMA Band 6 (211-275 GHz)
“alma7”: ALMA Band 7 (275-373 GHz)
“alma8”: ALMA Band 8 (385-500 GHz)
“alma9”: ALMA Band 9 (602-720 GHz)
“alma10”: ALMA Band 10 (787-950 GHz)
“pf1”: GBT PF1 (0.29-0.92 GHz)
“pf2”: GBT PF2 (0.91-1.23 GHz)
“l”: GBT/VLA L (1-2 GHz)
“s”: GBT/VLA S (1.7-4 GHz)
“c”: GBT/VLA C (3.9-8 GHz)
“x”: GBT/VLA X (8-12 GHz)
“ku”: GBT/VLA Ku (12-18 GHz)
“kfpa”: GBT KFPA (18-27.5 GHz)
“k”: VLA K (18-26.5 GHz)
“ka”: GBT/VLA Ka (26-40 GHz)
“q”: GBT/VLA Q (38-50 GHz)
“w”: GBT W (67-93.3 GHz)
“mustang”: GBT Mustang (80-100 GHz)
Default: ‘any’
- top20 : list
Limit results to the given top20 list(s). Possibles are:
‘comet’: molecules most likely found in comets
‘planet’: molecules most likely planetary atmospheres
‘top20’: most common molecules
‘ism_hotcore’: molecules most likely found in hot cores
‘ism_darkcloud’: molecules most likely found in dark clouds
‘ism_diffusecloud’: molecules most likely found in diffuse clouds
Default: None
- chemical_name : str
Limit results to the specified chemical, by name. Default: ‘’
- line_lists : list
Which line list(s) to use for the search. Possibles are:
‘Lovas’: Search the Lovas/NIST list of molecules
‘SLAIM’: Search the SLAIM list of molecules
‘JPL’: Search the Jet Propulsion Lab list of molecules
‘CDMS’: Search the Cologne database of molecules
‘ToyoMA’: Search the ToyoMA list of moleules
‘OSU’: Search the Ohio State list of molecules
‘Recomb’: Search for recombination lines
‘Lisa’: Search the TopModel list
‘RFI’: Search for radio frequency interference lines
Default: [‘Lovas’, ‘SLAIM’, ‘JPL’, ‘CDMS’, ‘ToyoMA’, ‘OSU’, ‘Recomb’, ‘Lisa’, ‘RFI’]
- line_strengths : list
Which line strength units should be reported, several can be given. Possibles are:
‘ls1’: JPL/CDMS
‘ls2’: Sijmu^2
‘ls3’: Sij
‘ls4’: Aij
‘ls5’: Lovas/SLAIM
Default: (‘ls1’, ‘ls2’, ‘ls3’, ‘ls4’, ‘ls5’)
- energy_levels : list
Which energies should be reported. Possibles are:
‘el1’: Lower state in cm^-1
‘el2’: Lower state in K
‘el3’: Upper state in cm^-1
‘el4’: Upper state in K
Default: [‘el1’, ‘el2’, ‘el3’, ‘el4’]
- exclude : list
Which types of molecules to exclude from the search. Possibles are:
‘potential’: Species that may be found in the ISM
‘atmospheric’: Species know to be in the Earth’s atmosphere
‘probable’: Species that might be found in the ISM
Default: [‘potential’, ‘atmospheric’, ‘probable’]
- version : str
Which Splatalogue interface is being used. Default: ‘v2.0’
- only_NRAO_recommended : bool
Only return lines that are recommended by NROA. Can eliminate duplicate lines from multiple databases. Default: False
- export : bool
Wherther splatalogue should return an export formatted list rather than HTML. Default: True
- export_limit : int
The maximum number of lines to return. Default: 10000
- noHFS : bool
Whether or not to suppress hyperfine components in the results. Default: False
- displayHFS : bool
Whether or not to return the hyperfine line strength. Default: False
- show_unres_qn : bool
Whether or not to return the unresolved quantum numbers. Typically in a machine readable format. Default: False
- show_upper_degeneracy : bool
Whether or not th return the upper state degeneracy of each transition. Default: False
- show_molecule_tag : bool
Whether or not to return the molecule tag. Default: False
- show_qn_code : bool
Whether or not to return the quantum number encoding (the encoding of ‘show_unres_qn’). Default: False
- show_lovas_labref : bool
Whether or not to return the lab reference frequency from the Lovas/NIST list. Default: False
- show_lovas_obsref : bool
Whether or not to return the observational reference from the Loval/NIST list. Default: False
- show_orderedfreq_only : bool
Default: False
- show_nrao_recommended : bool
Whether or not to return the NRAO recommended rest frequency. Default: False
- chem_re_flags : int
Default: 0
- energy_min : float
Minimum lower/upper state energy to search for. Units are specified in ‘energy_type’. Default None
- energy_max : float
Maximum lower/upper state energy to search for. Units are specified in ‘energy_type’. Default None
- energy_type : str
The energy units for the ‘energy_min’ and ‘energy_max’ columns. Possibles are:
‘el_cm1’: Lower state in cm^-1
‘el_k’: Lower state in K
‘eu_cm1’: Upper state in cm^-1
‘eu_k’: Upper state in K
Default: None
- intensity_lower_limit : float
Lower limit for the transition strength, units are specified in ‘intensity_type’. Default: None
- intensity_type : str
The units for the ‘intensity_lower_limit’ parameter. Possibles are:
‘cdms_jpl’: Cologne database/JPL intensity units
‘aij’: Einstein A units
- ‘sijmu2’: Smu^2, line strength times the square of the relevant dipole
moment
Default: None
- transition : str
Seach for a specific transition (i.e. ‘(1-0)’‘). Default: None
- fel : bool
Whether or not to remove results that have an uncertainty of over 50 MHz. Default: False
Examples
>>> from splatalogue import Splatalogue >>> sp = Splatalogue #Create an object of type Splatalogue
>>> # Query by frequency range in units of GHz >>> sp.query_lines(min_frequency=114.0, max_frequency=116.0)
>>> # Query by frequency range and chemical name >>> sp.query_lines(min_frequency=114.0, max_frequency=116.0, chemical_name=" CO ")
>>> # Query by frequency range (no keywords needed and chemical name) >>> sp.query_lines(0.1,1000.0, chemical_name='Ethylene Glycol')
>>> # Query by line list and energy >>> sp.query_lines(218.40, 218.50, energy_max=300, energy_type='eu_k', line_lists='JPL')
>>> # Parse response into a list of dictionaries and store in result >>> result = sp.parse_response()
Attributes
None Methods
get_species_ids
([restr, reflags])Get a dictionary of “species” IDs, where species refers to the molecule name, mass, and chemical composition. parse_response
()Parse a response (of type urllib2.urlopen) into a list of dictionaries. query_lines
([min_frequency, max_frequency])Query Splatalogue for transitions between min_frequency and max_frequency with the given kwargs. set_default_options
(\*\*kwargs)Method to modify the default options. -
ALL_LINE_LISTS
= ('Lovas', 'SLAIM', 'JPL', 'CDMS', 'ToyoMA', 'OSU', 'Recomb', 'Lisa', 'RFI')¶
-
FREQUENCY_BANDS
= {'pf1': 'GBT PF1 (0.29-0.92 GHz)', 'pf2': 'GBT PF2 (0.91-1.23 GHz)', 'mustang': 'GBT Mustang (80-100 GHz)', 'any': 'Any', 'kfpa': 'GBT KFPA (18-27.5 GHz)', 'alma10': 'ALMA Band 10 (787-950 GHz)', 'ku': ' GBT/VLA Ku (12-18 GHz)', 'ka': ' GBT/VLA Ka (26-40 GHz)', 'alma6': 'ALMA Band 6 (211-275 GHz)', 'alma7': 'ALMA Band 7 (275-373 GHz)', 'alma4': ' ALMA Band 4 (125-163 GHz)', 'alma5': ' ALMA Band 5 (163-211 GHz)', 'alma3': 'ALMA Band 3 (84-116 GHz)', 'alma8': 'ALMA Band 8 (385-500 GHz)', 'alma9': 'ALMA Band 9 (602-720 GHz)', 'c': 'GBT/VLA C (3.9-8 GHz)', 'k': 'VLA K (18-26.5 GHz)', 'l': 'GBT/VLA L (1-2 GHz)', 'q': 'GBT/VLA Q (38-50 GHz)', 's': 'GBT/VLA S (1.7-4 GHz)', 'w': 'GBT W (67-93.3 GHz)', 'x': 'GBT/VLA X (8-12 GHz)'}¶
-
LINES_LIMIT
= 10000¶
-
QUERY_URL
= 'http://www.cv.nrao.edu/php/splat/c_export.php'¶
-
TIMEOUT
= 60¶
-
TOP20_LIST
= ('comet', 'planet', 'top20', 'ism_hotcore', 'ism_darkcloud', 'ism_diffusecloud')¶
-
get_species_ids
(restr=None, reflags=0)[source]¶ Get a dictionary of “species” IDs, where species refers to the molecule name, mass, and chemical composition.
Parameters: restr : str
String to compile into an re, if specified. Searches table for species whose names match. Default: None
reflags : int
Flags to pass to re. Default: 0
Returns: The id of the species
-
parse_response
()[source]¶ Parse a response (of type urllib2.urlopen) into a list of dictionaries.
Parameters: None Returns: A dictonary of the response
-
query_lines
(min_frequency=None, max_frequency=None, **kwargs)[source]¶ Query Splatalogue for transitions between min_frequency and max_frequency with the given kwargs.
Parameters: min_frequency : float
The starting frequency for the search in GHz. Default: None
max_frequency : float
The ending frequency for the search in GHz. Default: None
kwargs : dict
Any additional arguments for the search.
Returns: response : requests.Response
The response of the HTTP request.
-
set_default_options
(**kwargs)[source]¶ Method to modify the default options.
Parameters: kwargs : dict
See the class description for the key words and their meaning
Returns: None
-
versions
= ('v1.0', 'v2.0')¶
-
admit.util.Splatalogue.
clean_column_headings
(header, renaming_dict={'Resolved QNs': 'QNs', 'Log<sub>10</sub> (A<sub>ij</sub>)': 'log10(Aij)', 'E_U (K)': 'EU_K', 'S<sub>ij</sub>': 'Sij'})[source]¶ Rename column headings to shorter version that are easier for display on-screen / at the terminal
Parameters: header : dict
A dictionary of the header keywords
renaming_dict : dict
A dictionary containing the old names (as the key) and the new names (as the value)
Returns: The new header.