Tier1DB — Tier 1 molecular line database services.

This module is used to interact with the Tier 1 database.

class admit.util.Tier1DB.Tier1DB[source]

Class for interacting with the Tier 1 database. Methods are supplied to query the database and get restults of the query. See the DOCUMENTATION on the Tier 1 database for specifics.

Parameters:None

Attributes

conn (sql connection) The main sql database connection.
cursor (sql cursor) The cursor used to interact with the database.

Methods

add(string) Method to append to the query string, automatically adding where/and if necessary.
close() Method to cleanly close the database connection
get(num) Method to get many results from the query
getall() Method to get all results from the query
getone() Method to get the next result from the query
query(querystring) Method to execute the requested query against the transitions database
searchhfs(hfsid) Method to search the HFS table for the requested transitions
searchtransitions([freq, eu, el, linestr, ...]) Method to construct the query and send it to the database.
add(string)[source]

Method to append to the query string, automatically adding where/and if necessary.

Parameters:

string : str

The string to add to the query

Returns:

None

close()[source]

Method to cleanly close the database connection

Parameters:None
Returns:None
get(num)[source]

Method to get many results from the query

Parameters:

num : int

The number of results to get

Returns:

A tuple containing the requested results as a list

getall()[source]

Method to get all results from the query

Parameters:None
Returns:List of LineData objects, one for each transition
getone()[source]

Method to get the next result from the query

Parameters:None
Returns:LineData object containing the transition data
query(querystring)[source]

Method to execute the requested query against the transitions database

Parameters:

query : str

The query to perform, no error checking is done

Returns:

None

searchhfs(hfsid)[source]

Method to search the HFS table for the requested transitions

Parameters:

hfsid : int

The id of the HFS line to get

Returns:

None

searchtransitions(freq=[], eu=[], el=[], linestr=[], species=None)[source]

Method to construct the query and send it to the database.

Parameters:

freq : list or float

The frequency range to search over. If a list is given it is treated as [min,max]. If a single float is given then it is treated as a maximum allowable frequency. The units are GHz.

eu : list or float

The upper energy range to search over. If a list is given it is treated as [min,max]. If a single float is given then it is treated as a maximum allowable upper state energy.

el : list or float

The lower energy range to search over. If a list is given it is treated as [min,max]. If a single float is given then it is treated as a maximum allowable lower state energy.

linestr : list or float

The line strength range to search over. If a list is given it is treated as [min,max]. If a single float is given then it is treated as a maximum allowable line strength.

species : str

The species to restrict the search to. It is executed as an sql “like” statement, and thus an exact match is not required.