Skip to content
/ ele Public

A lightweight package with the periodic table of the elements

License

Notifications You must be signed in to change notification settings

rsdefever/ele

Repository files navigation

Ele

License Codecov Azure

Overview

Element is an extremely lightweight package that defines the elements of the periodic table and allows them to be accessed by symbol, name, atomic number, or mass. It has zero dependencies outside of the Python Standard Library.

Warning

Ele is still in early development (0.x releases). The API may change unexpectedly.

Usage

Ele only supports a few modes of use. You can retrieve an element from the symbol, the name, the atomic number, or the mass (in amu):

import ele
na = ele.element_from_symbol("Na")
na = ele.element_from_name("sodium")
na = ele.element_from_atomic_number(11)
na = ele.element_from_mass(22.990)

The mass is rounded to a single decimal before comparison. If you wish to retrieve the element with the mass closest to the specified value you may use the exact=False keyword.

Each Element has four attributes which can be accessed (as demonstrated below for na):

na.name
na.symbol
na.atomic_number
na.mass

The elements can also be accessed by symbol as follows:

import ele
na = ele.Elements.Na

Installation

Install via pip:

pip install ele

or conda:

conda install -c conda-forge ele

Installation from source is also an option:

git clone [email protected]/rsdefever/ele.git
cd ele
pip install .

Data Sources

Complete details of the sources are provided here

Credits

Development of Ele was supported by the National Science Foundation under grant NSF Grant Number 1835874. Any opinions, findings, and conclusions or recommendations expressed in this material are those of the author(s) and do not necessarily reflect the views of the National Science Foundation.