File: shelltable.py

package info (click to toggle)
python-periodictable 2.0.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,068 kB
  • sloc: python: 13,338; makefile: 103; sh: 92; javascript: 7
file content (27 lines) | stat: -rw-r--r-- 796 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
"""
Example of isotope specific extensions to the periodic table.
"""
from periodictable.core import Isotope

def init(table, reload=False):
    if 'shells' in table.properties and not reload: return
    table.properties.append('shells')

    # Set the default.  This is required, even if it is only
    # setting it to None.  If the attribute is missing then
    # the isotope data reverts to the element to supply the
    # value, which is almost certainly not what you want.
    Isotope.shells = None

    # Load the data
    for symbol,eldata in data.items():
        el = table.symbol(symbol)
        for iso,isodata in eldata.items():
            el[iso].shells = isodata

# Define the data
data = dict(
    Fe = {56: "56-Fe shell info",
          58: "58-Fe shell info",
         },
    )