CDMSClass

class astroquery.linelists.cdms.CDMSClass(*, fallback_to_getmolecule=False)[source]

Bases: BaseQuery

CDMS line list query class

Parameters:
fallback_to_getmoleculebool, optional

If True, when a molecule is requested that results in a malformatted or unparseable response, get_molecule will be attempted automatically to retrieve the full catalog for that molecule. In this case, no frequency-based selection will be applied.

Attributes Summary

CLASSIC_URL

MALFORMATTED_MOLECULE_LIST

SERVER

TIMEOUT

URL

Methods Summary

get_molecule(molecule_id, *[, cache, ...])

Retrieve the whole molecule table for a given molecule id

get_species_table(*[, catfile, use_cached, ...])

A directory of the catalog is found in a file called 'catdir.cat.'

query_lines(min_frequency, max_frequency, *)

Queries the service and returns a table object.

query_lines_async(min_frequency, ...[, ...])

Creates an HTTP POST request based on the desired parameters and returns a response.

Attributes Documentation

CLASSIC_URL = 'https://cdms.astro.uni-koeln.de/classic'
MALFORMATTED_MOLECULE_LIST = ['017506 NH3-wHFS', '028528 H2NC', '058501 H2C2S', '064527 HC3HCN']
SERVER = 'https://cdms.astro.uni-koeln.de/'
TIMEOUT = 60
URL = 'https://cdms.astro.uni-koeln.de/cgi-bin/cdmssearch'

Methods Documentation

get_molecule(molecule_id, *, cache=True, return_response=False)[source]

Retrieve the whole molecule table for a given molecule id

Parameters:
molecule_idint or str

The molecule tag/identifier. Can be an integer (e.g., 18003 for H2O) or a zero-padded 6-character string (e.g., ‘018003’).

cachebool

Defaults to True. If set overrides global caching behavior. See caching documentation.

return_responsebool, optional

If True, return the raw requests.Response object instead of parsing the response. If this is set, the response will be returned whether or not it was successful. Default is False.

get_species_table(*, catfile='partfunc.cat', use_cached=True, catfile_url='https://cdms.astro.uni-koeln.de/classic/entries/partition_function.html', catfile2='catdir.cat', catfile_url2='https://cdms.astro.uni-koeln.de/classic/predictions/catalog/catdir.html', write_new_species_cache=False)[source]

A directory of the catalog is found in a file called ‘catdir.cat.’

The table is derived from https://cdms.astro.uni-koeln.de/classic/entries/partition_function.html

Parameters:
catfilestr, name of file, default ‘catdir.cat’

The catalog file, installed locally along with the package

use_cachedbool, optional

If True, use the cached file if it exists. If False, download the file from the CDMS server and save it to the cache if write_new_species_cache is set.

write_new_species_cachebool, optional

Overrides ``use_cached=True``. If True, write the species data table files to the CDMS data directory. Use this option if you need to update the index from CDMS; this should be set to False for testing.

Returns:
Table: Table
tag : The species tag or molecular identifier.
molecule : An ASCII name for the species.
#line : The number of lines in the catalog.
lg(Q(n)) : A seven-element vector containing the base 10 logarithm of the partition function.
query_lines(min_frequency, max_frequency, *, min_strength=-500, molecule='All', temperature_for_intensity=300, flags=0, parse_name_locally=False, get_query_payload=False, fallback_to_getmolecule=False, verbose=False, cache=True)[source]

Queries the service and returns a table object.

Creates an HTTP POST request based on the desired parameters and returns a response.

Parameters:
min_frequencyastropy.units.Quantity or None

Minimum frequency (or any spectral() equivalent). None can be interpreted as zero.

max_frequencyastropy.units.Quantity or None

Maximum frequency (or any spectral() equivalent). None can be interpreted as infinite.

min_strengthint, optional

Minimum strength in catalog units, the default is -500

moleculelist or string if parse_name_locally=False,

string of regex if parse_name_locally=True, optional Identifiers of the molecules to search for. If this parameter is not provided the search will match any species. Default is ‘All’. As a first pass, the molecule will be searched for with a direct string match. If no string match is found, a regular expression match is attempted. Note that if the molecule name regex contains parentheses, they must be escaped. For example, ‘H2C(CN)2.*’ must be specified as ‘H2C(CN)2.*’ (but because of the first-attempt full-string matching, ‘H2C(CN)2’ will match that molecule successfully).

temperature_for_intensityfloat

The temperature to use when computing the intensity Smu^2. Set to 300 by default for compatibility with JPL and the native catalog format, which defaults to 300. ** If temperature is set to zero, the return value in this column will be the Einstein A value **

flagsint, optional

Regular expression flags. Default is set to 0

parse_name_locallybool, optional

When set to True it allows the method to parse through catdir.cat (see get_species_table) in order to match the regex inputted in the molecule parameter and request the corresponding tags of the matches instead. Default is set to False

get_query_payloadbool, optional

When set to True the method should return the HTTP request parameters as a dict. Default value is set to False

cachebool

Defaults to True. If set overrides global caching behavior. See caching documentation.

Returns:
tableA Table object.

Examples

>>> table = CDMS.query_lines(min_frequency=100*u.GHz,
...                          max_frequency=110*u.GHz,
...                          min_strength=-500,
...                          molecule="018505 H2O+")
>>> print(table)
    FREQ     ERR   LGINT   DR   ELO    GUP  TAG  QNFMT  Ju  Ku  vu  Jl  Kl  vl      F      name
    MHz      MHz  MHz nm2      1 / cm
----------- ----- ------- --- -------- --- ----- ----- --- --- --- --- --- --- ----------- ----
103614.4941 2.237 -4.1826   3 202.8941   8 18505  2356   4   1   4   4   0   4 3 2 1 3 0 3 H2O+
107814.8763 148.6 -5.4438   3 878.1191  12 18505  2356   6   5   1   7   1   6 7 4 4 8 1 7 H2O+
107822.3481 148.6 -5.3846   3 878.1178  14 18505  2356   6   5   1   7   1   7 7 4 4 8 1 8 H2O+
107830.1216 148.6 -5.3256   3 878.1164  16 18505  2356   6   5   1   7   1   8 7 4 4 8 1 9 H2O+
query_lines_async(min_frequency, max_frequency, *, min_strength=-500, molecule='All', temperature_for_intensity=300, flags=0, parse_name_locally=False, get_query_payload=False, cache=True)[source]

Creates an HTTP POST request based on the desired parameters and returns a response.

Parameters:
min_frequencyastropy.units.Quantity or None

Minimum frequency (or any spectral() equivalent). None can be interpreted as zero.

max_frequencyastropy.units.Quantity or None

Maximum frequency (or any spectral() equivalent). None can be interpreted as infinite.

min_strengthint, optional

Minimum strength in catalog units, the default is -500

moleculelist or string if parse_name_locally=False,

string of regex if parse_name_locally=True, optional Identifiers of the molecules to search for. If this parameter is not provided the search will match any species. Default is ‘All’. As a first pass, the molecule will be searched for with a direct string match. If no string match is found, a regular expression match is attempted. Note that if the molecule name regex contains parentheses, they must be escaped. For example, ‘H2C(CN)2.*’ must be specified as ‘H2C(CN)2.*’ (but because of the first-attempt full-string matching, ‘H2C(CN)2’ will match that molecule successfully).

temperature_for_intensityfloat

The temperature to use when computing the intensity Smu^2. Set to 300 by default for compatibility with JPL and the native catalog format, which defaults to 300. ** If temperature is set to zero, the return value in this column will be the Einstein A value **

flagsint, optional

Regular expression flags. Default is set to 0

parse_name_locallybool, optional

When set to True it allows the method to parse through catdir.cat (see get_species_table) in order to match the regex inputted in the molecule parameter and request the corresponding tags of the matches instead. Default is set to False

get_query_payloadbool, optional

When set to True the method should return the HTTP request parameters as a dict. Default value is set to False

cachebool

Defaults to True. If set overrides global caching behavior. See caching documentation.

Returns:
responserequests.Response

The HTTP response returned from the service.

Examples

>>> table = CDMS.query_lines(min_frequency=100*u.GHz,
...                          max_frequency=110*u.GHz,
...                          min_strength=-500,
...                          molecule="018505 H2O+")
>>> print(table)
    FREQ     ERR   LGINT   DR   ELO    GUP  TAG  QNFMT  Ju  Ku  vu  Jl  Kl  vl      F      name
    MHz      MHz  MHz nm2      1 / cm
----------- ----- ------- --- -------- --- ----- ----- --- --- --- --- --- --- ----------- ----
103614.4941 2.237 -4.1826   3 202.8941   8 18505  2356   4   1   4   4   0   4 3 2 1 3 0 3 H2O+
107814.8763 148.6 -5.4438   3 878.1191  12 18505  2356   6   5   1   7   1   6 7 4 4 8 1 7 H2O+
107822.3481 148.6 -5.3846   3 878.1178  14 18505  2356   6   5   1   7   1   7 7 4 4 8 1 8 H2O+
107830.1216 148.6 -5.3256   3 878.1164  16 18505  2356   6   5   1   7   1   8 7 4 4 8 1 9 H2O+