Compare commits
2 commits
522d0761c6
...
13536ea628
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
13536ea628 | ||
|
|
27dfebbe28 |
2 changed files with 12 additions and 3 deletions
14
bananas.py
14
bananas.py
|
|
@ -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))
|
||||
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue