trident.line_database.LineDatabase
- class trident.line_database.LineDatabase(input_file=None)[source]
Class for storing and selecting collections of spectral lines. These lines will be used in the
SpectrumGenerator
andadd_ion_fields()
functionality.Without arguments, the LineDatabase will be empty, and you must manually add individual lines to it using the
add_line
function. If LineDatabase is provided with an optional :input_file:, it will automatically add spectral lines for each corresponding line in the list.Once created, you can select a subset of the total lines present in the database for further use. Use the
parse_subset
function to accomplish this.Parameters
- Input_file
string, optional
An optional input_file can be provided to pre-store a list of Line objects. input_file should be a tab delimited text file of the format:
element, ion_state, wavelength, gamma, f_value, (name)
H, I, 1215.67, 4.69e8, 4.16e-1, Ly a
Example
>>> # Create a LineDatabase using the lines present in lines.txt >>> ldb = LineDatabase('lines.txt')
>>> # Parse ldb and only select Lyman alpha, Mg II and Fe lines >>> lines = ldb.parse_subset(lines=['H I 1216', 'Mg II', 'Fe']) >>> print(lines)
Methods
Manually add a line to the |
|
Load a line list from a file into the LineDatabase. |
|
Select multiple lines based on atom, ion state, identifier, and/or wavelength. |
|
Select ions based on those needed to create specific lines. |
|
Select lines based on atom, ion state, identifier, and/or wavelength. |