What is the average of $E_1+E_2$?
In [1]:
import matplotlib.pyplot as plt
import matplotlib.colors
import numpy as np
import os
import scipy.io as sio
import sys
import time
import inspect
import pandas as pd
from tqdm import *
In [2]:
%load_ext autoreload
%autoreload 2
In [3]:
sys.path.append('../scripts/')
import bicorr as bicorr
import bicorr_plot as bicorr_plot
import bicorr_e as bicorr_e
import bicorr_math as bicorr_math
In [4]:
bhm_e, e_bin_edges, note = bicorr_e.load_bhm_e('../analysis/Cf072115_to_Cf072215b/datap')
In [5]:
det_df = bicorr.load_det_df()
In [6]:
dict_pair_to_index, dict_index_to_pair, dict_pair_to_angle = bicorr.build_dict_det_pair(det_df)
In [7]:
num_fissions = int(sio.loadmat(r'../analysis/Cf072115_to_Cf072215b/datap/num_fissions.mat')['num_fissions'])
num_fissions
Out[7]:
In [8]:
bhp_e, norm_factor = bicorr_e.build_bhp_e(bhm_e,e_bin_edges,num_fissions=num_fissions,print_flag=True)
In [9]:
bicorr_plot.bhp_e_plot(bhp_e, e_bin_edges, zoom_range=[0,6], title = "normalized bhp_e", show_flag = True)
In [19]:
E_min = 0.75
E_max = 4
In [22]:
i_E_min = np.digitize(E_min,e_bin_edges)-1
i_E_max = np.digitize(E_max,e_bin_edges)-1
print(i_E_min,i_E_max)
In [27]:
centers = bicorr_math.calc_centers(e_bin_edges)[i_E_min:i_E_max]
centers.shape
Out[27]:
In [31]:
X, Y = np.meshgrid(centers, centers)
In [32]:
H = bhp_e[i_E_min:i_E_max,i_E_min:i_E_max]
In [33]:
print(X.shape)
print(Y.shape)
print(H.shape)
In [37]:
bicorr_math.calc_histogram_mean((X+Y)/2,H,True,True)
Out[37]:
In [ ]:
In [55]:
th_bin_edges = np.arange(8,190,10)
th_bin_centers = bicorr_math.calc_centers(th_bin_edges)
E_min = 0.75
E_max = 4
In [42]:
i_E_min = np.digitize(E_min,e_bin_edges)-1
i_E_max = np.digitize(E_max,e_bin_edges)-1
print(i_E_min,i_E_max)
In [56]:
Esum_df = pd.DataFrame({'th_bin_center':th_bin_centers})
Esum_df['Eave'] = np.nan
Esum_df['Eave_err'] = np.nan
In [58]:
Esum_df.head()
Out[58]:
In [59]:
for th_i in range(len(th_bin_edges)-1):
th_min = th_bin_edges[th_i]
th_max = th_bin_edges[th_i+1]
pair_is = bicorr.generate_pair_is(det_df,th_min=th_min,th_max=th_max)
if len(pair_is) > 5:
bhp_e = bicorr_e.build_bhp_e(bhm_e,e_bin_edges,pair_is=pair_is)[0]
H = bhp_e[i_E_min:i_E_max,i_E_min:i_E_max]
Esum_df.loc[th_i,'Eave'], Esum_df.loc[th_i,'Eave_err'] = bicorr_math.calc_histogram_mean((X+Y)/2,H,False,True)
In [62]:
plt.figure(figsize=(4,4))
ax = plt.gca()
ax.errorbar(Esum_df['th_bin_center'],Esum_df['Eave'],yerr=Esum_df['Eave_err'],fmt='.')
plt.xlabel('Angle (degrees)')
plt.ylabel('Average neutron energy (MeV)')
plt.show()
In [ ]:
Esum_df.to_csv()