In order to correct for differences in detection efficiencies and solid angles, we will divide all of the doubles rates by the singles rates of the two detectors as follows:
$ W_{i,j} = \frac{D_{i,j}}{S_i*S_j}$
This requires calculating $S_i$ and $S_j$ from the cced
files. I need to rewrite my analysis from the beginning, or write another function that parses the cced
file.
In this file, I will import the singles and bicorr data and calculate all $D_{i,j}$, $S_i$, $S_j$, and $W_{i,j}$.
In [1]:
import os
import sys
import matplotlib.pyplot as plt
import numpy as np
import imageio
In [2]:
import pandas as pd
In [3]:
import seaborn as sns
sns.set(style='ticks')
In [4]:
sys.path.append('../scripts/')
In [5]:
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 [6]:
%load_ext autoreload
%autoreload 2
In [7]:
det_df = bicorr.load_det_df('../meas_info/det_df_pairs_angles.csv')
pair_is = bicorr.generate_pair_is(det_df,ignore_fc_neighbors_flag=True)
det_df = det_df.loc[pair_is].reset_index().rename(columns={'index':'index_og'}).copy()
det_df.head()
Out[7]:
I am going to add in a new optional input parameter in bicorr.load_det_df
that will let you provide this det_df
without fission chamber neighbors directly. Try it out.
In [7]:
det_df = bicorr.load_det_df('../meas_info/det_df_pairs_angles.csv', remove_fc_neighbors=True)
det_df.head()
Out[7]:
In [8]:
chList, fcList, detList, num_dets, num_det_pairs = bicorr.build_ch_lists()
dict_pair_to_index, dict_index_to_pair, dict_pair_to_angle = bicorr.build_dict_det_pair(det_df)
In [9]:
num_fissions = 2194651200.00
In [10]:
singles_hist, dt_bin_edges_sh, dict_det_to_index, dict_index_to_det = bicorr.load_singles_hist(filepath='../analysis/Cf072115_to_Cf072215b/datap',plot_flag=True,show_flag=True)
In [11]:
npzfile = np.load('../analysis/Cf072115_to_Cf072215b/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']
The fission chamber neighbors have already been removed
In [12]:
len(pair_is)
Out[12]:
In [12]:
emin = 0.62
emax = 12
Columns:
Sp
- Singles counts, positiveSn
- Singles counts, negativeSd
- Singles counts, br-subtractedSd_err
- Singles counts, br-subtracted, err
In [15]:
singles_df = pd.DataFrame.from_dict(dict_index_to_det,orient='index',dtype=np.int8).rename(columns={0:'ch'})
chIgnore = [1,17,33]
singles_df = singles_df[~singles_df['ch'].isin(chIgnore)].copy()
In [16]:
singles_df['Sp']= 0.0
singles_df['Sn']= 0.0
singles_df['Sd']= 0.0
singles_df['Sd_err'] = 0.0
In [17]:
for index in singles_df.index.values:
Sp, Sn, Sd, Sd_err = bicorr.calc_n_sum_br(singles_hist, dt_bin_edges_sh, index, emin=emin, emax=emax)
singles_df.loc[index,'Sp'] = Sp
singles_df.loc[index,'Sn'] = Sn
singles_df.loc[index,'Sd'] = Sd
singles_df.loc[index,'Sd_err'] = Sd_err
In [18]:
singles_df.head()
Out[18]:
In [19]:
bicorr_plot.Sd_vs_angle_all(singles_df)
In [20]:
det_df.head()
Out[20]:
In [21]:
det_df['Cp'] = 0.0
det_df['Cn'] = 0.0
det_df['Cd'] = 0.0
det_df['Cd_err'] = 0.0
det_df['Np'] = 0.0
det_df['Nn'] = 0.0
det_df['Nd'] = 0.0
det_df['Nd_err'] = 0.0
In [22]:
det_df.head()
Out[22]:
In [23]:
for index in det_df.index.values:
Cp, Cn, Cd, err_Cd = bicorr.calc_nn_sum_br(bhp_nn_pos[index,:,:],
bhp_nn_neg[index,:,:],
dt_bin_edges,
emin=emin, emax=emax)
det_df.loc[index,'Cp'] = Cp
det_df.loc[index,'Cn'] = Cn
det_df.loc[index,'Cd'] = Cd
det_df.loc[index,'Cd_err'] = err_Cd
Np, Nn, Nd, err_Nd = bicorr.calc_nn_sum_br(bhp_nn_pos[index,:,:],
bhp_nn_neg[index,:,:],
dt_bin_edges,
emin=emin, emax=emax,
norm_factor = num_fissions)
det_df.loc[index,'Np'] = Np
det_df.loc[index,'Nn'] = Nn
det_df.loc[index,'Nd'] = Nd
det_df.loc[index,'Nd_err'] = err_Nd
In [24]:
det_df.head()
Out[24]:
In [25]:
bicorr_plot.counts_vs_angle_all(det_df, normalized=True)
det_df
In [26]:
det_df['Sd1'] = 0.0
det_df['Sd1_err'] = 0.0
det_df['Sd2'] = 0.0
det_df['Sd2_err'] = 0.0
det_df['W'] = 0.0
det_df['W_err'] = 0.0
In [27]:
det_df.head()
Out[27]:
In [28]:
singles_df.head()
Out[28]:
Fill the S
and S_err
values for each channel in each detector pair.
In [30]:
# Fill S columns in det_df
for index in singles_df.index.values:
ch = singles_df.loc[index,'ch']
d1_indices = (det_df[det_df['d1'] == ch]).index.tolist()
d2_indices = (det_df[det_df['d2'] == ch]).index.tolist()
det_df.loc[d1_indices,'Sd1'] = singles_df.loc[index,'Sd']
det_df.loc[d1_indices,'Sd1_err'] = singles_df.loc[index,'Sd_err']
det_df.loc[d2_indices,'Sd2'] = singles_df.loc[index,'Sd']
det_df.loc[d2_indices,'Sd2_err'] = singles_df.loc[index,'Sd_err']
In [38]:
# Calculate W, W_err from S columns
det_df['W'] = det_df['Cd']/(det_df['Sd1']*det_df['Sd2'])
In [39]:
det_df['W_err'] = det_df['W'] * np.sqrt((det_df['Cd_err']/det_df['Cd'])**2 +
(det_df['Sd1_err']/det_df['Sd1'])**2 +
(det_df['Sd2_err']/det_df['Sd2'])**2)
In [40]:
det_df.head()
Out[40]:
In [44]:
bicorr_plot.W_vs_angle_all(det_df)
This is much "tighter" than the raw counts.
In [17]:
emin = 0.62
emax = 12
Data you have to have loaded:
In [15]:
singles_df = bicorr_sums.init_singles_df(dict_index_to_det)
singles_df.head()
Out[15]:
In [18]:
singles_df = bicorr_sums.fill_singles_df(dict_index_to_det, singles_hist, dt_bin_edges_sh, emin, emax)
singles_df.head()
Out[18]:
In [19]:
bicorr_plot.Sd_vs_angle_all(singles_df)
In [20]:
det_df.head()
Out[20]:
In [23]:
det_df = bicorr_sums.init_det_df_sums(det_df, t_flag = True)
det_df = bicorr_sums.fill_det_df_singles_sums(det_df, singles_df)
det_df = bicorr_sums.fill_det_df_doubles_t_sums(det_df, bhp_nn_pos, bhp_nn_neg, dt_bin_edges, emin, emax)
det_df = bicorr_sums.calc_det_df_W(det_df)
det_df.head()
Out[23]:
In [24]:
angle_bin_edges = np.arange(8,190,10)
In [26]:
by_angle_df = bicorr_sums.condense_det_df_by_angle(det_df,angle_bin_edges)
by_angle_df.head()
Out[26]:
In [27]:
bicorr_plot.W_vs_angle(det_df, by_angle_df, save_flag=False)
In [14]:
angle_bin_edges = np.arange(8,190,10)
In [15]:
singles_df, det_df, by_angle_df = bicorr_sums.perform_W_calcs(det_df,
dict_index_to_det, singles_hist, dt_bin_edges_sh,
bhp_nn_pos, bhp_nn_neg, dt_bin_edges,
num_fissions, emin, emax, angle_bin_edges)
In [16]:
det_df.head()
Out[16]:
In [17]:
bicorr_plot.W_vs_angle(det_df, by_angle_df, save_flag = False)
In [ ]: