Compare commits

...

2 commits

Author SHA1 Message Date
Nicolas Rohrbeck
13536ea628 read EDB, not ED 2025-06-26 19:56:57 +02:00
Nicolas Rohrbeck
27dfebbe28 split slice 0 2025-06-26 19:56:39 +02:00
2 changed files with 12 additions and 3 deletions

View file

@ -2,6 +2,8 @@
from seth_classes import Banana
import argparse
import numpy as np
import pandas as pd
parser = argparse.ArgumentParser(prog='bananas.py')
parser.add_argument('filepath')
@ -9,6 +11,14 @@ args = parser.parse_args()
fp = args.filepath
test = Banana()
print(test.read_from_file(fp))
def make_hist(dataframe, binsize = 100):
mask_slice0 = dataframe['sl'] == '0'
slice0 = dataframe[mask_slice0]
pha = list(dataframe.pha) # int16 = short
bins = np.arange(-32768, 32767, 65353/binsize) # highest and lowest possible 16 bit number, do min(pha)?
print(slice0)
test = Banana()
make_hist(test.read_from_file(fp))

View file

@ -9,11 +9,10 @@ class Banana():
def read_from_file(self, filepath):
d={'clock':[], 'sl':[], 'channel':[], 'dtime':[], 'lost':[], 'a':[], 'b':[], 'phase':[], 'banana':[], 'pha':[]} # slice (sl) is called det in ahepamfile.c
keys = list(d.keys())
print(keys)
with open(filepath) as file:
for line in file:
contents = line.split(" ")
if contents[0] == "ED":
if contents[0] == "EDB":
for i in range(10):
d[keys[i]].append(contents[i+1])
return pd.DataFrame(d)