trident.line_database.LineDatabase.parse_subset_to_ions

LineDatabase.parse_subset_to_ions(subsets=None)[source]

Select ions based on those needed to create specific lines. Once you’ve created a LineDatabase, you can subselect certain ions from it based on the line characteristics of atom, ion state, identifier, and/or wavelength. Similar to parse_subset but outputs a list of ion tuples (e.g. (‘H’, 1), (‘Fe’, 2)), instead of a list of Line objects.

Will return the unique union of all ions matching the specified subsets from the LineDatabase.

Parameters

Subsets:

list of strings, optional

List strings matching possible lines. Strings can be of the form: * Atom - Examples: “H”, “C”, “Mg” * Ion - Examples: “H I”, “H II”, “C IV”, “Mg II” * Line - Examples: “H I 1216”, “C II 1336”, “Mg II 1240” * Identifier - Examples: “Ly a”, “Ly b”

If set to None, selects ions necessary to produce all lines in LineDatabase. Default: None

Returns

Ion subset:

list of ion tuples

A list of the ions necessary to produce the desired lines Each ion tuple is of the form (‘H’, 1) = neutral hydrogen

Example

Get a list of all ions necessary to generate lines for Carbon, Mg II and Lyman alpha

>>> ldb = LineDatabase('lines.txt')
>>> ions = ldb.parse_subset_to_ions(['C', 'Mg II', 'H I 1216'])
>>> print(ions)