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]

Funtion to plot a single abundance pattern, but possibly including all components.

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

  • components (list, 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]

Function to plot multiple abundance patterns.

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

  • components (list, 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 for calculating elemental abundances including various scaling and depletion on to 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:

object

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]

Method to get the integrated abundance for a collection of elements.

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

  • a (dict) – The component to use.

Returns:

integrated abundance (float)

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

calculate_mass(elements, a=None)[source]

Method to get the mass for a collection of elements.

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

  • a (dict) – The component to use.

Returns:

mass (float)

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

calculate_mass_fraction(elements, a=None)[source]

Method to get the mass fraction for a collection of elements.

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

  • a (dict) – The component to use.

Returns:

mass (float)

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

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

A method to 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:

abundance (float)

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