Compare commits
No commits in common. "434f09f410c42a811cc4e15e7a822e8bd2ea461e" and "2de2265d32f6c6a3b67c8a5129a1d1a88a12c0fc" have entirely different histories.
434f09f410
...
2de2265d32
5 changed files with 150 additions and 242 deletions
100
CHAOSa.py
100
CHAOSa.py
|
|
@ -30,27 +30,27 @@ parser.add_argument("-res", type=str, nargs='+', help = "multiplies resolution w
|
||||||
parser.add_argument("-equal", action='store_true', help = "puts temperature correction to BGO data") # on/off flag
|
parser.add_argument("-equal", action='store_true', help = "puts temperature correction to BGO data") # on/off flag
|
||||||
parser.add_argument("-cut",type=str, nargs='+',help=("Choose cut definitions for specific detectors and apply corresponding conditions:\n"
|
parser.add_argument("-cut",type=str, nargs='+',help=("Choose cut definitions for specific detectors and apply corresponding conditions:\n"
|
||||||
"- D: Applies a condition on D1H and D2H that D2H lies within 15% of D1H, with a tolerance of ±30 units.\n"
|
"- D: Applies a condition on D1H and D2H that D2H lies within 15% of D1H, with a tolerance of ±30 units.\n"
|
||||||
"- B: Ensures B channel is above 35.\n"
|
"- B: Ensures B channel is inside the range [106.38, 366.46].\n"
|
||||||
"- nB: Ensures B channel is lower 35.\n"
|
"- nB: Ensures B channel is outside the range [106.38, 366.46].\n"
|
||||||
"- A: For detector A\n"
|
"- As: For detector A, requires either A1H or A2H to be above threshold.\n"
|
||||||
"- C: For detector C\n"
|
"- Ah: For detector A, requires one of A1H or A2H to be above threshold, while the other is below.\n"
|
||||||
"- E123: For detector group E123, requires at least one of E1, E2, or E3 to be above threshold.\n"
|
"- Cs: For detector C, requires either C1H or C2H to be above threshold.\n"
|
||||||
|
"- Ch: For detector C, requires one of C1H or C2H to be above threshold, while the other is below.\n"
|
||||||
|
"- E123s: For detector group E123, requires at least one of E1, E2, or E3 to be above threshold.\n"
|
||||||
|
"- E123h: For detector group E123, requires one of E1, E2, or E3 to be above threshold, while the others are below.\n"
|
||||||
"- E123_two: For detector group E123, requires at least two of E1, E2, or E3 to be above threshold."
|
"- E123_two: For detector group E123, requires at least two of E1, E2, or E3 to be above threshold."
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
parser.add_argument("-mask",type=str, nargs='+',help=("Choose mask definitions and apply corresponding conditions:\n"
|
parser.add_argument("-mask",type=str, nargs='+',help=("Choose mask definitions and apply corresponding conditions:\n"
|
||||||
"- HeA: Applies He-mask using A/E123 vs D (fishplot).\n"
|
"- HeA: Applies He-mask using A/E123 vs D (fishplot).\n"
|
||||||
"- HeC: Applies He-mask using C/E123 vs D (fishplot).\n"
|
"- HeC: Applies He-mask using C/E123 vs D (fishplot).\n"))
|
||||||
"- He1: Applies He-mask for min(A,C)-D plot"))
|
|
||||||
|
|
||||||
parser.add_argument("-deltaT", action='store_true', help = "saves deltatimes between events")
|
parser.add_argument("-deltaT", action='store_true', help = "saves deltatimes between events")
|
||||||
|
|
||||||
parser.add_argument("-nameadd", type=str, nargs='+', help = "custom nameadd to add to filename")
|
parser.add_argument("-nameadd", type=str, nargs='+', help = "custom nameadd to add to filename")
|
||||||
|
|
||||||
|
|
||||||
parser.add_argument("-Denergy", action='store_true', help = 'Histogramm of Detector D in MeV ')
|
parser.add_argument("-Denergy", action='store_true', help = ' ')
|
||||||
|
|
||||||
parser.add_argument("-Denergylog", action='store_true', help = 'Histogramm of Detector D in MeV and log scale')
|
|
||||||
|
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
|
@ -74,8 +74,6 @@ from histframe import get_T
|
||||||
from histframe import CmV
|
from histframe import CmV
|
||||||
from histframe import CmV_v
|
from histframe import CmV_v
|
||||||
from histframe import isCut
|
from histframe import isCut
|
||||||
from histframe import isMask
|
|
||||||
from histframe import isMask_other
|
|
||||||
from histframe import isMask_1D
|
from histframe import isMask_1D
|
||||||
from histframe import get_MeV_mean
|
from histframe import get_MeV_mean
|
||||||
from histframe import get_MeV
|
from histframe import get_MeV
|
||||||
|
|
@ -102,7 +100,7 @@ if args.tdhist and not args.res:
|
||||||
if args.tdhistlog and not args.res:
|
if args.tdhistlog and not args.res:
|
||||||
resV = 60*resV
|
resV = 60*resV
|
||||||
if args.res != None:
|
if args.res != None:
|
||||||
resV=resV*float(args.res[0])
|
resV=resV*int(args.res[0])
|
||||||
|
|
||||||
if args.lim:
|
if args.lim:
|
||||||
minV = int(args.lim[0])
|
minV = int(args.lim[0])
|
||||||
|
|
@ -129,14 +127,11 @@ if args.notrig:
|
||||||
for t in args.notrig:
|
for t in args.notrig:
|
||||||
notrig.append(t)
|
notrig.append(t)
|
||||||
|
|
||||||
mask=[]
|
|
||||||
if args.cut:
|
if args.cut:
|
||||||
nameadd += "_cut-" + "".join(args.cut)
|
nameadd += "_cut-" + "".join(args.cut)
|
||||||
|
|
||||||
if args.mask:
|
if args.mask:
|
||||||
nameadd += "_mask-" + "".join(args.mask)
|
nameadd += "_mask-" + "".join(args.mask)
|
||||||
for m in args.mask:
|
|
||||||
mask.append(m)
|
|
||||||
|
|
||||||
|
|
||||||
if args.lim:
|
if args.lim:
|
||||||
|
|
@ -227,9 +222,6 @@ def main():
|
||||||
if args.Denergy:
|
if args.Denergy:
|
||||||
generate_hist_D_MeV()
|
generate_hist_D_MeV()
|
||||||
|
|
||||||
if args.Denergylog:
|
|
||||||
generate_hist_D_MeV_log()
|
|
||||||
|
|
||||||
if args.hist:
|
if args.hist:
|
||||||
generate_hist()
|
generate_hist()
|
||||||
|
|
||||||
|
|
@ -338,10 +330,10 @@ def generate_hist():
|
||||||
if l[0] == 'H':
|
if l[0] == 'H':
|
||||||
timestamp = int(l[1])
|
timestamp = int(l[1])
|
||||||
T = get_T(float(l[8]))
|
T = get_T(float(l[8]))
|
||||||
if l[0] == 'EI' and len(l)>3*18 and conditions(l,args) and isMask_other(l,T,mask) and isFloat(args,timestamp):
|
if l[0] == 'EI' and len(l)>3*18 and conditions(l,args) and isFloat(args,timestamp):
|
||||||
for i,chan in enumerate(chans):
|
for i,chan in enumerate(chans):
|
||||||
b = value_HL(l,chan,u)
|
b = value_HL(l,chan,u)
|
||||||
#b = value
|
b = value
|
||||||
if minV <= b <= maxV:
|
if minV <= b <= maxV:
|
||||||
xb = int((b-minV)/resV)
|
xb = int((b-minV)/resV)
|
||||||
hist[xb,i+1] += 1
|
hist[xb,i+1] += 1
|
||||||
|
|
@ -352,11 +344,11 @@ def generate_hist():
|
||||||
|
|
||||||
################ 1D HISTOGRAM D in MeV ############################################################
|
################ 1D HISTOGRAM D in MeV ############################################################
|
||||||
def generate_hist_D_MeV():
|
def generate_hist_D_MeV():
|
||||||
minV = 0
|
|
||||||
maxV = 100
|
|
||||||
resV = 0.5
|
|
||||||
#minV = 0
|
#minV = 0
|
||||||
#maxV = 1000
|
#maxV = 50
|
||||||
|
#resV = 0.1
|
||||||
|
minV = 0
|
||||||
|
maxV = 1000
|
||||||
bin = int((maxV-minV)/resV)
|
bin = int((maxV-minV)/resV)
|
||||||
|
|
||||||
hist = np.zeros((bin+1,2))
|
hist = np.zeros((bin+1,2))
|
||||||
|
|
@ -378,59 +370,19 @@ def generate_hist_D_MeV():
|
||||||
if l[0] == 'EI' and len(l)>3*18 and conditions(l,args) and isFloat(args,timestamp):
|
if l[0] == 'EI' and len(l)>3*18 and conditions(l,args) and isFloat(args,timestamp):
|
||||||
#T=15
|
#T=15
|
||||||
b = value_HL(l,'D1',u)+value_HL(l,'D2',u)
|
b = value_HL(l,'D1',u)+value_HL(l,'D2',u)
|
||||||
bx = get_MeV(b, T)
|
bx = b #get_MeV(b,T)
|
||||||
if minV <= bx <= maxV:
|
if minV <= bx <= maxV:
|
||||||
xb = int((bx-minV)/resV)
|
xb = int((bx-minV)/resV)
|
||||||
hist[xb,1] += 1
|
hist[xb,1] += 1
|
||||||
|
|
||||||
frame = pd.DataFrame(hist, columns = ['MeV'] + ['D'])
|
frame = pd.DataFrame(hist, columns = ['keV'] + ['D'])
|
||||||
frame.to_csv(f'histograms/{filename}{nameadd}_D_MeV.1dhist', sep = ' ', index = False)
|
frame.to_csv(f'histograms/{filename}_D_keV.1dhist', sep = ' ', index = False)
|
||||||
print(f'histograms/{filename}{nameadd}_D_MeV.1dhist was created')
|
print(f'histograms/{filename}_D_keV.1dhist was created')
|
||||||
|
|
||||||
def generate_hist_D_MeV_log():
|
|
||||||
minX = 1
|
|
||||||
maxX = 10000
|
|
||||||
resX = 190*resV
|
|
||||||
#minV = 0
|
|
||||||
bin_x = int((maxX-minX)/resX)
|
|
||||||
|
|
||||||
edges_x = np.logspace(np.log10(minX), np.log10(maxX), bin_x)
|
|
||||||
|
|
||||||
hist = np.zeros((bin_x,2))
|
|
||||||
|
|
||||||
for i, edge in enumerate(edges_x):
|
|
||||||
hist[i][0] = edge
|
|
||||||
|
|
||||||
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):
|
|
||||||
#T=15
|
|
||||||
b = value_HL(l,'D1',u)+value_HL(l,'D2',u)
|
|
||||||
bx = get_MeV(b, T)
|
|
||||||
if minX <= bx <= maxX:
|
|
||||||
xb = np.digitize(bx, edges_x)-1
|
|
||||||
hist[xb,1] += 1
|
|
||||||
|
|
||||||
frame = pd.DataFrame(hist, columns = ['MeV'] + ['D'])
|
|
||||||
frame.to_csv(f'histograms/{filename}{nameadd}_D_MeV.1dhistlog', sep = ' ', index = False)
|
|
||||||
print(f'histograms/{filename}{nameadd}_D_MeV.1dhistlog was created')
|
|
||||||
|
|
||||||
|
|
||||||
##########################################################################################
|
|
||||||
|
|
||||||
def generate_hist_xlog():
|
def generate_hist_xlog():
|
||||||
minX = 1
|
minX = 0.01
|
||||||
maxX = 3500
|
maxX = 100
|
||||||
resX = 100*resV
|
resX = resV
|
||||||
bin_x = int((maxX-minX)/resX)
|
bin_x = int((maxX-minX)/resX)
|
||||||
|
|
||||||
edges_x = np.logspace(np.log10(minX), np.log10(maxX), bin_x)
|
edges_x = np.logspace(np.log10(minX), np.log10(maxX), bin_x)
|
||||||
|
|
@ -451,13 +403,13 @@ def generate_hist_xlog():
|
||||||
if l[0] == 'H':
|
if l[0] == 'H':
|
||||||
timestamp = int(l[1])
|
timestamp = int(l[1])
|
||||||
T = get_T(float(l[8]))
|
T = get_T(float(l[8]))
|
||||||
if l[0] == 'EI' and len(l)>3*18 and conditions(l,args) and isMask_other(l,T,mask):
|
if l[0] == 'EI' and len(l)>3*18 and conditions(l,args):
|
||||||
for i,chan in enumerate(chans):
|
for i,chan in enumerate(chans):
|
||||||
#b = value_HL(l,chan,u)
|
#b = value_HL(l,chan,u)
|
||||||
x_expr, x_op, x_next_op, x_next_channel = parse_channel_expression(chan)
|
x_expr, x_op, x_next_op, x_next_channel = parse_channel_expression(chan)
|
||||||
try: b = get_channel_value(l, u,x_expr, x_op, x_next_op, x_next_channel,T)
|
try: b = get_channel_value(l, u,x_expr, x_op, x_next_op, x_next_channel,T)
|
||||||
except: b = 0
|
except: b = 0
|
||||||
if minV <= b <= maxX:
|
if minV <= b <= maxX and isMask_1D(l,args.mask,T):
|
||||||
xb = np.digitize(b, edges_x)-1
|
xb = np.digitize(b, edges_x)-1
|
||||||
hist[xb,i+1] += 1
|
hist[xb,i+1] += 1
|
||||||
|
|
||||||
|
|
|
||||||
187
CHAOScustom.py
187
CHAOScustom.py
|
|
@ -13,7 +13,6 @@ from histframe import get_T
|
||||||
from histframe import get_MeV
|
from histframe import get_MeV
|
||||||
from histframe import CmV
|
from histframe import CmV
|
||||||
from histframe import isCut
|
from histframe import isCut
|
||||||
from histframe import isMask
|
|
||||||
|
|
||||||
|
|
||||||
name = hf.names
|
name = hf.names
|
||||||
|
|
@ -28,16 +27,15 @@ resV = hf.resV
|
||||||
|
|
||||||
pol = hf.pol
|
pol = hf.pol
|
||||||
|
|
||||||
file = "2024-10-02-flight-2.EI"
|
#file = "2024-10-02-flight-2.EI"
|
||||||
# file = "chaos_sd_float.EI"
|
file = "chaos_sd_float.EI"
|
||||||
# file = "data_sim/proton.EI"
|
#file = "data_sim/proton.EI"
|
||||||
# file = "data_sim/e-.EI"
|
#file = "data_sim/e-.EI"
|
||||||
# file = "data_sim/mu.EI"file = "data_sim/he.EI"
|
#file = "data_sim/mu.EI"
|
||||||
|
#file = "data_sim/he.EI"
|
||||||
|
|
||||||
|
|
||||||
def do_hist(cuts,val):
|
def main():
|
||||||
print('do ' + val)
|
|
||||||
print('with cuts: ' +str(cuts))
|
|
||||||
bin_x = int((maxX-minX)/resX)
|
bin_x = int((maxX-minX)/resX)
|
||||||
bin_y = bin_x+1
|
bin_y = bin_x+1
|
||||||
edges_x = np.logspace(np.log10(minX), np.log10(maxX), bin_x)
|
edges_x = np.logspace(np.log10(minX), np.log10(maxX), bin_x)
|
||||||
|
|
@ -62,13 +60,8 @@ def do_hist(cuts,val):
|
||||||
T = get_T(float(l[8]))
|
T = get_T(float(l[8]))
|
||||||
if l[0] == 'EI' and len(l)>3*18 and isCut(l,cuts) and T != None:
|
if l[0] == 'EI' and len(l)>3*18 and isCut(l,cuts) and T != None:
|
||||||
if int(int(l[4].split(':')[0])/3) > deltacut:
|
if int(int(l[4].split(':')[0])/3) > deltacut:
|
||||||
if val=='fish':
|
bx,by = get_values(l,T)
|
||||||
bx,by = get_values_fish(l,T)
|
if minX <= bx <= maxX and minY <= by <= maxY:
|
||||||
elif val =='other':
|
|
||||||
bx,by = get_values_other(l,T)
|
|
||||||
else:
|
|
||||||
bx,by = get_values(l,T)
|
|
||||||
if minX <= bx <= maxX and minY <= by <= maxY and isMask(bx,by,masks):
|
|
||||||
bxx = np.digitize(bx, edges_x) - 1
|
bxx = np.digitize(bx, edges_x) - 1
|
||||||
#bxx = int((bx-minX)/resX)
|
#bxx = int((bx-minX)/resX)
|
||||||
byy = np.digitize(by, edges_y)
|
byy = np.digitize(by, edges_y)
|
||||||
|
|
@ -77,112 +70,106 @@ def do_hist(cuts,val):
|
||||||
|
|
||||||
frame = pd.DataFrame(hist, columns = ['MeV']+edges_y.astype(str).tolist())
|
frame = pd.DataFrame(hist, columns = ['MeV']+edges_y.astype(str).tolist())
|
||||||
frame.to_csv(f'{folder}/{filename}', sep = ' ', index = False)
|
frame.to_csv(f'{folder}/{filename}', sep = ' ', index = False)
|
||||||
print(f'{folder}/{filename} was created \n')
|
print(f'{folder}/{filename} was created')
|
||||||
|
|
||||||
|
# def mainZ():
|
||||||
|
# bin_x = int((maxX-minX)/resX)
|
||||||
|
# bin_y = bin_x+1
|
||||||
|
# edges_x = np.logspace(np.log10(minX), np.log10(maxX), bin_x)
|
||||||
|
# #edges_x = [minX + i*resX for i in range(bin_x+1)]
|
||||||
|
# edges_y = np.logspace(np.log10(minY), np.log10(maxY), bin_y)
|
||||||
|
|
||||||
|
# #hist = np.zeros((bin_x+1, bin_y+1))
|
||||||
|
# hist = np.zeros((bin_x, bin_y+1))
|
||||||
|
|
||||||
|
# for i, edge in enumerate(edges_x):
|
||||||
|
# hist[i][0] = edge
|
||||||
|
|
||||||
|
|
||||||
|
# with fileinput.input(files=("2024-10-02-flight-2.EI"), encoding="utf-8", errors='ignore') as f:
|
||||||
|
# T=None
|
||||||
|
# timestamp=0
|
||||||
|
# for line in f:
|
||||||
|
# if not line.strip():
|
||||||
|
# continue
|
||||||
|
# l = line.split()
|
||||||
|
# if l[0] == 'H':
|
||||||
|
# timestamp = int(l[1])
|
||||||
|
# T = get_T(float(l[8]))
|
||||||
|
# if l[0] == 'EI' and len(l)>3*18 and isCut(l,cuts) and 1727859780 < timestamp < 1727872980 and T != None:
|
||||||
|
# if int(int(l[4].split(':')[0])/3) > deltacut:
|
||||||
|
# bx,by,z = get_valuesZ(l,T)
|
||||||
|
# if minX <= bx <= maxX and minY <= by <= maxY:
|
||||||
|
# bxx = np.digitize(bx, edges_x) - 1
|
||||||
|
# #bxx = int((bx-minX)/resX)
|
||||||
|
# byy = np.digitize(by, edges_y) - 1
|
||||||
|
# if 0 <= bxx < bin_x and 0 <= byy < bin_y:
|
||||||
|
# hist[bxx, byy] = z
|
||||||
|
|
||||||
|
# frame = pd.DataFrame(hist, columns = ['MeV']+edges_y.astype(str).tolist())
|
||||||
|
# frame.to_csv(f'{folder}/{filename}', sep = ' ', index = False)
|
||||||
|
# print(f'{folder}/{filename} was created')
|
||||||
|
|
||||||
|
|
||||||
|
##################################################################################################
|
||||||
|
def get_valuesZ(l,T):
|
||||||
|
y = min(max(value(l,"A1H"),value(l,"A2H")),max(value(l,"C1H"),value(l,"C2H")))/max(value(l,"E1"),value(l,"E2"),value(l,"E3"))
|
||||||
|
x = value(l,"D1H")+value(l,"D2H")
|
||||||
|
x2 = get_MeV(x,T)
|
||||||
|
z = value(l,"B")
|
||||||
|
return x2,y,z
|
||||||
|
|
||||||
###################################################################################################
|
###################################################################################################
|
||||||
|
|
||||||
def get_values_fish(l,T):
|
|
||||||
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_HL(l,"A",u)/max(value(l,"E1",u),value(l,"E2",u),value(l,"E3",u))
|
|
||||||
x = value_HL(l,"D1",u)+value_HL(l,"D2",u)
|
|
||||||
x2 = get_MeV(x,T)
|
|
||||||
return x2,y
|
|
||||||
|
|
||||||
def get_values_other(l,T):
|
|
||||||
y = min(value_HL(l,"A",u),value_HL(l,"C",u))/1000
|
|
||||||
#y = value_HL(l,"A",u)/1000
|
|
||||||
x = value_HL(l,"D1",u)+value_HL(l,"D2",u)
|
|
||||||
x2 = get_MeV(x,T)
|
|
||||||
return x2,y
|
|
||||||
|
|
||||||
|
|
||||||
def get_values(l,T):
|
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,"A",u)/1000
|
||||||
#y = value(l,"C",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)
|
x = value_HL(l,"D1",u)+value_HL(l,"D2",u)
|
||||||
x2 = get_MeV(x,T)
|
x2 = get_MeV(x,T)
|
||||||
return x2,y
|
return x2,y
|
||||||
|
|
||||||
|
|
||||||
deltacut = 0
|
cuts = ['A','hB','C','AeqC','D','E123']
|
||||||
|
|
||||||
allcuts = [['A','B','C','AeqC','D'],['A','nB','C','AeqC','D']]
|
|
||||||
#allcuts = [['A','D'],['A','B','D'],['A','nB','D']]
|
|
||||||
allcuts = [['A','C','AeqC','D']]
|
|
||||||
|
|
||||||
#masks = ['He1']
|
|
||||||
masks=[]
|
|
||||||
|
|
||||||
allfish = True
|
|
||||||
allother = True
|
|
||||||
|
|
||||||
|
filename = "chaos20_Cut"+ "".join(cuts)+"~min(A,C)dE-D.2dhist2log"
|
||||||
|
#filename = "chaos20_Cut"+ "".join(cuts)+"~min(A,C)-D.2dhist2log"
|
||||||
folder = "hists_fish"
|
folder = "hists_fish"
|
||||||
#folder = "hists_sim"
|
|
||||||
|
|
||||||
minX = 2
|
|
||||||
maxX = 10000
|
|
||||||
minY = 0.02
|
|
||||||
maxY = 20
|
|
||||||
resV = 50*80*resV
|
|
||||||
resX = resV/0.00362/polynom(15,*pol)
|
|
||||||
|
|
||||||
if allother:
|
|
||||||
for cut in allcuts:
|
|
||||||
filename = "chaos_Cut"+ "".join(cut)+"~min(A,C)-D.2dhist2log"
|
|
||||||
#filename = "chaosB35_Cut"+ "".join(cut)+"~A-D.2dhist2log"
|
|
||||||
#filename = "simHe-chaos_Cut"+ "".join(cut)+"~min(A,C)-D.2dhist2log"
|
|
||||||
do_hist(cut,'other')
|
|
||||||
|
|
||||||
if allfish:
|
|
||||||
for cut in allcuts:
|
|
||||||
cut.append('E123')
|
|
||||||
filename = "chaos_Cut"+ "".join(cut)+"~min(A,C)dE-D.2dhist2log"
|
|
||||||
#filename = "chaosB35_Cut"+ "".join(cut)+"~AdE-D.2dhist2log"
|
|
||||||
#filename = "simHe-chaos_Cut"+ "".join(cut)+"~min(A,C)dE-D.2dhist2log"
|
|
||||||
do_hist(cut,'fish')
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#cuts = ['A','hB','C','AeqC','D','E123']
|
|
||||||
|
|
||||||
#filename = "chaos35_Cut"+ "".join(cuts)+"~min(A,C)dE-D.2dhist2log"
|
|
||||||
#filename = "chaos35_Cut"+ "".join(cuts)+"~min(A,C)-D.2dhist2log"
|
|
||||||
#folder = "hists_fish"
|
|
||||||
|
|
||||||
# filename = "chaos-dE-cut"+ "".join(cuts)+"~A-D.2dhist2log"
|
# filename = "chaos-dE-cut"+ "".join(cuts)+"~A-D.2dhist2log"
|
||||||
# folder = "hists_dEdx"
|
# folder = "hists_dEdx"
|
||||||
|
|
||||||
#chaos
|
#chaos
|
||||||
#resV = 50*resV
|
#resV = 50*resV
|
||||||
# minY = 0.05
|
minY = 0.05
|
||||||
# maxY = 10
|
maxY = 10
|
||||||
|
|
||||||
# minX = 10
|
minX = 10
|
||||||
# maxX = 170
|
maxX = 170
|
||||||
|
|
||||||
# minX = 7
|
minX = 7
|
||||||
# maxX = 10000
|
maxX = 10000
|
||||||
|
|
||||||
# #fish
|
#fish
|
||||||
# resV = 80*resV
|
resV = 80*resV
|
||||||
# minY = 0.01
|
minY = 0.01
|
||||||
# maxY = 100
|
maxY = 100
|
||||||
# minX = 5
|
minX = 5
|
||||||
# maxX = 500
|
maxX = 500
|
||||||
# maxX = 10000
|
maxX = 10000
|
||||||
# resV = 50*resV
|
resV = 50*resV
|
||||||
|
|
||||||
# # minY = 0.02
|
# minY = 0.02
|
||||||
# # maxY = 20
|
# maxY = 20
|
||||||
|
|
||||||
# mask_He = False
|
mask_He = False
|
||||||
# if mask_He:
|
if mask_He:
|
||||||
# minX,minY,maxX,maxY= 64,0.6,102, 1.5
|
minX,minY,maxX,maxY= 64,0.6,102, 1.5
|
||||||
|
|
||||||
#kontur
|
#kontur
|
||||||
# resV=3*resV
|
# resV=3*resV
|
||||||
|
|
@ -195,9 +182,15 @@ if allfish:
|
||||||
# minX = 1
|
# minX = 1
|
||||||
# maxX = 1000
|
# maxX = 1000
|
||||||
|
|
||||||
#resX = resV/0.00362/polynom(15,*pol)
|
|
||||||
|
resX = resV/0.00362/polynom(15,*pol)
|
||||||
#resX = resV/0.00362
|
#resX = resV/0.00362
|
||||||
|
|
||||||
|
deltacut = 0
|
||||||
|
|
||||||
|
###############################################
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
main()
|
||||||
|
|
||||||
#mainZ()
|
#mainZ()
|
||||||
69
histframe.py
69
histframe.py
|
|
@ -35,17 +35,17 @@ 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[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
|
names[17] = "E3"; ch[17] = 2; thr[17] = 8; s[17] = 2.2; u[17] = 11.32
|
||||||
|
|
||||||
thr[9]=18
|
thr[9]=60
|
||||||
thr[11]=18
|
thr[11]=60
|
||||||
|
|
||||||
thr[0] = 8
|
thr[0] = 8
|
||||||
thr[2] = 14
|
thr[2] = 14
|
||||||
thr[5] = 7
|
thr[5] = 7
|
||||||
thr[7] = 13
|
thr[7] = 13
|
||||||
|
|
||||||
thr[13] = 13.19
|
thr[13] = 14.73
|
||||||
|
|
||||||
thr[15] = 5.92; thr[16] = 5.92; thr[17] = 5.92
|
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"]
|
names_a = ["A1", "A2", "B", "C1", "C2", "D1", "D2", "E", "E1", "E2", "E3"]
|
||||||
boundary = 2500 #mV
|
boundary = 2500 #mV
|
||||||
|
|
@ -55,7 +55,7 @@ boundary = 2500 #mV
|
||||||
|
|
||||||
|
|
||||||
mV = 14000
|
mV = 14000
|
||||||
minV = -100
|
minV = 0
|
||||||
maxV = 3500
|
maxV = 3500
|
||||||
resV = 0.838214/2
|
resV = 0.838214/2
|
||||||
|
|
||||||
|
|
@ -83,7 +83,7 @@ def get_MeV(keV,T):
|
||||||
return keV/0.00362/polynom(T,*pol)
|
return keV/0.00362/polynom(T,*pol)
|
||||||
|
|
||||||
def get_MeV_mean(keV):
|
def get_MeV_mean(keV):
|
||||||
return keV/0.00362/polynom(14.92,*pol)
|
return keV/0.00362/polynom(15,*pol)
|
||||||
|
|
||||||
def get_MeV_H(keV,T):
|
def get_MeV_H(keV,T):
|
||||||
return keV/0.00362/line_H(T)
|
return keV/0.00362/line_H(T)
|
||||||
|
|
@ -148,24 +148,22 @@ def isCut(l, cut):
|
||||||
if d1 < thresholds['D1H'] or d2 < thresholds['D2H']: return False
|
if d1 < thresholds['D1H'] or d2 < thresholds['D2H']: return False
|
||||||
if not (0.85 * (d1 - 30) < d2 < d1/0.85 + 30): return False
|
if not (0.85 * (d1 - 30) < d2 < d1/0.85 + 30): return False
|
||||||
|
|
||||||
elif "nD" in cut:
|
# Cut für B oder nB
|
||||||
d1 = value_HL(l,'D1',u)
|
# if "B" in cut:
|
||||||
d2 = value_HL(l,'D2',u)
|
# b = value(l,"B",u)
|
||||||
if d1 > thresholds['D1H'] and d2 > thresholds['D2H']: return False
|
# if not (106.38 < b < 366.46): return False
|
||||||
if (0.85 * (d1 - 30) < d2 < d1/0.85 + 30): return False
|
# elif "nB" in cut:
|
||||||
|
# b = value(l,"B",u)
|
||||||
if "B" in cut or "hB" in cut:
|
# if 106.38 < b < 366.46: return False
|
||||||
|
elif "nB" or "lB" in cut:
|
||||||
b = value(l,"B",u)
|
b = value(l,"B",u)
|
||||||
if b < 17: return False
|
if b > 35: return False
|
||||||
#if b > 106.38: return False
|
#if b > 106.38: return False
|
||||||
|
elif "B" or "hB" in cut:
|
||||||
elif "nB" in cut or "lB" in cut:
|
|
||||||
b = value(l,"B",u)
|
b = value(l,"B",u)
|
||||||
if b > 17: return False
|
#if b < 366.46:
|
||||||
|
#if b < 106.38: return False
|
||||||
elif "rB" in cut or "lB" in cut:
|
if b < 35: return False
|
||||||
b = value(l,"B",u)
|
|
||||||
if b < 17 or b > 43: return False
|
|
||||||
|
|
||||||
if "A" in cut:
|
if "A" in cut:
|
||||||
a1 = value_HL(l,"A1",u)
|
a1 = value_HL(l,"A1",u)
|
||||||
|
|
@ -208,35 +206,6 @@ def isCut(l, cut):
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
###########################################################################################
|
|
||||||
|
|
||||||
def get_values_fish(l,T):
|
|
||||||
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_HL(l,"A",u)/max(value(l,"E1",u),value(l,"E2",u),value(l,"E3",u))
|
|
||||||
x = value_HL(l,"D1",u)+value_HL(l,"D2",u)
|
|
||||||
x2 = get_MeV(x,T)
|
|
||||||
return x2,y
|
|
||||||
|
|
||||||
def get_values_other(l,T):
|
|
||||||
y = min(value_HL(l,"A",u),value_HL(l,"C",u))/1000
|
|
||||||
#y = value_HL(l,"A",u)/1000
|
|
||||||
x = value_HL(l,"D1",u)+value_HL(l,"D2",u)
|
|
||||||
x2 = get_MeV(x,T)
|
|
||||||
return x2,y
|
|
||||||
|
|
||||||
def isMask(x,y,mask):
|
|
||||||
if 'He1' in mask:
|
|
||||||
if x<60 or x>100: return False
|
|
||||||
if y<0.26 or y>0.61:return False
|
|
||||||
return True
|
|
||||||
|
|
||||||
def isMask_other(l,T,mask):
|
|
||||||
x,y = get_values_other(l, T)
|
|
||||||
if 'He1' in mask:
|
|
||||||
if x<60 or x>100: return False
|
|
||||||
if y<0.26 or y>0.61:return False
|
|
||||||
return True
|
|
||||||
|
|
||||||
|
|
||||||
def isMask_1D(l, mask,T):
|
def isMask_1D(l, mask,T):
|
||||||
if not mask:
|
if not mask:
|
||||||
|
|
|
||||||
|
|
@ -106,7 +106,7 @@ def do_2dhist():
|
||||||
y_edges = data.columns[1:].astype(float).tolist()
|
y_edges = data.columns[1:].astype(float).tolist()
|
||||||
|
|
||||||
# Hauptplot: 2D-Histogramm
|
# Hauptplot: 2D-Histogramm
|
||||||
cb = ax_main.pcolormesh(x_edges, y_edges, c, cmap=cmap, shading='nearest', vmin=1git status, norm='log')
|
cb = ax_main.pcolormesh(x_edges, y_edges, c, cmap=cmap, shading='nearest', vmin=1, norm='log')
|
||||||
ax_main.set_yscale('log') # Logarithmische Skala für y
|
ax_main.set_yscale('log') # Logarithmische Skala für y
|
||||||
|
|
||||||
# Summenberechnung
|
# Summenberechnung
|
||||||
|
|
|
||||||
28
xplot.py
28
xplot.py
|
|
@ -106,16 +106,10 @@ def do_1dhist():
|
||||||
#plt.axvline(x=6.5, color='k', linestyle = '--', lw=2, label = 'thr(E123) = 6.5 mV') 6.593
|
#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=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=67, color='k', linestyle = '--', lw=2, label = 'thr(E123) = 67 keV')
|
||||||
#plt.axvline(x=60, color='r', linestyle = '--', lw=2, label = 'thr(E) = 60 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=20, color='blue', linestyle='--', linewidth=2, label='20 mV (flight)')
|
||||||
#plt.axvline(x=18, color='black', linestyle='--', linewidth=2, label='18 mV (2 MeV)')
|
#plt.axvline(x=60, color='black', linestyle='--', linewidth=2, label='60 mV (data analysis)')
|
||||||
#plt.axvline(x=2, color='black', linestyle='--', linewidth=2, label='2 MeV')
|
|
||||||
#plt.axvline(x=9, color='r', linestyle='--', linewidth=2, label='9 mV (1 MeV)')
|
|
||||||
|
|
||||||
plt.axvline(x=17, color='red', linestyle='--', linewidth=2, label='17 mV')
|
|
||||||
plt.axvline(x=43, color='black', linestyle='--', linewidth=2, label='43 mV')
|
|
||||||
|
|
||||||
|
|
||||||
plot_layout(title, energy, limits,None,None,None)
|
plot_layout(title, energy, limits,None,None,None)
|
||||||
|
|
||||||
|
|
@ -188,7 +182,7 @@ def do_2dhist():
|
||||||
c = np.array(data)[:,1:].T
|
c = np.array(data)[:,1:].T
|
||||||
|
|
||||||
Dcuts = False
|
Dcuts = False
|
||||||
ACcuts = False
|
ACcuts = True
|
||||||
AeqC = False
|
AeqC = False
|
||||||
Ecuts = False
|
Ecuts = False
|
||||||
Lowcal = False
|
Lowcal = False
|
||||||
|
|
@ -198,13 +192,13 @@ def do_2dhist():
|
||||||
vmin = 1
|
vmin = 1
|
||||||
if Dcuts:
|
if Dcuts:
|
||||||
plt.plot(x_edges, np.multiply(np.add(x_edges,-30), 0.85), 'r-', lw=2,
|
plt.plot(x_edges, np.multiply(np.add(x_edges,-30), 0.85), 'r-', lw=2,
|
||||||
label=("Cuts: $0.85 \\cdot (D1 - 30$ mV$)< D2 < D1/0.85 + 30$mV"))
|
label=("Cuts: $0.85 \\cdot (D1H - 30$ mV$)< D2H < D1H/0.85 + 30$mV"))
|
||||||
#plt.plot(x_edges,np.multiply(x_edges,1.15)+30, 'r-', lw=1.5)
|
#plt.plot(x_edges,np.multiply(x_edges,1.15)+30, 'r-', lw=1.5)
|
||||||
plt.plot(x_edges,np.add(np.divide(x_edges,0.85),30), 'r-', lw=2)
|
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([0, 30], [30, 30], 'r--', lw=2)
|
||||||
#plt.plot([30, 30], [30, 0], 'r--', lw=2)
|
#plt.plot([30, 30], [30, 0], 'r--', lw=2)
|
||||||
plt.axhline(y=25, color='r', linestyle = '--', lw=1.5,label = " $D1, D2 > 25$ mV")
|
plt.axhline(y=60, color='r', linestyle = '--', lw=1.5,label = " $D1H, D2H > 60$ mV")
|
||||||
plt.axvline(x=25, color='r', linestyle = '--', lw=1.5,)
|
plt.axvline(x=60, color='r', linestyle = '--', lw=1.5,)
|
||||||
|
|
||||||
if ACcuts:
|
if ACcuts:
|
||||||
plt.axhline(y=15, color='r', linestyle = '-', lw=1.5, label = "thr['C1H'] = 10 mV; thr['C2H'] = 15 mV")
|
plt.axhline(y=15, color='r', linestyle = '-', lw=1.5, label = "thr['C1H'] = 10 mV; thr['C2H'] = 15 mV")
|
||||||
|
|
@ -223,13 +217,13 @@ def do_2dhist():
|
||||||
|
|
||||||
if Dcuts:
|
if Dcuts:
|
||||||
plt.plot(x_edges, np.multiply(np.add(x_edges,-30), 0.85), 'r-', lw=2,
|
plt.plot(x_edges, np.multiply(np.add(x_edges,-30), 0.85), 'r-', lw=2,
|
||||||
label=("Cuts: $0.85 \\cdot (D1 - 30$ mV$)< D2 < D1/0.85 + 30$mV"))
|
label=("Cuts: $0.85 \\cdot (D1H - 30$ mV$)< D2H < D1H/0.85 + 30$mV"))
|
||||||
#plt.plot(x_edges,np.multiply(x_edges,1.15)+30, 'r-', lw=1.5)
|
#plt.plot(x_edges,np.multiply(x_edges,1.15)+30, 'r-', lw=1.5)
|
||||||
plt.plot(x_edges,np.add(np.divide(x_edges,0.85),30), 'r-', lw=2)
|
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([0, 30], [30, 30], 'r--', lw=2)
|
||||||
#plt.plot([30, 30], [30, 0], 'r--', lw=2)
|
#plt.plot([30, 30], [30, 0], 'r--', lw=2)
|
||||||
plt.axhline(y=18, color='r', linestyle = '--', lw=1.5,label = " $D1, D2 > 18$ mV")
|
plt.axhline(y=60, color='r', linestyle = '--', lw=1.5,label = " $D1H, D2H > 60$ mV")
|
||||||
plt.axvline(x=18, color='r', linestyle = '--', lw=1.5,)
|
plt.axvline(x=60, color='r', linestyle = '--', lw=1.5,)
|
||||||
|
|
||||||
|
|
||||||
if Ecuts:
|
if Ecuts:
|
||||||
|
|
@ -304,8 +298,8 @@ def do_2dhist():
|
||||||
cbar = plt.colorbar(contour, orientation = 'vertical', shrink = 0.95, pad = 0.1)
|
cbar = plt.colorbar(contour, orientation = 'vertical', shrink = 0.95, pad = 0.1)
|
||||||
|
|
||||||
else:
|
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='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='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')
|
#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)
|
cbar = plt.colorbar(cb, orientation = 'vertical', shrink = 0.95, pad = 0.1)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue