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

moved example code to separate directory and tidied up

parent 9e01f98a
......@@ -3,48 +3,47 @@ CXXFLAGS = -Wall $$(root-config --cflags)
LDLIBS = $$(root-config --glibs)
DATATABLES = ame16/mass16.txt ame16/rct1-16.txt ame16/rct2-16.txt nubase16/nubase2016.txt
EXAMPLE_DIR = examples
EXAMPLE_FIGURES = qec-all.pdf qec-no-estimates.pdf
EXAMPLE_DATAFILES = qec.dat qbn.dat
EXPDIR = expansion
EXPEXS = expand-nuchart-QEC expand-nuchart-QECp expand-nuchart-QEC2p
EXAMPLE_DATAFILES = qec.dat
EXPANSION_DIR = expansion
EXPANSION_EXS = expand-nuchart-QEC expand-nuchart-QECp expand-nuchart-QEC2p
EXS = dataprinter
.PHONEY: default all clean
.PHONEY: default all example1 clean
default: nuchart.root
default: nuchart.root dataprinter
all: default $(EXAMPLE_FIGURES) qbn.dat
all: default example1
nuchart.root: treemaker.py $(addprefix $(EXPDIR)/, $(EXPEXS))
nuchart.root: treemaker.py $(addprefix $(EXPANSION_DIR)/, $(EXPANSION_EXS))
ifeq ($(ROOTSYS), ) # source thisroot.sh if ROOTSYS is not defined
source $$(root-config --bindir)/thisroot.sh && python3 treemaker.py
else
python3 treemaker.py
endif
$(foreach exec, $(addprefix $(EXPDIR)/, $(EXPEXS)), ./$(exec); )
qec-all.pdf qec-no-estimates.pdf: graph-example-qec.py
$(foreach exec, $(addprefix $(EXPANSION_DIR)/, $(EXPANSION_EXS)), ./$(exec); )
example1: $(EXAMPLE_DIR)/graph-example-qec.py # PHONEY target avoids multiple executions with two real targets ('qec-all.pdf', 'qec-no-estimates.pdf'), but results in 'example1' always being executed if make is run on 'all' or 'example1'
python3 $<
graph-example-qec.py: qec.dat
$(EXAMPLE_DIR)/graph-example-qec.py: $(EXAMPLE_DIR)/qec.dat
qec.dat: dataprinter nuchart.root Makefile
$(EXAMPLE_DIR)/qec.dat: dataprinter nuchart.root Makefile
./$< nuchart.root a A Z QEC QEC_est "A <= 70" "QEC >= 0" > $@
qbn.dat: dataprinter nuchart.root Makefile
./$< nuchart.root a A Z QB QEC Sp QECp "A <= 70" > $@
dataprinter: dataprinter.cxx
$(CXX) $(CXXFLAGS) -o $@ $< $(LDLIBS)
$(EXPDIR)/expand-nuchart-QEC: $(EXPDIR)/expand-nuchart-QEC.cxx
$(EXPANSION_DIR)/expand-nuchart-QEC: $(EXPANSION_DIR)/expand-nuchart-QEC.cxx
$(CXX) $(CXXFLAGS) -o $@ $< $(LDLIBS)
$(EXPDIR)/expand-nuchart-QECp: $(EXPDIR)/expand-nuchart-QECp.cxx
$(EXPANSION_DIR)/expand-nuchart-QECp: $(EXPANSION_DIR)/expand-nuchart-QECp.cxx
$(CXX) $(CXXFLAGS) -o $@ $< $(LDLIBS)
$(EXPDIR)/expand-nuchart-QEC2p: $(EXPDIR)/expand-nuchart-QEC2p.cxx
$(EXPANSION_DIR)/expand-nuchart-QEC2p: $(EXPANSION_DIR)/expand-nuchart-QEC2p.cxx
$(CXX) $(CXXFLAGS) -o $@ $< $(LDLIBS)
treemaker.py: datagetter.py
......@@ -53,4 +52,5 @@ datagetter.py: $(DATATABLES)
clean:
$(RM) -r __pycache__
$(RM) nuchart.root $(addprefix $(EXPDIR)/, $(EXPEXS)) $(EXS) $(EXAMPLE_FIGURES) $(EXAMPLE_DATAFILES)
$(RM) nuchart.root $(addprefix $(EXPANSION_DIR)/, $(EXPANSION_EXS)) $(EXS) \
$(addprefix $(EXAMPLE_DIR)/, $(EXAMPLE_FIGURES)) $(addprefix $(EXAMPLE_DIR)/, $(EXAMPLE_DATAFILES))
......@@ -2,7 +2,7 @@ import matplotlib.pyplot as plt
import numpy as np
#QEC_est removed from below
n, A, Z, QEC, QEC_est = np.loadtxt('qec.dat', unpack=True)
n, A, Z, QEC, QEC_est = np.loadtxt('examples/qec.dat', unpack=True)
QEC /= 1000
msee = dict(linestyle='', color='k', markersize=8, mfc='k', mec='None')
......@@ -29,7 +29,7 @@ plt.xlabel('$A$')
plt.ylabel('$Q_{EC}$ (MeV)')
L = plt.legend()
plt.setp(L.texts, family='monospace')
plt.savefig('qec-all.pdf')
plt.savefig('examples/qec-all.pdf')
plt.close()
plt.plot(A[filteree & (QEC_est == 0)], QEC[filteree & (QEC_est == 0)], marker='$\mathrm{EE}$', **msee, label='Even N, Even Z')
......@@ -40,4 +40,4 @@ plt.xlabel('$A$')
plt.ylabel('$Q_{EC}$ (MeV)')
L = plt.legend()
plt.setp(L.texts, family='monospace')
plt.savefig('qec-no-estimates.pdf')
plt.savefig('examples/qec-no-estimates.pdf')
Supports Markdown
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