Commit adc705a8 authored by Erik Asbjørn Mikkelsen Jensen's avatar Erik Asbjørn Mikkelsen Jensen
Browse files

done improving chart of nuclides example

parent 53d37918
......@@ -41,7 +41,7 @@ $(EXAMPLE_DIR)/graph-example-beta-delayed.py: $(EXAMPLE_DIR)/beta-delayed.dat
$(EXAMPLE_DIR)/beta-delayed.dat: nuchart.root Makefile
# `Dataprinter` is available at gitlab.au.dk/ausa/erik/rootcon
Dataprinter $< a Z N QECp QBn QEC2p QB2n QECa QBa QECp_est QBn_est QEC2p_est QB2n_est QECa_est QBa_est half_life_stbl "Z <= 50" "N <= 50" > $@
Dataprinter $< a Z N QEC QB Qa QECp QBn QEC2p QB2n QECa QBa QECp_est QBn_est QEC2p_est QB2n_est QECa_est QBa_est half_life half_life_est half_life_stbl "Z <= 50" "N <= 50" > $@
$(EXPANSION_DIR)/expand-nuchart-QEC: $(EXPANSION_DIR)/expand-nuchart-QEC.cxx
$(CXX) $(CXXFLAGS) -o $@ $< $(LDLIBS)
......@@ -61,6 +61,8 @@ $(EXPANSION_DIR)/expand-nuchart-QB2n: $(EXPANSION_DIR)/expand-nuchart-QB2n.cxx
$(EXPANSION_DIR)/expand-nuchart-QBa: $(EXPANSION_DIR)/expand-nuchart-QBa.cxx
$(CXX) $(CXXFLAGS) -o $@ $< $(LDLIBS)
$(EXAMPLE_DIR)/beta-delayed.pdf: $(EXAMPLE_DIR)/graph-example-beta-delayed.py
treemaker.py: datagetter.py
datagetter.py: $(DATATABLES)
......
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
import matplotlib.patheffects as pe
# TODO: some points on the final plot are missing, and some should probably be
# removed based on beta stability considerations.
# this example still serves as a basic draft for making parameter-specific
# chart of nuclides figures, however.
mpl.style.use('seaborn-colorblind')
n, Z, N, QECp, QBn, QEC2p, QB2n, QECa, QBa, QECp_est, QBn_est, QEC2p_est, \
QB2n_est, QECa_est, QBa_est, half_life_stbl = np.loadtxt('beta-delayed.dat', unpack=True)
n, Z, N, QEC, QB, Qa, QECp, QBn, QEC2p, QB2n, QECa, QBa, QECp_est, QBn_est, QEC2p_est, \
QB2n_est, QECa_est, QBa_est, half_life, half_life_est, half_life_stbl = np.loadtxt('examples/beta-delayed.dat', unpack=True)
xmin = int(np.min(N))
xmax = int(np.max(N))
ymin = int(np.min(Z))
ymax = int(np.max(Z))
filters = [(np.ones(len(n), dtype=bool)), (half_life_stbl == 1),
filters = [(np.ones(len(n), dtype=bool)),
(half_life_stbl == 1),
(
(
((QECp > 0)) & ((QEC2p < 0) | np.isnan(QEC2p))
) |
(QECp > 0) & ((QEC2p < 0) | np.isnan(QEC2p)) & (QEC > 0) & (half_life > 1e-4)
)
|
(
(QBn > 0) & ((QB2n < 0) | np.isnan(QB2n))
(QBn > 0) & ((QB2n < 0) | np.isnan(QB2n)) & (QB > 0) & (half_life > 1e-4)
)
),
((QEC2p > 0) | (QB2n > 0)), ((QECa > 0) | (QBa > 0))
),
(((QEC2p > 0) & (QEC > 0) & (half_life > 1e-4)) | ((QB2n > 0) & (QB > 0) & (half_life > 1e-4))),
(((QBa > 0) & (QB > 0) & (half_life > 1e-4)) | ((QECa > 0) & (QEC > 0) & (half_life > 1e-4))),
((half_life < 1e-4) | (np.isnan(half_life))) & ~(half_life_stbl == 1)
]
labels = ['', '$\mathtt{Stable}$',
labels = ['',
'$\mathtt{Stable}$',
'$\mathtt{ECp}$ / $\mathtt{\\beta^{-}n}$',
'$\mathtt{EC2p}$ / $\mathtt{\\beta^{-}2n}$',
'$\mathtt{EC\\alpha}$ / $\mathtt{\\beta^{-}\\alpha}$']
rectcenters = [0.5, 0.5, 0.5, 0.5, 0.3]
rectsizes = [1.0, 1.0, 1.0, 1.0, 0.6]
linewidths = [0.0, 0.0, 0.0, 0.0, 0.01]
'$\mathtt{EC\\alpha}$ / $\mathtt{\\beta^{-}\\alpha}$',
'$\mathtt{t_{1/2} }$ < 0.1 ms or \n$\mathtt{t_{1/2} }$ unknown']
rectcenters = [0.5, 0.5, 0.5, 0.5, 0.3, 0.5]
rectsizes = [1.0, 1.0, 1.0, 1.0, 0.6, 1.0]
linewidths = [0.0, 0.0, 0.0, 0.0, 0.2, 0.0]
markersizes = np.array(rectsizes) * 7.0
edgecolors = ['w', 'k', 'tomato', 'limegreen', 'k']
facecolors = ['w', 'k', 'tomato', 'limegreen', 'dodgerblue']
edgecolors = ['w', 'k', 'C5', 'C2', 'k', 'C9']
facecolors = ['w', 'k', 'C5', 'C2', 'C4', 'C9']
shapes = ['s', 's', 's', 's', 'D', 's']
xlower = xupper = ylower = yupper = np.array([])
for i in range(xmin, xmax + 1):
......@@ -55,12 +62,17 @@ ax.set_axisbelow(True)
ax.grid(which='both', linestyle='--', alpha=0.3)
for i in range(len(filters)):
if i > 0: # no legend for white squares which are printed for all existing nuclides (otherwise grid is obstructing)
plt.plot(-100, -100, marker='s', markeredgecolor=edgecolors[i], markersize=markersizes[i],
plt.plot(-100, -100, marker=shapes[i], markeredgecolor=edgecolors[i], markersize=markersizes[i],
markerfacecolor=facecolors[i], linestyle='', markeredgewidth=linewidths[i], label=labels[i])
for x, y in zip(N[filters[i]], Z[filters[i]]):
ax.add_patch(plt.Rectangle((x - rectcenters[i], y - rectcenters[i]),
if shapes[i] == 's':
ax.add_patch(plt.Rectangle((x - rectcenters[i], y - rectcenters[i]),
rectsizes[i], rectsizes[i], edgecolor=edgecolors[i],
facecolor=facecolors[i], linewidth=linewidths[i]))
elif shapes[i] == 'D':
ax.add_patch(plt.Rectangle((x, y - np.sqrt(2)*rectcenters[i]),
rectsizes[i], rectsizes[i], edgecolor=edgecolors[i],
facecolor=facecolors[i], linewidth=linewidths[i], angle=45.0))
ax.set_aspect('equal')
......@@ -75,24 +87,20 @@ xlower = np.roll(xlower, -1)
plt.vlines(np.array(range(int(xmin), int(xmax) + 1)) + 0.5, ylower - 0.5, yupper[0:-1] + 0.5, lw=0.4, color='k', capstyle='round')
plt.hlines(np.array(range(int(ymin), int(ymax) + 1)) + 0.5, xlower[0:-1] + 0.5, xupper - 0.5, lw=0.4, color='k', capstyle='round')
plt.arrow(3, 17, 6, -5, length_includes_head=True, linewidth=1.0, head_width=0.7, joinstyle='round', facecolor='k')
plt.arrow(7, 21, 2, -8, length_includes_head=True, linewidth=1.0, head_width=0.7, joinstyle='round', edgecolor='darkgray', facecolor='darkgray', zorder=9999)
plt.arrow(10, 21, 1, -6, length_includes_head=True, linewidth=1.0, head_width=0.7, joinstyle='round', edgecolor='darkgray', facecolor='darkgray', zorder=9999)
plt.text(2, 17, '$\mathtt{^{21}Mg}$', horizontalalignment='center', verticalalignment='bottom', fontsize=9.0)
plt.text(6, 21, '$\mathtt{^{22}Al}$', horizontalalignment='center', verticalalignment='bottom', fontsize=9.0, color='darkgray')
plt.text(10, 21, '$\mathtt{^{26}P}$', horizontalalignment='center', verticalalignment='bottom', fontsize=9.0, color='darkgray')
#plt.plot(9, 12, 'o', markerfacecolor="None", markeredgecolor='dimgrey')
#plt.plot(9, 13, 'o', markerfacecolor="None", markeredgecolor='dimgrey')
#plt.plot(11, 15, 'o', markerfacecolor="None", markeredgecolor='dimgrey')
text0 = plt.annotate("$\mathtt{^{21}Mg}$", (9, 12), (3.5, 17), arrowprops=dict(arrowstyle="wedge", lw=1, facecolor='k'), ha="right", path_effects=[pe.withStroke(linewidth=0.6, foreground='lightgrey')])
text0.arrow_patch.set_path_effects([pe.Stroke(linewidth=1.6, foreground='lightgrey'), pe.Normal()])
text1 = plt.annotate("$\mathtt{^{22}Al}$", (9, 13), (7.5, 21), arrowprops=dict(arrowstyle="wedge", lw=1, edgecolor='whitesmoke', facecolor='whitesmoke'), ha="right", color='whitesmoke', path_effects=[pe.withStroke(linewidth=0.6, foreground='k')])
text1.arrow_patch.set_path_effects([pe.Stroke(linewidth=1.6, foreground='k'), pe.Normal()])
text2 = plt.annotate("$\mathtt{^{26}P}$", (11, 15), (11, 21), arrowprops=dict(arrowstyle="wedge", lw=1, edgecolor='whitesmoke', facecolor='whitesmoke'), ha="right", color='whitesmoke', path_effects=[pe.withStroke(linewidth=0.6, foreground='k')])
text2.arrow_patch.set_path_effects([pe.Stroke(linewidth=1.6, foreground='k'), pe.Normal()])
plt.xlim(xmin - 0.5, xmax + 0.5)
plt.ylim(xmin - 0.5, xmax + 0.5)
plt.xlim(xmin - 0.5, 36 + 0.5)
plt.ylim(xmin - 0.5, 36 + 0.5)
plt.xlabel('$N$')
plt.ylabel('$Z$')
handles, labels = plt.gca().get_legend_handles_labels()
order = [0, 1, 2, 3]
L = plt.legend([handles[idx] for idx in order], [labels[idx] for idx in order])
order = [0, 1, 2, 3, 4]
L = plt.legend([handles[idx] for idx in order], [labels[idx] for idx in order], fontsize=8.0)
plt.setp(L.texts, family='monospace')
plt.savefig('beta-delayed-asd2.pdf')
plt.savefig('examples/beta-delayed.pdf', bbox_inches='tight', dpi=300)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment