In [1]:
import os
import sys
import matplotlib.pyplot as plt
import numpy as np
import scipy.io as sio
import imageio
import pandas as pd
import seaborn as sns
sns.set(style='ticks')
In [2]:
sys.path.append('../../scripts')
In [3]:
import bicorr as bicorr
import bicorr_e as bicorr_e
import bicorr_plot as bicorr_plot
import bicorr_sums as bicorr_sums
import bicorr_math as bicorr_math
In [4]:
%load_ext autoreload
%autoreload 2
In [5]:
os.getcwd()
Out[5]:
In [6]:
det_df = bicorr.load_det_df('../../meas_info/det_df_pairs_angles.csv')
det_df.head()
Out[6]:
In [7]:
num_fissions = int(int(sio.loadmat('datap/num_fissions.mat')['num_fissions'])*float(sio.loadmat('datap/fc_efficiency.mat')['fc_efficiency']))
print(num_fissions)
In [36]:
npzfile = np.load('datap/bhp_nn_by_pair_1ns.npz')
pair_is = npzfile['pair_is']
bhp_nn_pos = npzfile['bhp_nn_pos']
bhp_nn_neg = npzfile['bhp_nn_neg']
dt_bin_edges = npzfile['dt_bin_edges']
In [37]:
bhp_nn_diff = np.subtract(bhp_nn_pos.astype(np.int32),bhp_nn_neg[:,::-1,::-1].astype(np.int32))
Run some calculations to estimate relative magnitude of background.
In [10]:
bhp_nn_diff.shape
Out[10]:
In [11]:
a = bhp_nn_neg
b = bhp_nn_pos
print(a.shape, b.shape)
fraction_negative = np.divide(a,b,out=np.zeros_like(a), where=b!=0)
fraction_negative.shape
Out[11]:
Overall number of events
In [12]:
a = np.sum(bhp_nn_neg)
b = np.sum(bhp_nn_pos)
print(a, b)
fraction_negative = np.divide(a,b,out=np.zeros_like(a), where=b!=0)
fraction_negative
Out[12]:
In relevant time ranges:
In [13]:
bicorr_math.convert_energy_to_time(0.62)
Out[13]:
In [14]:
bicorr_math.convert_energy_to_time(6)
Out[14]:
In [15]:
i_min = int(np.digitize(30,dt_bin_edges))
i_max = int(np.digitize(100,dt_bin_edges))
print(i_min,i_max)
In [16]:
a = np.sum(bhp_nn_neg[i_min:i_max,:,:])
b = np.sum(bhp_nn_pos[i_min:i_max,:,:])
print(a, b)
fraction_negative = np.divide(a,b,out=np.zeros_like(a), where=b!=0)
fraction_negative
Out[16]:
Alright we'll go with this.
In [17]:
norm_factor = num_fissions * len(pair_is) * np.power((dt_bin_edges[1]-dt_bin_edges[0]),2)
bhp = np.sum(bhp_nn_diff,axis=0)/norm_factor
In [18]:
vmin = np.min(bhp[np.nonzero(bhp)])
vmax = np.max(bhp)
print(vmin,vmax)
In [20]:
ax = bicorr_plot.bhp_plot(bhp,dt_bin_edges,show_flag=False,
vmin = 1e-12, vmax=4e-9, clear=False)
ax.text(10,175,'EXPERIMENT', size=10, backgroundcolor='lightgray')
ax.text(165,175,'(a)',size=15,backgroundcolor='lightgray')
bicorr_plot.save_fig_to_folder('bhm_all_normed',dpi=150)
plt.show()
In [42]:
all_pairs = pair_is
all_pairs.shape
Out[42]:
In [27]:
with_to_without = dict(zip(all_pairs,np.arange(861)))
In [28]:
pair_is = bicorr.generate_pair_is(det_df, th_min=10, th_max=20, ignore_fc_neighbors_flag=True)
pair_is_without = [with_to_without[pair_is[i]] for i in range(len(pair_is))]
In [29]:
norm_factor = num_fissions * len(pair_is) * np.power((dt_bin_edges[1]-dt_bin_edges[0]),2)
bhp = np.sum(bhp_nn_diff[pair_is_without,:,:],axis=0)/norm_factor
In [30]:
bicorr_plot.bhp_plot(bhp,dt_bin_edges,show_flag=True,
save_flag=True,
save_filename = 'bhm_15_normed')
Out[30]:
In [26]:
pair_is = bicorr.generate_pair_is(det_df, th_min=40, th_max=50, ignore_fc_neighbors_flag=True)
pair_is_without = [with_to_without[pair_is[i]] for i in range(len(pair_is))]
In [27]:
norm_factor = num_fissions * len(pair_is) * np.power((dt_bin_edges[1]-dt_bin_edges[0]),2)
bhp = np.sum(bhp_nn_diff[pair_is_without,:,:],axis=0)/norm_factor
In [28]:
bicorr_plot.bhp_plot(bhp,dt_bin_edges,show_flag=True,
save_flag=True,
save_filename = 'bhm_45_normed')
Out[28]:
In [43]:
bhm_e, e_bin_edges, note = bicorr_e.load_bhm_e('datap')
In [44]:
bhp_e, norm_factor = bicorr_e.build_bhp_e(bhm_e,e_bin_edges,pair_is=all_pairs,num_fissions=num_fissions)
In [45]:
vmin = np.min(bhp_e[np.nonzero(bhp_e)])
vmax = np.max(bhp_e)
print(vmin, vmax)
In [46]:
ax = bicorr_plot.bhp_e_plot(bhp_e, e_bin_edges, show_flag = False,
vmin = 1e-8, vmax=1e-6, zoom_range =[0,6],
clear_flag=False)
ax.text(0.25,5.25,'EXPERIMENT', size=10, backgroundcolor='lightgray')
ax.text(4.85,5.25,'(c)',size=15,backgroundcolor='lightgray')
bicorr_plot.save_fig_to_folder(fig_filename='bhm_e_all')
plt.show()
In [33]:
bhm_e.shape
Out[33]:
In [34]:
pair_is = bicorr.generate_pair_is(det_df, th_min=10, th_max=20, ignore_fc_neighbors_flag=True)
In [35]:
bhp_e, norm_factor = bicorr_e.build_bhp_e(bhm_e,e_bin_edges,pair_is=pair_is,num_fissions=num_fissions)
In [36]:
vmin = np.min(bhp_e[np.nonzero(bhp_e)])
vmax = np.max(bhp_e)
print(vmin, vmax)
In [37]:
bicorr_plot.bhp_e_plot(bhp_e, e_bin_edges, show_flag = True,
vmin = 1e-8, vmax=1e-5, zoom_range =[0,6],
save_flag = True, save_filename = 'bhm_e_15')
Out[37]:
In [32]:
pair_is = bicorr.generate_pair_is(det_df, th_min=40, th_max=50, ignore_fc_neighbors_flag=True)
In [33]:
bhp_e, norm_factor = bicorr_e.build_bhp_e(bhm_e,e_bin_edges,pair_is=pair_is,num_fissions=num_fissions)
In [34]:
vmin = np.min(bhp_e[np.nonzero(bhp_e)])
vmax = np.max(bhp_e)
print(vmin, vmax)
In [35]:
bicorr_plot.bhp_e_plot(bhp_e, e_bin_edges, show_flag = True,
vmin = 1e-8, vmax=1e-5, zoom_range =[0,6],
save_flag = True, save_filename = 'bhm_e_45')
Out[35]:
In [ ]: