Files
ALF/dioderata/lost_pids1.py
2023-10-23 19:03:37 +02:00

54 lines
1.0 KiB
Python
Executable File

#!/photonics/home/gac-alvra/.conda/envs/adaq/bin/python
#from time import sleep
#from collections import deque
#import numpy as np
#import scipy.signal
from bstrd import BS, bsstream
#from zoetrope import aniplot as plt
#plt.blit = False
chname = "SARES11-SPEC125-M1.edge_amplitude"
ch = BS(chname)
pids = BS("pid")
seen = set()
#last = None
missing_prev = set()
#missing_next = set()
for _ in bsstream:
p_curr = pids.get()
p_prev = p_curr - 1
p_next = p_curr + 1
seen.add(p_curr)
if p_prev not in seen:
missing_prev.add(p_curr)
# miss_prev.remove(prev)
last_few = sorted(seen)[-23:]
if missing_prev:
print("missing prev:", missing_prev)
print("last few: ", last_few)
print(p_curr)
to_be_removed = set()
for p in missing_prev:
if p-1 in seen:
print("late:", p)
print("max:", max(seen), "-- min:", min(seen))
to_be_removed.add(p)
raise SystemExit
missing_prev -= to_be_removed