Skip to main content

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

Project description

Nuclear Masses

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 nuclearmasses

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.3.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.3-py3-none-any.whl (4.1 MB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: nuclearmasses-0.0.3.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.3.tar.gz
Algorithm Hash digest
SHA256 55ba44d607b22dfc6b6ea52727665bb64fa669b5970e189c3436f936a607c805
MD5 b96923057bc017e057d5b60125824534
BLAKE2b-256 d40fa518b4b4f9ffc8cd2485a3b179841d077f8897002a7f4fdda55d7c4aa1e4

See more details on using hashes here.

Provenance

The following attestation bundles were made for nuclearmasses-0.0.3.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.3-py3-none-any.whl.

File metadata

  • Download URL: nuclearmasses-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 4.1 MB
  • 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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 a13ff9dcb226f40b7ee814992bd1caaadc61f9c051b6273cee693659b2656e9b
MD5 117dc1ad371f629cbb757e0df60bfd67
BLAKE2b-256 d86cb80ef0013d110b9ee26e04dc67a3c649b1a7f43673f7d2f0da30c5e4a2ac

See more details on using hashes here.

Provenance

The following attestation bundles were made for nuclearmasses-0.0.3-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