Skip to content

kalvdans/periodic

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

52 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Periodic

A python API/console script for the periodic table.

Created by Luis Naranjo <luisnaranjo733@hotmail.com>

Documentation at http://periodic.readthedocs.org

Source code https://github.com/doubledubba/periodic

Installation

>>> pip install periodic

Basic Usage

Retrieve element as an object

>>> from periodic import element >>> hydrogen = element('hydrogen') >>> hydrogen.mass 1.0079

Advanced database queries (using sqlalchemy)

>>> from periodic.table import session, Element >>> session.query(Element).order_by(Element.mass).all()[-4:] # 4 heaviest elements (by mass) [<Element('Uup', '115')>, <Element('Uuq', '114')>, <Element('Uuh', '116')>, <Element('Uuo', '118')>]

ASCII Table

>>> import periodic >>> print periodic.table ----- -----1 | H | 2 Be | | B | C | N | O | F 3 Mg 8B Al P | S Ar | 4 | K Sc V Mn Co Cu Ga As Br 5 Sr | Y Nb Tc Rh Ag In Sb I 6 Ba Hf W Os Pt Hg Pb Po Rn | Fr ACT| ------------- ------------------------------------------------------------- Lanthanide Ce Nd Sm Gd Dy Er Yb Actinide Th U Pu Cm Cf Fm No -------------------------------------------------------------

Interactive shell (Console script)

Periodic provides an originally named console script called 'periodic'.

It's usage for now is limited to periodic table reference.

In the future, it will be able to do with elements!

This interactive shell may also be invoked from the python interpreter:

>>> import periodic >>> periodic.interactive_shell()

Or from the command line:

$ periodic
Enter any of the following periodic values of the element you are looking for:
    ['atomic', 'symbol', 'name', 'mass']

Use ^C or type 'exit' to exit.
========================================================================
> 12
atomic: 12
symbol: Mg
name: Magnesium
mass: 24.305
========================================================================
> uranium
atomic: 92
symbol: U
name: Uranium
mass: 238.02891
========================================================================
> H
atomic: 1
symbol: H
name: Hydrogen
mass: 1.00794
========================================================================
> 15.9994
atomic: 8
symbol: O
name: Oxygen
mass: 15.9994
========================================================================

About

periodic is a python API for the periodic table.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%