Skip to main content

A periodic table API.

Project description

Periodic

A python API/console script for the periodic table.

Created by Luis Naranjo <luisnaranjo733@hotmail.com>

Documentation at http://periodic.readthedocs.org

Original source code https://github.com/doubledubba/periodic Maintainer fork https://github.com/NMRbox/periodic

Installation

>>> pip install periodic2023

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 |                                                               |He |
  |---+----                                       --------------------+---|
2 |Li |Be |                                       | B | C | N | O | F |Ne |
  |---+---|                                       |---+---+---+---+---+---|
3 |Na |Mg |3B  4B  5B  6B  7B |    8B     |1B  2B |Al |Si | P | S |Cl |Ar |
  |---+---+---------------------------------------+---+---+---+---+---+---|
4 | K |Ca |Sc |Ti | V |Cr |Mn |Fe |Co |Ni |Cu |Zn |Ga |Ge |As |Se |Br |Kr |
  |---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---|
5 |Rb |Sr | Y |Zr |Nb |Mo |Tc |Ru |Rh |Pd |Ag |Cd |In |Sn |Sb |Te | I |Xe |
  |---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---|
6 |Cs |Ba |LAN|Hf |Ta | W |Re |Os |Ir |Pt |Au |Hg |Tl |Pb |Bi |Po |At |Rn |
  |---+---+---+------------------------------------------------------------
7 |Fr |Ra |ACT|
  -------------
              -------------------------------------------------------------
   Lanthanide |La |Ce |Pr |Nd |Pm |Sm |Eu |Gd |Tb |Dy |Ho |Er |Tm |Yb |Lu |
              |---+---+---+---+---+---+---+---+---+---+---+---+---+---+---|
   Actinide   |Ac |Th |Pa | U |Np |Pu |Am |Cm |Bk |Cf |Es |Fm |Md |No |Lw |
              -------------------------------------------------------------

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
========================================================================

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

periodic2023-2.2.1-py3-none-any.whl (8.0 kB view details)

Uploaded Python 3

File details

Details for the file periodic2023-2.2.1-py3-none-any.whl.

File metadata

  • Download URL: periodic2023-2.2.1-py3-none-any.whl
  • Upload date:
  • Size: 8.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.4.2 requests/2.22.0 setuptools/65.6.3 requests-toolbelt/0.8.0 tqdm/4.64.1 CPython/3.8.10

File hashes

Hashes for periodic2023-2.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 9c9bbf4579340c5389adbbc49f1f12c566c076b66f38b07c2c30b8d044da2b79
MD5 5291a6d8457be92a68f511dfe3af707f
BLAKE2b-256 13a0a383914d26fd93845fa17c1b9fe8f1bd31ef42b4db91b7aadba067a15e4d

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page