In [1]:
import os
import sys
import matplotlib.pyplot as plt
import matplotlib.colors
import numpy as np
In [2]:
os.getcwd()
Out[2]:
In [4]:
os.listdir('../../scripts')
Out[4]:
In [5]:
sys.path.append('../../scripts/')
In [6]:
import bicorr as bicorr
import bicorr_plot as bicorr_plot
In [7]:
%load_ext autoreload
%autoreload 2
In [8]:
import seaborn as sns
sns.set(style='ticks')
In [9]:
det_df = bicorr.load_det_df('../../meas_info/det_df_pairs_angles.csv',plot_flag=True)
In [10]:
chList, fcList, detList, num_dets, num_det_pairs = bicorr.build_ch_lists(print_flag=True)
In [11]:
os.listdir()
Out[11]:
In [12]:
sparse_bhm, dt_bin_edges, note = bicorr.load_sparse_bhm(filepath='datap')
In [13]:
sparse_bhm.nbytes
Out[13]:
In [14]:
bhm = bicorr.revive_sparse_bhm(sparse_bhm, det_df, dt_bin_edges)
In [15]:
bhm.shape
Out[15]:
In [16]:
print(bhm.shape)
print(dt_bin_edges[1]-dt_bin_edges[0])
In [17]:
bhm, dt_bin_edges = bicorr.coarsen_bhm(bhm,dt_bin_edges,4,True)
In [18]:
print(bhm.shape)
print(dt_bin_edges[1]-dt_bin_edges[0])
In [19]:
pair_is = bicorr.generate_pair_is(det_df, ignore_fc_neighbors_flag=True)
len(pair_is)
Out[19]:
In [20]:
plt.figure(figsize=(6,6))
plt.plot(det_df.iloc[pair_is]['d1'],det_df.iloc[pair_is]['d2'],'sk')
for i in [1,17,33]:
plt.axvline(i,c='r')
plt.axhline(i,c='r')
plt.xlabel('Detector 1 channel')
plt.ylabel('Detector 2 channel')
plt.title('Included detector pairs')
sns.despine(right=False)
plt.show()
In [21]:
bhp_nn_shape = bhm[pair_is,0,:,:].shape
print(bhp_nn_shape)
In [22]:
bhp_nn = np.zeros(bhp_nn_shape)
bhp_nn.shape
Out[22]:
In [23]:
for i in np.arange(len(pair_is)):
pair_i = pair_is[i]
bhp_nn[i,:,:] = bicorr.build_bhp(bhm,dt_bin_edges,pair_is=[pair_i],type_is=[0])[0]
print(bhp_nn.shape)
In [24]:
bicorr_plot.bhp_plot(np.sum(bhp_nn[:,:,:],axis=0),dt_bin_edges,show_flag=True)
Out[24]:
In [25]:
i = 50
bicorr_plot.bhp_plot(bhp_nn[i,:,:],dt_bin_edges,show_flag=True)
Out[25]:
In [26]:
note = "Stored from IPOL simulation file with 1 ns time binning. Pairs are without fc neighbors. -PFS, 7/10/18"
In [27]:
save_filename = 'datap/bhp_nn_1ns'
In [28]:
np.savez(save_filename,
bhp_nn = bhp_nn,
dt_bin_edges = dt_bin_edges,
pair_is = pair_is,
note = note)
In [29]:
os.listdir('datap')
Out[29]:
In [30]:
os.getcwd()
Out[30]:
In [31]:
load_filename = 'datap/bhp_nn_1ns.npz'
In [32]:
npzfile = np.load(load_filename)
print(npzfile.files)
print(npzfile['note'])
In [33]:
pair_is = npzfile['pair_is']
bhp_nn = npzfile['bhp_nn']
dt_bin_edges = npzfile['dt_bin_edges']
pair_is = npzfile['pair_is']
In [ ]: