synthesizer.abundances.abundance_patterns

A module for creating and manipulating abundance patterns.

Abundance patterns describe the relative abundances of elements in a particular component of a galaxy (e.g. stars, gas, dust). This code is used to define abundance patterns as a function of metallicity, alpha enhancement, etc.

The main current use of this code is in the creation cloudy input models when processing SPS incident grids to model nebular emission.

Some notes on (standard) notation: - [X/H] = log10(N_X/N_H) - log10(N_X/N_H)_sol

Functions

synthesizer.abundances.abundance_patterns.plot_abundance_pattern(a, show=False, ylim=None, components=['total'])[source]

Plot a single abundance pattern.

This method plots the abundance pattern of a single galaxy component (e.g. stars, gas, dust) as a function of element. The x-axis is the element number, and the y-axis is the logarithmic abundance of each element relative to H. The plot also includes a legend indicating the abundance pattern used for each element.

Parameters:
  • a (abundances.Abundance) – Abundance pattern object.

  • components (list of str) – List of components to plot. By default only plot “total”.

  • show (bool) – Toggle whether to show the plot.

  • ylim (list/tuple, float) – Limits of y-axis.

synthesizer.abundances.abundance_patterns.plot_multiple_abundance_patterns(abundance_patterns, labels=None, show=False, ylim=None)[source]

Plot multiple abundance patterns.

Parameters:
  • abundance_patterns (abundances.Abundance) – Abundance pattern object.

  • labels (list of str) – List of components to plot. By default only plot “total”.

  • show (bool) – Toggle whether to show the plot.

  • ylim (list/tuple, float) – Limits of y-axis.

Classes

class synthesizer.abundances.abundance_patterns.Abundances(metallicity=None, alpha=0.0, abundances=None, reference=<class 'synthesizer.abundances.reference_abundance_patterns.GalacticConcordance'>, depletion=None, depletion_model=None, depletion_scale=None)[source]

A class calculating elemental abundances.

This class is used to calculate the elemental abundances in a galaxy component (e.g. stars, gas, dust) as a function of metallicity and alpha-enhancement. The class can also apply a depletion pattern to the abundances to account for the presence of dust.

metallicity

Mass fraction in metals, default is reference metallicity. Optional initialisation argument. If not provided is calculated from the provided abundance pattern.

Type:

float

alpha

Enhancement of the alpha elements relative to the reference abundance pattern. Optional initialisation argument. Defaults to 0.0 (no alpha-enhancement).

Type:

float

abundances

A dictionary containing the abundances for specific elements or functions to calculate them for the specified metallicity. Optional initialisation argument. Defaults to None.

Type:

dict, float/str

reference

Reference abundance pattern. Optional initialisation argument. Defaults to the GalacticConcordance pattern.

Type:

AbundancePattern

depletion

The depletion pattern to use. Should not be provided with depletion_model. Optional initialisation argument. Defaults to None.

Type:

dict, float

depletion_model

The depletion model object. Should not be provided with depletion. Optional initialisation argument. Defaults to None.

Type:

object

depletion_scale

The depletion scale factor. Sometimes this is linear, but for some models (e.g. Jenkins (2009)) it’s more complex. Optional initialisation argument. Defaults to None.

Type:

float

helium_mass_fraction

The helium mass fraction (more commonly denoted as “Y”).

Type:

float

hydrogen_mass_fraction

The hydrogen mass fraction (more commonly denoted as “X”).

Type:

float

total

The total logarithmic abundance of each element.

Type:

dict, float

gas

The logarithmic abundance of each element in the depleted gas phase.

Type:

dict, float

dust

The logarithmic abundance of each element in the dust phase.

Type:

dict, float

metal_mass_fraction

Mass fraction in metals. Since this should be metallicity it is redundant but serves as a useful test.

Type:

float

dust_mass_fraction

Mass fraction in metals.

Type:

float

dust_to_metal_ratio

Dust-to-metal ratio.

Type:

float

add_depletion(depletion=None, depletion_model=None, depletion_scale=None)[source]

Add depletion using a provided depletion pattern or model.

This method creates the following attributes:
gas (dict, float):

The logarithmic abundances of the gas, including depletion.

dust (dict, float):

The logarithmic abundances of the dust. Set to -np.inf is no contribution.

metal_mass_fraction (float):

Mass fraction in metals. Since this should be metallicity it is redundant but serves as a useful test.

dust_mass_fraction (float):

Mass fraction in metals.

dust_to_metal_ratio (float):

Dust-to-metal ratio.

Parameters:
  • depletion (dict, float) – The depletion pattern to use. Should not be provided with depletion_model.

  • depletion_model (object) – The depletion model object. Should not be provided with depletion.

  • depletion_scale (float) – The depletion scale factor. Sometimes this is linear, but for some models (e.g. Jenkins (2009)) it’s more complex.

calculate_integrated_abundance(elements, a=None)[source]

Calculate the integrated abundance for a collection of elements.

Parameters:
  • elements (list of str) – A list of element names.

  • a (dict) – The component to use.

Returns:

The mass in those elements. Normally this needs to be normalised to be useful.

Return type:

integrated abundance (float)

calculate_mass(elements, a=None)[source]

Calculate the mass for a collection of elements.

Parameters:
  • elements (list of str) – A list of element names.

  • a (dict) – The component to use.

Returns:

The mass in those elements. Normally this needs to be normalised to be useful.

Return type:

mass (float)

calculate_mass_fraction(elements, a=None)[source]

Calculate the mass fraction for a collection of elements.

Parameters:
  • elements (list of str) – A list of element names.

  • a (dict) – The component to use.

Returns:

The mass in those elements. Normally this needs to be normalised to be useful.

Return type:

mass (float)

reference_relative_abundance(element, ref_element='H')[source]

Return the relative abundance of an element.

This method will return an element’s abundance relative to that in the Sun,

i.e. [X/H] = log10(N_X/N_H) - log10(N_X/N_H)_sol

Parameters:
  • element (str) – The element of interest.

  • ref_element (str) – The reference element.

Returns:

The logarithmic relative abundance of an element, relative to the sun.

Return type:

abundance (float)