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

Get lines example

Get lines example
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.

synthesizer.line.get_ratio_label(ratio_id)[source]

Get a label for a given ratio_id.

Parameters:

ratio_id (str) – The ratio identificantion, e.g. R23.

Returns:

label (str)

A string representation of the label.

Examples using synthesizer.line.get_ratio_label

Get lines example

Get lines example
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(*lines, line_id=None, wavelength=None, luminosity=None, continuum=None)[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.

wavelength

The standard (not vacuum) wavelength of the line.

Type:

Quantity

vacuum_wavelength

The vacuum wavelength of the line.

Type:

Quantity

continuum

The continuum at the line.

Type:

Quantity

luminosity

The luminosity of the line.

Type:

Quantity

flux

The flux of the line.

Type:

Quantity

equivalent_width

The equivalent width of the line.

Type:

Quantity

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

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.

get_flux(cosmo, z)[source]

Calculate the line flux.

Parameters:
  • cosmo (astropy.cosmology.) – Astropy cosmology object.

  • z (float) – The redshift.

Returns:

flux (float)

Flux of the line in units of erg/s/cm2 by default.

sum()[source]

For objects containing lines of multiple particles sum them to produce the integrated quantities.

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.

Args
lines (dictionary of Line objects)

A dictionary of line objects.

Methods

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

get_diagram_labels(diagram_id)[source]

Wrapper around get_ratio_label

get_ratio(ratio_id)[source]

Measure (and return) a line ratio.

Parameters:

ratio_id (str, list) – Either a ratio_id where the ratio lines are defined in line_ratios or a list of lines.

Returns:

float

a line ratio

get_ratio_label(ratio_id)[source]

Wrapper around get_ratio_label

sum()[source]

For collections containing lines from multiple particles calculate the integrated line properties and create a new LineCollection object.

Examples using synthesizer.line.LineCollection

Get lines example

Get lines example