Mass Excess Visualized#
import pynucastro as pyna
First we’ll get all nuclei with known masses and look at the binding energy
nuclei = pyna.get_all_nuclei()
We want to visualize the mass excess and binding energy in the \(Z\)-\(N\) plane. First let’s get the extent of \(N\) and \(Z\) in our nucleus list.
max_Z = max(nuclei, key=lambda n : n.Z).Z
max_N = max(nuclei, key=lambda n : n.N).N
and the maximum absolute value of the mass excess (in MeV)
dm_mag = abs(max(nuclei, key=lambda n: abs(n.dm)).dm)
dm_mag
201.37
Now we’ll create an array to store dm(Z, N) and be(Z, N) and loop over all the nuclei and store each mass excess and binding energy / nucleon.
import numpy as np
dm = np.zeros((max_Z+1, max_N+1))
be = np.zeros((max_Z+1, max_N+1))
We’ll initialize these to NaN so we can mask out the regions where there are no nuclei
dm[:,:] = np.nan
be[:,:] = np.nan
for n in nuclei:
dm[n.Z, n.N] = n.dm
be[n.Z, n.N] = n.nucbind
Note
Due to mass excess estimation in the nuclear databases, a few nuclei have negative binding energies.
n = [n for n in nuclei if n.nucbind < 0]
n
[Li3, B6]
Finally, we can plot
import matplotlib as mpl
import matplotlib.pyplot as plt
# mask out the regions with no nuclei
cmap = mpl.colormaps['RdYlBu']
cmap.set_bad(color='white')
fig, ax = plt.subplots()
im = ax.imshow(dm, origin="lower", cmap="RdYlBu",
vmin=-100, vmax=100)
ax.set_xlabel("N")
ax.set_ylabel("Z")
ax.set_title("mass excess")
ax.grid(ls=":")
fig.colorbar(im, ax=ax, location="bottom", shrink=0.5, label="MeV")
fig.set_size_inches(8, 6)
