43 lines
1.2 KiB
Python
43 lines
1.2 KiB
Python
NUM_PIDS = 10000
|
|
CHANNEL = "SARES11-SPEC125-M2.roi_signal_x_profile"
|
|
KEEP=True
|
|
#CHANNEL = "SARES11-SPEC125-M1.roi_signal_x_profile"
|
|
|
|
st = Stream("pulse_id", dispatcher)
|
|
st.addWaveform(c, c, 1, 0)
|
|
st.initialize()
|
|
st.start()
|
|
st.waitCacheChange(10000) #Wait stream be running before starting scan
|
|
|
|
if KEEP:
|
|
try:
|
|
r=bscan(st, NUM_PIDS, display=False, save=False)
|
|
finally:
|
|
st.close()
|
|
|
|
pids=r.getReadable(0)
|
|
plot(pids)
|
|
|
|
error_count = 0
|
|
cur = pids[0]
|
|
for i in range(len(pids)-1):
|
|
if pids[i+1] != cur+1:
|
|
print ("Error in " + str(i))
|
|
error_count = error_count+1
|
|
cur = pids[i+1]
|
|
pid_range = (pids[-1]-pids[0]+1)
|
|
else:
|
|
first = None
|
|
last = None
|
|
def after_read(record, scan):
|
|
global first, last
|
|
last=record[0]
|
|
if first is None: first = last
|
|
try:
|
|
r=bscan(st, NUM_PIDS, display=False, save=False, keep=False, after_read=after_read)
|
|
finally:
|
|
st.close()
|
|
pid_range = (last-first+1)
|
|
|
|
missing = pid_range-NUM_PIDS
|
|
print "TOTAL MISSING: ", missing, "/", pid_range, " RATE: ", (100.0*missing/pid_range), "%" |