petitRADTRANS.chemistry.prt_molmass#

Interface between molmass and petitRADTRANS.

Attributes#

Functions#

element_number2element_symbol(→ str)

Convert an element's atomic number (e.g. 6) to its element symbol (e.g. 'C').

element_symbol2element_number(→ int)

Convert an element symbol (e.g. 'C') to its atomic number (e.g. 6).

_get_cached_molmass_name(→ tuple[str, Ellipsis])

Return the molmass tokens for a pRT species as an immutable cache entry.

get_molmass_name(species)

Convert a pRT species' name into a molmass-compatible name.

_get_cached_species_elements(→ tuple[tuple[str, int], ...)

Return species elements as immutable key-value pairs for safe caching.

get_species_elements(→ dict[str, int])

Decompose a species into its elements and their amount.

get_species_molar_mass(→ float)

Get the molecular mass of a given species.

Module Contents#

petitRADTRANS.chemistry.prt_molmass._ELEMENT_NUMBER_TO_SYMBOL#
petitRADTRANS.chemistry.prt_molmass._ELEMENT_SYMBOL_TO_NUMBER#
petitRADTRANS.chemistry.prt_molmass.element_number2element_symbol(atomic_number: int) str#

Convert an element’s atomic number (e.g. 6) to its element symbol (e.g. ‘C’).

petitRADTRANS.chemistry.prt_molmass.element_symbol2element_number(symbol: str) int#

Convert an element symbol (e.g. ‘C’) to its atomic number (e.g. 6).

petitRADTRANS.chemistry.prt_molmass._get_cached_molmass_name(species: str) tuple[str, Ellipsis]#

Return the molmass tokens for a pRT species as an immutable cache entry.

petitRADTRANS.chemistry.prt_molmass.get_molmass_name(species: str)#

Convert a pRT species’ name into a molmass-compatible name.

petitRADTRANS.chemistry.prt_molmass._get_cached_species_elements(species: str) tuple[tuple[str, int], Ellipsis]#

Return species elements as immutable key-value pairs for safe caching.

petitRADTRANS.chemistry.prt_molmass.get_species_elements(species: str) dict[str, int]#

Decompose a species into its elements and their amount.

Example:
>>> get_species_elements('H2O')
>>> {'H': 2, 'O': 1}
Args:

species: pRT chemical formula of the species

Returns:

A dictionary containing the element symbols of the species as keys and their amount as values.

petitRADTRANS.chemistry.prt_molmass.get_species_molar_mass(species: str) float#

Get the molecular mass of a given species.

This function uses the molmass package to calculate the mass number for the standard isotope of an input species. If all_iso is part of the input, it will return the mean molar mass.

Args:
speciesstring

The chemical formula of the compound. ie C2H2 or H2O

Returns:

The molar mass of the compound in atomic mass units.