e15190.utilities.atomic_mass_evaluation

This module interacts with the atomic mass data.

By the time of writing this module, the latest available data is Atomic Mass Evaluation in 2016 (AME2016). When future evaluation is released, manual modification needs to be made by updating DataManager.ame_url, and possibly DataManager.read_in_data(), if the format of the table has been changed.

Functions

get_A_Z(notation[, simple_tuple])

Converts mass-number annotated isotope expression into A and Z.

get_N_Z(notation[, simple_tuple])

get_symb(Z)

mass(argv[, unitless, not_found_okay, ...])

Get mass of isotope.

Classes

DataManager([force_download, auto_read_in])

A class to interacts with the atomic masses.

class e15190.utilities.atomic_mass_evaluation.DataManager(force_download=False, auto_read_in=True)

A class to interacts with the atomic masses. Many kinematic calculations require the knowledge of masses of atomic isotopes. This class allows user to automatically download the data sheet of Atomic Mass Evaluation to local machine, and perform some simple query tasks on the table.

ame_url

https://www-nds.iaea.org/amdc/ame2016/mass16.txt

Type

str

ame_loc_path

PROJECT_DIR / 'database/utilities/mass16.txt'

Type

pathlib.Path

df

Dataframe for storing AME data

Type

pandas.DataFrame

units

Specifying units for every column in self.df

Type

dict

Z_to_symb

Dictionary mapping atomic number to chemical symbol

Type

dict

symb_to_Z

Dictionary mapping chemical symbol to atomic number

Type

dict

download(filepath=None, url=None)

Download AME data from the web.

Parameters
  • filepath (str or pathlib.Path, default None) – The local filepath that store the downloaded data. Default is None, which will then be set into self.ame_loc_path.

  • url (str or pathlib.Path, default None) – The url to the AME data. Default is None, which will then be set into self.ame_url.

read_in_data(filepath=None)

Updates class attribute self.df into formatted AME data.

This function only reads from a local copy of AME data. Make sure the data has been downloaded from the web. Not all columns from AME data will be kept. The columns that will be returned are Z, A, symb, mass_excess and mass_excess_err. Other columns including isospin, binding energy (and its error) and mass in a.m.u (and its error) are discarded as they can all be calculated directly from mass excess.

No unit conversion has been made. The AME provides mass excess in \(\mathrm{keV}/c^2\). Nonetheless, units have been stored as self.units.

Parameters: filepath : str or pathlib.Path, default None

The local filepath that store the downloaded data. Default is None, which will then be set into self.ame_loc_path.

static auto_column_splitter(content)

This function automatically separates the columns of an ASCII table.

This function can separate the columns of .txt tables that use space characters as their delimiters.

Parameters

content (list of str) – A list of strings that correspond to the content of the ASCII table. Each element in the list, which is a string, corresponds to each row of the table. These strings can be either ended with the newline character or not. The row of column names or headers should not be included.

Returns

splitted_content

Return type

2D list of str

Examples

>>> from e15190.utilities import atomic_mass_evaluation as ame
>>> dm = ame.DataManager()
>>> content = ['Amy  168.5cm', 'Bob  181.9cm', 'Cici 157.3cm']
>>> dm.auto_column_splitter(content)
[['Amy  ', '168.5cm'], ['Bob  ', '181.9cm'], ['Cici ', '157.3cm']]
e15190.utilities.atomic_mass_evaluation.get_A_Z(notation, simple_tuple=False)

Converts mass-number annotated isotope expression into A and Z.

Parameters
  • notation (str or tuple) – A string that represents an isotope, e.g. ‘Ca40’ or (‘Ca’, 40).

  • simple_tuple (bool, default False) – If True, returns a simple tuple (A, Z); if False, returns a named tuple.

Examples

>>> from e15190.utilities import atomic_mass_evaluation as ame
>>> ame.get_A_Z('ca40')
(40, 20)
e15190.utilities.atomic_mass_evaluation.mass(argv, unitless=True, not_found_okay=False, not_found_warning=True)

Get mass of isotope.

Parameters
  • argv (str or tuple or dict) – If str, it should be an expression of isotope, e.g. ‘Ca40’; if tuple, it should be (A, Z); if dict, it should have keys A and Z.

  • unitless (bool, default True) – If True, returns the mass floating point in \(\mathrm{MeV}/c^2\); if False, returns the mass with units.

  • not_found_okay (bool, default False) – If True, returns zero mass when the isotope is not found; if False, raises a ValueError when the isotope is not found.

  • not_found_warning (bool, default True) – If True, prints a warning when the isotope is not found; if False, nothing is printed. This parameter is ignored if not_found_okay is False.

Returns

mass – The mass of the isotope.

Return type

float or astropy.units.Quantity