synthesizer.line¶
A module containing functionality for working with spectral lines.
The primary class is Line which holds information about an individual or blended emission line, including its identification, wavelength, luminosity, and the strength of the continuum. From these the equivalent width is automatically calculated. Combined with a redshift and cosmology the flux can also be calcualted.
A second class is LineCollection which holds a collection of Line objects and provides additional functionality such as calcualting line ratios and diagrams (e.g. BPT-NII, OHNO).
Several functions exist for obtaining line, ratio, and diagram labels for use in plots etc.
Functions
- synthesizer.line.flatten_linelist(list_to_flatten)[source]¶
Flatten a mixed list of lists and strings and remove duplicates.
Used when converting a line list which may contain single lines and doublets.
- Parameters:
list_to_flatten (list) – list containing lists and/or strings and integers
- Returns:
- (list)
flattened list
- synthesizer.line.get_diagram_labels(diagram_id)[source]¶
Get a x and y labels for a given diagram_id
- Parameters:
diagram_id (str) – The diagram identificantion, e.g. OHNO.
- Returns:
- xlabel (str)
A string representation of the x-label.
- ylabel (str)
A string representation of the y-label.
Examples using synthesizer.line.get_diagram_labels
¶
- synthesizer.line.get_line_id(id)[source]¶
A function for converting a line id possibly represented as a list to a single string.
- Args
- id (str, list, tuple)
a str, list, or tuple containing the id(s) of the lines
- Returns
- id (str)
string representation of the id
- synthesizer.line.get_line_label(line_id)[source]¶
Get a line label for a given line_id, ratio, or diagram. Where the line_id is one of several predifined lines in line_ratios.line_labels this label is used, otherwise the label is constructed from the line_id.
- Argumnents
- line_id (str or list)
The line_id either as a list of individual lines or a string. If provided as a list this is automatically converted to a single string so it can be used as a key.
- Returns
- line_label (str)
A nicely formatted line label.
Examples using synthesizer.line.get_ratio_label
¶
- synthesizer.line.get_roman_numeral(number)[source]¶
Function to convert an integer into a roman numeral str.
Used for renaming emission lines from the cloudy defaults.
- Parameters:
number (int) – The number to convert into a roman numeral.
- Returns:
- number_representation (str)
String reprensentation of the roman numeral.
Classes
- class synthesizer.line.Line(line_id=None, wavelength=None, luminosity=None, continuum=None, combine_lines=())[source]¶
A class representing a spectral line or set of lines (e.g. a doublet).
Although a Line can be instatiated directly most users should generate them using the various different “get_line” methods implemented across Synthesizer.
A Line object can either be a single line or a combination of multiple, individually unresolved lines.
A collection of Line objects are stored within a LineCollection which provides an interface to interact with multiple lines at once.
- individual_lines¶
A list of individual lines that make up this line.
- Type:
list
- element¶
A list of the elements that make up this line.
- Type:
list
- apply_attenuation(tau_v, dust_curve, mask=None)[source]¶
Apply attenuation to this line.
- Parameters:
tau_v (float/array-like, float) – The V-band optical depth for every star particle.
dust_curve (synthesizer.emission_models.attenuation.*) – An instance of one of the dust attenuation models. (defined in synthesizer/emission_models.attenuation.py)
mask (array-like, bool) – A mask array with an entry for each line. Masked out spectra will be ignored when applying the attenuation. Only applicable for multidimensional lines.
- Returns:
- Line
A new Line object containing the attenuated line.
- combine(*lines)[source]¶
Combine this line with an arbitrary number of other lines.
This is important for combing >2 lines together since the simple line1 + line2 + line3 addition of multiple lines will not correctly average over all lines.
- Parameters:
lines (Line) – Any number of Line objects to combine into a single line.
- Returns:
- (Line)
A new Line object containing the combined lines.
- property continuum_llam¶
Return the continuum in units of Llam (erg/s/AA).
- property equivalent_width¶
Return the equivalent width.
Examples using synthesizer.line.Line
¶
Plot the line continuum for a given grid point
Generating Lines from a Parametric Galaxy
- class synthesizer.line.LineCollection(lines)[source]¶
A class holding a collection of emission lines.
This enables additional functionality such as quickly calculating line ratios or line diagrams.
- lines¶
A dictionary of synthesizer.line.Line objects.
- Type:
dict
- line_ids¶
A list of line ids.
- Type:
list
- wavelengths¶
An array of line wavelengths.
- Type:
unyt_array
- available_ratios¶
A list of available line ratios.
- Type:
list
- available_diagrams¶
A list of available line diagrams.
- Type:
list
- concatenate(other)[source]¶
Concatenate two LineCollection objects together.
Note that any duplicate lines will be taken from other (i.e. the LineCollection passed to concatenate).
- Parameters:
other (LineCollection) – A LineCollection object to concatenate with the current LineCollection object.
- Returns:
- LineCollection
A new LineCollection object containing the lines from both LineCollection objects.
- get_diagram(diagram_id)[source]¶
Return a pair of line ratios for a given diagram_id (E.g. BPT).
- Parameters:
diagram_id (str, list) – Either a diagram_id where the pairs of ratio lines are defined in line_ratios or a list of lists defining the ratios.
- Returns:
- tuple (float)
a pair of line ratios
Examples using synthesizer.line.LineCollection
¶
Plot the line continuum for a given grid point
Generating Lines from a Parametric Galaxy