Compare commits

...

2 commits

Author SHA1 Message Date
ava@asterix
a4d8c0f391 Changed test.py 2024-05-23 08:35:14 +02:00
ava@asterix
30315e49f9 ADD option -dau to AHBGOx.py 2024-05-23 08:30:29 +02:00
2 changed files with 42 additions and 2 deletions

View file

@ -12,6 +12,7 @@ parser.add_argument("file", type = str, help="path/file were data is stored in")
parser.add_argument('-hist', action='store_true', help = "makes histogramm of all channels") # on/off flag
parser.add_argument("-sum", action='store_true', help = "makes histogramms of BGOdiodes and sum (same as 'AHBGOC_vertical.py')") # on/off flag
parser.add_argument('-Itime', action='store_true', help = "if chosen, Itime is calculatet and printet to filename.Itime") # on/off flag
parser.add_argument('-dau', action='store_true', help = "if chosen, time and temperature of BGO are printet to filename.dau") # on/off flag
parser.add_argument("-mV", action='store_true', help = "if chosen, data will be kept in mV changed to keV otherwise") # on/off flag
parser.add_argument('-muon', action='store_true', help = "only select muon data") # on/off flag
parser.add_argument("-xray", action='store_true', help = "only select xray data") # on/off flag
@ -61,6 +62,11 @@ def main(x):
outfile = open(fname, 'w')
outfile.write(str(Itime))
outfile.close()
elif args.dau:
time,temp = find_timetemp()
frame = pd.DataFrame({'time': time, 'T': temp})
frame.to_csv('histograms/'+filename+'.dau', sep = ' ', index = False)
else:
global thr
@ -251,6 +257,19 @@ def find_Itime():
lasttime=time
return Itime
def find_timetemp():
time=[]
temp=[]
with fileinput.input(files=(file), encoding="utf-8", errors = 'ignore') as f:
for line in f:
l = line.split()
if not 'EOF' in l and l[0] == 'H':
T = adc_to_T(int(l[8]))
time.append(l[1])
temp.append(T)
return time,temp
def CmV(line, i):
return int(line[3*i+5])/mV

25
test.py
View file

@ -5,7 +5,28 @@ Created on Wed Apr 10 13:16:52 2024
@author: ava
"""
import pandas as pd
a = [0,1,2]
a = a + [3,4]
print(a)
print(a)
b = 6*[[30,40]]+[[50,90]]
print(b)
leer = [[],[],[]]
leer[0].append("P1")
leer[0].append("P2")
leer[1].append(3.5)
leer[1].append(1.0)
d = {'P': [], 'mpv': [], 'err_mpv':[]}
d['P'].append('P1')
d['mpv'].append(2.4)
d['err_mpv'].append(0.3)
print(d)
frame = pd.DataFrame(d)
frame.to_csv('fitparameters/'+'test'+'_mpv_sums.txt', sep = ' ', index = False)