Version 3 (modified by CakeProphet, 6 years ago)

--

The idea's been tossed around for a bit on the mailing list, but now we've got some something actually started.

The PeriodicTable package will contain a pythonitized periodic table of elements, crammed full of easy to access information on all the known atomic elements.

Hypothetical example of use

The user should only need to import the package itself, at which point __init__.py will construct all the elemental information and instantiate an object of the Periodic class.

The periodic table consists of "element" objects. Each element object contains attributes which correspond to elemental properties such as freezing point, atomic mass, and electon configuration.

from Periodic import PeriodicTable as table

Each element can be accessed by its symbol, atomic number, and official name by using dictionary keys

table["H"]  
table[1]    
table["hydrogen"]  #note that the element name is lowercase

You can also get a range of elements this way.

table["H":6]       #returns a numpy array from hydrogen to carbon 
table["He":"gold"] #helium to gold

for more specific operations, you can use methods on the table object

...here are some methods I've already implemented

table.getby("group", 8)  #array of noble gases
table.getby("block", "d") #array of transition metals

#This is also all of the transition metals. Except now the elements are organized in a 2d array,
#with each "column" representing one group.

table.getby("group",3,4,5,6,7,8,9,10,11,12,13)

table.iterover("atomic_mass")  #flat iterator over the atomic mass of each element

The element objects themselves will contain attributes corresponding to their properties.

table["hydrogen"].atomic_mass   
table["helium"].electron_configuration
table["oxygen"].freezing_point

as well as methods for obtaining information

table["hydrogen"].stateat("60","k") #returns the state of hydrogen at 60 kelvin as a string.

What needs to be done

Currently the design is being worked on by myself, and testing and reviewing needs to be done as well. Feel free to suggest or make any changes you think will make the table easier to use or more powerful.

Substantial help is needed gathering all the elemental information for the final product. The information needs to be as accurate as possible, and the loving caring hands of a science wiz may be needed.

The primary focus at the moment is accuracy, ease-of-use, and power. Optimization can come later.

Some conventions to follow

I don't require any conventions unless they're required for the code to operate properly.

* All temperatures should be in Celsius. Conversions will be performed by methods (or a package in scipy, if scipy has a unit conversion system)
* A dictionary mapping properties to Element objects should follow the naming convention of "bypropname" (for example, the dictionary mapping symbol to Element is named "bysymbol"). See Periodic.__getitem__ for why this should be done.

Attachments