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/plot-energy | |
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/plot-energy')
-rwxr-xr-x | utils/plot-energy | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/utils/plot-energy b/utils/plot-energy index 4568bcc..2fb2aa1 100755 --- a/utils/plot-energy +++ b/utils/plot-energy @@ -31,7 +31,7 @@ from scipy.stats import iqr, poisson from matplotlib.lines import Line2D from scipy.stats import iqr, norm, beta from scipy.special import spence -from itertools import izip_longest +from itertools import chain particle_id = {20: 'e', 22: r'\mu'} @@ -56,6 +56,11 @@ def plot_hist2(df, muons=False): plt.hist(df_id.ke.values, bins=bins, histtype='step') plt.gca().set_xscale("log") plt.xlabel("Energy (MeV)") + 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.title('$' + ''.join([particle_id[int(''.join(x))] for x in grouper(str(id),2)]) + '$') if len(df): |