diff options
author | tlatorre <tlatorre@uchicago.edu> | 2020-11-30 17:15:26 -0500 |
---|---|---|
committer | tlatorre <tlatorre@uchicago.edu> | 2020-11-30 17:15:26 -0500 |
commit | 3716b099fe18ff458012084d344fce5f439d3532 (patch) | |
tree | b33fb9a03e5ca8e0d2026353f3597b104b9218a6 /utils/chi2 | |
parent | 8a8e51c15ec61e50e1e32a0ca5b71fdf758937a5 (diff) | |
download | sddm-3716b099fe18ff458012084d344fce5f439d3532.tar.gz sddm-3716b099fe18ff458012084d344fce5f439d3532.tar.bz2 sddm-3716b099fe18ff458012084d344fce5f439d3532.zip |
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
Diffstat (limited to 'utils/chi2')
-rwxr-xr-x | utils/chi2 | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -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)]) + '$') |