API Reference

Table object creation

class masstable.masstable.Table(name='', df=None)
classmethod from_ZNM(Z, N, M, name='')

Creates a table from arrays Z, N and M

>>> Z = [82, 82, 83]
>>> N = [126, 127, 130]
>>> M = [-21.34, -18.0, -14.45]
>>> Table.from_ZNM(Z, N, M, name='Custom Table')
Z   N
82  126   -21.34
    127   -18.00
83  130   -14.45
Name: Custom Table, dtype: float64
classmethod from_file(filename, name='')

Imports a mass table from a file

classmethod from_name(name)

Imports a mass table from a file

to_file(path)

Export the contents to a file as comma separated values.

path : string
File path where the data should be saved to

Export the last ten elements of AME2012 to a new file:

>>> Table('AME2012').tail(10).to_file('last_ten.txt')

Properties

class masstable.masstable.Table(name='', df=None)
A

Return the mass number A for all nuclei in the table as a numpy array.

N

Return the neutron number N for all nuclei in the table as a numpy array.

Z

Return the proton number Z for all nuclei in the table as a numpy array.

count

Return the total number of nuclei in the table:

>>> Table('AME2012').count
2438

It is also possible to do:

>>> len(Table('AME2012'))
2438
error(relative_to='AME2003')

Calculate error difference

relative_to : string,
a valid mass table name.
>>> Table('DUZU').error(relative_to='AME2003')
classmethod names()

Return a list of the names of all supported mass models

>>> Table.names()
['AME2003', 'AME2003all', 'AME2012', 'AME2012all', 'AME1995',
'AME1995all', 'DUZU', 'FRDM95', 'KTUY05', 'ETFSI12', 'HFB14',
'HFB26', 'TCSM12', 'TCSM13', 'BR2013', 'MAJA88', 'GK88', 'WS32010', 'WS32011',
'SVM13']
rmse(relative_to='AME2003')

Calculate root mean squared error

relative_to : string,
a valid mass table name.
>>> template = '{0:10}|{1:^6.2f}|{2:^6.2f}|{3:^6.2f}'
>>> print 'Model      ', 'AME95 ', 'AME03 ', 'AME12 '  #  Table header
... for name in Table.names:
...     print template.format(name, Table(name).rmse(relative_to='AME1995'),
...                             Table(name).rmse(relative_to='AME2003'),
...                             Table(name).rmse(relative_to='AME2012'))
Model       AME95  AME03  AME12
AME2003   | 0.13 | 0.00 | 0.13
AME2003all| 0.42 | 0.40 | 0.71
AME2012   | 0.16 | 0.13 | 0.00
AME2012all| 0.43 | 0.43 | 0.69
AME1995   | 0.00 | 0.13 | 0.16
AME1995all| 0.00 | 0.17 | 0.21
DUZU      | 0.52 | 0.52 | 0.76
FRDM95    | 0.79 | 0.78 | 0.95
KTUY05    | 0.78 | 0.77 | 1.03
ETFSI12   | 0.84 | 0.84 | 1.04
HFB14     | 0.84 | 0.83 | 1.02

Derived quantities

class masstable.masstable.Table(name='', df=None)
binding_energy

Return binding energies instead of mass excesses

ds2n

Calculates the derivative of the neutron separation energies:

ds2n(Z,A) = s2n(Z,A) - s2n(Z,A+2)

ds2p

Calculates the derivative of the neutron separation energies:

ds2n(Z,A) = s2n(Z,A) - s2n(Z,A+2)

q_alpha

Return Q_alpha

q_beta

Return Q_beta

s1n

Return 1 neutron separation energy

s1p

Return 1 proton separation energy

s2n

Return 2 neutron separation energy

s2p

Return 2 proton separation energy

Convenience methods

class masstable.masstable.Table(name='', df=None)
__getitem__(index)

Access [] operator Examples:

>>> Table('DUZU')[82, 126:127]
        DUZU
Z   N
82  126 -22.29
    127 -17.87
>>> Table('AME2012all')[118, :]
        AME2012all
Z   N
118 173  198.93
    174  199.27
    175  201.43
at(nuclei)

Return a selection of the Table at positions given by nuclei

nuclei: list of tuples
A list where each element is tuple of the form (Z,N)

Return binding energies at magic nuclei:

>>> magic_nuclei = [(20,28), (50,50), (50,82), (82,126)]
>>> Table('AME2012').binding_energy.at(magic_nuclei)
Z   N
20  28      416.014215
50  50      825.325172
    82     1102.876416
82  126    1636.486450
even_odd

Selects even-odd nuclei from the table

not_in(table)

Select nuclei not in table

table: Table, Table object from where nuclei should be removed

Find the new nuclei in AME2003 with Z,N >= 8:

>>> Table('AME2003').not_in(Table('AME1995'))[8:,8:].count
389
odd_even

Selects odd-even nuclei from the table

odd_odd

Selects odd-odd nuclei from the table:

>>> Table('FRDM95').odd_odd
Out[13]:
Z   N
9   9       1.21
    11      0.10
    13      3.08
    15      9.32
...
select(condition, name='')

Selects nuclei according to a condition on Z,N or M

condition : function,
Can have one of the signatures f(M), f(Z,N) or f(Z, N, M) must return a boolean value

name: string, optional name for the resulting Table

Select all nuclei with A > 160:

>>> A_gt_160 = lambda Z,N: Z + N > 160
>>> Table('AME2003').select(A_gt_160)

Table Of Contents

Previous topic

Quickstart