From 3716b099fe18ff458012084d344fce5f439d3532 Mon Sep 17 00:00:00 2001 From: tlatorre Date: Mon, 30 Nov 2020 17:15:26 -0500 Subject: update code to work with python3 This commit updates the python code to work with python 3 and with a newer version of matplotlib. - zip_longest -> izip_longest - fix tick marks for log plots - scipy.misc -> scipy.special --- utils/chi2 | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'utils/chi2') diff --git a/utils/chi2 b/utils/chi2 index 5d56f17..acb59de 100755 --- a/utils/chi2 +++ b/utils/chi2 @@ -29,13 +29,13 @@ from scipy.stats import iqr, poisson from matplotlib.lines import Line2D from scipy.stats import iqr, norm, beta, percentileofscore from scipy.special import spence -from itertools import izip_longest from sddm.stats import * from sddm.dc import estimate_errors, EPSILON, truncnorm_scaled import emcee from sddm import printoptions from sddm.utils import fast_cdf, correct_energy_bias import nlopt +from itertools import chain # Likelihood Fit Parameters # 0 - Atmospheric Neutrino Flux Scale @@ -125,6 +125,11 @@ def plot_hist2(hists, bins, color=None): bincenters = (bins[1:] + bins[:-1])/2 plt.hist(bincenters, bins=bins, histtype='step', weights=hists[id],color=color) plt.gca().set_xscale("log") + major = np.array([10,100,1000,10000]) + minor = np.unique(list(chain(*list(range(i,i*10,i) for i in major[:-1])))) + minor = np.setdiff1d(minor,major) + plt.gca().set_xticks(major) + plt.gca().set_xticks(minor,minor=True) plt.xlabel("Energy (MeV)") plt.title('$' + ''.join([particle_id[int(''.join(x))] for x in grouper(str(id),2)]) + '$') -- cgit