Compare commits
2 commits
917570b9e0
...
91beefeb74
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
91beefeb74 | ||
|
|
52d8a95582 |
2 changed files with 20 additions and 17 deletions
17
bananas.py
17
bananas.py
|
|
@ -1,24 +1,7 @@
|
||||||
#! /usr/bin/python3
|
#! /usr/bin/python3
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
import numpy as np
|
|
||||||
import pandas as pd
|
|
||||||
|
|
||||||
|
|
||||||
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":
|
|
||||||
for i in range(10):
|
|
||||||
d[keys[i]].append(contents[i+1])
|
|
||||||
return pd.DataFrame(d)
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
parser = argparse.ArgumentParser(
|
parser = argparse.ArgumentParser(
|
||||||
prog='bananas.py',
|
prog='bananas.py',
|
||||||
|
|
|
||||||
20
seth_classes.py
Normal file
20
seth_classes.py
Normal file
|
|
@ -0,0 +1,20 @@
|
||||||
|
#! /usr/bin/python3
|
||||||
|
|
||||||
|
import numpy as np
|
||||||
|
import pandas as pd
|
||||||
|
|
||||||
|
|
||||||
|
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":
|
||||||
|
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