Compare commits
2 commits
ca122517c7
...
24ec356ec7
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
24ec356ec7 | ||
|
|
7e04a53367 |
6 changed files with 158 additions and 102 deletions
50
CHAOSa.py
50
CHAOSa.py
|
|
@ -49,6 +49,9 @@ parser.add_argument("-deltaT", action='store_true', help = "saves deltatimes bet
|
|||
|
||||
parser.add_argument("-nameadd", type=str, nargs='+', help = "custom nameadd to add to filename")
|
||||
|
||||
|
||||
parser.add_argument("-Denergy", action='store_true', help = ' ')
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
file = args.file
|
||||
|
|
@ -72,6 +75,8 @@ from histframe import CmV
|
|||
from histframe import CmV_v
|
||||
from histframe import isCut
|
||||
from histframe import isMask_1D
|
||||
from histframe import get_MeV_mean
|
||||
from histframe import get_MeV
|
||||
|
||||
|
||||
names = hf.names
|
||||
|
|
@ -214,6 +219,9 @@ def main():
|
|||
if args.deltaT:
|
||||
generate_deltaTimes()
|
||||
|
||||
if args.Denergy:
|
||||
generate_hist_D_MeV()
|
||||
|
||||
if args.hist:
|
||||
generate_hist()
|
||||
|
||||
|
|
@ -325,7 +333,8 @@ def generate_hist():
|
|||
if l[0] == 'EI' and len(l)>3*18 and conditions(l,args) and isFloat(args,timestamp):
|
||||
for i,chan in enumerate(chans):
|
||||
b = value_HL(l,chan,u)
|
||||
if minV <= b <= maxV and isMask_1D(l,args.mask,T):
|
||||
b = value
|
||||
if minV <= b <= maxV:
|
||||
xb = int((b-minV)/resV)
|
||||
hist[xb,i+1] += 1
|
||||
|
||||
|
|
@ -333,6 +342,41 @@ def generate_hist():
|
|||
frame.to_csv(f'histograms/{filename}{nameadd}.1dhist', sep = ' ', index = False)
|
||||
print(f'histograms/{filename}{nameadd}.1dhist was created')
|
||||
|
||||
################ 1D HISTOGRAM D in MeV ############################################################
|
||||
def generate_hist_D_MeV():
|
||||
minV = 0
|
||||
maxV = 50
|
||||
resV = 0.1
|
||||
bin = int((maxV-minV)/resV)
|
||||
|
||||
hist = np.zeros((bin+1,2))
|
||||
|
||||
for i in range(0,bin+1):
|
||||
hist[i][0]=minV + resV*i
|
||||
|
||||
with fileinput.input(files=(file), encoding="utf-8", errors='ignore') as f:
|
||||
timestamp = 0
|
||||
T=None
|
||||
for line in f:
|
||||
if not line.strip() or len(line.split()) < 9:
|
||||
continue
|
||||
l = line.split()
|
||||
if not any(x in l for x in ['EOF', 'X', 'xF']):
|
||||
if l[0] == 'H':
|
||||
timestamp = int(l[1])
|
||||
T = get_T(float(l[8]))
|
||||
if l[0] == 'EI' and len(l)>3*18 and conditions(l,args) and isFloat(args,timestamp):
|
||||
#T=15
|
||||
b = value_HL(l,'D1',u)+value_HL(l,'D2',u)
|
||||
bx = get_MeV(b,T)
|
||||
if minV <= bx <= maxV:
|
||||
xb = int((b-minV)/resV)
|
||||
hist[xb,1] += 1
|
||||
|
||||
frame = pd.DataFrame(hist, columns = ['MeV'] + ['D'])
|
||||
frame.to_csv(f'histograms/{filename}_D_MeV.1dhist', sep = ' ', index = False)
|
||||
print(f'histograms/{filename}_D_MeV.1dhist was created')
|
||||
|
||||
def generate_hist_xlog():
|
||||
minX = 0.01
|
||||
maxX = 100
|
||||
|
|
@ -470,7 +514,7 @@ def generate_2d_hist_logy():
|
|||
############ 2D HISTOGRAMM MIT LOGARITMISCHER XY_SKALE (FISCH) ######################################
|
||||
|
||||
def generate_2d_hist_logxy():
|
||||
minY = 0.01
|
||||
minY = 0.1
|
||||
#minY = 50
|
||||
maxY = 100
|
||||
maxY = 3500
|
||||
|
|
@ -490,7 +534,7 @@ def generate_2d_hist_logxy():
|
|||
#A1 vs A2
|
||||
maxX = 100000
|
||||
maxY = 100000
|
||||
maxY = 10
|
||||
#maxY = 10
|
||||
|
||||
#maxX=3500
|
||||
#maxY=3500
|
||||
|
|
|
|||
|
|
@ -119,25 +119,27 @@ def get_valuesZ(l,T):
|
|||
z = value(l,"B")
|
||||
return x2,y,z
|
||||
|
||||
###################################################################################################
|
||||
|
||||
def get_values(l,T):
|
||||
#y = max(value(l,"C1H"),value(l,"C2H"))/value(l,"EH")q
|
||||
#y = min(value_HL(l,"A",u),value_HL(l,"C",u))/max(value(l,"E1",u),value(l,"E2",u),value(l,"E3",u))
|
||||
y = min(value_HL(l,"A",u),value_HL(l,"C",u))/max(value(l,"E1",u),value(l,"E2",u),value(l,"E3",u))
|
||||
|
||||
#y = value(l,"A",u)/1000
|
||||
#y = value(l,"C",u)/1000
|
||||
|
||||
y = min(value_HL(l,"A",u),value_HL(l,"C",u))/1000
|
||||
#y = min(value_HL(l,"A",u),value_HL(l,"C",u))/1000
|
||||
|
||||
x = value_HL(l,"D1",u)+value_HL(l,"D2",u)
|
||||
x2 = get_MeV(x,T)
|
||||
return x2,y
|
||||
|
||||
|
||||
cuts = ['A','hB','C','AeqC','D']
|
||||
cuts = ['A','hB','C','AeqC','D','E123']
|
||||
|
||||
#filename = "chaos-fish-cut"+ "".join(cuts)+"~min(A,C)dE-D.2dhist2log"
|
||||
filename = "chaos-fish_Cut"+ "".join(cuts)+"~min(A,C)-D.2dhist2log"
|
||||
folder = "hists_sim"
|
||||
filename = "chaos20_Cut"+ "".join(cuts)+"~min(A,C)dE-D.2dhist2log"
|
||||
#filename = "chaos20_Cut"+ "".join(cuts)+"~min(A,C)-D.2dhist2log"
|
||||
folder = "hists_fish"
|
||||
|
||||
# filename = "chaos-dE-cut"+ "".join(cuts)+"~A-D.2dhist2log"
|
||||
# folder = "hists_dEdx"
|
||||
|
|
|
|||
|
|
@ -201,7 +201,6 @@ def Do_hist():
|
|||
if b>=minV and b<=maxV:
|
||||
xb = int((b-minV)/resV)
|
||||
hist[xb,i+1] += 1
|
||||
|
||||
frame = pd.DataFrame(hist, columns = [energy] + name)
|
||||
frame.to_csv('histograms/'+filename+nameadd+'.hist', sep = ' ', index = False)
|
||||
|
||||
|
|
@ -239,6 +238,7 @@ def Do_HC():
|
|||
Rntc = 33e3 * Vntc / (Vana - Vntc)
|
||||
Tntc = b / (np.log(Rntc / R25) + b / 298) - 273
|
||||
HV = (float(l[11]) / 0x8000 - 1) * 5.12 * 281
|
||||
HV = (HV-float(0x8000))*(5.12/float(0x8000))*303
|
||||
|
||||
# Applying cuts for valid voltages and currents
|
||||
validV = all(0 <= v < 100 for v in [Vprim, Vana, Vdrv]) and (0 <= HV <= 1100) and (-20 < Tntc < 150)
|
||||
|
|
|
|||
31
CHAOSx.py
31
CHAOSx.py
|
|
@ -70,6 +70,8 @@ from histframe import get_T
|
|||
from histframe import CmV
|
||||
from histframe import isCut
|
||||
from histframe import isMask_1D
|
||||
from histframe import get_MeV
|
||||
from histframe import get_MeV_H
|
||||
|
||||
name = hf.names
|
||||
ch = hf.ch
|
||||
|
|
@ -276,9 +278,13 @@ def generate_deltaTimes():
|
|||
################ 1D HISTOGRAM ############################################################
|
||||
|
||||
def generate_hist():
|
||||
minV = 0
|
||||
maxV = 30
|
||||
resV = 0.1
|
||||
bin = int((maxV-minV)/resV)
|
||||
|
||||
hist = np.zeros((bin+1,18+1))
|
||||
#Arbeithist = np.zeros((bin+1,9))
|
||||
|
||||
for i in range(0,bin+1):
|
||||
hist[i][0]=minV + resV*i
|
||||
|
|
@ -297,12 +303,31 @@ def generate_hist():
|
|||
if l[0] == 'EI' and len(l)>3*18 and conditions(l,args) and isFloat(args,timestamp):
|
||||
for i, chan in enumerate(chans):
|
||||
b = CmV(l,ch[chan])*u[chan]
|
||||
if minV <= b <= maxV and isMask_1D(l, args.mask,T):
|
||||
if minV <= b <= maxV:
|
||||
xb = int((b-minV)/resV)
|
||||
hist[xb,i+1] += 1
|
||||
hist[xb,i+1] += 1
|
||||
# i=0
|
||||
# if 19.0 <= T < 21.0:
|
||||
# i = 4
|
||||
# elif 17.0 <= T < 19.0:
|
||||
# i = 3
|
||||
# elif 15.0 <= T < 17.0:
|
||||
# i = 2
|
||||
# elif 13.0 <= T < 15.0:
|
||||
# i = 1
|
||||
# if i >0:
|
||||
# a = CmV(l,ch[9])*u[9]+CmV(l,ch[11])*u[11]
|
||||
# b = get_MeV(a,T)
|
||||
# if minV <= b <= maxV:
|
||||
# xb = int((b-minV)/resV)
|
||||
# hist[xb,i] += 1
|
||||
# c = get_MeV_H(a,T)
|
||||
# xc = int((c-minV)/resV)
|
||||
# hist[xc,4+i] += 1
|
||||
|
||||
frame = pd.DataFrame(hist, columns = [energy] + name)
|
||||
frame.to_csv(f'histograms/{filename}{nameadd}.1dhist', sep = ' ', index = False)
|
||||
#frame = pd.DataFrame(hist, columns = [energy] + ['14','16','18','20']+['14H','16H','18H','20H'])
|
||||
frame.to_csv(f'histograms/{filename}{nameadd}_T_MeV.1dhist', sep = ' ', index = False)
|
||||
print(f'histograms/{filename}{nameadd}.1dhist was created')
|
||||
|
||||
|
||||
|
|
|
|||
27
histframe.py
27
histframe.py
|
|
@ -34,15 +34,18 @@ names[14] = "EL"; ch[14] = 0; thr[14] = 10; s[14] = 1.0; u[14] = 4.55; v[14]
|
|||
names[15] = "E1"; ch[15] = 8; thr[15] = 8; s[15] = 2.2; u[15] = 11.32
|
||||
names[16] = "E2"; ch[16] = 5; thr[16] = 8; s[16] = 2.2; u[16] = 11.32
|
||||
names[17] = "E3"; ch[17] = 2; thr[17] = 8; s[17] = 2.2; u[17] = 11.32
|
||||
thr[9]=30
|
||||
thr[11]=30
|
||||
|
||||
thr[9]=60
|
||||
thr[11]=60
|
||||
|
||||
thr[0] = 8
|
||||
thr[2] = 14
|
||||
thr[5] = 7
|
||||
thr[7] = 13
|
||||
|
||||
thr[15] = 5; thr[16] = 5; thr[17] = 5
|
||||
thr[13] = 14.73
|
||||
|
||||
thr[15] = 6.64; thr[16] = 6.54; thr[17] = 6.54
|
||||
|
||||
names_a = ["A1", "A2", "B", "C1", "C2", "D1", "D2", "E", "E1", "E2", "E3"]
|
||||
boundary = 2500 #mV
|
||||
|
|
@ -56,8 +59,8 @@ minV = 0
|
|||
maxV = 3500
|
||||
resV = 0.838214/2
|
||||
|
||||
#pol = [1.88909231e-04, -6.84421799e-03, -3.28911747e+00, 3.24630271e+02]
|
||||
pol = [ 2.89915947e-03, -1.05037109e-01, -5.04775548e+01, 4.98204836e+03]
|
||||
#pol = [ 2.89915947e-03, -1.05037109e-01, -5.04775548e+01, 4.98204836e+03]
|
||||
pol = [2.36849137e-03, -1.06835334e-01, -5.25201198e+01, 5.30730515e+03] # mein Polynom, Hannes Datenpunkte
|
||||
|
||||
|
||||
def get_T(x):
|
||||
|
|
@ -73,9 +76,18 @@ def get_T(x):
|
|||
def polynom(T, a,b,c,d):
|
||||
return np.multiply(np.multiply(np.multiply(a,T),T),T)+np.multiply(np.multiply(b,T),T)+np.multiply(c,T)+d
|
||||
|
||||
def line_H(T):
|
||||
return np.multiply(T,-57)+5392
|
||||
|
||||
def get_MeV(keV,T):
|
||||
return keV/0.00362/polynom(T,*pol)
|
||||
|
||||
def get_MeV_mean(keV):
|
||||
return keV/0.00362/polynom(15,*pol)
|
||||
|
||||
def get_MeV_H(keV,T):
|
||||
return keV/0.00362/line_H(T)
|
||||
|
||||
# def get_keV15(keV,T):
|
||||
# return keV * polynom(15, *pol) / polynom(T, *pol)/ 0.00362
|
||||
|
||||
|
|
@ -159,12 +171,13 @@ def isCut(l, cut):
|
|||
if a1 < 7.5 and a2 <= a1+11: return False
|
||||
if a2 > 12 and a1 > 7.5 and 0.01*a1 < a2 < 1/0.01*a1: return False
|
||||
|
||||
|
||||
if "C" in cut:
|
||||
c1 = value_HL(l,"C1",u)
|
||||
c2 = value_HL(l,"C2",u)
|
||||
c2 = value_HL(l,"C2",u)
|
||||
if c1 < 7.5 and c2 <= c1+11: return False
|
||||
if c2 > 12 and c1 > 7.5 and 0.01*c1 < c2 < 1/0.01*c1: return False
|
||||
|
||||
|
||||
|
||||
if "AeqC" in cut:
|
||||
a = value_HL(l,"A",u)
|
||||
|
|
|
|||
136
xplot.py
136
xplot.py
|
|
@ -89,23 +89,27 @@ def do_1dhist():
|
|||
|
||||
for ch in channels:
|
||||
if not Itime==None:
|
||||
plt.step(data[energy], np.multiply(data[ch], f*3600/resV/Itime),label=ch)
|
||||
plt.step(data[energy], np.multiply(data[ch], f*3600/resV/Itime),label=ch, lw=2)
|
||||
else:
|
||||
plt.step(data[energy], data[ch], label=ch)
|
||||
|
||||
limits = args.limits if args.limits else [-100, 10000, 0.1, 100000]
|
||||
#limits = args.limits if args.limits else [0, 500, 1, 100]
|
||||
#limits = args.limits if args.limits else [-100, 10000, 0.1, 100000]
|
||||
limits = args.limits if args.limits else [0, 100, 10, 10000]
|
||||
|
||||
border = True
|
||||
border = False
|
||||
|
||||
if border:
|
||||
plt.axvline(x=2500, color='black', linestyle='--', linewidth=2, label='Gain switching at 2500 $mV$')
|
||||
|
||||
#plt.axvline(x=0.5, color='r', linestyle = '-', lw=1.5,)
|
||||
#plt.axvline(x=2, color='r', linestyle = '-', lw=1.5,)
|
||||
|
||||
#plt.axvline(x=20, color='blue', linestyle='--', linewidth=2, label='20 mV (flight)')
|
||||
#plt.axvline(x=30, color='black', linestyle='--', linewidth=2, label='30 mV (data analysis)')
|
||||
#plt.axvline(x=6.5, color='k', linestyle = '--', lw=2, label = 'thr(E123) = 6.5 mV') 6.593
|
||||
#plt.axvline(x=14, color='r', linestyle = '--', lw=2, label = 'thr(E) = 14 mV')
|
||||
#plt.axvline(x=67, color='k', linestyle = '--', lw=2, label = 'thr(E123) = 67 keV')
|
||||
#plt.axvline(x=60, color='r', linestyle = '--', lw=2, label = 'thr(E) = 67 keV')
|
||||
|
||||
plt.axvline(x=20, color='blue', linestyle='--', linewidth=2, label='20 mV (flight)')
|
||||
plt.axvline(x=60, color='black', linestyle='--', linewidth=2, label='60 mV (data analysis)')
|
||||
|
||||
plot_layout(title, energy, limits,None,None,None)
|
||||
|
||||
|
|
@ -177,8 +181,8 @@ def do_2dhist():
|
|||
|
||||
c = np.array(data)[:,1:].T
|
||||
|
||||
Dcuts = False
|
||||
ACcuts =False
|
||||
Dcuts = True
|
||||
ACcuts = False
|
||||
AeqC = False
|
||||
Ecuts = False
|
||||
Lowcal = False
|
||||
|
|
@ -193,8 +197,8 @@ def do_2dhist():
|
|||
plt.plot(x_edges,np.add(np.divide(x_edges,0.85),30), 'r-', lw=2)
|
||||
#plt.plot([0, 30], [30, 30], 'r--', lw=2)
|
||||
#plt.plot([30, 30], [30, 0], 'r--', lw=2)
|
||||
plt.axhline(y=30, color='r', linestyle = '--', lw=1.5,label = " $D1H, D2H > 30$ mV")
|
||||
plt.axvline(x=30, color='r', linestyle = '--', lw=1.5,)
|
||||
plt.axhline(y=60, color='r', linestyle = '--', lw=1.5,label = " $D1H, D2H > 60$ mV")
|
||||
plt.axvline(x=60, color='r', linestyle = '--', lw=1.5,)
|
||||
|
||||
if ACcuts:
|
||||
plt.axhline(y=15, color='r', linestyle = '-', lw=1.5, label = "thr['C1H'] = 10 mV; thr['C2H'] = 15 mV")
|
||||
|
|
@ -218,8 +222,8 @@ def do_2dhist():
|
|||
plt.plot(x_edges,np.add(np.divide(x_edges,0.85),30), 'r-', lw=2)
|
||||
#plt.plot([0, 30], [30, 30], 'r--', lw=2)
|
||||
#plt.plot([30, 30], [30, 0], 'r--', lw=2)
|
||||
plt.axhline(y=30, color='r', linestyle = '--', lw=1.5,label = " $D1H, D2H > 30$ mV")
|
||||
plt.axvline(x=30, color='r', linestyle = '--', lw=1.5,)
|
||||
plt.axhline(y=60, color='r', linestyle = '--', lw=1.5,label = " $D1H, D2H > 60$ mV")
|
||||
plt.axvline(x=60, color='r', linestyle = '--', lw=1.5,)
|
||||
|
||||
|
||||
if Ecuts:
|
||||
|
|
@ -227,93 +231,60 @@ def do_2dhist():
|
|||
plt.axhline(y=6.5, color='r', linestyle = '--', lw=2)
|
||||
# plt.axvline(x=5, color='r', linestyle = '--', lw=1.5, label = "thr['E123'] = 5 mV")
|
||||
# plt.axhline(y=5, color='r', linestyle = '--', lw=1.5)
|
||||
# xx = np.linspace(0.1, 250000, 2500000)
|
||||
# a=0
|
||||
# b=0
|
||||
# while xx[a]<5:
|
||||
# a+=1
|
||||
# while (xx[b]-5)/0.4<5:
|
||||
# b+=1
|
||||
|
||||
# #plt.plot(x_edges,np.multiply(x_edges,0.01), 'r--', lw=1, label=("Relative cuts: E1/E2&E2/E1 < 1%"))
|
||||
# # plt.plot(x_edges,np.multiply(x_edges,1/0.01), 'r--', lw=1)
|
||||
|
||||
# # plt.plot(xx[:a],0.4*xx[:a]+5,color='magenta',label='E2(E1) = 0.4*E1+5 mV', lw=2)
|
||||
# # plt.plot(xx[a:],0.4*xx[a:]+5,linestyle=':',color='magenta',lw=2)
|
||||
|
||||
# # plt.plot(xx[:b],(xx[:b]-5)/0.4,color='magenta', lw=2)
|
||||
# # plt.plot(xx[b:],(xx[b:]-5)/0.4,linestyle=':',color='magenta',lw=2)
|
||||
|
||||
# # plt.plot(xx[a:b],-1*xx[a:b]+12,color='orange',label = 'E2(E1) = -E1+12 mV')
|
||||
# # plt.plot(xx,-1*xx+12,linestyle=':',color='orange')
|
||||
# # plt.plot(xx,-1*xx+12,linestyle=':',color='orange')
|
||||
|
||||
# plt.plot(xx[:a],0.4*xx[:a]+5,color='k',label='cutting lines', lw=2)
|
||||
# plt.plot(xx[:b],(xx[:b]-5)/0.4,color='k', lw=2)
|
||||
# plt.plot(xx[a:b],-1*xx[a:b]+12,color='k')
|
||||
|
||||
# xx = np.linspace(0.1, 100000, 1000000)
|
||||
# a=0
|
||||
# alpha=0.2
|
||||
# while xx[a]<5:
|
||||
# a+=1
|
||||
# b=a
|
||||
# while xx[b]<7:
|
||||
# b+=1
|
||||
# plt.fill_between(xx[:a], 0, 0.4*xx[:a]+5, color='red', alpha=alpha, label ='noise')
|
||||
# plt.fill_between(xx[a-1:b], (xx[a-1:b]-5)/0.4, -xx[a-1:b]+12, color='red', alpha=alpha)
|
||||
|
||||
# plt.fill_between(xx[:a], 3500, 0.4*xx[:a]+5, color='green', alpha=alpha, label ='clean data')
|
||||
# plt.fill_between(xx[a-1:b], (xx[a-1:b]-5)/0.4,0, color='green', alpha=alpha)
|
||||
# plt.fill_between(xx[a-1:b], -xx[a-1:b] + 12, 3500, color='green', alpha=alpha, antialiased=False)
|
||||
# plt.fill_between(xx[b-1:], 0, 3500, color='green', alpha=alpha, antialiased=False)
|
||||
|
||||
if AeqC:
|
||||
a=2
|
||||
b=0
|
||||
xx = np.linspace(0.1, 100000, 1000000)
|
||||
#plt.plot(xx, a*xx-b, 'r-', label='A = '+str(a)+'C | C = '+str(a)+'A')
|
||||
#plt.plot(xx, (xx+b)/a, 'r-')
|
||||
plt.axhline(y=a, color='r', linestyle = '-', lw=1.5, label='A = '+str(a)+'C | C = '+str(a)+'A',)
|
||||
plt.axhline(y=1/a, color='r', linestyle = '-', lw=1.5,)
|
||||
plt.plot(xx, a*xx-b, 'r-', lw=1.5, label='A = '+str(a)+'C | C = '+str(a)+'A')
|
||||
plt.plot(xx, (xx+b)/a, 'r-', lw=1.5)
|
||||
#plt.axhline(y=a, color='r', linestyle = '-', lw=1.5, label='A = '+str(a)+'C | C = '+str(a)+'A',)
|
||||
#plt.axhline(y=1/a, color='r', linestyle = '-', lw=1.5,)
|
||||
|
||||
#plt.plot([7.5, 10000, 10000, 7.5, 7.5], [7.5, 7.5, 10000, 10000, 7.5], color='r', linewidth=1, label = 'zoom')
|
||||
|
||||
|
||||
|
||||
if ACcuts:
|
||||
plt.axvline(x=7.5, color='r', linestyle = '-', lw=2, label = "thr(C1) = 7.5 mV")
|
||||
plt.axhline(y=12, color='r', linestyle = '-', lw=2, label = "thr(C2) = 12 mV")
|
||||
# plt.axvline(x=7.5, color='r', linestyle = '-', lw=3, label = "thr(C1) = 7.5 mV")
|
||||
# plt.axhline(y=12, color='r', linestyle = '-', lw=3, label = "thr(C2) = 12 mV")
|
||||
|
||||
plt.plot(x_edges,np.multiply(x_edges,0.01), 'r--', lw=2, label=("Relative cuts: Q < 1%"))
|
||||
plt.plot(x_edges,np.multiply(x_edges,1/0.01), 'r--', lw=2)
|
||||
# plt.plot(x_edges,np.multiply(x_edges,0.01), 'r--', lw=2, label=("Relative cuts: Q < 1%"))
|
||||
# plt.plot(x_edges,np.multiply(x_edges,1/0.01), 'r--', lw=2)
|
||||
|
||||
xx = np.linspace(0.1, 100000, 1000000)
|
||||
a=0
|
||||
while xx[a]<7.5:
|
||||
a+=1
|
||||
|
||||
b=a
|
||||
while xx[b]<1195:
|
||||
b+=1
|
||||
|
||||
plt.plot(xx[:a],1.0*xx[:a]+11,color='orange',label='C2 = C1+11 mV', lw=2)
|
||||
plt.plot(xx[a:],1.0*xx[a:]+11,linestyle=':',color='orange',lw=2)
|
||||
|
||||
# plt.plot(xx[:a],1.0*xx[:a]+11,color='k', lw=5)
|
||||
# plt.plot(xx[a:],1.0*xx[a:]+11,linestyle='-',color='k',lw=3)
|
||||
# plt.plot(xx[:a],1.0*xx[:a]+11,color='orange',label='C2 = C1+11 mV', lw=3)
|
||||
# plt.plot(xx[a:],1.0*xx[a:]+11,linestyle=':',color='orange',lw=3)
|
||||
|
||||
# plt.plot(xx[:a],1.0*xx[:a]+11,color='k', lw=1)
|
||||
# plt.plot(x_edges,np.multiply(x_edges,0.01), 'k--', lw=1)
|
||||
# plt.plot(x_edges,np.multiply(x_edges,1/0.01), 'k--', lw=1)
|
||||
# plt.axvline(x=7.5, color='k', linestyle = '-', lw=1)
|
||||
# plt.axhline(y=12, color='k', linestyle = '-', lw=1)
|
||||
plt.plot(xx[:a],1.0*xx[:a]+11,color='k', lw=1)
|
||||
plt.plot(xx[b:],np.multiply(xx[b:],0.01), 'k--', lw=1)
|
||||
plt.plot(xx[a:],np.multiply(xx[a:],1/0.01), 'k--', lw=1)
|
||||
plt.plot(xx[a:],len(xx[a:])*[12],color='k', linestyle = '-', lw=1)
|
||||
plt.axvline(x=7.5, color='k', linestyle = '-', lw=1)
|
||||
#plt.axhline(y=12, color='k', linestyle = '-', lw=1, xmin=7.5, xmax=100000)
|
||||
|
||||
# alpha=0.3
|
||||
alpha=0.3
|
||||
|
||||
# plt.fill_between(xx[:a], 0, 1.0*xx[:a]+11, color='red', alpha=alpha, label ='noise')
|
||||
plt.fill_between(xx[:a], 0, 1.0*xx[:a]+11, color='red', alpha=alpha, label ='noise')
|
||||
|
||||
# plt.fill_between(xx[:a], 100000,1.0*xx[:a]+11, color='green', alpha=alpha, label ='clean data')
|
||||
# plt.fill_between(xx[a:], 0,12, color='green', alpha=alpha)
|
||||
plt.fill_between(xx[:a], 100000,1.0*xx[:a]+11, color='green', alpha=alpha, label ='clean data')
|
||||
plt.fill_between(xx[a:], 0,12, color='green', alpha=alpha)
|
||||
|
||||
# plt.fill_between(xx[a:], np.maximum(0.01 * xx[a:],12),12, color='b', alpha=alpha, label = 'crosstalk')
|
||||
# plt.fill_between(xx[a:], 1/0.01*xx[a:],100000, color='b', alpha=alpha)
|
||||
plt.fill_between(xx[a:], np.maximum(0.01 * xx[a:],12),12, color='b', alpha=alpha, label = 'crosstalk')
|
||||
plt.fill_between(xx[a:], 1/0.01*xx[a:],100000, color='b', alpha=alpha)
|
||||
|
||||
# plt.fill_between(xx[a:], 1/0.01*xx[a:],np.maximum(0.01 * xx[a:], 12), color='orange', alpha=alpha, label = 'dual hits')
|
||||
plt.fill_between(xx[a:], 1/0.01*xx[a:],np.maximum(0.01 * xx[a:], 12), color='orange', alpha=alpha, label = 'dual hits')
|
||||
|
||||
|
||||
if mask_He:
|
||||
|
|
@ -327,8 +298,8 @@ def do_2dhist():
|
|||
cbar = plt.colorbar(contour, orientation = 'vertical', shrink = 0.95, pad = 0.1)
|
||||
|
||||
else:
|
||||
#cb = plt.pcolormesh(x_edges, y_edges,c, cmap = cmap, shading='nearest', vmin=vmin, vmax = 2000,norm='log')
|
||||
cb = plt.pcolormesh(x_edges, y_edges,c, cmap = cmap, shading='auto', vmin=vmin, norm='log')
|
||||
cb = plt.pcolormesh(x_edges, y_edges,c, cmap = cmap, shading='nearest', vmin=vmin, vmax = 2000,norm='log')
|
||||
#cb = plt.pcolormesh(x_edges, y_edges,c, cmap = cmap, shading='auto', vmin=vmin, norm='log')
|
||||
#cb = plt.pcolormesh(np.multiply(x_edges,f), y_edges,c, cmap = cmap, shading='nearest', vmin=vmin, vmax=30, norm='log')
|
||||
cbar = plt.colorbar(cb, orientation = 'vertical', shrink = 0.95, pad = 0.1)
|
||||
|
||||
|
|
@ -386,13 +357,14 @@ def read_Itime(file, end):
|
|||
###############################################################################
|
||||
|
||||
def plot_layout(title, energy, limits, x, y, cbar):
|
||||
fs = 17
|
||||
fs = 20
|
||||
fs = 15
|
||||
fs = 24
|
||||
|
||||
if x == None and y == None:
|
||||
add = ""
|
||||
if energy == 'keV':
|
||||
add = '$_{Si}$'
|
||||
add = ""
|
||||
ylab = 'counts / h / ' + energy + add
|
||||
xlab = 'signal in ' + energy + add
|
||||
plt.yscale('log')
|
||||
|
|
@ -405,12 +377,12 @@ def plot_layout(title, energy, limits, x, y, cbar):
|
|||
xlab = x + ' in number of $e_{ph}$'
|
||||
|
||||
if 'd' in y:
|
||||
ylab = y.split('d')[0] + '/' + y.split('d')[1]
|
||||
ylab = y.split('d')[0] + ' / ' + y.split('d')[1]
|
||||
plt.yscale('log')
|
||||
|
||||
#ylab=y
|
||||
#xlab=x
|
||||
plt.yscale('log')
|
||||
#plt.yscale('log')
|
||||
|
||||
plt.ylabel(ylab, fontsize=fs + 5)
|
||||
plt.xlabel(xlab, fontsize=fs + 5)
|
||||
|
|
@ -434,7 +406,7 @@ def plot_layout(title, energy, limits, x, y, cbar):
|
|||
cbar.ax.tick_params(labelsize=fs)
|
||||
|
||||
if plt.gca().get_legend_handles_labels()[0]: # Gibt eine Liste von Künstlern (Handles) und Labels zurück
|
||||
plt.legend(fontsize=fs, loc="upper right",ncol=3)
|
||||
plt.legend(fontsize=fs-1, loc="upper right",ncol=1)
|
||||
#plt.legend(fontsize=fs+5, loc="upper right")
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue