Compare commits

...

3 commits

Author SHA1 Message Date
ava
9bc50667a3 CHANGE histplot.py 2023-10-09 12:36:41 +02:00
ava
eb89da9779 CHANGE landau_sum.py AND landau_trigger.py AND BigBGO.py 2023-10-09 12:36:02 +02:00
ava
920a228e37 CHANGE landau_sum.py AND landau_trigger.py 2023-10-09 12:35:06 +02:00
4 changed files with 88 additions and 43 deletions

View file

@ -18,6 +18,7 @@ parser.add_argument("-plot", action='store_true', help = "if chosen, histogramms
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
parser.add_argument("-zero", action='store_true', help = "if chosen, data will be normalized to 0°C") # on/off flag
args = parser.parse_args()
if args.verbose == None:
@ -32,6 +33,7 @@ mV = 14000
minV = -100
maxV = 3500
resV = 0.838214/2
pol = [1.65857396e-04, -7.56891495e-03, -3.66207616e+00, 3.70051587e+02] #polynom zur Temperaturumrechung
if args.trigger:
resV=resV*2
@ -78,18 +80,26 @@ def main():
if args.trigger: nameadd = nameadd + '_trigger'
if args.sum: nameadd = nameadd + '_sum'
if args.mV: nameadd = nameadd + '_mV'
if args.zero: nameadd = nameadd + '_zero'
if args.hist:
with fileinput.input(files=(file), encoding="utf-8") as f:
data = [[],[],[],[],[],[],[]]
T='unknown'
for line in f:
l = line.split()
if not 'EOF' in l:
if l[0] == 'H':
T = adc_to_T(l[8])
if l[0] == 'EI':
if (not args.xray and not args.muon) or(args.xray and isXray(l)) or (args.muon and ismuon(l)):
if not args.trigger or (args.trigger and CmV(l,ch[3]) >= thr[3]):
for i in range(0,len(ch)):
data[i].append(CmV(l,ch[i])*u[i])
if not T=='unknown':
if (not args.xray and not args.muon) or(args.xray and isXray(l)) or (args.muon and ismuon(l)):
if not args.trigger or (args.trigger and CmV(l,ch[3]) >= thr[3]):
for i in range(0,len(ch)):
if args.zero:
data[i].append(CmV(l,ch[i])*u[i])*polynom(0,*pol)/polynom(T,*pol)
else:
data[i].append(CmV(l,ch[i])*u[i])
h = do_hist(data)
if args.plot:
for i in range(0,len(ch)):
@ -102,18 +112,26 @@ def main():
if args.sum:
with fileinput.input(files=(file), encoding="utf-8") as f:
data = [[],[]]
T='unknown'
for line in f:
l = line.split()
if not 'EOF' in l:
if l[0] == 'H':
T = adc_to_T(int(l[8]))
if l[0] == 'EI':
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.two:
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])
if not T=='unknown':
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.two:
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])
if args.zero:
data[0][-1] = data[0][-1]*polynom(0,*pol)/polynom(T,*pol)
data[1][-1] = data[1][-1]*polynom(0,*pol)/polynom(T,*pol)
h = do_hist_sum(data)
if args.plot:
@ -183,4 +201,19 @@ def ismuon(l):
else: return False
def polynom(x, a,b,c,d):
return np.multiply(np.multiply(np.multiply(a,x),x),x)+np.multiply(np.multiply(b,x),x)+np.multiply(c,x)+d
def adc_to_T(adc):
R25 = 10000
R1 = 10000
b = 3940
dac = 62690
T = 0
alpha = np.log(R1/R25 *(dac/(dac-adc)-1))
T = 1/(alpha/b+1/298.15) -273.15
return T
main()

View file

@ -82,7 +82,7 @@ def main():
data, Itime = read_data(file, end, raw, args.dhist)
if Itime == None:
raw = True
plt.figure(figsize=(17,12))
plt.figure(figsize=(15,10))
if 'keV' in data:
energy = 'keV'
@ -166,7 +166,7 @@ def layout(tit,raw, limits,energy):
if not raw == True:
ylab = 'counts [1/h/' +energy+']'
ylab = 'counts [1/h/' +energy+'$_{Si}$]'
if lim[2] == None:
lim[2] = 0.009
if lim[3] == None:
@ -178,7 +178,7 @@ def layout(tit,raw, limits,energy):
if lim[3] == None:
lim[3] = 2000
xlab = 'A [' + energy +']'
xlab = 'A [' + energy +'$_{Si}$]'
plt.legend(fontsize = fs)
plt.xticks(fontsize=fs)
plt.yticks(fontsize=fs)

View file

@ -16,17 +16,18 @@ from fit_functions import mips
from fit_functions import find_par
from fit_functions import find_par_new
plt.figure(figsize=(15,10))
file = 'data/2023-07-24-BigBGO-Bi207h_muon_sum'
tit = "Comparison sumA(3)-sumB(2) of '2023-07-24-BigBGO-Bi207'"
#file = 'data/2023-07-29-BigBGO-Bi207-2h_muon_sum'
#tit = "Comparison sumA(3)-sumB(2) of '2023-07-29-BigBGO-Bi207-2'"
file = 'data/2023-07-29-BigBGO-Bi207-2h_muon_sum'
tit = "Comparison sumA(3)-sumB(2) of '2023-07-29-BigBGO-Bi207-2'"
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'"
# file = 'data/2023-08-07-BigBGO-3h_muon_sum'
# tit = "Comparison sumA(2 120°)-sumB(2) of '2023-08-07-BigBGO-3'"
keV = True
plt.figure(figsize=(17,12))
@ -66,8 +67,8 @@ for ch in ['sumA','sumB']:
fs = 15
ylab = 'counts [1/h/keV]'
xlab = 'A [' + energy +']'
ylab = 'counts [1/h/$keV_{Si}$]'
xlab = 'A [' + energy +'$_{Si}$]'
plt.plot(0, 0,'k--', linewidth=1, label = 'landau_fit')
plt.legend(fontsize = fs)
plt.xticks(fontsize=fs)
@ -78,8 +79,8 @@ plt.yscale('log')
plt.ylabel(ylab, fontsize = fs+5)
plt.xlabel(xlab, fontsize=fs+5)
#plt.ylim(5,100) #1
#plt.ylim(2,30) #2
plt.ylim(0.9,50) #3
plt.ylim(2,30) #2
#plt.ylim(0.9,50) #3
plt.xlim(100,450)
#plt.show()

View file

@ -11,24 +11,33 @@ import os.path
from fit_functions import lan
from fit_functions import mips
# file = 'data/2023-07-24-BigBGO-Bi207h_muon_trigger'
# tit = "Comparison of single diodes when T1 has triggered '2023-07-24-BigBGO-Bi207'"
# a = [190,183,180,233,215]
# b = [295,285,290,365,365]
plt.figure(figsize=(15,10))
file = 'data/2023-07-24-BigBGO-Bi207h_muon_trigger'
tit = "Comparison of single diodes when T1 has triggered '2023-07-24-BigBGO-Bi207'"
a = [190,183,180,233,215]
b = [295,285,290,365,365]
# 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'"
# a = [175,175,190,215,225]
# 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']
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]]
# 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]]
# file = 'data/2023-09-11-BigBGO-8h_muon_trigger'
# tit = "Comparison of single diodes when T1 has triggered '2023-09-11-BigBGO-8'"
# a = [145,145,165,170, 190]
# b = [270,270,290,300, 320]
# channels=['A1','A2','A3','B1','B2']
# startparams = [[150,51,10,4,100],[141,51,11,4,100],[141,61,11,4,100],[110,68,15,4,100],[110,85,15,4,100]]
keV = True
plt.figure(figsize=(17,12))
@ -55,8 +64,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 ='2')
# 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][b[1]], color = 'r')
#plt.axvline(data[energy][a[1]])
#plt.axvline(data[energy][b[1]], color = 'r')
for i in range (0,len(channels)):
ch = channels[i]
@ -78,8 +87,8 @@ for i in range (0,len(channels)):
fs = 15
ylab = 'counts [1/h/keV]'
xlab = 'A [' + energy +']'
ylab = 'counts [1/h/$keV_{Si}$]'
xlab = 'A [' + energy +'$_{Si}$]'
plt.plot(0, 0,'k--', linewidth=1, label = 'landau_fit')
plt.legend(fontsize = fs)
plt.xticks(fontsize=fs)
@ -90,10 +99,12 @@ plt.yscale('log')
plt.ylabel(ylab, fontsize = fs+5)
plt.xlabel(xlab, fontsize=fs+5)
plt.ylim(0.03,6)
plt.ylim(0.03,2) #two
#plt.ylim(0.03,2) #two
#plt.ylim(0.01,2)#8
plt.xlim(0,300)
# plt.xlim(0,250) #8
plt.show()
#plt.savefig('plots/landau_'+file.split('/')[-1])
#plt.savefig('plots/landau_'+file.split('/')[-1]+'.pdf')
#plt.show()
plt.savefig('plots/landau_'+file.split('/')[-1])
plt.savefig('plots/landau_'+file.split('/')[-1]+'.pdf')