Author: James Bourbeau
In [1]:
%load_ext watermark
%watermark -u -d -v -p numpy,scipy,pandas,sklearn,mlxtend
In [2]:
import sys
sys.path.append('/home/jbourbeau/cr-composition')
print('Added to PYTHONPATH')
In [3]:
from __future__ import division, print_function
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import matplotlib.gridspec as gridspec
from icecube.weighting.weighting import from_simprod
import composition as comp
import composition.analysis.plotting as plotting
# # Plotting-related
# sns.set_palette('muted')
# sns.set_color_codes()
# color_dict = {}
# for i, composition in enumerate(['light', 'heavy', 'total']):
# color_dict[composition] = sns.color_palette('muted').as_hex()[i]
%matplotlib inline
[ back to top ]
In [4]:
df_sim = comp.load_dataframe(datatype='sim', config='IC79')
df_data = comp.load_dataframe(datatype='data', config='IC79')
n_sim = len(df_sim)
n_data = len(df_data)
print('{} simulation events'.format(n_sim))
print('{} data events'.format(n_data))
In [5]:
beta_bins=np.linspace(1.4, 9.5, 75)
plotting.make_verification_plot(df_data, df_sim, 'lap_beta', beta_bins, 'Laputop \\beta')
In [10]:
charge_hits_bins=np.linspace(0, 30, 75)
plotting.make_verification_plot(df_data, df_sim, 'charge_nhits_ratio', charge_hits_bins, 'Charge/Hits ratio')
In [11]:
rlogl_bins=np.linspace(-50, 0, 75)
plotting.make_verification_plot(df_data, df_sim, 'lap_rlogl', rlogl_bins, 'Laputop rlogl')
In [14]:
s125_bins=np.linspace(0, 2.5, 75)
plotting.make_verification_plot(df_data, df_sim, 'log_s125', s125_bins, 'S125')
In [ ]:
In [12]:
df_sim['log_s125'].min(), df_sim['log_s125'].max()
Out[12]:
In [ ]:
fig, ax = plt.subplots()
ax.errorbar(beta_midpoints, rate_sim, yerr=rate_sim_err, label='MC', marker='.', ms=8)
ax.errorbar(beta_midpoints, rate_data, yerr=rate_data_err, label='Data', marker='.', ms=8)
ax.set_yscale("log", nonposy='clip')
ax.set_xlabel('Laputop $\\beta$')
ax.set_ylabel('Frequency')
plt.grid()
plt.legend()
plt.show()
In [7]:
fig, ax = plt.subplots()
ratio, ratio_err = comp.ratio_error(rate_data, rate_data_err,
rate_sim, rate_sim_err)
ax.errorbar(beta_midpoints, ratio, yerr=ratio_err, marker='.', ms=8)
ax.axhline(1.0, marker='None', ls=':')
ax.set_xlabel('Laputop $\\beta$')
ax.set_ylabel('Data/MC')
plt.grid()
plt.show()
In [ ]: