Skip to main content

A python package to parse and store the various files published by AME and NUBASE

Project description

Nuclear Masses

PyPI Python Version

Unit Tests codecov

Introduction

Python package to parse the various files published by the AME and NUBASE. The files produced by the AME and NUBASE have unique formats so this package does the hard work for you and parses the data into a pandas dataframe for simple access.

No guarantee is supplied with regards to the accuracy of the data presented. Estimated values are included, please always refer to the original sources. All data should, however, be accurate.

Mass tables

The data files released by the papers linked below are used to create the mass tables read by this code. There was no AME data published in 1997, but the 1995 AME matches the 1997 NUBASE according to section 4, "The tables" on P31 of these proceedings. As a result the 1997 NUBASE data is referred to as being from 1995 for simplicity when merging data.

The NUBASE files are read for all of the data values, with the AME files being used to populate an additional mass excess data field. No comparison or validation is done on common values.

Setup

The package is available on the Python Package Index so can be installed via pip

pip install nuclearmasses

Or you can clone the latest version from github

git clone https://github.com/php1ic/nuclearmasses

Usage

Once installed or cloned, the data is available as a single dataframe indexed on the mass table year

>>> from nuclearmasses.mass_table import MassTable
>>> df = MassTable().full_data

You can then interrogate, or extract, whatever information you want. For example, how has the mass excess and it's accuracy changed overtime for 190Re according to the AME

>>> df[(df['A'] == 190) & (df['Symbol'] == 'Re')][['AMEMassExcess', 'AMEMassExcessError']]
           AMEMassExcess  AMEMassExcessError
TableYear
1983          -35536.605             200.029
1993          -35557.789             145.549
1995          -35568.032             212.151
2003          -35566.326             149.248
2012          -35634.992              70.542
2016          -35635.830              70.852
2020          -35583.015               4.870

Or how does the mass excess of gold vary across the isotopic chain according to NUBASE in the most recent table for both experimentally measured and theoretical values

>>> df.query("TableYear == 2020 and Symbol == 'Au'")[['A', 'NUBASEMassExcess', 'NUBASEMassExcessError', 'Experimental']]
             A  NUBASEMassExcess  NUBASEMassExcessError  Experimental
TableYear
2020       168            2530.0                  400.0         False
2020       169           -1790.0                  300.0         False
2020       170           -3700.0                  200.0         False
2020       171           -7562.0                   21.0          True
2020       172           -9320.0                   60.0          True
2020       173          -12832.0                   23.0          True
2020       174          -14060.0                  100.0         False
2020       175          -17400.0                   40.0          True
2020       176          -18520.0                   30.0          True
2020       177          -21546.0                   10.0          True
2020       178          -22303.0                   10.0          True
2020       179          -24989.0                   12.0          True
2020       180          -25626.0                    5.0          True
2020       181          -27871.0                   20.0          True
2020       182          -28304.0                   19.0          True
2020       183          -30191.0                    9.0          True
2020       184          -30319.0                   22.0          True
2020       185          -31858.1                    2.6          True
2020       186          -31715.0                   21.0          True
2020       187          -33029.0                   22.0          True
2020       188          -32371.3                    2.7          True
2020       189          -33582.0                   20.0          True
2020       190          -32834.0                    3.0          True
2020       191          -33798.0                    5.0          True
2020       192          -32772.0                   16.0          True
2020       193          -33405.0                    9.0          True
2020       194          -32211.9                    2.1          True
2020       195          -32567.1                    1.1          True
2020       196          -31138.7                    3.0          True
2020       197          -31139.8                    0.5          True
2020       198          -29580.8                    0.5          True
2020       199          -29093.8                    0.5          True
2020       200          -27240.0                   27.0          True
2020       201          -26401.0                    3.0          True
2020       202          -24353.0                   23.0          True
2020       203          -23143.0                    3.0          True
2020       204          -20390.0                  200.0         False
2020       205          -18570.0                  200.0         False
2020       206          -14190.0                  300.0         False
2020       207          -10640.0                  300.0         False
2020       208           -5910.0                  300.0         False
2020       209           -2230.0                  400.0         False
2020       210            2680.0                  400.0         False

Contributing

If you have ideas for additional functionality or find bugs please create an issue or better yet a pull request.

We use a combination of isort, ruff and mypy to keep things tidy and hopefully catch errors and bugs before they happen. The command below returns no errors or issues so should be run after any code changes. We might add a CI pipeline in the future, but for the moment, it's a manual process.

isort . && ruff format && ruff check && mypy src

Known issues

  • #6 The decay mode field from the NUBASE data is stored 'as-is' from the file. It looks like it can be split on the ';' character for isotopes where there is more than one mode. A dictionary of {decay mode: fraction} may be the best way to store all of this information.
  • #7 Information from anything other than the ground state of an isotope is ignored when parsing the NUBASE file. The selection of what is and what is not included appears random to me which is why I simply ignored for the moment.

Project details


Download files

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

Source Distribution

nuclearmasses-0.0.4.tar.gz (4.1 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

nuclearmasses-0.0.4-py3-none-any.whl (5.0 kB view details)

Uploaded Python 3

File details

Details for the file nuclearmasses-0.0.4.tar.gz.

File metadata

  • Download URL: nuclearmasses-0.0.4.tar.gz
  • Upload date:
  • Size: 4.1 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for nuclearmasses-0.0.4.tar.gz
Algorithm Hash digest
SHA256 f381388c18eecbec43b49954267af2516da999ca0656b74bffdd266904ad33e4
MD5 addf08f0c898ae7e81b4abd312231d03
BLAKE2b-256 587e3c3a5b62d6acc1d6ffc1b29d71b998fc16de90577ad40f125ebc0fea9281

See more details on using hashes here.

Provenance

The following attestation bundles were made for nuclearmasses-0.0.4.tar.gz:

Publisher: publish-to-pypi.yml on php1ic/nuclearmasses

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file nuclearmasses-0.0.4-py3-none-any.whl.

File metadata

  • Download URL: nuclearmasses-0.0.4-py3-none-any.whl
  • Upload date:
  • Size: 5.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for nuclearmasses-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 397ab48292fa89bc4413d8f80b37f6049c4a75a1323fe003795947f80ac1f054
MD5 1d7c5f36fa503d6bee950e6df56ecabb
BLAKE2b-256 04fb6c2c5a64f9b67d83df4f32110667a2e9c104f2b013a538c1b985dcfc1825

See more details on using hashes here.

Provenance

The following attestation bundles were made for nuclearmasses-0.0.4-py3-none-any.whl:

Publisher: publish-to-pypi.yml on php1ic/nuclearmasses

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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