-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathkinetoscope.py
More file actions
executable file
·35 lines (27 loc) · 831 Bytes
/
kinetoscope.py
File metadata and controls
executable file
·35 lines (27 loc) · 831 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/usr/bin/env python3
"Damn simple stripcharter"
datafile = "/Applications/spectackler/fusiondata.dat"
handin = open(datafile, 'r')
refresh = 0.1 # refresh time in s
import os
from time import sleep
from subprocess import check_output
from oscilloscope import Osc
# strip chart width in seconds
osc = Osc(window_sec=300)
# get column names from data file
with open(datafile, 'r') as handin:
cols = handin.readline().rstrip().split('\t')
@osc.signal
def fluor_trace(state):
row = ""
while True:
row_prev = row
# read last line in with bash tail
row = check_output(["tail", "-1", datafile]).decode().rstrip()
# if it's not redundant, plot it!
if row != row_prev:
#print(row.split('\t')[2])
state.draw(float(row.split('\t')[cols.index("intensity")])) # fluor hardcoded for now
sleep(refresh)
osc.start()