Compare commits
No commits in common. "409ab517455944d52123346bf522797a15174107" and "d65d205b8e7bf7f4875c2f8d99b2b6fd32beec12" have entirely different histories.
409ab51745
...
d65d205b8e
3 changed files with 29 additions and 58 deletions
36
BigBGO.py
36
BigBGO.py
|
|
@ -16,8 +16,6 @@ parser.add_argument("-xray", action='store_true', help = "if chosen, only xray d
|
||||||
parser.add_argument("-trigger", action='store_true', help = "if chosen, only data triggered on T1 is beeing considered") # on/off flag
|
parser.add_argument("-trigger", action='store_true', help = "if chosen, only data triggered on T1 is beeing considered") # on/off flag
|
||||||
parser.add_argument("-plot", action='store_true', help = "if chosen, histogramms are beeing plotted, not saved to csv") # on/off flag
|
parser.add_argument("-plot", action='store_true', help = "if chosen, histogramms are beeing plotted, not saved to csv") # on/off flag
|
||||||
parser.add_argument("-sum", action='store_true', help = "if chosen, sums of A and B in keV will be histogrammed") # on/off flag
|
parser.add_argument("-sum", action='store_true', help = "if chosen, sums of A and B in keV will be histogrammed") # on/off flag
|
||||||
parser.add_argument("-two", action='store_true', help = "if chosen, functions function for two diodes A1 and A2") # on/off flag
|
|
||||||
parser.add_argument("-mV", action='store_true', help = "if chosen, data will not be changed to keV") # on/off flag
|
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
if args.verbose == None:
|
if args.verbose == None:
|
||||||
|
|
@ -55,11 +53,6 @@ F2 = 1; thr[4] = 100;ch[4] = F2; name[4]="F2"#; u[4] = 1.0 #???
|
||||||
B1 = 16; thr[5] = 12; ch[5] = B1; name[5]="B1"; u[5] = 1/0.674
|
B1 = 16; thr[5] = 12; ch[5] = B1; name[5]="B1"; u[5] = 1/0.674
|
||||||
B2 = 13; thr[6] = 12; ch[6] = B2; name[6]="B2"; u[6] = 1/0.668
|
B2 = 13; thr[6] = 12; ch[6] = B2; name[6]="B2"; u[6] = 1/0.668
|
||||||
|
|
||||||
energy = 'keV'
|
|
||||||
if args.mV:
|
|
||||||
energy = 'mV'
|
|
||||||
u = [1.0,1.0,1.0,1.0,1.0,1.0,1.0]
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
|
||||||
|
|
@ -70,14 +63,11 @@ def main():
|
||||||
outfile.write(str(Itime))
|
outfile.write(str(Itime))
|
||||||
outfile.close()
|
outfile.close()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
nameadd = 'h'
|
nameadd = 'h'
|
||||||
if args.xray: nameadd = nameadd + '_xray'
|
if args.xray: nameadd = nameadd + '_xray'
|
||||||
if args.muon: nameadd = nameadd + '_muon'
|
if args.muon: nameadd = nameadd + '_muon'
|
||||||
if args.trigger: nameadd = nameadd + '_trigger'
|
if args.trigger: nameadd = nameadd + '_trigger'
|
||||||
if args.sum: nameadd = nameadd + '_sum'
|
if args.sum: nameadd = nameadd + '_sum'
|
||||||
if args.mV: nameadd = nameadd + '_mV'
|
|
||||||
|
|
||||||
if args.hist:
|
if args.hist:
|
||||||
with fileinput.input(files=(file), encoding="utf-8") as f:
|
with fileinput.input(files=(file), encoding="utf-8") as f:
|
||||||
|
|
@ -93,7 +83,7 @@ def main():
|
||||||
h = do_hist(data)
|
h = do_hist(data)
|
||||||
if args.plot:
|
if args.plot:
|
||||||
for i in range(0,len(ch)):
|
for i in range(0,len(ch)):
|
||||||
plt.plot(h[energy], h[name[i]], label = name[i])
|
plt.plot(h['mV'], h[name[i]], label = name[i])
|
||||||
plt.yscale('log')
|
plt.yscale('log')
|
||||||
plt.show()
|
plt.show()
|
||||||
else:
|
else:
|
||||||
|
|
@ -108,17 +98,13 @@ def main():
|
||||||
if l[0] == 'EI':
|
if l[0] == 'EI':
|
||||||
if not args.trigger or (args.trigger and CmV(l,ch[3]) >= thr[3]):
|
if not args.trigger or (args.trigger and CmV(l,ch[3]) >= thr[3]):
|
||||||
if not args.muon or (args.muon and ismuon(l)):
|
if not args.muon or (args.muon and ismuon(l)):
|
||||||
if not args.two:
|
|
||||||
data[0].append(CmV(l,ch[0])*u[0]+CmV(l,ch[1])*u[1]+CmV(l,ch[2])*u[2])
|
data[0].append(CmV(l,ch[0])*u[0]+CmV(l,ch[1])*u[1]+CmV(l,ch[2])*u[2])
|
||||||
else:
|
|
||||||
#data[0].append(CmV(l,ch[1])*u[1]+CmV(l,ch[2])*u[2])
|
|
||||||
data[0].append(CmV(l,ch[0])*u[0]+CmV(l,ch[1])*u[1])
|
|
||||||
data[1].append(CmV(l,ch[5])*u[5]+CmV(l,ch[6])*u[6])
|
data[1].append(CmV(l,ch[5])*u[5]+CmV(l,ch[6])*u[6])
|
||||||
|
|
||||||
h = do_hist_sum(data)
|
h = do_hist_sum(data)
|
||||||
if args.plot:
|
if args.plot:
|
||||||
plt.plot(h[energy], h['sumA'], label = 'sumA')
|
plt.plot(h['keV'], h['sumA'], label = 'sumA')
|
||||||
plt.plot(h[energy], h['sumB'], label = 'sumB')
|
plt.plot(h['keV'], h['sumB'], label = 'sumB')
|
||||||
plt.yscale('log')
|
plt.yscale('log')
|
||||||
plt.show()
|
plt.show()
|
||||||
else:
|
else:
|
||||||
|
|
@ -149,20 +135,20 @@ def Cphase(line, i):
|
||||||
def do_hist(data):
|
def do_hist(data):
|
||||||
bin = int((maxV-minV)/resV)
|
bin = int((maxV-minV)/resV)
|
||||||
hist, bins = np.histogram(data[0], bins=bin, range=(minV,maxV), density=False)
|
hist, bins = np.histogram(data[0], bins=bin, range=(minV,maxV), density=False)
|
||||||
df = pd.DataFrame({energy:bins[1:]/2+ bins[:-1]/2, name[0]: hist})
|
df = pd.DataFrame({'keV':bins[1:]/2+ bins[:-1]/2, name[0]: hist})
|
||||||
for i in range(1, len(ch)):
|
for i in range(1, len(ch)):
|
||||||
hist, bins = np.histogram(data[i], bins=bin, range=(minV,maxV), density=False)
|
hist, bins = np.histogram(data[i], bins=bin, range=(minV,maxV), density=False)
|
||||||
df1 = pd.DataFrame({energy:bins[1:]/2+ bins[:-1]/2, name[i]: hist})
|
df1 = pd.DataFrame({'keV':bins[1:]/2+ bins[:-1]/2, name[i]: hist})
|
||||||
df = pd.merge(df, df1 , left_on = energy, right_on = energy)
|
df = pd.merge(df, df1 , left_on = 'keV', right_on = 'keV')
|
||||||
return df
|
return df
|
||||||
|
|
||||||
def do_hist_sum(data):
|
def do_hist_sum(data):
|
||||||
bin = int((maxV-minV)/resV)
|
bin = int((maxV-minV)/resV)
|
||||||
hist, bins = np.histogram(data[0], bins=bin, range=(minV,maxV), density=False)
|
hist, bins = np.histogram(data[0], bins=bin, range=(minV,maxV), density=False)
|
||||||
df = pd.DataFrame({energy:bins[1:]/2+ bins[:-1]/2, 'sumA': hist})
|
df = pd.DataFrame({'keV':bins[1:]/2+ bins[:-1]/2, 'sumA': hist})
|
||||||
hist, bins = np.histogram(data[1], bins=bin, range=(minV,maxV), density=False)
|
hist, bins = np.histogram(data[1], bins=bin, range=(minV,maxV), density=False)
|
||||||
df1 = pd.DataFrame({energy:bins[1:]/2+ bins[:-1]/2, 'sumB': hist})
|
df1 = pd.DataFrame({'keV':bins[1:]/2+ bins[:-1]/2, 'sumB': hist})
|
||||||
df = pd.merge(df, df1 , left_on = energy, right_on = energy)
|
df = pd.merge(df, df1 , left_on = 'keV', right_on = 'keV')
|
||||||
return df
|
return df
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -176,10 +162,8 @@ def isXray(l):
|
||||||
else: return False
|
else: return False
|
||||||
|
|
||||||
def ismuon(l):
|
def ismuon(l):
|
||||||
if not args.two and CmV(l,B1) >= thr[5] and CmV(l,B2) >= thr[6] and \
|
if CmV(l,B1) >= thr[5] and CmV(l,B2) >= thr[6] and \
|
||||||
CmV(l,A1) >= thr[0] and CmV(l,A2) >= thr[1] and CmV(l,A3) >= thr[2]: return True
|
CmV(l,A1) >= thr[0] and CmV(l,A2) >= thr[1] and CmV(l,A3) >= thr[2]: return True
|
||||||
if args.two and CmV(l,B1) >= thr[5] and CmV(l,B2) >= thr[6] and \
|
|
||||||
CmV(l,A1) >= thr[0] and CmV(l,A2) >= thr[1]: return True
|
|
||||||
else: return False
|
else: return False
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,12 +21,7 @@ file = 'data/2023-07-24-BigBGO-Bi207h_muon_sum'
|
||||||
tit = "Comparison sumA(3)-sumB(2) of '2023-07-24-BigBGO-Bi207'"
|
tit = "Comparison sumA(3)-sumB(2) of '2023-07-24-BigBGO-Bi207'"
|
||||||
|
|
||||||
#file = 'data/2023-07-29-BigBGO-Bi207-2h_muon_sum'
|
#file = 'data/2023-07-29-BigBGO-Bi207-2h_muon_sum'
|
||||||
#tit = "Comparison sumA(3)-sumB(2) of '2023-07-29-BigBGO-Bi207-2'"
|
#tit = "Comparison sumA(3)-sumB(2) of '2023-07-29-BigBGO-Bi207'"
|
||||||
a = 610
|
|
||||||
b = 1100
|
|
||||||
|
|
||||||
file = 'data/2023-08-07-BigBGO-3h_muon_sum'
|
|
||||||
tit = "Comparison sumA(2 120°)-sumB(2) of '2023-08-07-BigBGO-3'"
|
|
||||||
|
|
||||||
keV = True
|
keV = True
|
||||||
plt.figure(figsize=(17,12))
|
plt.figure(figsize=(17,12))
|
||||||
|
|
@ -42,6 +37,8 @@ while len(f) > 0:
|
||||||
else:
|
else:
|
||||||
f=f[:-1]
|
f=f[:-1]
|
||||||
|
|
||||||
|
a = 610
|
||||||
|
b=1100
|
||||||
startparams = [4000,230,30,25,170]
|
startparams = [4000,230,30,25,170]
|
||||||
energy = 'keV'
|
energy = 'keV'
|
||||||
resV = 0.838214/2
|
resV = 0.838214/2
|
||||||
|
|
@ -77,9 +74,8 @@ plt.title(tit, fontsize = fs+10, pad = 15)
|
||||||
plt.yscale('log')
|
plt.yscale('log')
|
||||||
plt.ylabel(ylab, fontsize = fs+5)
|
plt.ylabel(ylab, fontsize = fs+5)
|
||||||
plt.xlabel(xlab, fontsize=fs+5)
|
plt.xlabel(xlab, fontsize=fs+5)
|
||||||
#plt.ylim(5,100) #1
|
plt.ylim(5,100)
|
||||||
#plt.ylim(2,30) #2
|
#plt.ylim(2,30)
|
||||||
plt.ylim(0.9,50) #3
|
|
||||||
plt.xlim(100,450)
|
plt.xlim(100,450)
|
||||||
|
|
||||||
#plt.show()
|
#plt.show()
|
||||||
|
|
|
||||||
|
|
@ -13,29 +13,20 @@ from fit_functions import mips
|
||||||
|
|
||||||
# file = 'data/2023-07-24-BigBGO-Bi207h_muon_trigger'
|
# file = 'data/2023-07-24-BigBGO-Bi207h_muon_trigger'
|
||||||
# tit = "Comparison of single diodes when T1 has triggered '2023-07-24-BigBGO-Bi207'"
|
# tit = "Comparison of single diodes when T1 has triggered '2023-07-24-BigBGO-Bi207'"
|
||||||
# a = [190,183,180,233,215]
|
a = [190,183,180,233,215]
|
||||||
# b = [295,285,290,365,365]
|
b = [295,285,290,365,365]
|
||||||
|
|
||||||
# file = 'data/2023-07-29-BigBGO-Bi207-2h_muon_trigger'
|
file = 'data/2023-07-29-BigBGO-Bi207-2h_muon_trigger'
|
||||||
# tit = "Comparison of single diodes when T1 has triggered '2023-07-29-BigBGO-Bi207-2'"
|
tit = "Comparison of single diodes when T1 has triggered '2023-07-29-BigBGO-Bi207-2'"
|
||||||
# a = [175,175,190,215,225]
|
a = [175,175,190,215,225]
|
||||||
# b = [320,320,350,380,380]
|
b = [320,320,350,380,380]
|
||||||
#startparams = [[150,85,10,4,100],[141,72,11,4,100],[141,72,11,4,100],[110,125,15,4,100],[110,110,16,4,100]]
|
|
||||||
#channels=['A1','A2','A3','B1','B2']
|
|
||||||
|
|
||||||
file = 'data/2023-08-07-BigBGO-3h_muon_trigger'
|
|
||||||
tit = "Comparison of single diodes when T1 has triggered '2023-08-07-BigBGO-3'"
|
|
||||||
a = [175,210,210,220]
|
|
||||||
b = [320,350,350,350]
|
|
||||||
channels=['A2','A3','B1','B2']
|
|
||||||
startparams = [[150,95,10,4,100],[141,115,11,4,100],[141,115,11,4,100],[110,125,15,4,100]]
|
|
||||||
|
|
||||||
keV = True
|
keV = True
|
||||||
plt.figure(figsize=(17,12))
|
plt.figure(figsize=(17,12))
|
||||||
|
|
||||||
data = pd.read_csv(file+'.hist', sep = ' ', delim_whitespace=False, skiprows=0)
|
data = pd.read_csv(file+'.hist', sep = ' ', delim_whitespace=False, skiprows=0)
|
||||||
ch = pd.read_csv(file+'.hist', sep = ' ', nrows=0)
|
ch = pd.read_csv(file+'.hist', sep = ' ', nrows=0)
|
||||||
|
channels=['A1','A2','A3','B1','B2']
|
||||||
|
|
||||||
f = file
|
f = file
|
||||||
Itime = None
|
Itime = None
|
||||||
|
|
@ -47,6 +38,7 @@ while len(f) > 0:
|
||||||
f=f[:-1]
|
f=f[:-1]
|
||||||
|
|
||||||
energy = 'keV'
|
energy = 'keV'
|
||||||
|
startparams = [[150,85,10,4,100],[141,72,11,4,100],[141,72,11,4,100],[110,125,15,4,100],[110,110,16,4,100]]
|
||||||
|
|
||||||
resV = 0.838214/2
|
resV = 0.838214/2
|
||||||
# plt.plot(data[energy], np.multiply(mips(data[energy], 150, 75, 15), 3600/resV/Itime),'--',label = '1')
|
# plt.plot(data[energy], np.multiply(mips(data[energy], 150, 75, 15), 3600/resV/Itime),'--',label = '1')
|
||||||
|
|
@ -55,8 +47,8 @@ resV = 0.838214/2
|
||||||
# plt.plot(data[energy], np.multiply(lan(data[energy], 140,75,15,4,100), 3600/resV/Itime), '--', label ='1')
|
# plt.plot(data[energy], np.multiply(lan(data[energy], 140,75,15,4,100), 3600/resV/Itime), '--', label ='1')
|
||||||
# plt.plot(data[energy], np.multiply(lan(data[energy], 140,75,15,4,100), 3600/resV/Itime), '--', label ='2')
|
# plt.plot(data[energy], np.multiply(lan(data[energy], 140,75,15,4,100), 3600/resV/Itime), '--', label ='2')
|
||||||
# plt.plot(data[energy], np.multiply(lan(data[energy], 140,75,15,4,100), 3600/resV/Itime), '--', label ='3')
|
# plt.plot(data[energy], np.multiply(lan(data[energy], 140,75,15,4,100), 3600/resV/Itime), '--', label ='3')
|
||||||
# plt.axvline(data[energy][a[1]])
|
# plt.axvline(data[energy][a])
|
||||||
# plt.axvline(data[energy][b[1]], color = 'r')
|
# plt.axvline(data[energy][a1], color = 'r')
|
||||||
|
|
||||||
for i in range (0,len(channels)):
|
for i in range (0,len(channels)):
|
||||||
ch = channels[i]
|
ch = channels[i]
|
||||||
|
|
@ -90,10 +82,9 @@ plt.yscale('log')
|
||||||
plt.ylabel(ylab, fontsize = fs+5)
|
plt.ylabel(ylab, fontsize = fs+5)
|
||||||
plt.xlabel(xlab, fontsize=fs+5)
|
plt.xlabel(xlab, fontsize=fs+5)
|
||||||
plt.ylim(0.03,6)
|
plt.ylim(0.03,6)
|
||||||
plt.ylim(0.03,2) #two
|
|
||||||
|
|
||||||
plt.xlim(0,300)
|
plt.xlim(0,300)
|
||||||
|
|
||||||
plt.show()
|
#plt.show()
|
||||||
#plt.savefig('plots/landau_'+file.split('/')[-1])
|
plt.savefig('plots/landau_'+file.split('/')[-1])
|
||||||
#plt.savefig('plots/landau_'+file.split('/')[-1]+'.pdf')
|
plt.savefig('plots/landau_'+file.split('/')[-1]+'.pdf')
|
||||||
Loading…
Add table
Add a link
Reference in a new issue