aboutsummaryrefslogtreecommitdiff
path: root/utils/plot-fit-results
diff options
context:
space:
mode:
Diffstat (limited to 'utils/plot-fit-results')
-rwxr-xr-xutils/plot-fit-results54
1 files changed, 9 insertions, 45 deletions
diff --git a/utils/plot-fit-results b/utils/plot-fit-results
index e154b21..c90c13a 100755
--- a/utils/plot-fit-results
+++ b/utils/plot-fit-results
@@ -24,52 +24,16 @@ if __name__ == '__main__':
import itertools
from sddm import IDP_E_MINUS, IDP_MU_MINUS, SNOMAN_MASS
from sddm.plot import plot_hist, plot_legend, get_stats, despine, iqr_std_err, iqr_std, quantile_error, q90_err, q90, median, median_err, std_err
+ from sddm import setup_matplotlib
parser = argparse.ArgumentParser("plot fit results")
parser.add_argument("filenames", nargs='+', help="input files")
parser.add_argument("--save", action="store_true", default=False, help="save plots")
args = parser.parse_args()
- if args.save:
- # default \textwidth for a fullpage article in Latex is 16.50764 cm.
- # You can figure this out by compiling the following TeX document:
- #
- # \documentclass{article}
- # \usepackage{fullpage}
- # \usepackage{layouts}
- # \begin{document}
- # textwidth in cm: \printinunitsof{cm}\prntlen{\textwidth}
- # \end{document}
-
- width = 16.50764
- width /= 2.54 # cm -> inches
- # According to this page:
- # http://www-personal.umich.edu/~jpboyd/eng403_chap2_tuftegospel.pdf,
- # Tufte suggests an aspect ratio of 1.5 - 1.6.
- height = width/1.5
- FIGSIZE = (width,height)
-
- import matplotlib.pyplot as plt
-
- font = {'family':'serif', 'serif': ['computer modern roman']}
- plt.rc('font',**font)
-
- plt.rc('text', usetex=True)
- else:
- # on retina screens, the default plots are way too small
- # by using Qt5 and setting QT_AUTO_SCREEN_SCALE_FACTOR=1
- # Qt5 will scale everything using the dpi in ~/.Xresources
- import matplotlib
- matplotlib.use("Qt5Agg")
-
- import matplotlib.pyplot as plt
-
- # Default figure size. Currently set to my monitor width and height so that
- # things are properly formatted
- FIGSIZE = (13.78,7.48)
+ setup_matplotlib(args.save)
- # Make the defalt font bigger
- plt.rc('font', size=22)
+ import matplotlib.pyplot as plt
# Read in all the data.
#
@@ -148,8 +112,8 @@ if __name__ == '__main__':
markers = itertools.cycle(('o', 'v'))
- fig3, ax3 = plt.subplots(3,1,figsize=FIGSIZE,num=3,sharex=True)
- fig4, ax4 = plt.subplots(3,1,figsize=FIGSIZE,num=4,sharex=True)
+ fig3, ax3 = plt.subplots(3,1,num=3,sharex=True)
+ fig4, ax4 = plt.subplots(3,1,num=4,sharex=True)
for id in [IDP_E_MINUS, IDP_MU_MINUS]:
events = data_true[data_true['mcgn_id'] == id]
@@ -168,10 +132,10 @@ if __name__ == '__main__':
marker = markers.next()
- plt.figure(1,figsize=FIGSIZE)
+ plt.figure(1)
plt.errorbar(T,dT['median']*100/T,yerr=dT['median_err']*100/T,fmt=marker,label=label)
- plt.figure(2,figsize=FIGSIZE)
+ plt.figure(2)
plt.errorbar(T,dT['iqr_std']*100/T,yerr=dT['iqr_std_err']*100/T,fmt=marker,label=label)
ax3[0].errorbar(T,dx['median'],yerr=dx['median_err'],fmt=marker,label=label)
@@ -182,10 +146,10 @@ if __name__ == '__main__':
ax4[1].errorbar(T,dy['iqr_std'],yerr=dy['iqr_std_err'],fmt=marker,label=label)
ax4[2].errorbar(T,dz['iqr_std'],yerr=dz['iqr_std_err'],fmt=marker,label=label)
- plt.figure(5,figsize=FIGSIZE)
+ plt.figure(5)
plt.errorbar(T,theta['std'],yerr=theta['std_err'],fmt=marker,label=label)
- plt.figure(6,figsize=FIGSIZE)
+ plt.figure(6)
plt.scatter(events['Te'],events['ratio'],marker=marker,label=label)
fig = plt.figure(1)