Spectral line search classes and functions#
Classes and functions associated with searching spectral line databases
- class dysh.line.SpectralLineSearchClass[source]#
Bases:
object- Attributes:
colnamesReturns ——- colname : list The list of column names present in the default returned table.
Methods
Clear the local caches.
get_species_ids(species_regex[, reflags, ...])Convenience call-through to
get_species_id().localquery(min_frequency, max_frequency[, ...])Query a local file for lines and return a table object.
query_lines(min_frequency, max_frequency[, ...])Query locally or remotely for lines and return a table object.
recomb(min_frequency, max_frequency, line[, ...])Search for recombination lines of H, He, and C.
recomball(min_frequency, max_frequency[, ...])Fetch all recombination lines of H, He, C in the given frequency range from the catalog.
- clear_cache()[source]#
Clear the local caches. This will clear the Splatalogue cache and any local tables that have been cached.
See https://astroquery.readthedocs.io/en/stable/splatalogue/splatalogue.html#troubleshooting
- Returns:
- None.
- property colnames#
- Returns:
- colnamelist
The list of column names present in the default returned table. You can choose a subset of these when performing a search.
- get_species_ids(species_regex, reflags=0, recache=False)[source]#
Convenience call-through to
get_species_id().Get a dictionary of “species” IDs, where species refers to the molecule name, mass, and chemical composition.
- Parameters:
Examples
>>> import re >>> import pprint # unfortunate hack required for documentation testing >>> rslt = Splatalogue.get_species_ids(species_regex='Formaldehyde') >>> pprint.pprint(rslt) {'03023 H2CO - Formaldehyde': '194', '03106 H213CO - Formaldehyde': '324', '03107 HDCO - Formaldehyde': '109', '03108 H2C17O - Formaldehyde': '982', '03202 H2C18O - Formaldehyde': '155', '03203 D2CO - Formaldehyde': '94', '03204 HD13CO - Formaldehyde': '1219', '03301 D213CO - Formaldehyde': '1220', '03315 HDC18O - Formaldehyde': '21141', '03410 D2C18O - Formaldehyde': '21140'} >>> rslt = Splatalogue.get_species_ids(species_regex='H2CO') >>> pprint.pprint(rslt) {'03023 H2CO - Formaldehyde': '194', '03109 H2COH+ - Hydroxymethylium ion': '224', '04406 c-H2COCH2 - Ethylene Oxide': '21', '06029 NH2CONH2 - Urea': '21166', '07510 H2NCH2COOH - I v=0 - Glycine': '389', '07511 H2NCH2COOH - I v=1 - Glycine': '1312', '07512 H2NCH2COOH - I v=2 - Glycine': '1313', '07513 H2NCH2COOH - II v=0 - Glycine': '262', '07514 H2NCH2COOH - II v=1 - Glycine': '1314', '07515 H2NCH2COOH - II v=2 - Glycine': '1315', '07517 NH2CO2CH3 v=0 - Methyl Carbamate': '1334', '07518 NH2CO2CH3 v=1 - Methyl Carbamate': '1335', '08902 CH3CHNH2COOH - I - α-Alanine': '1321', '08903 CH3CHNH2COOH - II - α-Alanine': '1322'} >>> # note the whitespace, preventing H2CO within other >>> # more complex molecules >>> Splatalogue.get_species_ids(species_regex=' H2CO ') {'03023 H2CO - Formaldehyde': '194'} >>> Splatalogue.get_species_ids(species_regex=' h2co ', reflags=re.IGNORECASE) {'03023 H2CO - Formaldehyde': '194'}
- localquery(min_frequency: ~astropy.units.quantity.Quantity, max_frequency: ~astropy.units.quantity.Quantity, cat: ~typing.Literal[<generator object SpectralLineSearchClass.<genexpr> at 0x77aedad67760>] | ~pathlib.Path = 'gbtlines', columns: str | list = ['species_id', 'name', 'chemical_name', 'resolved_QNs', 'linelist', 'LovasASTIntensity', 'lower_state_energy', 'upper_state_energy', 'sijmu2', 'sij', 'aij', 'intintensity', 'Lovas_NRAO', 'orderedfreq', 'lower_state_energy_K', 'upper_state_energy_K', 'upperStateDegen', 'moleculeTag', 'qnCode', 'labref_Lovas_NIST', 'rel_int_HFS_Lovas', 'unres_quantum_numbers', 'lineid', 'transition_in_space', 'transition_in_G358', 'obsref_Lovas_NIST', 'source_Lovas_NIST', 'telescope_Lovas_NIST', 'searchErrorMessage'], chemical_name: str | None = None, chem_re_flags: int = 0, energy_min: float | None = None, energy_max: float | None = None, energy_type: ~typing.Literal[<generator object SpectralLineSearchClass.<genexpr> at 0x77aedad677d0>] | None = None, intensity_lower_limit=None, intensity_type: ~typing.Literal[<generator object SpectralLineSearchClass.<genexpr> at 0x77aedad67840>] | None = None, line_lists: ~typing.Literal[<generator object SpectralLineSearchClass.<genexpr> at 0x77aedad678b0>] | None = None, cache: bool = False, format: str = 'ascii.ecsv', **kwargs) Table[source]#
Query a local file for lines and return a table object. The query returns lines with rest frequencies in the range [
min_frequency,`max_frequency`].- Note:
If the search parameters result no matches, a zero-length Table will be returned.
Many of the keywords are only supported if
cat='splatalogue'because local tables do not have all the columns that the Splatalogue database has.
- Parameters:
- min_frequency
Quantity The minimum frequency to search (or any
u.spectral()equivalent). No default.- max_frequency
Quantity The maximum frequency to search (or any
u.spectral()equivalent). No default.- catstr
The catalog to use. One of: [‘splatalogue’, ‘gbtlines’, ‘gbtrecomb’] (minimum string match) or a valid local astropy-compatible table. The local table must have all the columns listed in the
columnsparameter. The default is a GBT-specific line catalog, ‘gbtlines’.- columns: str or list
The query result columns to include in the returned table. Any of [‘species_id’, ‘name’, ‘chemical_name’, ‘resolved_QNs’, ‘linelist’, ‘LovasASTIntensity’, ‘lower_state_energy’, ‘upper_state_energy’, ‘sijmu2’, ‘sij’, ‘aij’, ‘intintensity’, ‘Lovas_NRAO’, ‘orderedfreq’, ‘lower_state_energy_K’, ‘upper_state_energy_K’, ‘upperStateDegen’, ‘moleculeTag’, ‘qnCode’, ‘labref_Lovas_NIST’, ‘rel_int_HFS_Lovas’, ‘unres_quantum_numbers’, ‘lineid’, ‘transition_in_space’, ‘transition_in_G358’, ‘obsref_Lovas_NIST’, ‘source_Lovas_NIST’, ‘telescope_Lovas_NIST’, ‘searchErrorMessage’]. The default is all columns.
- chemical_namestr
Name of the chemical to search for. Treated as a regular expression. An empty set will match any species. Examples:
'H2CO'- 13 species have H2CO somewhere in their formula.'Formaldehyde'- There are 8 isotopologues of Formaldehyde(e.g., H213CO).
'formaldehyde'- Thioformaldehyde,Cyanoformaldehyde.'formaldehyde',chem_re_flags=re.I- Formaldehyde,thioformaldehyde,and Cyanoformaldehyde.
' H2CO '- Just 1 species, H2CO. The spaces prevent includingothers.
- chem_re_flagsint
See the
remodule- energy_min
Noneor float Energy range to include. See
energy_type- energy_max
Noneor float Energy range to include. See
energy_type- energy_type
'el_cm1','eu_cm1','eu_k','el_k' Type of energy to restrict. L/U for lower/upper state energy, cm/K for inverse cm, i.e. wavenumber, or K for Kelvin
- intensity_lower_limit
Noneor float Lower limit on the intensity. See
intensity_type- intensity_type
None,'CDMS/JPL (log)','Sij-mu2','Aij (log)' The type of intensity on which to place a lower limit
- line_listslist
Options: Lovas, SLAIM, JPL, CDMS, ToyaMA, OSU, Recombination, RFI
- cache: bool
Make an in-memory copy of the input table to be used in subsequent queries to this catalog.
- format: str
The astropy IO format string for the input table. Default is ECSV format.
- min_frequency
- Returns:
- Table
An astropy table containing the results of the search
- query_lines(min_frequency: ~astropy.units.quantity.Quantity, max_frequency: ~astropy.units.quantity.Quantity, cat: ~typing.Literal[<generator object SpectralLineSearchClass.<genexpr> at 0x77aedb10b300>] | ~pathlib.Path = 'splatalogue', columns: str | list = ['species_id', 'name', 'chemical_name', 'resolved_QNs', 'linelist', 'LovasASTIntensity', 'lower_state_energy', 'upper_state_energy', 'sijmu2', 'sij', 'aij', 'intintensity', 'Lovas_NRAO', 'orderedfreq', 'lower_state_energy_K', 'upper_state_energy_K', 'upperStateDegen', 'moleculeTag', 'qnCode', 'labref_Lovas_NIST', 'rel_int_HFS_Lovas', 'unres_quantum_numbers', 'lineid', 'transition_in_space', 'transition_in_G358', 'obsref_Lovas_NIST', 'source_Lovas_NIST', 'telescope_Lovas_NIST', 'searchErrorMessage'], asynchronous: bool = False, cache: bool = True, format: str = 'ascii.ecsv', only_NRAO_recommended=True, **kwargs) Table[source]#
Query locally or remotely for lines and return a table object. The query returns lines with rest frequencies in the range [
min_frequency,`max_frequency`].Note: If the search parameters result in no matches, a zero-length Table will be returned.
- Parameters:
- min_frequency
Quantity The minimum frequency to search (or any
u.spectral()equivalent)- max_frequency
Quantity The maximum frequency to search (or any
u.spectral()equivalent)- catstr or Path
The catalog to use. One of: [‘splatalogue’, ‘gbtlines’, ‘gbtrecomb’] (minimum string match) or a valid Path to a local astropy-compatible table. The local table must have all the columns listed in the
columnsparameter.'gbtlines'is a local catalog of spectral lines between 300 MHz and 120 GHz with CDMS/JP log(intensity) > -9.'gbtrecomb'is a local catalog of H, He, and C recombination lnes between 300 MHz and 120 GHz.
columns: str or list The query result columns to include in the returned table. Any of [‘species_id’, ‘name’, ‘chemical_name’, ‘resolved_QNs’, ‘linelist’, ‘LovasASTIntensity’, ‘lower_state_energy’, ‘upper_state_energy’, ‘sijmu2’, ‘sij’, ‘aij’, ‘intintensity’, ‘Lovas_NRAO’, ‘orderedfreq’, ‘lower_state_energy_K’, ‘upper_state_energy_K’, ‘upperStateDegen’, ‘moleculeTag’, ‘qnCode’, ‘labref_Lovas_NIST’, ‘rel_int_HFS_Lovas’, ‘unres_quantum_numbers’, ‘lineid’, ‘transition_in_space’, ‘transition_in_G358’, ‘obsref_Lovas_NIST’, ‘source_Lovas_NIST’, ‘telescope_Lovas_NIST’, ‘searchErrorMessage’]. The default is all columns.
- cache: bool
For a local file query, make an in-memory copy of the input catalog to be used in subsequent queries to this catalog.
- asynchronous: bool
Use asynchronous query
- format: str
Stringe describing the format of a local input table. Must be a valid astropy.io.ascii format string. Default is ‘ascii.ecsv’
- chemical_namestr
Name of the chemical to search for. Treated as a regular expression. An empty set (‘’, (), [], {}) will match any species. Examples:
'H2CO'- 13 species have H2CO somewhere in their formula.'Formaldehyde'- There are 8 isotopologues of Formaldehyde(e.g., H213CO).
'formaldehyde'- Thioformaldehyde,Cyanoformaldehyde.'formaldehyde',chem_re_flags=re.I- Formaldehyde,thioformaldehyde,and Cyanoformaldehyde.
' H2CO '- Just 1 species, H2CO. The spaces prevent includingothers.
- parse_chemistry_locallybool
Attempt to determine the species ID #’s locally before sending the query? This will prevent queries that have no matching species. It also performs a more flexible regular expression match to the species IDs. See the examples in
get_species_ids- chem_re_flagsint
See the
remodule- energy_min
Noneor float Energy range to include. See energy_type
- energy_max
Noneor float Energy range to include. See energy_type
- energy_type
'el_cm1','eu_cm1','eu_k','el_k' Type of energy to restrict. L/U for lower/upper state energy, cm/K for inverse cm, i.e. wavenumber, or K for Kelvin
- intensity_lower_limit
Noneor float Lower limit on the intensity. See intensity_type
- intensity_type
Noneor'sij','cdms_jpl','aij' The type of intensity on which to place a lower limit
- transitionstr
e.g. 1-0
- version
'v1.0','v2.0','v3.0'or'vall' Data version
- excludelist
Types of lines to exclude. Default is: (
'potential','atmospheric','probable') Can also exclude'known'. To exclude nothing, use ‘none’, not the python object None, since the latter is meant to indicate ‘leave as default’- only_astronomically_observedbool
Show only astronomically observed species?
- only_NRAO_recommendedbool
Show only NRAO recommended species?
- line_listslist
Options: Lovas, SLAIM, JPL, CDMS, ToyaMA, OSU, Recombination, RFI
- line_strengthslist
CDMS/JPL Intensity : ls1
Sij : ls3
Aij : ls4
Lovas/AST : ls5
- energy_levelslist
E_lower (cm^-1) : “One”
E_lower (K) : “Two”
E_upper (cm^-1) : “Three”
E_upper (K) : “Four”
- exportbool
Set up arguments for the export server (as opposed to the HTML server)?
- export_limitint
Maximum number of lines in output file
- noHFSbool
No HFS Display
- displayHFSbool
Display HFS Intensity
- show_unres_qnbool
Display Unresolved Quantum Numbers
- show_upper_degeneracybool
Display Upper State Degeneracy
- show_molecule_tagbool
Display Molecule Tag
- show_qn_codebool
Display Quantum Number Code
- show_lovas_labrefbool
Display Lab Ref
- show_lovas_obsrefbool
Display Obs Ref
- show_orderedfreq_onlybool
Display Ordered Frequency ONLY
- show_nrao_recommendedbool
Display NRAO Recommended Frequencies
- min_frequency
- Returns:
- Table
An
astropy.table.Tablecontaining the results of the search.
- recomb(min_frequency: ~astropy.units.quantity.Quantity, max_frequency: ~astropy.units.quantity.Quantity, line: str, cat: ~typing.Literal[<generator object SpectralLineSearchClass.<genexpr> at 0x77aedb10b290>] | ~pathlib.Path = 'splatalogue', columns: str | list = ['species_id', 'name', 'chemical_name', 'resolved_QNs', 'linelist', 'LovasASTIntensity', 'lower_state_energy', 'upper_state_energy', 'sijmu2', 'sij', 'aij', 'intintensity', 'Lovas_NRAO', 'orderedfreq', 'lower_state_energy_K', 'upper_state_energy_K', 'upperStateDegen', 'moleculeTag', 'qnCode', 'labref_Lovas_NIST', 'rel_int_HFS_Lovas', 'unres_quantum_numbers', 'lineid', 'transition_in_space', 'transition_in_G358', 'obsref_Lovas_NIST', 'source_Lovas_NIST', 'telescope_Lovas_NIST', 'searchErrorMessage'], convert_to_unicode: bool = True, only_NRAO_recommended: bool = True, **kwargs) Table[source]#
Search for recombination lines of H, He, and C.
- Parameters:
- min_frequency
Quantity The minimum frequency to search (or any
u.spectral()equivalent). No default.- max_frequency
Quantity The maximum frequency to search (or any
u.spectral()equivalent). No default.- linestr
A string describing the line or series to search for, e.g. “Hydrogen”, “Halpha”, “Hebeta”, “C”, “carbon”. No default.
- catstr or Path
The catalog to use. One of: {0} (minimum string match) or a valid Path to a local astropy-compatible table. The local table must have all the columns listed in the
columnsparameter. Default is ‘splatalogue’.- columns: str or list
The query result columns to include in the returned table. Any of {1}. The default is all columns.
- convert_to_unicodebool, optional
Splatalogue stores line names using the unicode characters for Greek symbols, e.g.
αfor ‘alpha’. dysh will convert for you, if you put in e.g., ‘Halpha’. You should only change this if a) you are inputing unicode or b) you are searching a local file that you know doesn’t use unicode. The default is True.- **kwargsdict
Other keyword arguments supported by
query_lines()ifcatis ‘splatalogue’.
- min_frequency
- Returns:
- Table
An astropy table containing the results of the search
- recomball(min_frequency: ~astropy.units.quantity.Quantity, max_frequency: ~astropy.units.quantity.Quantity, cat: ~typing.Literal[<generator object SpectralLineSearchClass.<genexpr> at 0x77aedad67920>] | ~pathlib.Path = 'splatalogue', columns: str | list = ['species_id', 'name', 'chemical_name', 'resolved_QNs', 'linelist', 'LovasASTIntensity', 'lower_state_energy', 'upper_state_energy', 'sijmu2', 'sij', 'aij', 'intintensity', 'Lovas_NRAO', 'orderedfreq', 'lower_state_energy_K', 'upper_state_energy_K', 'upperStateDegen', 'moleculeTag', 'qnCode', 'labref_Lovas_NIST', 'rel_int_HFS_Lovas', 'unres_quantum_numbers', 'lineid', 'transition_in_space', 'transition_in_G358', 'obsref_Lovas_NIST', 'source_Lovas_NIST', 'telescope_Lovas_NIST', 'searchErrorMessage'], cache: bool = False, only_NRAO_recommended: bool = True, **kwargs) Table[source]#
Fetch all recombination lines of H, He, C in the given frequency range from the catalog.
- Parameters:
- min_frequency
Quantity The minimum frequency to search (or any
u.spectral()equivalent). No default.- max_frequency
Quantity The maximum frequency to search (or any
u.spectral()equivalent). No default.- catstr or Path
The catalog to use. One of: {0} (minimum string match) or a valid Path to a local astropy-compatible table. The local table must have all the columns listed in the
columnsparameter. Default is ‘splatalogue’.- columns: str or list
The query result columns to include in the returned table. Any of {1}. The default is all columns.
- cache: bool
For a local file query, make an in-memory copy of the input table to be used in subsequent queries to this catalog.
- **kwargsdict
Other keyword arguments supported by
query_lines()ifcatis ‘splatalogue’.
- min_frequency
- Returns:
- Table
An astropy table containing the results of the search.